Skip to content

A6: delete($AppUI) deletes holiday row 1 instead of the current row #7

Open

Description

@caseysoftware

CHoliday::remove() and HolidayFunctions::storeRecords() call $obj->delete($AppUI). w2p_Core_BaseObject::delete($oid) does $this->$k = (int) $oid. Casting the AppUI object gives a warning and 1, so the query deletes holiday_id = 1, not the intended row.

This happens when removing the last day of a one-day entry, and when merging two adjacent ranges (the second range is meant to be deleted).

store($AppUI) also passes the AppUI object as $updateNulls.

Files: holiday.class.php L36, L41–56; holiday_functions.class.php L446, L458

Fix: delete() / store() with no arguments, and check the bool result (the code tests is_string($result)).

Evidence: found by reading the code against master; not reproduced on a running install.
Effort: XS

Part of #1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions