Esempio n. 1
0
    /**

     * Cleanup Report Tables References from an array of data

     *

     * @param array $aReportTables

     * @return void

     */

    public function cleanupReportTablesReferences ($aReportTables)

    {

        foreach ($aReportTables as $sKey => $aRow) {

            $oReportTables = new ReportTables();

            $oReportTables->deleteReportTable( $aRow['REP_TAB_UID'] );

            $oReportTables->deleteAllReportVars( $aRow['REP_TAB_UID'] );

            $oReportTables->dropTable( $aRow['REP_TAB_NAME'] );

        }

    } #@!neyek
 function saveConsolidated($data)
 {
     $status = $data['con_status'];
     $sTasUid = $data['tas_uid'];
     $sDynUid = $data['dyn_uid'];
     $sProUid = $data['pro_uid'];
     $sRepTabUid = $data['rep_uid'];
     $tableName = $data['table_name'];
     $title = $data['title'];
     if ($sRepTabUid != '') {
         if (!$status) {
             $oCaseConsolidated = new CaseConsolidatedCore();
             $oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
             if (!is_object($oCaseConsolidated) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
                 $oCaseConsolidated = new CaseConsolidatedCore();
                 $oCaseConsolidated->setTasUid($sTasUid);
                 $oCaseConsolidated->setConStatus('INACTIVE');
                 $oCaseConsolidated->save();
             } else {
                 $oCaseConsolidated->delete();
             }
             return 1;
         }
         $rptUid = null;
         $criteria = new Criteria();
         $criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
         $criteria->add(ReportTablePeer::REP_TAB_UID, $sRepTabUid);
         $rsCriteria = ReportTablePeer::doSelectRS($criteria);
         if ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $rptUid = $row[0];
         }
         $rpts = new ReportTables();
         if ($rptUid != null) {
             $rpts->deleteReportTable($rptUid);
         }
         $sClassName = $tableName;
         $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
         @unlink($sPath . $sClassName . '.php');
         @unlink($sPath . $sClassName . 'Peer.php');
         @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
         @unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
         @unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
         $sRepTabUid = '';
     }
     $_POST['form']['PRO_UID'] = $sProUid;
     $_POST['form']['REP_TAB_UID'] = $sRepTabUid;
     $_POST['form']['REP_TAB_NAME'] = $tableName;
     $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
     $_POST['form']['REP_TAB_GRID'] = '';
     $_POST['form']['REP_TAB_CONNECTION'] = 'wf';
     $_POST['form']['REP_TAB_CREATE_DATE'] = date("Y-m-d H:i:s");
     $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
     $_POST['form']['REP_TAB_TITLE'] = $title;
     $_POST['form']['FIELDS'] = array();
     G::LoadClass("reportTables");
     $oReportTable = new ReportTable();
     $sOldTableName = $_POST['form']['REP_TAB_NAME'];
     $sOldConnection = $_POST['form']['REP_TAB_CONNECTION'];
     $oReportTable->create($_POST['form']);
     $_POST['form']['REP_TAB_UID'] = $oReportTable->getRepTabUid();
     $oReportVar = new ReportVar();
     $oReportTables = new ReportTables();
     $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);
     $aFields = array();
     G::LoadClass("pmDynaform");
     $pmDyna = new pmDynaform(array());
     $pmDyna->fields["CURRENT_DYNAFORM"] = $sDynUid;
     $dataDyna = $pmDyna->getDynaform();
     $json = G::json_decode($dataDyna["DYN_CONTENT"]);
     $fieldsDyna = $json->items[0]->items;
     foreach ($fieldsDyna as $value) {
         foreach ($value as $val) {
             if (isset($val->type)) {
                 if ($val->type == 'text' || $val->type == 'textarea' || $val->type == 'dropdown' || $val->type == 'checkbox' || $val->type == 'datetime' || $val->type == 'yesno' || $val->type == 'date' || $val->type == 'hidden' || $val->type == 'currency' || $val->type == 'percentage' || $val->type == 'link') {
                     $_POST['form']['FIELDS'][] = $val->name . '-' . $val->type;
                 }
             }
         }
     }
     $aFieldsClases = array();
     $i = 1;
     $aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
     $aFieldsClases[$i]['FLD_NULL'] = 'off';
     $aFieldsClases[$i]['FLD_KEY'] = 'on';
     $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
     $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
     $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR';
     $aFieldsClases[$i]['FLD_SIZE'] = 32;
     $i++;
     $aFieldsClases[$i]['FLD_NAME'] = 'APP_NUMBER';
     $aFieldsClases[$i]['FLD_NULL'] = 'off';
     $aFieldsClases[$i]['FLD_KEY'] = 'on';
     $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
     $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
     $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR';
     $aFieldsClases[$i]['FLD_SIZE'] = 255;
     foreach ($_POST['form']['FIELDS'] as $sField) {
         $aField = explode('-', $sField);
         if ($aField[1] == 'title' || $aField[1] == 'submit') {
             continue;
         }
         $i++;
         $aFieldsClases[$i]['FLD_NAME'] = $aField[0];
         $aFieldsClases[$i]['FLD_NULL'] = 'off';
         $aFieldsClases[$i]['FLD_KEY'] = 'off';
         $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
         $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
         switch ($aField[1]) {
             case 'currency':
             case 'percentage':
                 $sType = 'number';
                 $aFieldsClases[$i]['FLD_TYPE'] = 'FLOAT';
                 $aFieldsClases[$i]['FLD_SIZE'] = 255;
                 break;
             case 'text':
             case 'password':
             case 'dropdown':
             case 'yesno':
             case 'checkbox':
             case 'radiogroup':
             case 'hidden':
             case "link":
                 $sType = 'char';
                 $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR';
                 $aFieldsClases[$i]['FLD_SIZE'] = 255;
                 break;
             case 'textarea':
                 $sType = 'text';
                 $aFieldsClases[$i]['FLD_TYPE'] = 'TEXT';
                 $aFieldsClases[$i]['FLD_SIZE'] = '';
                 break;
             case 'date':
                 $sType = 'date';
                 $aFieldsClases[$i]['FLD_TYPE'] = 'DATE';
                 $aFieldsClases[$i]['FLD_SIZE'] = '';
                 break;
             default:
                 $sType = 'char';
                 $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR';
                 $aFieldsClases[$i]['FLD_SIZE'] = 255;
                 break;
         }
         $oReportVar->create(array('REP_TAB_UID' => $_POST['form']['REP_TAB_UID'], 'PRO_UID' => $_POST['form']['PRO_UID'], 'REP_VAR_NAME' => $aField[0], 'REP_VAR_TYPE' => $sType));
         $aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
     }
     $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
     $oReportTables->dropTable($sOldTableName, $sOldConnection);
     $oReportTables->createTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields);
     $oReportTables->populateTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields, $_POST['form']['PRO_UID'], '');
     $sRepTabUid = $_POST['form']['REP_TAB_UID'];
     $oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
     if (!is_object($oCaseConsolidated) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
         $oCaseConsolidated = new CaseConsolidatedCore();
         $oCaseConsolidated->setTasUid($sTasUid);
     }
     $criteria = new Criteria();
     $criteria->addSelectColumn(CaseConsolidatedCorePeer::TAS_UID);
     $criteria->add(CaseConsolidatedCorePeer::TAS_UID, $sTasUid);
     $rsCriteria = CaseConsolidatedCorePeer::doSelectRS($criteria);
     if ($rsCriteria->next()) {
         $row = $rsCriteria->getRow();
         $oCaseConsolidated->delete();
         $oCaseConsolidated = CaseConsolidatedCorePeer::retrieveByPK($sTasUid);
     }
     if (!is_object($oCaseConsolidated) || get_class($oCaseConsolidated) != 'CaseConsolidatedCore') {
         $oCaseConsolidated = new CaseConsolidatedCore();
         $oCaseConsolidated->setTasUid($sTasUid);
     }
     $oCaseConsolidated->setConStatus('ACTIVE');
     $oCaseConsolidated->setDynUid($sDynUid);
     $oCaseConsolidated->setRepTabUid($sRepTabUid);
     $oCaseConsolidated->save();
     $sClassName = $tableName;
     $oAdditionalTables = new AdditionalTables();
     $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid);
 }
