private function onBeforeDelete() { if ($this->writ_id == "") { return false; } //................................. $useInPayCalc = manage_writ::check_for_use_in_pay_calc($this->writ_id, $this->writ_ver, $this->staff_id); if ($useInPayCalc != null || $this->state != WRIT_PERSONAL) { parent::PushException(WRIT_CAN_NOT_DELETE); return false; } if ($this->check_corrective_state() == "NOT_CORRECTING" || $this->writ_has_new_version()) { parent::PushException(ER_CANNT_DELETE_CORREDTED_WRIT); return false; } if (self::is_new_writ($this->execute_date) && !self::is_last($this->staff_id, $this->execute_date) && $this->check_corrective_state() != "CORRECTING") { parent::PushException(ER_CANNT_DELETE_NEW_WRITS); return false; } $query = "select * from writs where corrective_writ_id=:wid AND corrective_writ_ver=:wver AND staff_id = :stid"; $temp = PdoDataAccess::runquery($query, array(":wid" => $this->writ_id, ":wver" => $this->writ_ver, ":stid" => $this->staff_id)); if (count($temp) > 0) { parent::PushException(ER_CONSTRAINT); return false; } return true; }
} else { if ($pay_calc != null && $state != WRIT_PERSONAL) { ExceptionHandler::PushException(" این حکم در محاسبه حقوق" . " " . $pay_calc . " " . "استفاده شده است و امکان ویرایش آن وجود ندارد.", ExceptionHandler::ExceptionType_warning); $readOnly = true; } } //................................... $is_auto_writ = manage_writ::is_auto_writ($exedate, $objWrt->person_type, $writ_id, $writver, $staff_id); if (manage_writ::is_first_writ($writ_id, $writver, $staff_id)) { $is_new_writ = false; $header_is_open = false; $is_auto_writ = true; } $is_new_writ = manage_writ::is_new_writ($exedate, $objPerson->person_type, $writ_id, $writver, $staff_id); $header_is_open = $is_new_writ ? "false" : "true"; if (manage_writ::check_for_use_in_pay_calc($writ_id, $writver, $staff_id) == null) { $salary_fields_is_open = true; } $time_limited = $FullWrt[0]['time_limited']; //$drp_MaritalStatus = manage_domains::DRP_MaritalStatus("marital_status",$objWrt->marital_status); //$drp_educ = manage_domains::DRP_EducLevel("education_level",$objWrt->education_level,"with:50%"); //$studyFielsArr = manage_domains::DRP_StudyField_StudyBranch("form_WritForm","sfid", "sbid",$objWrt->sfid, $objWrt->sbid); //$writTypeArr = manage_domains::DRP_writType_writSubType("form_WritForm", "writ_type_id", "writ_subtype_id",$objWrt->writ_type_id ,$objWrt->writ_subtype_id); $drp_salary_pay_proc = manage_domains::DRP_SalaryPayProc("salary_pay_proc", $objWrt->salary_pay_proc, "with:50%"); $drp_annual_effect = manage_domains::DRP_Annual_Effect("annual_effect", $objWrt->annual_effect, "with:50%"); $drp_costCenters = manage_domains::DRP_CostCenters("cost_center_id", $objWrt->cost_center_id); $drp_jobs = manage_domains::DRP_Jobs("job_id", $objWrt->job_id, "form_WritForm"); $workplaceArr = manage_domains::DRP_State_City("form_WritForm", "work_state_id", "work_city_id", $objWrt->work_state_id, $objWrt->work_city_id); $drp_worktime = manage_domains::DRP_WorkTimeType("worktime_type", $objWrt->worktime_type); $drp_emp_state = manage_domains::DRP_EMP_STATE_WST("emp_state", $objWrt->emp_state); $drp_emp_mode = manage_domains::DRP_EMP_MODE_WST("emp_mode", $objWrt->emp_mode);
$exedate = $_REQUEST["ExeDate"]; } else { $exedate = $FullWrt[0]['execute_date']; } //............................................ $state = $FullWrt[0]["state"]; //............................................ $readOnly = false; $state = manage_writ::get_writ_state($_REQUEST["WID"], $writver, $_REQUEST["STID"]); if ($state == WRIT_PERSONAL) { if ($objWrt->check_corrective_state() == 'NOT_CORRECTING' || $objWrt->writ_has_new_version()) { ExceptionHandler::PushException('اين حکم در صدور حکم اصلاحي استفاده شده است و امکان تغيير آن وجود ندارد', ExceptionHandler::ExceptionType_warning); $readOnly = true; } } else { $pay_calc = manage_writ::check_for_use_in_pay_calc($_REQUEST["WID"], $writver, $_REQUEST["STID"]); if ($pay_calc == null) { ExceptionHandler::PushException("این حکم منتقل شده است و امکان ویرایش آن وجود ندارد", ExceptionHandler::ExceptionType_warning); $readOnly = true; } else { ExceptionHandler::PushException(" این حکم در محاسبه حقوق" . " " . $pay_calc . " " . "استفاده شده است و امکان ویرایش آن وجود ندارد.", ExceptionHandler::ExceptionType_warning); $readOnly = true; } } //................................... //echo PdoDataAccess::GetLatestQueryString(); die(); $is_auto_writ = manage_writ::is_auto_writ($exedate, $objWrt->person_type, $writ_id, $writver, $staff_id); if (manage_writ::is_first_writ($writ_id, $writver, $staff_id)) { $is_new_writ = false; $header_is_open = false; $is_auto_writ = true;