function postSave() { $this->removeCache($this->getId()); Debug::Text('Post Save... Deleted: ' . (int) $this->getDeleted(), __FILE__, __LINE__, __METHOD__, 10); //Delete punch control/schedules assigned to this. if ($this->getDeleted() == TRUE) { //Delete schedules assigned to this user date. //Turn off any re-calc's $slf = new ScheduleListFactory(); $slf->getByUserDateID($this->getId()); if ($slf->getRecordCount() > 0) { foreach ($slf as $schedule_obj) { $schedule_obj->setDeleted(TRUE); $schedule_obj->Save(); } } $pclf = new PunchControlListFactory(); $pclf->getByUserDateID($this->getId()); if ($pclf->getRecordCount() > 0) { foreach ($pclf as $pc_obj) { $pc_obj->setDeleted(TRUE); $pc_obj->Save(); } } //Delete user_date_total rows too $udtlf = new UserDateTotalListFactory(); $udtlf->getByUserDateID($this->getId()); if ($udtlf->getRecordCount() > 0) { foreach ($udtlf as $udt_obj) { $udt_obj->setDeleted(TRUE); $udt_obj->Save(); } } } return TRUE; }