Esempio n. 3
0
    /**
     * Get Data Generate
     *
     * @access public
     * @param string $pro_uid, Process Uid
     * @param string $tas_uid, Task Uid
     * @param string $dyn_uid, Dynaform Uid
     * @return string
     *
     * @author Brayan Pereyra (Cochalo) <*****@*****.**>
     * @copyright Colosa - Bolivia
    */
    public function getDataGrid ($pro_uid, $tas_uid, $dyn_uid, $usr_uid, $start = '', $limit = '', $search = '')
    {
        $start    = !empty($start)      ?   $start      : "0";
        $limit    = !empty($limit)      ?   $limit      : "20";
        $search   = !empty($search)     ?   $search     : "";

        $callback = isset($_REQUEST["callback"])? $_REQUEST["callback"] : "stcCallback1001";
        $dir      = isset($_REQUEST["dir"])?      $_REQUEST["dir"]    : "DESC";
        $sort     = isset($_REQUEST["sort"])?     $_REQUEST["sort"]   : "";
        $filter   = isset($_REQUEST["filter"])?   $_REQUEST["filter"] : "";
        $user     = isset($_REQUEST["user"])?     $_REQUEST["user"]   : "";
        $status   = isset($_REQUEST["status"])?   strtoupper($_REQUEST["status"]) : "";
        $action   = isset($_GET["action"])?    $_GET["action"] : (isset($_REQUEST["action"])? $_REQUEST["action"] : "todo");
        $type     = isset($_GET["type"])?      $_GET["type"] : (isset($_REQUEST["type"])? $_REQUEST["type"] : "extjs");
        $user     = isset($_REQUEST["user"])?     $_REQUEST["user"] : "";
        $dateFrom = isset($_REQUEST["dateFrom"])? substr($_REQUEST["dateFrom"], 0, 10) : "";
        $dateTo   = isset($_REQUEST["dateTo"])?   substr($_REQUEST["dateTo"], 0, 10) : "";

        $rowUid = isset($_REQUEST["rowUid"])? $_REQUEST["rowUid"] : "";
        $dropdownList = isset($_REQUEST ["dropList"])? G::json_decode($_REQUEST ["dropList"]) : array();

        try {
            G::LoadClass("pmFunctions");
            G::LoadClass("BasePeer");
            G::LoadClass("configuration");
            G::LoadClass("case");
            G::LoadClass("reportTables");

            $response = array();
            $searchFields = array();
            //
            $query = "SELECT REP_TAB_UID
                      FROM   CASE_CONSOLIDATED
                      WHERE  TAS_UID = '" . $tas_uid . "'";
            $caseConsolidated = executeQuery($query);

            $tableUid  = null;
            $tableName = null;

            foreach ($caseConsolidated as $item) {
                $criteria = new Criteria();
                $criteria->addSelectColumn(ReportTablePeer::REP_TAB_NAME);
                $criteria->add(ReportTablePeer::REP_TAB_UID,$item["REP_TAB_UID"]);

                $result = ReportTablePeer::doSelectRS($criteria);
                $result->setFetchmode(ResultSet::FETCHMODE_ASSOC);

                if ($result->next()) {
                    $row = $result->getRow();

                    $tableUid  = $item["REP_TAB_UID"];
                    $tableName = $row["REP_TAB_NAME"];
                } else {
                    throw (new Exception("Not found the report table"));
                }
            }

            $className = $tableName;

            if (!class_exists($className)) {
                require_once (PATH_DB . SYS_SYS . PATH_SEP . "classes" . PATH_SEP . $className . ".php");
            }

            $oCriteria = new Criteria("workflow");
            
            $oCriteria->addSelectColumn("*");
            $oCriteria->addSelectColumn($tableName . ".APP_UID");
            
            $oCriteria->addJoin($tableName . ".APP_UID", AppCacheViewPeer::APP_UID, Criteria::LEFT_JOIN);
            
            $oCriteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN");
            $oCriteria->add(AppCacheViewPeer::TAS_UID, $tas_uid);
            $oCriteria->add(AppCacheViewPeer::USR_UID, $usr_uid);
            $oCriteria->add(AppCacheViewPeer::APP_STATUS, "TO_DO");
            
            if ($search != "") {
                $filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";

                if (!class_exists('Smarty')) {
                    require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php');  
                }
                $G_FORM = new \xmlform();
                $G_FORM->home = PATH_DYNAFORM;
                $G_FORM->parseFile($filename, SYS_LANG, true);

                foreach ($G_FORM->fields as $key => $val) {
                    switch ($val->type) {
                        case "text":
                        case "textarea":
                        case "currency":
                        case "percentage":
                            $searchFields[] = $val->name;
                            $dataType[] = $val->type;
                            break;
                    }
                }

                $oNewCriteria = new Criteria("workflow");
                $oTmpCriteria = null;
                $sw = 0;

                foreach ($searchFields as $index => $value) {
                    $value = strtoupper($value);
                    eval("\$field = " . $tableName . "Peer::" . $value . ";");

                    if ($sw == 0) {
                        if ($dataType[$index] == 'currency' || $dataType[$index] == 'percentage') {
                            if ( is_numeric($search) || is_float($search) ) {
                                $oTmpCriteria = $oNewCriteria->getNewCriterion($field, $search);
                            }
                        } else {
                            $oTmpCriteria = $oNewCriteria->getNewCriterion($field, "%" . $search . "%", Criteria::LIKE);
                        }
                    } else {
                        if ($dataType[$index] == 'currency' || $dataType[$index] == 'percentage') {
                            if ( is_numeric($search) || is_float($search) ) {
                                $oTmpCriteria = $oNewCriteria->getNewCriterion($field, $search)->addOr($oTmpCriteria);
                            }
                        } else {
                            $oTmpCriteria = $oNewCriteria->getNewCriterion($field, "%" . $search . "%", Criteria::LIKE)->addOr($oTmpCriteria);
                        }
                    }

                    $sw = 1;
                }

                if ($oTmpCriteria != null) {
                    $oCriteria->add(
                        $oCriteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE)->addOr($oTmpCriteria)
                    );
                } else {
                    $oCriteria->add($oCriteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE));
                }
            }
            
            G::LoadSystem('inputfilter');
            $filter = new \InputFilter();

            if ($sort != "") {
                $reportTable = new ReportTables();
                $arrayReportTableVar = $reportTable->getTableVars($tableUid);
                $tableName = $filter->validateInput($tableName);
                $sort = $filter->validateInput($sort);
                if (in_array($sort, $arrayReportTableVar)) {
                    $sort = strtoupper($sort);
                    eval('$field = ' . $tableName . 'Peer::' . $sort . ';');
                } else {
                    eval('$field = AppCacheViewPeer::' . $sort . ';');
                }

                if ($dir == "ASC") {
                    $oCriteria->addAscendingOrderByColumn($field);
                } else {
                    $oCriteria->addDescendingOrderByColumn($field);
                }
            } else {
                $oCriteria->addDescendingOrderByColumn(AppCacheViewPeer::APP_NUMBER);
            }

            //pagination pagination attributes
            $oCriteria->setLimit($limit);
            $oCriteria->setOffset($start);
            //end of pagination attributes

            $oDataset = AppCacheViewPeer::doSelectRS($oCriteria);
            //eval('$oDataset = '.$className.'Peer::doSelectRS($oCriteria);');

            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            //$oDataset->next();

            $aTaskConsolidated = array();

            while ($oDataset->next()) {
                $aRow = $oDataset->getRow();

                foreach ($aRow as $datakey => $dataField) {
                    foreach ($dropdownList as $tmpField) {
                        if ($tmpField == $datakey) {
                            $appUid = $aRow["APP_UID"];
                            $fieldVal = $aRow[$tmpField];
                            $aRow[$tmpField] = self::getDropdownLabel($appUid, $pro_uid, $dyn_uid, $tmpField, $fieldVal);
                        }
                    }
                }

                $aTaskConsolidated[] = $aRow;
            }

            foreach ($aTaskConsolidated as $key => $val) {
                foreach ($val as $iKey => $iVal) {
                    if (self::checkValidDate($iVal)) {
                        $val[$iKey] = str_replace("-", "/", $val[$iKey]);
                    }
                }
                $response["data"][] = $val;
            }

            $query = "SELECT COUNT(APP_CACHE_VIEW.TAS_UID) AS QTY
                      FROM   CASE_CONSOLIDATED
                             LEFT JOIN CONTENT ON (CASE_CONSOLIDATED.TAS_UID = CONTENT.CON_ID)
                             LEFT JOIN APP_CACHE_VIEW ON (CASE_CONSOLIDATED.TAS_UID = APP_CACHE_VIEW.TAS_UID)
                             LEFT JOIN TASK ON (CASE_CONSOLIDATED.TAS_UID = TASK.TAS_UID)
                      WHERE  CONTENT.CON_CATEGORY = 'TAS_TITLE' AND
                             CONTENT.CON_LANG = 'en' AND
                             APP_CACHE_VIEW.DEL_THREAD_STATUS = 'OPEN' AND
                             USR_UID = '" . $usr_uid . "' AND
                             APP_CACHE_VIEW.TAS_UID = '" . $tas_uid . "'";
            $count = executeQuery($query);

            $totalCount = 0;
            foreach ($count as $item) {
                $totalCount = $totalCount + $item["QTY"];
            }

            $response["totalCount"] = $totalCount;
            echo G::json_encode($response);
        } catch (Exception $e) {
            $msg = array("error" => $e->getMessage());
            echo G::json_encode($msg);
        }
    }
Esempio n. 4
0
    public function cancelCase($sApplicationUID, $iIndex, $user_logged)

    {

        $this->getExecuteTriggerProcess($sApplicationUID, 'CANCELED');



        $oApplication = new Application();

        $aFields = $oApplication->load($sApplicationUID);

        $appStatusCurrent = $aFields['APP_STATUS'];

        $oCriteria = new Criteria('workflow');

        $oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);

        $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);

        if (AppDelegationPeer::doCount($oCriteria) == 1) {

            $aFields['APP_STATUS'] = 'CANCELLED';

            $oApplication->update($aFields);



            G::LoadClass('reportTables');

            require_once 'classes/model/AdditionalTables.php';

            $oReportTables = new ReportTables();

            $addtionalTables = new additionalTables();

            $oReportTables->updateTables($aFields['PRO_UID'], $aFields['APP_UID'], $aFields['APP_NUMBER'], $aFields['APP_DATA']);

            $addtionalTables->updateReportTables($aFields['PRO_UID'], $aFields['APP_UID'], $aFields['APP_NUMBER'], $aFields['APP_DATA'], $aFields['APP_STATUS']);

        }

        $this->CloseCurrentDelegation($sApplicationUID, $iIndex);

        $oAppDel = new AppDelegation();

        $oAppDel->Load($sApplicationUID, $iIndex);

        $aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME);

        $this->closeAppThread($sApplicationUID, $aAppDel['DEL_THREAD']);



        $delay = new AppDelay();

        $array['PRO_UID'] = $aFields['PRO_UID'];

        $array['APP_UID'] = $sApplicationUID;



        $c = new Criteria('workflow');

        $c->clearSelectColumns();

        $c->addSelectColumn(AppThreadPeer::APP_THREAD_INDEX);

        $c->add(AppThreadPeer::APP_UID, $sApplicationUID);

        $c->add(AppThreadPeer::DEL_INDEX, $iIndex);

        $oDataset = AppThreadPeer::doSelectRS($c);

        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $oDataset->next();

        $aRow = $oDataset->getRow();

        $array['APP_THREAD_INDEX'] = $aRow['APP_THREAD_INDEX'];

        $array['APP_DEL_INDEX'] = $iIndex;

        $array['APP_TYPE'] = 'CANCEL';



        $c = new Criteria('workflow');

        $c->clearSelectColumns();

        $c->addSelectColumn(ApplicationPeer::APP_STATUS);

        $c->add(ApplicationPeer::APP_UID, $sApplicationUID);

        $oDataset = ApplicationPeer::doSelectRS($c);

        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $oDataset->next();

        $aRow1 = $oDataset->getRow();

        $array['APP_STATUS'] = $aRow1['APP_STATUS'];



        $array['APP_DELEGATION_USER'] = $user_logged;

        $array['APP_ENABLE_ACTION_USER'] = $user_logged;

        $array['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');

        $delay->create($array);



        //Before cancel a case verify if is a child case

        $oCriteria2 = new Criteria('workflow');

        $oCriteria2->add(SubApplicationPeer::APP_UID, $sApplicationUID);

        $oCriteria2->add(SubApplicationPeer::SA_STATUS, 'ACTIVE');

        if (SubApplicationPeer::doCount($oCriteria2) > 0) {

            G::LoadClass('derivation');

            $oDerivation = new Derivation();

            $oDerivation->verifyIsCaseChild($sApplicationUID, $iIndex);

        }



        //update searchindex

        if ($this->appSolr != null) {

            $this->appSolr->updateApplicationSearchIndex($sApplicationUID);

        }

        /*----------------------------------********---------------------------------*/

    }
 public function deleteProcess($sProcessUID)
 {
     try {
         G::LoadClass('case');
         G::LoadClass('reportTables');
         //Instance all classes necesaries
         $oProcess = new Process();
         $oDynaform = new Dynaform();
         $oInputDocument = new InputDocument();
         $oOutputDocument = new OutputDocument();
         $oTrigger = new Triggers();
         $oRoute = new Route();
         $oGateway = new Gateway();
         $oEvent = new Event();
         $oSwimlaneElement = new SwimlanesElements();
         $oConfiguration = new Configuration();
         $oDbSource = new DbSource();
         $oReportTable = new ReportTables();
         $oCaseTracker = new CaseTracker();
         $oCaseTrackerObject = new CaseTrackerObject();
         //Delete the applications of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID);
         $oDataset = ApplicationPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $oCase = new Cases();
         while ($aRow = $oDataset->getRow()) {
             $oCase->removeCase($aRow['APP_UID']);
             $oDataset->next();
         }
         //Delete the tasks of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
         $oDataset = TaskPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $this->deleteTask($aRow['TAS_UID']);
             $oDataset->next();
         }
         //Delete the dynaforms of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
         $oDataset = DynaformPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oDynaform->remove($aRow['DYN_UID']);
             $oDataset->next();
         }
         //Delete the input documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = InputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oInputDocument->remove($aRow['INP_DOC_UID']);
             $oDataset->next();
         }
         //Delete the output documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oOutputDocument->remove($aRow['OUT_DOC_UID']);
             $oDataset->next();
         }
         //Delete the triggers of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(TriggersPeer::PRO_UID, $sProcessUID);
         $oDataset = TriggersPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oTrigger->remove($aRow['TRI_UID']);
             $oDataset->next();
         }
         //Delete the routes of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
         $oDataset = RoutePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oRoute->remove($aRow['ROU_UID']);
             $oDataset->next();
         }
         //Delete the gateways of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(GatewayPeer::PRO_UID, $sProcessUID);
         $oDataset = GatewayPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oGateway->remove($aRow['GAT_UID']);
             $oDataset->next();
         }
         //Delete the Event of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(EventPeer::PRO_UID, $sProcessUID);
         $oDataset = EventPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oEvent->remove($aRow['EVN_UID']);
             $oDataset->next();
         }
         //Delete the swimlanes elements of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(SwimlanesElementsPeer::PRO_UID, $sProcessUID);
         $oDataset = SwimlanesElementsPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oSwimlaneElement->remove($aRow['SWI_UID']);
             $oDataset->next();
         }
         //Delete the configurations of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ConfigurationPeer::PRO_UID, $sProcessUID);
         $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
             $oDataset->next();
         }
         //Delete the DB sources of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(DbSourcePeer::PRO_UID, $sProcessUID);
         $oDataset = DbSourcePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             /**
              * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
              * in order to solve the bug 0004389, we use the validation function Exists
              * inside the remove function in order to verify if the DbSource record
              * exists in the Database, however there is a strange behavior within the
              * propel engine, when the first record is erased somehow the "_deleted"
              * attribute of the next row is set to true, so when propel tries to erase
              * it, obviously it can't and trows an error. With the "Exist" function
              * we ensure that if there is the record in the database, the _delete attribute must be false.
              *
              * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
              * I have just identified the source of the issue, when is created a $oDbSource DbSource object
              * it's used whenever a record is erased or removed in the db, however the problem
              * it's that the same object is used every time, and the delete method invoked
              * sets the _deleted attribute to true when its called, of course as we use
              * the same object, the first time works fine but trowns an error with the
              * next record, cos it's the same object and the delete method checks if the _deleted
              * attribute it's true or false, the attrib _deleted is setted to true the
              * first time and later is never changed, the issue seems to be part of
              * every remove function in the model classes, not only DbSource
              * i recommend that a more general solution must be achieved to resolve
              * this issue in every model class, to prevent future problems.
              */
             $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
             $oDataset->next();
         }
         //Delete the supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
         ProcessUserPeer::doDelete($oCriteria);
         //Delete the object permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
         ObjectPermissionPeer::doDelete($oCriteria);
         //Delete the step supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
         StepSupervisorPeer::doDelete($oCriteria);
         //Delete the report tables
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUID);
         $oDataset = ReportTablePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
             $oDataset->next();
         }
         //Delete case tracker configuration
         $oCaseTracker->remove($sProcessUID);
         //Delete case tracker objects
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
         ProcessUserPeer::doDelete($oCriteria);
         //Delete the process
         try {
             $oProcess->remove($sProcessUID);
         } catch (Exception $oError) {
             //nada
         }
         return true;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Esempio n. 6
0
    public function con_save_properties($sTasUid, $sDynUid, $sStatus, $sProUid, $sRepTabUid, $tableName, $title, $swOverwrite)
    {
        G::LoadClass("reportTables");

        if ($sStatus == "1" && $sDynUid != "") {
            //Verified as not to duplicate the name of the table

            switch ($swOverwrite) {
                case 1:
                    //Delete report table
                    $criteria = new Criteria();

                    $criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
                    $criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);

                    $rsCriteria = ReportTablePeer::doSelectRS($criteria);

                    $rptUid = null;

                    if ($rsCriteria->next()) {
                        $row = $rsCriteria->getRow();

                        $rptUid = $row[0];
                    }

                    $rpts = new ReportTables();

                    if ($rptUid != null) {
                        $rpts->deleteReportTable($rptUid);
                    }

                    $sRepTabUid = "";
                    break;
                case 2:
                    //Delete table
                    $rpts = new ReportTables();
                    $rpts->dropTable($tableName, "wf");

                    $sRepTabUid = "";
                    break;
            }

            $criteria = new Criteria();
            $criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
            //$criteria->add(ReportTablePeer::PRO_UID, $sProUid);
            $criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);

            $result = ReportTablePeer::doSelectRS($criteria);
            $result->setFetchmode(ResultSet::FETCHMODE_ASSOC);

            if ($result->next()) {
                $dataRes = $result->getRow();

                if ($dataRes["REP_TAB_UID"] != $sRepTabUid) {
                    return 1;
                }
            } else {
                //check if table $tableName exists
                $con = Propel::getConnection("workflow");
                $stmt = $con->createStatement();

                $sql="SHOW TABLES";
                $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
                $rs1->next();
                while ( is_array($row = $rs1->getRow() )) {
                    if ( $row[0] == $tableName ) {
                        return 2;
                    }
                    $rs1->next();
                }
            }

            $_POST['form']['PRO_UID'] = $sProUid;
            $_POST['form']['REP_TAB_UID']  = $sRepTabUid;
            $_POST['form']['REP_TAB_NAME'] = $tableName;
            $_POST['form']['REP_TAB_TYPE'] = "GRID";
            $_POST['form']['REP_TAB_GRID'] = $sProUid . "-" . $sDynUid;
            $_POST['form']['REP_TAB_CONNECTION'] = 'wf';
            $_POST['form']['REP_TAB_CREATE_DATE'] = date("Y-m-d H:i:s");
            $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
            $_POST['form']['REP_TAB_TITLE'] = $title;

            $_POST['form']['FIELDS'] = array();

            G::LoadClass("reportTables");

            $oReportTable = new ReportTable();
            //if (!isset($_POST['form']['REP_TAB_CONNECTION'])) {
            //  $_POST['form']['REP_TAB_CONNECTION'] = 'report';
            //}
            if ($_POST['form']['REP_TAB_UID'] != "") {
                $aReportTable   = $oReportTable->load($_POST['form']['REP_TAB_UID']);
                $sOldTableName  = $aReportTable['REP_TAB_NAME'];
                $sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
            } else {
                $sOldTableName  = $_POST['form']['REP_TAB_NAME'];
                $sOldConnection = $_POST['form']['REP_TAB_CONNECTION'];
                $_POST['form']['REP_TAB_TYPE'] = 'NORMAL';
                $oReportTable->create($_POST['form']);
                $_POST['form']['REP_TAB_UID'] = $oReportTable->getRepTabUid();
            }

            $_POST['form']['REP_TAB_TYPE'] = 'NORMAL';
            $oReportTable->update($_POST['form']);

            $_POST['form']['REP_TAB_TYPE'] = 'GRID';

            $oReportVar = new ReportVar();
            $oReportTables = new ReportTables();
            $oReportTables->deleteAllReportVars($_POST['form']['REP_TAB_UID']);

            $aFields = array();

            if ($_POST['form']['REP_TAB_TYPE'] == 'GRID') {
                $aAux = explode('-', $_POST['form']['REP_TAB_GRID']);
                global $G_FORM;

                G::LoadClass("formBatchRouting");
                $G_FORM = new FormBatchRouting($_POST["form"]["PRO_UID"] . PATH_SEP . $aAux[1], PATH_DYNAFORM, SYS_LANG, false);
                $aAux = $G_FORM->getVars(false);

                foreach ($aAux as $aField) {
                    $_POST['form']['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
                }
            }

            $aFieldsClases = array();
            $i = 1;
            $aFieldsClases[$i]['FLD_NAME'] = 'APP_UID';
            $aFieldsClases[$i]['FLD_NULL'] = 'off';
            $aFieldsClases[$i]['FLD_KEY'] = 'on';
            $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
            $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
            $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
            $aFieldsClases[$i]['FLD_SIZE'] = 32;
            $i++;
            $aFieldsClases[$i]['FLD_NAME'] = 'APP_NUMBER';
            $aFieldsClases[$i]['FLD_NULL'] = 'off';
            $aFieldsClases[$i]['FLD_KEY'] = 'on';
            $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
            $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';
            $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
            $aFieldsClases[$i]['FLD_SIZE'] = 255;

            foreach ($_POST['form']['FIELDS'] as $sField) {
                $aField = explode('-', $sField);
                $i++;
                $aFieldsClases[$i]['FLD_NAME'] = $aField[0];
                $aFieldsClases[$i]['FLD_NULL'] = 'off';
                $aFieldsClases[$i]['FLD_KEY'] = 'off';
                $aFieldsClases[$i]['FLD_AUTO_INCREMENT'] = 'off';
                $aFieldsClases[$i]['FLD_DESCRIPTION'] = '';

                switch ($aField[1]) {
                    case 'currency':
                    case 'percentage':
                        $sType = 'number';
                        $aFieldsClases[$i]['FLD_TYPE'] = 'FLOAT' ;
                        $aFieldsClases[$i]['FLD_SIZE'] = 255;
                        break;
                    case 'text':
                    case 'password':
                    case 'dropdown':
                    case 'yesno':
                    case 'checkbox':
                    case 'radiogroup':
                    case 'hidden':
                    case "link":
                        $sType = 'char';
                        $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
                        $aFieldsClases[$i]['FLD_SIZE'] = 255;
                        break;
                    case 'textarea':
                        $sType = 'text';
                        $aFieldsClases[$i]['FLD_TYPE'] = 'TEXT' ;
                        $aFieldsClases[$i]['FLD_SIZE'] = '';
                        break;
                    case 'date':
                        $sType = 'date';
                        $aFieldsClases[$i]['FLD_TYPE'] = 'DATE' ;
                        $aFieldsClases[$i]['FLD_SIZE'] = '';
                        break;
                    default:
                        $sType = 'char';
                        $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR' ;
                        $aFieldsClases[$i]['FLD_SIZE'] = 255;
                        break;
                }

                $oReportVar->create(array('REP_TAB_UID'  => $_POST['form']['REP_TAB_UID'],
                                          'PRO_UID'      => $_POST['form']['PRO_UID'],
                                          'REP_VAR_NAME' => $aField[0],
                                          'REP_VAR_TYPE' => $sType));
                $aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
            }

            $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
            $oReportTables->dropTable($sOldTableName, $sOldConnection);
            $oReportTables->createTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields);
            $oReportTables->populateTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields, $_POST['form']['PRO_UID'], '');

            $sRepTabUid = $_POST['form']['REP_TAB_UID'];

            //clases
        } else {
            $oReportTables = new ReportTables();
            if ($sRepTabUid != "") {
                $oReportTables->deleteReportTable($sRepTabUid);
            }
            $sRepTabUid = "";
        }

        $oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($sTasUid);

        if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidated') {
            $oCaseConsolidated = new CaseConsolidated();
            $oCaseConsolidated->setTasUid($sTasUid);
        }

        if ($sStatus == '1') {
            $oCaseConsolidated->setConStatus('ACTIVE');
        } else {
            $oCaseConsolidated->setConStatus('INACTIVE');
        }

        $oCaseConsolidated->setDynUid($sDynUid);
        $oCaseConsolidated->setRepTabUid($sRepTabUid);
        $oCaseConsolidated->save();

        $sClassName = $tableName;//'__' . $sTasUid;

        if ($sStatus == '1') {
            //$oAdditionalTables->createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid)
            //require_once 'classes/model/AdditionalTables.php';
            //$oAdditionalTables = new AdditionalTables();
            $oAdditionalTables = new AdditionalTables();//AdditionalTablesConsolidated

            $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid);
        } else {
            $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
            @unlink($sPath . $sClassName . '.php');
            @unlink($sPath . $sClassName . 'Peer.php');
            @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
            @unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
            @unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
        }

        return ($sRepTabUid);
    }
Esempio n. 7
0
         $dynFields = getDynafields($aFields['PRO_UID']);
         foreach ($dynFields as $dfield) {
             $aProcessFields[] = array('FIELD_UID' => $dfield['name'] . '-' . $dfield['type'], 'FIELD_NAME' => $dfield['name']);
         }
         $resultList['processFields'] = $aProcessFields;
     }
     echo G::json_encode($resultList);
     break;
 case 'fieldsList':
     G::LoadClass('reportTables');
     G::LoadClass('xmlfield_InputPM');
     $aFields['FIELDS'] = array();
     $oReportTable = new ReportTable();
     $aFields = $oReportTable->load($_POST['REP_TAB_UID']);
     $aTheFields = getDynaformsVars($aFields['PRO_UID'], false);
     $oReportTables = new ReportTables();
     $aVars = $oReportTables->getTableVars($_POST['REP_TAB_UID']);
     $aFields['FIELDS'] = array();
     foreach ($aTheFields as $aField) {
         if (in_array($aField['sName'], $aVars)) {
             $aResultFields[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'], 'FIELD_NAME' => $aField['sName'], 'FIELD_DYNAFORM' => $aField['sName']);
         }
     }
     $result->success = true;
     $result->data = $aResultFields;
     echo G::json_encode($result);
     break;
 case 'getDbConnectionsList':
     G::LoadClass('dbConnections');
     $proUid = $_POST['PRO_UID'];
     $dbConn = new DbConnections();
Esempio n. 8
0
 public function updateCase($sAppUid, $Fields = array())
 {
     try {
         $aApplicationFields = $Fields['APP_DATA'];
         $Fields['APP_UID'] = $sAppUid;
         $Fields['APP_UPDATE_DATE'] = 'now';
         $Fields['APP_DATA'] = serialize($Fields['APP_DATA']);
         /*
         $oApp = new Application;
         $appFields = $oApp->load($sAppUid);
         */
         $oApp = ApplicationPeer::retrieveByPk($sAppUid);
         $appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME);
         if (isset($Fields['APP_TITLE'])) {
             $appFields['APP_TITLE'] = $Fields['APP_TITLE'];
         }
         if (isset($Fields['APP_DESCRIPTION'])) {
             $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION'];
         }
         $newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields);
         //Start: Save History --By JHL
         if (isset($Fields['CURRENT_DYNAFORM'])) {
             //only when that variable is set.. from Save
             $FieldsBefore = $this->loadCase($sAppUid);
             $FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields);
             $fieldsOnBoth = array_intersect_assoc($FieldsBefore['APP_DATA'], $aApplicationFields);
             //Add fields that weren't in previous version
             foreach ($aApplicationFields as $key => $value) {
                 if (!isset($fieldsOnBoth[$key])) {
                     $FieldsDifference[$key] = $value;
                 }
             }
             if (is_array($FieldsDifference) && count($FieldsDifference) > 0) {
                 //There are changes
                 $appHistory = new AppHistory();
                 $aFieldsHistory = $Fields;
                 $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
                 $appHistory->insertHistory($aFieldsHistory);
             }
         }
         //End Save History
         //we are removing the app_title and app_description from this array,
         //because they already be updated in  newRefreshCaseTitleAndDescription function
         if (isset($Fields['APP_TITLE'])) {
             unset($Fields['APP_TITLE']);
         }
         if (isset($Fields['APP_DESCRIPTION'])) {
             unset($Fields['APP_DESCRIPTION']);
         }
         $oApp->update($Fields);
         $DEL_INDEX = isset($Fields['DEL_INDEX']) ? $Fields['DEL_INDEX'] : '';
         $TAS_UID = isset($Fields['TAS_UID']) ? $Fields['TAS_UID'] : '';
         G::LoadClass('reportTables');
         require_once 'classes/model/AdditionalTables.php';
         $oReportTables = new ReportTables();
         $addtionalTables = new additionalTables();
         $oReportTables->updateTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields);
         $addtionalTables->updateReportTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields);
         //now update the priority in appdelegation table, using the defined variable in task
         if (trim($DEL_INDEX) != '' && trim($TAS_UID) != '') {
             //optimized code to avoid load task content row.
             $c = new Criteria();
             $c->clearSelectColumns();
             $c->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE);
             $c->add(TaskPeer::TAS_UID, $TAS_UID);
             $rs = TaskPeer::doSelectRS($c);
             $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $rs->next();
             $row = $rs->getRow();
             $VAR_PRI = substr($row['TAS_PRIORITY_VARIABLE'], 2);
             //end optimized code.
             $x = unserialize($Fields['APP_DATA']);
             if (isset($x[$VAR_PRI])) {
                 if (trim($x[$VAR_PRI]) != '') {
                     $oDel = new AppDelegation();
                     $array = array();
                     $array['APP_UID'] = $sAppUid;
                     $array['DEL_INDEX'] = $DEL_INDEX;
                     $array['TAS_UID'] = $TAS_UID;
                     $array['DEL_PRIORITY'] = isset($x[$VAR_PRI]) ? $x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3' : '3';
                     $oDel->update($array);
                 }
             }
         }
         //Update Solr Index
         if ($this->appSolr != null) {
             $this->appSolr->updateApplicationSearchIndex($sAppUid);
         }
         return $Fields;
     } catch (exception $e) {
         throw $e;
     }
 }
Esempio n. 9
0
 public function deleteProcess($sProcessUID, $flagRemoveCases = true)
 {
     try {
         //G::LoadClass('case');
         //G::LoadClass('reportTables');
         //Instance all classes necesaries
         $oProcess = new \Process();
         $oDynaform = new \Dynaform();
         $oInputDocument = new \InputDocument();
         $oOutputDocument = new \OutputDocument();
         $oTrigger = new \Triggers();
         $oRoute = new \Route();
         $oGateway = new \Gateway();
         $oEvent = new \Event();
         $oSwimlaneElement = new \SwimlanesElements();
         $oConfiguration = new \Configuration();
         $oDbSource = new \DbSource();
         $oReportTable = new \ReportTables();
         $oCaseTracker = new \CaseTracker();
         $oCaseTrackerObject = new \CaseTrackerObject();
         //Update PROCESS_FILES_CHECKED
         $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", "");
         if (!is_null($configuration)) {
             $arrayProjectUid = unserialize($configuration->getCfgValue());
             unset($arrayProjectUid[$sProcessUID]);
             $conf = new \Configuration();
             $result = $conf->update(array("CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => ""));
         }
         //Delete the applications of process
         if ($flagRemoveCases) {
             $case = new \Cases();
             $criteria = new \Criteria("workflow");
             $criteria->addSelectColumn(\ApplicationPeer::APP_UID);
             $criteria->add(\ApplicationPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
             $rsCriteria = \ApplicationPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             while ($rsCriteria->next()) {
                 $row = $rsCriteria->getRow();
                 $result = $case->removeCase($row["APP_UID"]);
             }
         }
         //Delete the tasks of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
         $oDataset = \TaskPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             //$this->deleteTask($aRow['TAS_UID']);
             $oTasks = new \Tasks();
             $oTasks->deleteTask($aRow['TAS_UID']);
             $oDataset->next();
         }
         //Delete the dynaforms of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DynaformPeer::PRO_UID, $sProcessUID);
         $oDataset = \DynaformPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oDynaform->remove($aRow['DYN_UID']);
             $oDataset->next();
         }
         //Delete the input documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\InputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \InputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oInputDocument->remove($aRow['INP_DOC_UID']);
             $oDataset->next();
         }
         //Delete the output documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oOutputDocument->remove($aRow['OUT_DOC_UID']);
             $oDataset->next();
         }
         //Delete the triggers of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TriggersPeer::PRO_UID, $sProcessUID);
         $oDataset = \TriggersPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oTrigger->remove($aRow['TRI_UID']);
             $oDataset->next();
         }
         //Delete the routes of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\RoutePeer::PRO_UID, $sProcessUID);
         $oDataset = \RoutePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oRoute->remove($aRow['ROU_UID']);
             $oDataset->next();
         }
         //Delete the gateways of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\GatewayPeer::PRO_UID, $sProcessUID);
         $oDataset = \GatewayPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oGateway->remove($aRow['GAT_UID']);
             $oDataset->next();
         }
         //Delete the Event of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\EventPeer::PRO_UID, $sProcessUID);
         $oDataset = \EventPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oEvent->remove($aRow['EVN_UID']);
             $oDataset->next();
         }
         //Delete the swimlanes elements of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\SwimlanesElementsPeer::PRO_UID, $sProcessUID);
         $oDataset = \SwimlanesElementsPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oSwimlaneElement->remove($aRow['SWI_UID']);
             $oDataset->next();
         }
         //Delete the configurations of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ConfigurationPeer::PRO_UID, $sProcessUID);
         $oDataset = \ConfigurationPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
             $oDataset->next();
         }
         //Delete the DB sources of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DbSourcePeer::PRO_UID, $sProcessUID);
         $oDataset = \DbSourcePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             /**
              * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
              * in order to solve the bug 0004389, we use the validation function Exists
              * inside the remove function in order to verify if the DbSource record
              * exists in the Database, however there is a strange behavior within the
              * propel engine, when the first record is erased somehow the "_deleted"
              * attribute of the next row is set to true, so when propel tries to erase
              * it, obviously it can't and trows an error. With the "Exist" function
              * we ensure that if there is the record in the database, the _delete attribute must be false.
              *
              * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
              * I have just identified the source of the issue, when is created a $oDbSource DbSource object
              * it's used whenever a record is erased or removed in the db, however the problem
              * it's that the same object is used every time, and the delete method invoked
              * sets the _deleted attribute to true when its called, of course as we use
              * the same object, the first time works fine but trowns an error with the
              * next record, cos it's the same object and the delete method checks if the _deleted
              * attribute it's true or false, the attrib _deleted is setted to true the
              * first time and later is never changed, the issue seems to be part of
              * every remove function in the model classes, not only DbSource
              * i recommend that a more general solution must be achieved to resolve
              * this issue in every model class, to prevent future problems.
              */
             $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
             $oDataset->next();
         }
         //Delete the supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete the object permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ObjectPermissionPeer::PRO_UID, $sProcessUID);
         \ObjectPermissionPeer::doDelete($oCriteria);
         //Delete the step supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
         \StepSupervisorPeer::doDelete($oCriteria);
         //Delete the report tables
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ReportTablePeer::PRO_UID, $sProcessUID);
         $oDataset = \ReportTablePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
             $oDataset->next();
         }
         //Delete case tracker configuration
         $oCaseTracker->remove($sProcessUID);
         //Delete case tracker objects
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete SubProcess
         $criteria = new \Criteria("workflow");
         $criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL);
         $result = \SubProcessPeer::doDelete($criteria);
         //Delete WebEntries
         $webEntry = new \ProcessMaker\BusinessModel\WebEntry();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryPeer::WE_UID);
         $criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $webEntry->delete($row["WE_UID"]);
         }
         //Delete WebEntry-Events
         $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
         $criteria->add(\WebEntryEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $webEntryEvent->delete($row["WEE_UID"]);
         }
         //Delete MessageTypes
         $messageType = new \ProcessMaker\BusinessModel\MessageType();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageTypePeer::MSGT_UID);
         $criteria->add(\MessageTypePeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageTypePeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageType->delete($row["MSGT_UID"]);
         }
         //Delete Message-Event-Relation
         $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation();
         $messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Task-Relation
         $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
         $elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Definition
         $messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID);
         $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageEventDefinition->delete($row["MSGED_UID"]);
         }
         //Delete Script-Task
         $scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
         $scriptTask->deleteWhere(array(\ScriptTaskPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Timer-Event
         $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
         $timerEvent->deleteWhere(array(\TimerEventPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Email-Event
         $emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\EmailEventPeer::EMAIL_EVENT_UID);
         $criteria->add(\EmailEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \EmailEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $emailEvent->delete($sProcessUID, $row["EMAIL_EVENT_UID"], false);
         }
         //Delete files Manager
         $filesManager = new \ProcessMaker\BusinessModel\FilesManager();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
         $criteria->add(\ProcessFilesPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $filesManager->deleteProcessFilesManager($sProcessUID, $row["PRF_UID"]);
         }
         //Delete the actions by email
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\AbeConfigurationPeer::PRO_UID, $sProcessUID);
         \AbeConfigurationPeer::doDelete($oCriteria);
         //Delete the process
         try {
             $oProcess->remove($sProcessUID);
         } catch (\Exception $oError) {
             throw $oError;
         }
         return true;
     } catch (\Exception $oError) {
         throw $oError;
     }
 }
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
G::LoadClass('reportTables');
try {
    $oReportTables = new ReportTables();
    $oReportTables->deleteReportTable($_POST['REP_TAB_UID']);
    $result->success = true;
    $result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
} catch (Exception $e) {
    $result->success = false;
    $result->msg = $e->getMessage();
}
print G::json_encode($result);
Esempio n. 11
0
if (!isset($values['REP_TAB_CONNECTION'])) {
    $values['REP_TAB_CONNECTION'] = 'report';
}
if ($values['REP_TAB_UID'] != '') {
    $aReportTable = $oReportTable->load($values['REP_TAB_UID']);
    $sOldTableName = $aReportTable['REP_TAB_NAME'];
    $sOldConnection = $aReportTable['REP_TAB_CONNECTION'];
} else {
    $sOldTableName = $values['REP_TAB_NAME'];
    $sOldConnection = $values['REP_TAB_CONNECTION'];
    $oReportTable->create($values);
    $values['REP_TAB_UID'] = $oReportTable->getRepTabUid();
}
$oReportTable->update($values);
$oReportVar = new ReportVar();
$oReportTables = new ReportTables();
$oReportTables->deleteAllReportVars($values['REP_TAB_UID']);
$aFields = array();
if ($values['REP_TAB_TYPE'] == 'GRID') {
    $aAux = explode('-', $values['REP_TAB_GRID']);
    global $G_FORM;
    $G_FORM = new Form($values['PRO_UID'] . '/' . $aAux[1], PATH_DYNAFORM, SYS_LANG, false);
    $aAux = $G_FORM->getVars(false);
    foreach ($aAux as $aField) {
        $values['FIELDS'][] = $aField['sName'] . '-' . $aField['sType'];
    }
}
foreach ($values['FIELDS'] as $sField) {
    $aField = explode('-', $sField);
    switch ($aField[1]) {
        case 'currency':
Esempio n. 12
0
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
/*
 * RS.
 *
 * Adicioné un nuevo parámetro en la clase AddIdRawOption en class.menu.php que me ayude
 * a colocar una clase al elemento que se encuentra dentro de la lista (generada por el
 * submenu).
 *
 * En este caso seguiremos con el uso del sprite. ss_sprite ss_nombre_archivo
 */
global $G_TMP_MENU;
$G_TMP_MENU_ALIGN = "left";
$G_TMP_MENU->AddIdRawOption('DYNAFORMS', '', G::LoadTranslation('ID_DYNAFORMS'), "", 'Pm.data.render.buildingBlocks.injector(\'dynaforms\'); return false;', '', 'ss_sprite ss_application_form');
$G_TMP_MENU->AddIdRawOption('INPUTDOCS', '', G::LoadTranslation('ID_REQUEST_DOCUMENTS'), "", 'Pm.data.render.buildingBlocks.injector(\'inputs\'); return false;', '', 'ss_sprite ss_page_white_get');
$G_TMP_MENU->AddIdRawOption('OUTPUTDOCS', '', G::LoadTranslation('ID_OUTPUT_DOCUMENTS'), "", 'Pm.data.render.buildingBlocks.injector(\'outputs\'); return false;', '', 'ss_sprite ss_page_white_put');
$G_TMP_MENU->AddIdRawOption('TRIGGERS', '', G::LoadTranslation('ID_TRIGGERS'), "", 'Pm.data.render.buildingBlocks.injector(\'triggers\'); return false;', '', 'ss_sprite ss_cog');
//$G_TMP_MENU->AddIdRawOption('MESSAGES',     '', G::LoadTranslation('ID_MESSAGES'),"/images/mail.gif",'Pm.data.render.buildingBlocks.injector(\'messages\'); return false;');
G::LoadClass('reportTables');
if (ReportTables::tableExist()) {
    //DEPRECATED $G_TMP_MENU->AddIdRawOption('REPORT_TABLES', '', G::LoadTranslation('ID_REPORT_TABLESOLD'),"",'Pm.data.render.buildingBlocks.injector(\'reportTables2\'); return false;','','ss_sprite ss_table');
    $G_TMP_MENU->AddIdRawOption('REPORT_TABLES', '', G::LoadTranslation('ID_REPORT_TABLES'), "", 'Pm.data.render.buildingBlocks.injector(\'reportTables\'); return false;', '', 'ss_sprite ss_table');
}
$G_TMP_MENU->AddIdRawOption('DB_CONNECTIONS', '', G::LoadTranslation('ID_DB_CONNECTIONS'), "", 'showDbConnectionsList(Pm.options.uid); return false;', '', 'ss_sprite ss_database_connect');
$G_TMP_MENU->AddIdRawOption('CASE_SCHEDULER', '', G::LoadTranslation('ID_CASE_SCHEDULER'), "", 'showCaseSchedulerList(Pm.options.uid); return false;', '', 'ss_sprite ss_calendar_view_day');
//$G_TMP_MENU->AddIdRawOption('EDIT_BPMN', '', G::LoadTranslation('ID_SWITCH_EDITOR'), "", 'showNewProcessMap(Pm.options.uid); return false;','','ss_sprite ss_arrow_switch');
Esempio n. 13
0
                $sType = 'char';
                $aFieldsClases[$i]['FLD_TYPE'] = 'VARCHAR';
                $aFieldsClases[$i]['FLD_SIZE'] = 255;
                break;
        }
        $oReportVar->create(array('REP_TAB_UID' => $_POST['form']['REP_TAB_UID'], 'PRO_UID' => $_POST['form']['PRO_UID'], 'REP_VAR_NAME' => $aField[0], 'REP_VAR_TYPE' => $sType));
        $aFields[] = array('sFieldName' => $aField[0], 'sType' => $sType);
    }
    $_POST['form']['REP_TAB_TYPE'] = "NORMAL";
    $oReportTables->dropTable($sOldTableName, $sOldConnection);
    $oReportTables->createTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields);
    $oReportTables->populateTable($_POST['form']['REP_TAB_NAME'], $_POST['form']['REP_TAB_CONNECTION'], $_POST['form']['REP_TAB_TYPE'], $aFields, $_POST['form']['PRO_UID'], '');
    $sRepTabUid = $_POST['form']['REP_TAB_UID'];
    //clases
} else {
    $oReportTables = new ReportTables();
    if ($sRepTabUid != "") {
        $oReportTables->deleteReportTable($sRepTabUid);
    }
    $sRepTabUid = "";
}
require_once "classes/model/CaseConsolidatedPeer.php";
require_once "classes/model/CaseConsolidated.php";
$oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($sTasUid);
if (!is_object($oCaseConsolidated) || get_class($oCaseConsolidated) != 'CaseConsolidated') {
    $oCaseConsolidated = new CaseConsolidated();
    $oCaseConsolidated->setTasUid($sTasUid);
}
if ($sStatus == '1') {
    $oCaseConsolidated->setConStatus('ACTIVE');
} else {