public static function RemoveWrit($writ_id, $writ_ver, $staff_id) { $obj = new manage_writ($writ_id, $writ_ver, $staff_id); if (!$obj->onBeforeDelete()) { return false; } $DB = PdoDataAccess::getPdoObject(); /*@var $DB PDO*/ $DB->beginTransaction(); $return = PdoDataAccess::delete("writ_salary_items", "writ_id=:wid AND writ_ver=:wver AND staff_id=:stid", array(":wid" => $obj->writ_id, ":wver" => $obj->writ_ver, ":stid" => $obj->staff_id)); if ($return === false) { $DB->rollBack(); return false; } $return = PdoDataAccess::delete("writs", "writ_id=:wid AND writ_ver=:wver AND staff_id=:stid", array(":wid" => $obj->writ_id, ":wver" => $obj->writ_ver, ":stid" => $obj->staff_id)); if ($return === false) { $DB->rollBack(); return false; } $daObj = new DataAudit(); $daObj->ActionType = DataAudit::Action_delete; $daObj->MainObjectID = $obj->staff_id; $daObj->TableName = "writs"; $daObj->execute(); $last_writ_obj = manage_staff::GetLastWrit($obj->staff_id); if ($last_writ_obj) { //__________________________________________________ // دادن پست حكم قبلي به فرد در صورت خالي بودن اين پست if ($obj->is_last($obj->staff_id, $obj->execute_date) && $last_writ_obj->post_id != $obj->post_id) { if (!manage_posts::change_user_post($obj->staff_id, $obj->post_id, $last_writ_obj->post_id, $obj->execute_date)) { $DB->rollBack(); return false; } } } if ($obj->history_only != HISTORY_ONLY) { if (!manage_writ::change_writ_state(WRIT_PERSONAL, WRIT_PERSONAL, $obj->writ_id, $obj->writ_ver, $obj->staff_id, $obj->execute_date, $DB)) { $DB->rollBack(); return false; } } //__________________________________________________ //در صورت حذف يک حکم نسخه قبلي آن را در صورتي که به حقوق منتقل نشده است فعال مي کند if (!manage_staff::SetStaffLastWrit($obj->staff_id)) { $DB->rollBack(); return false; } $DB->commit(); return true; }