Example #1
0
 function release_post()
 {
     $temp = parent::runquery("SELECT s.staff_id, s.post_id\r\n    \t\tFROM position p INNER JOIN staff s ON(s.staff_id = p.staff_id)\r\n    \t\tWHERE p.post_id = ? AND s.staff_id=?", array($this->post_id, $this->staff_id));
     if (count($temp) == 0) {
         return true;
     }
     if ($temp[0]["post_id"] == $this->post_id) {
         ExceptionHandler::PushException(CANNT_RELEASE_WRIT_POST);
         return false;
     }
     parent::runquery("update position set staff_id=null where post_id=" . $this->post_id);
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_update;
     $daObj->RelatedPersonType = DataAudit::PersonType_staff;
     $daObj->RelatedPersonID = $this->staff_id;
     $daObj->MainObjectID = $this->post_id;
     $daObj->TableName = "position";
     $daObj->description = "آزاد کردن پست اجرایی هیئت علمی";
     $daObj->execute();
     //------------------ baseinfo update ---------------------------
     $staffObj = new manage_staff("", "", $this->staff_id);
     require_once inc_manage_post;
     manage_posts::baseinfoRelease($staffObj->PersonID, $this->post_id, "آزاد کردن پست اجرایی هیئت علمی");
     //--------------------------------------------------------------
     return true;
 }