try {
            if (!isset($_POST['DYN_UID'])) {
                throw new Exception('DYN_UID was not set!');
            }
            $DYN_UIDS = explode(',', $_POST['DYN_UID']);
            foreach ($DYN_UIDS as $i => $DYN_UID) {
                $dynaform = new dynaform();
                //in table dynaform
                $dynaform->remove($DYN_UID);
                //in table Step
                $oStep = new Step();
                $oStep->removeStep('DYNAFORM', $DYN_UID);
                //in table ObjectPermission
                $oOP = new ObjectPermission();
                $oOP->removeByObject('DYNAFORM', $DYN_UID);
                //in table Step_supervisor
                $oSS = new StepSupervisor();
                $oSS->removeByObject('DYNAFORM', $DYN_UID);
                //in table case_tracker_object
                $oCTO = new CaseTrackerObject();
                $oCTO->removeByObject('DYNAFORM', $DYN_UID);
            }
            $result->success = true;
            $result->msg = G::LoadTranslation('ID_DYNAFORM_REMOVED');
        } catch (Exception $e) {
            $result->success = false;
            $result->msg = $e->getMessage();
        }
        print G::json_encode($result);
        break;
}
Exemple #2
0
 /**
  * Delete DynaForm
  *
  * @param string $dynaFormUid Unique id of DynaForm
  *
  * return void
  */
 public function delete($dynaFormUid)
 {
     try {
         //Verify data
         $this->throwExceptionIfNotExistsDynaForm($dynaFormUid, "", $this->arrayFieldNameForException["dynaFormUid"]);
         //Load DynaForm
         $dynaForm = new \Dynaform();
         $arrayDynaFormData = $dynaForm->Load($dynaFormUid);
         $processUid = $arrayDynaFormData["PRO_UID"];
         //Verify dependences dynaforms
         $resultDepends = $this->dynaFormDepends($dynaFormUid, $processUid);
         if ($resultDepends != "") {
             throw new \Exception($resultDepends);
         }
         //Delete
         //In table DYNAFORM
         $result = $dynaForm->remove($dynaFormUid);
         //In table STEP
         $step = new \Step();
         $step->removeStep("DYNAFORM", $dynaFormUid);
         //In table OBJECT_PERMISSION
         $objPermission = new \ObjectPermission();
         $objPermission->removeByObject("DYNAFORM", $dynaFormUid);
         //In table STEP_SUPERVISOR
         $stepSupervisor = new \StepSupervisor();
         $stepSupervisor->removeByObject("DYNAFORM", $dynaFormUid);
         //In table CASE_TRACKER_OBJECT
         $caseTrackerObject = new \CaseTrackerObject();
         $caseTrackerObject->removeByObject("DYNAFORM", $dynaFormUid);
     } catch (\Exception $e) {
         throw $e;
     }
 }