Skip to content

fix: use NULL for missing calendar event job order references#768

Merged
anonymoususer72041 merged 2 commits into
opencats:masterfrom
anonymoususer72041:fix/calendar-event-null-joborder
May 30, 2026
Merged

fix: use NULL for missing calendar event job order references#768
anonymoususer72041 merged 2 commits into
opencats:masterfrom
anonymoususer72041:fix/calendar-event-null-joborder

Conversation

@anonymoususer72041
Copy link
Copy Markdown
Contributor

PR #704 changed optional activity job order references to use NULL instead of the legacy -1 sentinel. Calendar events have the same optional job order relationship, but calendar_event.joborder_id still used -1 for missing job order references.

This updates calendar_event.joborder_id so missing job order references are represented as NULL consistently. The base schema now allows NULL and defaults to NULL and the update migration converts existing -1 values as well as orphaned non-NULL job order references to NULL.

The runtime write paths were updated accordingly. Calendar event creation and updates now pass PHP null when no job order is associated, and Calendar::addEvent() / Calendar::updateEvent() write SQL NULL for that case. Deleting a job order now clears related calendar event job order references by setting them to NULL.

The scope is intentionally limited to calendar_event.joborder_id. Other legacy -1 sentinels, such as calendar_event.data_item_id, calendar_event.data_item_type, activity input sentinels, and filter parameters where -1 has a different meaning, are left unchanged.

@RussH
Copy link
Copy Markdown
Member

RussH commented May 26, 2026

Suggest we pin this for the next release, however;

Only thing to check before merge is that modules/install/Schema.php still applies cleanly against current master, as that file often picks up conflicts. Happy to merge.

@anonymoususer72041 anonymoususer72041 force-pushed the fix/calendar-event-null-joborder branch from 7f204c5 to ec9a3be Compare May 30, 2026 13:34
@anonymoususer72041 anonymoususer72041 merged commit 67b6007 into opencats:master May 30, 2026
3 checks passed
@anonymoususer72041 anonymoususer72041 deleted the fix/calendar-event-null-joborder branch May 30, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants