Пример #1
0
 public function process()
 {
     if ($this->value !== null) {
         Parameter::$report->addWhere[0] = '';
         // changed from $add_where. Assumed mistake.
         ReportTable::$maxRows = $this->value;
         FormInputs::addVisible("prm_{$this->id}", $this->value);
         Parameter::$display .= $this->description();
     }
 }
$idbr_detail_page .= ".php";
$idbr_primary_key_var = "";
$idbr_detail_field1_to_save = "";
$idbr_detail_field2_to_save = "";
$idbr_detail_field3_to_save = "";
$idbr_detail_field4_to_save = "";
$idbr_display_add_link = "";
$idbr_display_update_link = "Yes";
$idbr_display_delete_link = "Yes";
$idbr_display_detail_link = "";
$idbr_display_search = "Yes";
if (is_object(${"eDetail_" . $idbr_table_name})) {
    global ${"id" . $idbr_table_name};
    ${"id" . $idbr_table_name} = ${"eDetail_" . $idbr_table_name}->getParam("id" . $idbr_table_name);
}
$r_db_disp_table = new ReportTable($GLOBALS["conx"]);
$r_db_disp_table->setValue("display_add_link", $idbr_display_add_link);
$r_db_disp_table->setValue("display_update_link", $idbr_display_update_link);
$r_db_disp_table->setValue("display_delete_link", $idbr_display_delete_link);
$r_db_disp_table->setValue("display_detail_link", $idbr_display_detail_link);
$r_db_disp_table->setValue("display_search", $idbr_display_search);
$r_db_disp_table->setValue("detail_field1_to_save", $idbr_detail_field1_to_save);
$r_db_disp_table->setValue("detail_field2_to_save", $idbr_detail_field2_to_save);
$r_db_disp_table->setValue("detail_field3_to_save", $idbr_detail_field3_to_save);
$r_db_disp_table->setValue("detail_field4_to_save", $idbr_detail_field4_to_save);
if (!empty($idbr_registry)) {
    $r_db_disp_table->setRegistry($idbr_registry);
}
if (!empty($idbr_registry_form)) {
    $r_db_disp_table->setValue("registryname", $idbr_registry_form);
}
Пример #3
0
 /**
  * delete pm table
  *
  * @param string $httpData->rows
  */
 public function delete($httpData)
 {
     $rows = G::json_decode(stripslashes($httpData->rows));
     $errors = '';
     $count = 0;
     foreach ($rows as $row) {
         try {
             $at = new AdditionalTables();
             $table = $at->load($row->id);
             if (!isset($table)) {
                 require_once 'classes/model/ReportTable.php';
                 $rtOld = new ReportTable();
                 $existReportTableOld = $rtOld->load($row->id);
                 if (count($existReportTableOld) == 0) {
                     throw new Exception(G::LoadTranslation('ID_TABLE_NOT_EXIST_SKIPPED'));
                 }
             }
             if ($row->type == 'CLASSIC') {
                 G::LoadClass('reportTables');
                 $rp = new reportTables();
                 $rp->deleteReportTable($row->id);
                 $count++;
             } else {
                 $at->deleteAll($row->id);
                 $count++;
             }
         } catch (Exception $e) {
             $tableName = isset($table['ADD_TAB_NAME']) ? $table['ADD_TAB_NAME'] : $row->id;
             $errors .= $e->getMessage() . "\n";
             continue;
         }
     }
     if ($errors == '') {
         $result->success = true;
         $result->message = $count . G::LoadTranslation('ID_TABLES_REMOVED_SUCCESSFULLY');
     } else {
         $result->success = false;
         $result->message = $count . G::LoadTranslation('ID_TABLES_REMOVED_WITH_ERRORS') . $errors;
     }
     $result->errors = $errors;
     return $result;
 }
 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);
 }
 /**
  * Function deleteReportTable
  * This Function deletes report table
  *
  * @access public
  * @param string $sRepTabUid
  * @return void
  */
 public function deleteReportTable($sRepTabUid)
 {
     try {
         $oReportTable = new ReportTable();
         $aFields = $oReportTable->load($sRepTabUid);
         if (!empty($aFields)) {
             $this->dropTable($aFields['REP_TAB_NAME'], $aFields['REP_TAB_CONNECTION']);
             $oCriteria = new Criteria('workflow');
             $oCriteria->add(ReportVarPeer::REP_TAB_UID, $sRepTabUid);
             $oDataset = ReportVarPeer::doDelete($oCriteria);
             $oReportTable->remove($sRepTabUid);
         }
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Пример #6
0
    /**

     * Create Report Tables from an array of data

     *

     * @param array $aReportTables

     * @param array $aReportTablesVars

     * @return void

     */

    public function createReportTables ($aReportTables, $aReportTablesVars)

    {

        $this->createReportTablesVars( $aReportTablesVars );

        $oReportTables = new ReportTables();

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

            $bExists = true;

            $sTable = $aRow['REP_TAB_NAME'];

            $iCounter = 1;

            while ($bExists) {

                $oCriteria = new Criteria( 'workflow' );

                $oCriteria->add( ReportTablePeer::REP_TAB_NAME, $sTable );

                $oDataset = ReportTablePeer::doSelectRS( $oCriteria );

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

                $oDataset->next();

                $bExists = ($aRow2 = $oDataset->getRow());

                if ($bExists) {

                    $sTable = $aRow['REP_TAB_NAME'] . '_' . $iCounter;

                    $iCounter ++;

                } else {

                    $aRow['REP_TAB_NAME'] = $sTable;

                }

            }

            $aFields = $oReportTables->getTableVars( $aRow['REP_TAB_UID'], true );

            $oReportTables->createTable( $aRow['REP_TAB_NAME'], $aRow['REP_TAB_CONNECTION'], $aRow['REP_TAB_TYPE'], $aFields );

            $oReportTables->populateTable( $aRow['REP_TAB_NAME'], $aRow['REP_TAB_CONNECTION'], $aRow['REP_TAB_TYPE'], $aFields, $aRow['PRO_UID'], $aRow['REP_TAB_GRID'] );

            $aReportTables[$sKey]['REP_TAB_NAME'] = $aRow['REP_TAB_NAME'];

            $oRep = new ReportTable();

            if ($oRep->reportTableExists( $aRow['REP_TAB_UID'] )) {

                $oRep->remove( $aRow['REP_TAB_UID'] );

            }

            $oRep->create( $aRow );

        }

    }
Пример #7
0
 /**
  * Validates all modified columns of given ReportTable object.
  * If parameter $columns is either a single column name or an array of column names
  * than only those columns are validated.
  *
  * NOTICE: This does not apply to primary or foreign keys for now.
  *
  * @param      ReportTable $obj The object to validate.
  * @param      mixed $cols Column name or array of column names.
  *
  * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
  */
 public static function doValidate(ReportTable $obj, $cols = null)
 {
     $columns = array();
     if ($cols) {
         $dbMap = Propel::getDatabaseMap(ReportTablePeer::DATABASE_NAME);
         $tableMap = $dbMap->getTable(ReportTablePeer::TABLE_NAME);
         if (!is_array($cols)) {
             $cols = array($cols);
         }
         foreach ($cols as $colName) {
             if ($tableMap->containsColumn($colName)) {
                 $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                 $columns[$colName] = $obj->{$get}();
             }
         }
     } else {
         if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_UID)) {
             $columns[ReportTablePeer::REP_TAB_UID] = $obj->getRepTabUid();
         }
         if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::PRO_UID)) {
             $columns[ReportTablePeer::PRO_UID] = $obj->getProUid();
         }
         if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_NAME)) {
             $columns[ReportTablePeer::REP_TAB_NAME] = $obj->getRepTabName();
         }
         if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_TYPE)) {
             $columns[ReportTablePeer::REP_TAB_TYPE] = $obj->getRepTabType();
         }
         if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_CONNECTION)) {
             $columns[ReportTablePeer::REP_TAB_CONNECTION] = $obj->getRepTabConnection();
         }
         if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_STATUS)) {
             $columns[ReportTablePeer::REP_TAB_STATUS] = $obj->getRepTabStatus();
         }
     }
     return BasePeer::doValidate(ReportTablePeer::DATABASE_NAME, ReportTablePeer::TABLE_NAME, $columns);
 }
Пример #8
0
    /**
     * delete pm table
     *
     * @param string $httpData->rows
     */
    public function delete ($httpData)
    {
        $result = new stdClass();
        $rows = G::json_decode( stripslashes( $httpData->rows ) );
        $errors = '';
        $count = 0;
        $result = new StdClass();

        $tableCasesList = array();
        $conf = new Configurations();
        $confCasesListDraft = $conf->getConfiguration( 'casesList', 'draft');
        $confCasesListPaused = $conf->getConfiguration( 'casesList', 'paused');
        $confCasesListSent = $conf->getConfiguration( 'casesList', 'sent');
        $confCasesListTodo = $conf->getConfiguration( 'casesList', 'todo');
        $confCasesListUnassigned = $conf->getConfiguration( 'casesList', 'unassigned');
        $tableCasesList['draft'] = ($confCasesListDraft != null) ? (isset($confCasesListDraft['PMTable']) ? $confCasesListDraft['PMTable'] : '') : '';
        $tableCasesList['paused'] = ($confCasesListPaused != null) ? (isset($confCasesListPaused['PMTable']) ? $confCasesListPaused['PMTable'] : '') : '';
        $tableCasesList['sent'] = ($confCasesListSent != null) ? (isset($confCasesListSent['PMTable']) ? $confCasesListSent['PMTable'] : '') : '';
        $tableCasesList['todo'] = ($confCasesListTodo != null) ? (isset($confCasesListTodo['PMTable']) ? $confCasesListTodo['PMTable'] : '') : '';
        $tableCasesList['unassigned'] = ($confCasesListUnassigned != null) ? (isset($confCasesListUnassigned['PMTable']) ? $confCasesListUnassigned['PMTable'] : '') : '';

        foreach ($rows as $row) {
            try {
                $at = new AdditionalTables();
                $table = $at->load( $row->id );

                if (! isset( $table )) {
                    require_once 'classes/model/ReportTable.php';
                    $rtOld = new ReportTable();
                    $existReportTableOld = $rtOld->load( $row->id );
                    if (count($existReportTableOld) == 0) {
                        throw new Exception( G::LoadTranslation('ID_TABLE_NOT_EXIST_SKIPPED') );
                    }
                }

                foreach ($tableCasesList as $action => $idTable) {
                    if ($idTable == $row->id) {
                        $conf = new Configurations();
                        $resultJson = $conf->casesListDefaultFieldsAndConfig($action);
                        $conf->saveObject($resultJson, "casesList", $action, "", "", "");
                    }
                }

                if ($row->type == 'CLASSIC') {
                    G::LoadClass( 'reportTables' );
                    $rp = new reportTables();
                    $rp->deleteReportTable( $row->id );
                    $count ++;
                } else {
                    $at->deleteAll( $row->id );
                    $count ++;
                }
            } catch (Exception $e) {
                $tableName = isset( $table['ADD_TAB_NAME'] ) ? $table['ADD_TAB_NAME'] : $row->id;
                $errors .= $e->getMessage() . "\n";
                continue;
            }
        }

        if ($errors == '') {
            $result->success = true;
            $result->message = $count.G::LoadTranslation( 'ID_TABLES_REMOVED_SUCCESSFULLY' );
            G::auditLog("DeletePmtable", "Table Name: ". $table['ADD_TAB_NAME']." Table ID: (".$table['ADD_TAB_UID'].") ");
        } else {
            $result->success = false;
            $result->message = $count. G::LoadTranslation( 'ID_TABLES_REMOVED_WITH_ERRORS' ) .$errors;
        }

        $result->errors = $errors;

        return $result;
    }
Пример #9
0
     $rows = $oOutputDocument->load($_GET['tid']);
     $tmpData = G::json_encode($rows);
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
     $result = $tmpData;
     echo $result;
     break;
 case 'getReportTables':
     $rows = $oProcessMap->getExtReportTables($start, $limit, $_GET['pid']);
     $result['totalCount'] = $oProcessMap->getAllReportTableCount();
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'editReportTables':
     require_once 'classes/model/ReportTable.php';
     $oReportTable = new ReportTable();
     $rows = $oReportTable->load($_GET['REP_TAB_UID'], $_GET['pid']);
     $tmpData = G::json_encode($rows);
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
     $result = $tmpData;
     echo $result;
     break;
 case 'getReportTableType':
     if (isset($_GET['pid']) && $_GET['type'] == 'NORMAL') {
         $aTheFields = array();
         $aTheFields = getDynaformsVars($_GET['pid'], false);
         foreach ($aTheFields as $aField) {
             $rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'], 'FIELD_NAME' => $aField['sName']);
         }
     } else {
Пример #10
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);
    }
Пример #11
0
     } else {
         $aProcessFields = array();
         //$dynFields = getDynaformsVars($aFields['PRO_UID'], false);
         $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':
Пример #12
0
 public function displayFooter($startRow, $outputType)
 {
     echo "<tfoot>";
     if (!$this->numRows) {
         echo "<tr class='data'><td colspan=" . $this->nfields() . "><i>" . _("Sorry, no rows were returned.") . "</i></td></tr>";
     } else {
         if ($this->performSubtotalFlag) {
             $rowParms = array();
             $total = null;
             foreach ($this->fields() as $field) {
                 if (isset($this->columnData['sum'][$field], $this->totalSumArray[$field])) {
                     $total = $this->sumColumn($field, $this->totalSumArray, $this->numRows);
                 }
                 $rowParms[] = $total === null || $total === '' ? '&nbsp;' : $total;
                 $total = null;
             }
             $rowParms[0] = "Total for Report";
             echo ReportTable::formatTotalsRow($rowParms);
         }
         if (!$this->report->onlySummary || $outputType !== 'web') {
             echo "<tr><td colspan=" . $this->nfields() . " align='right'><i>Showing rows ", $startRow, " to ";
             if (ReportTable::$maxRows > 0 && $this->numRows > ReportTable::$maxRows) {
                 echo ReportTable::$maxRows . " of " . ReportTable::$maxRows;
             } else {
                 echo "{$this->numRows} of {$this->numRows}";
             }
             echo '</i></td></tr>';
         }
     }
     echo '</tfoot>';
 }
Пример #13
0
    $oProcessMap = new processMap(new DBConnection());
    if (isset($_GET['pid']) && !isset($_GET['type'])) {
        $rows = $oProcessMap->getExtReportTables($_GET['pid']);
    } else {
        if (isset($_GET['pid']) && $_GET['type'] == 'NORMAL') {
            $aTheFields = array();
            $aTheFields = getDynaformsVars($_GET['pid'], false);
            foreach ($aTheFields as $aField) {
                $rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'], 'FIELD_NAME' => $aField['sName']);
            }
        } else {
            if (isset($_GET['pid']) && $_GET['type'] == 'GRID') {
                $aTheFields = array();
                $aTheFields = getGridsVars($_GET['pid']);
                foreach ($aTheFields as $aField) {
                    $rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'], 'FIELD_NAME' => $aField['sName']);
                }
            }
        }
    }
    if (isset($_GET['tid'])) {
        require_once 'classes/model/ReportTable.php';
        $o = new ReportTable();
        $rows = $o->load($_GET['tid']);
    }
    $result['totalCount'] = count($rows);
    $result['data'] = $rows;
    print G::json_encode($result);
} catch (Exception $e) {
    print G::json_encode($e->getMessage());
}
Пример #14
0
 /**
  * Delete Table
  * @var string $tab_uid. Uid for table
  * @var string $pro_uid. Uid for process
  * @var string $reportFlag. If is report table
  *
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return void
  */
 public function deleteTable($tab_uid, $pro_uid = '', $reportFlag = false)
 {
     if ($reportFlag) {
         $pro_uid = $this->validateProUid($pro_uid);
     }
     $tab_uid = $this->validateTabUid($tab_uid, $reportFlag);
     $at = new AdditionalTables();
     $table = $at->load($tab_uid);
     if (!isset($table)) {
         require_once 'classes/model/ReportTable.php';
         $rtOld = new ReportTable();
         $existReportTableOld = $rtOld->load($tab_uid);
         if (count($existReportTableOld) == 0) {
             throw new Exception(G::LoadTranslation('ID_TABLE_NOT_EXIST_SKIPPED'));
         }
     }
     $at->deleteAll($tab_uid);
 }
Пример #15
0
 * 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');
if (isset($_POST['form'])) {
    $values = $_POST['form'];
    //For Old processmap
} else {
    $values = $_POST;
    //For extjs,since we are not using form
    $values['FIELDS'] = explode(',', $_POST['FIELDS']);
}
$oReportTable = new ReportTable();
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();
Пример #16
0
     $_POST['form']['REP_TAB_STATUS'] = 'ACTIVE';
     $_POST['form']['REP_TAB_TITLE'] = $title;
 } else {
     $_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';