예제 #1
0
 public function __construct($FacilityID, $ElementID = 0, $DeputyID = "", $ModuleID = "")
 {
     $db = parent::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework");
     if ($DeputyID != "" && $ModuleID != "") {
         $this->DeputyID = $DeputyID;
         $this->ModuleID = $ModuleID;
         $this->ElementID = $ElementID;
     } else {
         if (!empty($FacilityID)) {
             $query = "select * from SystemFacilities where FacilityID=?";
             $dt = parent::runquery($query, array($FacilityID), $db);
             if (parent::GetExceptionCount() != 0) {
                 return;
             }
             if (count($dt) == 0) {
                 return;
             }
             $this->DeputyID = $dt[0]["DeputyID"];
             $this->ModuleID = $dt[0]["ModuleID"];
             $this->ElementID = $ElementID;
         } else {
             return;
         }
     }
     $this->UserID = $_SESSION["User"]->UserID;
     $this->Roles = UserRole::GetUserRole($this->DeputyID, $this->UserID);
     if (parent::GetExceptionCount() != 0) {
         return;
     }
     $rolesStr = "-1";
     if (count($this->Roles) != 0) {
         for ($i = 0; $i < count($this->Roles); $i++) {
             $rolesStr .= "," . $this->Roles[$i]->UserRole;
         }
     }
     $query = "select DeputyID,ModuleID,ElementID,\r\n\t\t\t\t\t\tmax(AcInsert) as AcInsert,\r\n\t\t\t\t\t\tmax(AcFullUpdate) as AcFullUpdate,\r\n\t\t\t\t\t\tmax(AcUpdate) as AcUpdate,\r\n\t\t\t\t\t\tmax(AcFullDelete) as AcFullDelete,\r\n\t\t\t\t\t\tmax(AcDelete) as AcDelete\r\n\t\t\t\tfrom ModuleAccess\r\n\t\t\t\twhere (RoleID in({$rolesStr}) OR UserID=:uid)\r\n\t\t\t\t\tAND DeputyID=:did AND ModuleID=:mid AND ElementID=:eid\r\n\t\t\t\tgroup by DeputyID,ModuleID,ElementID";
     $dt = parent::runquery($query, array(":uid" => $this->UserID, ":did" => $this->DeputyID, ":mid" => $this->ModuleID, ":eid" => $this->ElementID), $db);
     if (parent::GetExceptionCount() != 0 || count($dt) == 0) {
         return;
     }
     $this->AcInsert = $dt[0]["AcInsert"] == 0 ? false : true;
     $this->AcFullUpdate = $dt[0]["AcFullUpdate"] == 0 ? false : true;
     $this->AcUpdate = $dt[0]["AcUpdate"] == 0 ? false : true;
     $this->AcFullDelete = $dt[0]["AcFullDelete"] == 0 ? false : true;
     $this->AcDelete = $dt[0]["AcDelete"] == 0 ? false : true;
 }
예제 #2
0
 public function run()
 {
     $pdo = parent::getPdoObject();
     $pdo->beginTransaction();
     if ($this->payment_type == 1) {
         $this->prepare_wheres();
         $this->init();
         $this->ins_commited_staff();
         $this->ins_last_flow_not_fich();
         $this->fail_log();
         $this->remove_from_limit_staff();
         $this->remove_payment_items();
         $this->remove_payment_writs();
         $this->remove_payments();
         $this->remove_temp_subtract_flow();
         $this->update_person_dependent_support();
     } else {
         $this->remove_payment_items($this->payment_type);
         $this->remove_payments($this->payment_type);
     }
     if (parent::GetExceptionCount() > 0) {
         print_r(ExceptionHandler::PopAllExceptions());
         echo "----";
         die;
         $pdo->rollBack();
         return false;
     } else {
         $pdo->commit();
         return true;
     }
 }