Skip to content

[BUG] Overriding Existing Sheet Classes #2

@vigoren

Description

@vigoren

Hey, A user of my module (Simple Calendar) ran into an interesting issue when using this module.

Simple Calendar has the ability to add notes to the calendar and these notes are saved as Journal Entries within Foundry. The Simple Calendar notes use their own Journal Sheet so that I can properly display all the metadata associated with a calendar note (Date, Time, Tags etc.)

The issue that I have run into is that when users are using the Ferncombe module any time a note is created in Simple Calendar it opens with the Ferncombe sheet and a lot of functionality is lost for that note. Looking at the code I see that in the preCreateJournalEntry hook you are assigning the Ferncombe journal sheet to every journal entry that is created, which overrides the one I had assigned to the calendar note journal entries.

I have a proposed fix for this and have submitted a pull request with the fix. The fix in my mind is in the preCreateJournalEntry hook to first check to see if the passed in data has a sheetClass defined in the flags before assigning the Ferncombe one. This should account for any sheets using a custom journal sheet to keep using that one while assigning all newly created journal entries to the Ferncombe journal sheet. I have tested this a bit and it seems to work well, though I may be missing a use case or two that would break with this approach.

Please let me know what you think and if we can resolve this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions