Ejemplo n.º 1
0
 function get_session_xmlforms()
 {
     $cur = array_keys($_SESSION);
     $res = '';
     $colors = array('white', '#EEFFFF');
     $colori = 0;
     $count = 0;
     //Get xmlforms in session
     foreach ($cur as $key) {
         $res .= '<div style="background-color:' . $colors[$colori] . ';">';
         $xml = G::getUIDName($key, '');
         if (strpos($xml, '.xml') !== false) {
             $res .= '<i>FORM:</i>  ' . $xml;
             $colori = $colori ^ 1;
             $count++;
         }
         $res .= '</div>';
     }
     //Get pagedTable in session
     foreach ($cur as $key) {
         $res .= '<div style="background-color:' . $colors[$colori] . ';">';
         if (substr($key, 0, 11) === "pagedTable[") {
             $xml = G::getUIDName(substr($key, 11, -1), '');
             $res .= '<i>TABLE:</i> ' . $xml;
             $colori = $colori ^ 1;
             $count++;
         }
         $res .= '</div>';
     }
     return array("count" => $count, "html" => $res);
 }
Ejemplo n.º 2
0
    $aux1->value = '__error_session__';
    $result = array();
    $result[] = array('name' => 'PME_VALIDATE_NAME', 'content' => array('type' => 'hidden', 'options' => array(array('key' => '__error_session__', 'value' => '__error_session__'))), 'value' => '__error_session__');
    die(Bootstrap::json_encode($result));
}
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/
if (isset($_SESSION['CURRENT_PAGE_INITILIZATION'])) {
    eval($_SESSION['CURRENT_PAGE_INITILIZATION']);
}
//G::LoadSystem('json');
//require_once (PATH_THIRDPARTY . 'pear/json/class.json.php');
//$json = new Services_JSON();
$G_FORM = new form(G::getUIDName(urlDecode($_POST['form'])));
$G_FORM->id = urlDecode($_POST['form']);
$G_FORM->values = $_SESSION[$G_FORM->id];
G::LoadClass('xmlDb');
$file = G::decrypt($G_FORM->values['PME_A'], URL_KEY);
define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml');
define('DB_XMLDB_USER', '');
define('DB_XMLDB_PASS', '');
define('DB_XMLDB_NAME', '');
define('DB_XMLDB_TYPE', 'myxml');
$newValues = Bootstrap::json_decode(urlDecode(stripslashes($_POST['fields'])));
//Resolve dependencies
//Returns an array ($dependentFields) with the names of the fields
//that depends of fields passed through AJAX ($_GET/$_POST)
$dependentFields = array();
$aux = array();
Ejemplo n.º 3
0
    /**

     * Get the condition for Cases List

     *

     * @name getConditionCasesList

     * @param string $sTypeList

     * @param string $sUIDUserLogged

     * @param string $ClearSession

     * @param string $aAdditionalFilter

     * @return array

     */

    public function getConditionCasesList($sTypeList = 'all', $sUIDUserLogged = '', $ClearSession = true, $aAdditionalFilter = null)

    {

        $c = new Criteria('workflow');

        $c->clearSelectColumns();

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

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

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

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

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

        $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);

        //$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);

        $c->addAsColumn(

                'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\'color:red\';>', " .

                AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "

        );



        global $RBAC;

        //seems the PM_SUPERVISOR can delete a completed case

        if ($sTypeList == "completed" && $RBAC->userCanAccess('PM_SUPERVISOR') == 1) {

            $c->addAsColumn("DEL_LINK", "CONCAT('" . G::LoadTranslation('ID_DELETE') . "')");

        }



        $c->addSelectColumn(AppDelegationPeer::DEL_INDEX);

        $c->addSelectColumn(AppDelegationPeer::TAS_UID);

        $c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);

        $c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);

        $c->addSelectColumn(UsersPeer::USR_UID);

        $c->addAsColumn('APP_CURRENT_USER', "CONCAT(USERS.USR_LASTNAME, ' ', USERS.USR_FIRSTNAME)");

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

        $c->addAsColumn('APP_TITLE', 'APP_TITLE.CON_VALUE');

        $c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE');

        $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');

        //$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');

        $c->addAsColumn(

                'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME,

            ' ',

            APP_LAST_USER.USR_FIRSTNAME)"

        );



        $c->addAlias("APP_TITLE", 'CONTENT');

        $c->addAlias("PRO_TITLE", 'CONTENT');

        $c->addAlias("TAS_TITLE", 'CONTENT');

        $c->addAlias("APP_PREV_DEL", 'APP_DELEGATION');

        $c->addAlias("APP_LAST_USER", 'USERS');



        $c->addJoin(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN);

        $c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);

        $appThreadConds[] = array(ApplicationPeer::APP_UID, AppThreadPeer::APP_UID);

        $appThreadConds[] = array(AppDelegationPeer::DEL_INDEX, AppThreadPeer::DEL_INDEX);

        $c->addJoinMC($appThreadConds, Criteria::LEFT_JOIN);

        $c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);



        $del = DBAdapter::getStringDelimiter();

        $appTitleConds = array();

        $appTitleConds[] = array(ApplicationPeer::APP_UID, 'APP_TITLE.CON_ID');

        $appTitleConds[] = array('APP_TITLE.CON_CATEGORY', $del . 'APP_TITLE' . $del);

        $appTitleConds[] = array('APP_TITLE.CON_LANG', $del . SYS_LANG . $del);

        $c->addJoinMC($appTitleConds, Criteria::LEFT_JOIN);



        $proTitleConds = array();

        $proTitleConds[] = array(ApplicationPeer::PRO_UID, 'PRO_TITLE.CON_ID');

        $proTitleConds[] = array('PRO_TITLE.CON_CATEGORY', $del . 'PRO_TITLE' . $del);

        $proTitleConds[] = array('PRO_TITLE.CON_LANG', $del . SYS_LANG . $del);

        $c->addJoinMC($proTitleConds, Criteria::LEFT_JOIN);



        $tasTitleConds = array();

        $tasTitleConds[] = array(AppDelegationPeer::TAS_UID, 'TAS_TITLE.CON_ID');

        $tasTitleConds[] = array('TAS_TITLE.CON_CATEGORY', $del . 'TAS_TITLE' . $del);

        $tasTitleConds[] = array('TAS_TITLE.CON_LANG', $del . SYS_LANG . $del);

        $c->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN);



        $prevConds = array();

        $prevConds[] = array(ApplicationPeer::APP_UID, 'APP_PREV_DEL.APP_UID');

        $prevConds[] = array('APP_PREV_DEL.DEL_INDEX', AppDelegationPeer::DEL_PREVIOUS);

        $c->addJoinMC($prevConds, Criteria::LEFT_JOIN);



        $usrConds = array();

        $usrConds[] = array('APP_PREV_DEL.USR_UID', 'APP_LAST_USER.USR_UID');

        $c->addJoinMC($usrConds, Criteria::LEFT_JOIN);



        $c->add(TaskPeer::TAS_TYPE, 'SUBPROCESS', Criteria::NOT_EQUAL);



        //gral, to_revise, to_reassign dont have userid in the query

        if ($sTypeList != 'gral' && $sTypeList != 'to_revise' && $sTypeList != 'to_reassign' &&

                $sTypeList != 'my_started' && $sTypeList != 'sent') {

            $c->add(UsersPeer::USR_UID, $sUIDUserLogged);

        }



        /**

         * Additional filters

         * By Erik <*****@*****.**>

         */

        if (isset($aAdditionalFilter) && is_array($aAdditionalFilter)) {

            foreach ($aAdditionalFilter as $sFilter => $sValue) {

                switch ($sFilter) {

                    case 'PRO_UID':

                        if ($sValue != "0") {

                            $c->add(ApplicationPeer::PRO_UID, $sValue, Criteria::EQUAL);

                        }

                        break;

                    case 'READ':

                        $c->add(AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL);

                        break;

                    case 'UNREAD':

                        $c->add(AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL);

                        break;

                }

            }

        }



        $filesList = array(

            //7 standard list

            'to_do' => 'cases/cases_ListTodo',

            'draft' => 'cases/cases_ListDraft',

            'paused' => 'cases/cases_ListOnHold',

            'cancelled' => 'cases/cases_ListCancelled',

            'completed' => 'cases/cases_ListCompleted',

            'sent' => 'cases/cases_ListSent',

            'selfservice' => 'cases/cases_ListSelfService',

            //5 admin list

            'all' => 'cases/cases_ListAll',

            'to_revise' => 'cases/cases_ListToRevise',

            'to_reassign' => 'cases/cases_ListAll_Reassign',

            'my_started' => 'cases/cases_ListStarted',

            'Alldelete' => 'cases/cases_ListAllDelete'

        );

        switch ($sTypeList) {

            case 'all':

                $c->add(

                        $c->getNewCriterion(

                                        AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->

                                addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->

                                        addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0)

                                        )

                                )

                );

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'my_started':

                $oCriteria = new Criteria('workflow');

                $oCriteria->addSelectColumn(AppDelayPeer::APP_UID);

                $oCriteria->add(

                        $oCriteria->getNewCriterion(

                                AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL

                        )->addOr(

                                $oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)

                        )

                );

                //$oCriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL);

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

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

                $oDataset->next();

                $aProcesses = array();

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

                    $aProcesses[] = $aRow['APP_UID'];

                    $oDataset->next();

                }



                $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged));

                $c->add(

                        $c->getNewCriterion(

                                AppThreadPeer::APP_THREAD_STATUS, 'OPEN'

                        )->addOr(

                                $c->getNewCriterion(

                                        ApplicationPeer::APP_STATUS, 'COMPLETED'

                                )->addAnd(

                                        $c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0)

                                )

                        )

                );

                $c->add($c->getNewCriterion(ApplicationPeer::APP_UID, $aProcesses, Criteria::NOT_IN));

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'to_do':

                $c->add(ApplicationPeer::APP_STATUS, 'TO_DO');

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

                $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');

                $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'draft':

                $c->add(ApplicationPeer::APP_STATUS, 'DRAFT');

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

                $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'paused':

                $appDelayConds[] = array(ApplicationPeer::APP_UID, AppDelayPeer::APP_UID);

                $appDelayConds[] = array(AppDelegationPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX);

                $c->addJoinMC($appDelayConds, Criteria::LEFT_JOIN);

                $c->add(AppDelayPeer::APP_DELAY_UID, null, Criteria::ISNOTNULL);

                $c->add(AppDelayPeer::APP_TYPE, array("REASSIGN", "ADHOC", "CANCEL"), Criteria::NOT_IN);

                $c->add(

                        $c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->

                                addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0))

                );

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'cancelled':

                $c->add(

                        $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'CLOSED')->

                                addAnd($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'CANCELLED'))

                );

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'completed':

                $c->add(ApplicationPeer::APP_STATUS, 'COMPLETED');

                $c->add(AppDelegationPeer::DEL_PREVIOUS, '0', Criteria::NOT_EQUAL);

                //$c->addAsColumn('DEL_FINISH_DATE', 'max('.AppDelegationPeer::DEL_FINISH_DATE.')');

                $c->addGroupByColumn(ApplicationPeer::APP_UID);

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'gral':

                $c->add(

                        $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->

                                addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->

                                        addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0)))

                );

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                $params = array();

                $sSql = BasePeer::createSelectSql($c, $params);

                break;

            case 'to_revise':

                $oCriteria = new Criteria('workflow');

                $oCriteria->add(ProcessUserPeer::USR_UID, $sUIDUserLogged);

                $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');

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

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

                $oDataset->next();

                $aProcesses = array();

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

                    $aProcesses[] = $aRow['PRO_UID'];

                    $oDataset->next();

                }

                $c->add(ApplicationPeer::PRO_UID, $aProcesses, Criteria::IN);

                $c->add(ApplicationPeer::APP_STATUS, 'TO_DO');

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

                $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');

                $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'selfservice':

                //get the valid selfservice tasks for this user

                $oCase = new Cases();

                $tasks = $oCase->getSelfServiceTasks($_SESSION['USER_LOGGED']);

                $aTasks = array();

                foreach ($tasks as $key => $val) {

                    if (strlen(trim($val['uid'])) > 10) {

                        $aTasks[] = $val['uid'];

                    }

                }

                $c = new Criteria('workflow');

                $c->clearSelectColumns();

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

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

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

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

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

                $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);



                $c->addAsColumn(

                        'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),

                    CONCAT('<span style=\'color:red\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE .

                        ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "

                );



                $c->addSelectColumn(AppDelegationPeer::DEL_INDEX);

                $c->addSelectColumn(AppDelegationPeer::TAS_UID);

                $c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);

                $c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);

                $c->addSelectColumn(UsersPeer::USR_UID);

                $c->addAsColumn('APP_CURRENT_USER', "CONCAT(USERS.USR_LASTNAME, ' ', USERS.USR_FIRSTNAME)");

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

                $c->addAsColumn('APP_TITLE', 'APP_TITLE.CON_VALUE');

                $c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE');

                $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');



                $c->addAlias("APP_TITLE", 'CONTENT');

                $c->addAlias("PRO_TITLE", 'CONTENT');

                $c->addAlias("TAS_TITLE", 'CONTENT');



                $c->addJoin(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN);

                $c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);

                $appThreadConds[] = array(ApplicationPeer::APP_UID, AppThreadPeer::APP_UID);

                $appThreadConds[] = array(AppDelegationPeer::DEL_INDEX, AppThreadPeer::DEL_INDEX);

                $c->addJoinMC($appThreadConds, Criteria::LEFT_JOIN);

                $c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);



                $del = DBAdapter::getStringDelimiter();

                $appTitleConds = array();

                $appTitleConds[] = array(ApplicationPeer::APP_UID, 'APP_TITLE.CON_ID');

                $appTitleConds[] = array('APP_TITLE.CON_CATEGORY', $del . 'APP_TITLE' . $del);

                $appTitleConds[] = array('APP_TITLE.CON_LANG', $del . SYS_LANG . $del);

                $c->addJoinMC($appTitleConds, Criteria::LEFT_JOIN);

                //

                $proTitleConds = array();

                $proTitleConds[] = array(ApplicationPeer::PRO_UID, 'PRO_TITLE.CON_ID');

                $proTitleConds[] = array('PRO_TITLE.CON_CATEGORY', $del . 'PRO_TITLE' . $del);

                $proTitleConds[] = array('PRO_TITLE.CON_LANG', $del . SYS_LANG . $del);

                $c->addJoinMC($proTitleConds, Criteria::LEFT_JOIN);

                //

                $tasTitleConds = array();

                $tasTitleConds[] = array(AppDelegationPeer::TAS_UID, 'TAS_TITLE.CON_ID');

                $tasTitleConds[] = array('TAS_TITLE.CON_CATEGORY', $del . 'TAS_TITLE' . $del);

                $tasTitleConds[] = array('TAS_TITLE.CON_LANG', $del . SYS_LANG . $del);

                $c->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN);



                $c->add(AppDelegationPeer::USR_UID, '');

                $c->add(AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN);

                break;

            case 'to_reassign':

                $c->add(

                        $c->getNewCriterion(ApplicationPeer::APP_STATUS, 'TO_DO')->

                                addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'DRAFT'))

                );

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

                $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');

                $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

            case 'sent':

                $oCriteria = new Criteria('workflow');

                $oCriteria->addSelectColumn(AppDelayPeer::APP_UID);

                $oCriteria->add(

                        $oCriteria->getNewCriterion(

                                AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL

                        )->addOr(

                                $oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)

                        )

                );

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

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

                $oDataset->next();

                $aProcesses = array();

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

                    $aProcesses[] = $aRow['APP_UID'];

                    $oDataset->next();

                }

                if (isset($aAdditionalFilter) && isset($aAdditionalFilter['MINE'])) {

                    $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged));

                } else {

                    $c->add(

                            $c->getNewCriterion(

                                    ApplicationPeer::APP_INIT_USER, $sUIDUserLogged

                            )->addOr(

                                    $c->getNewCriterion(

                                            AppDelegationPeer::USR_UID, $sUIDUserLogged

                                    )

                            )

                    );

                }

                if (isset($aAdditionalFilter) && isset($aAdditionalFilter['APP_STATUS_FILTER'])) {

                    $c->add(ApplicationPeer::APP_STATUS, $sValue, Criteria::EQUAL);

                } else {

                    $c->add(ApplicationPeer::APP_STATUS, 'DRAFT', Criteria::NOT_EQUAL);

                }



                $c->add(

                        $c->getNewCriterion(

                                AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED'

                        )->addOr(

                                $c->getNewCriterion(

                                        ApplicationPeer::APP_STATUS, 'COMPLETED'

                                )->addAnd(

                                        $c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0)

                                )

                        )

                );

                $c->add($c->getNewCriterion(ApplicationPeer::APP_UID, $aProcesses, Criteria::NOT_IN));

                $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);

                break;

        }



        //select the xmlList to show

        if ($sTypeList == 'gral') {

            if ($RBAC->userCanAccess('PM_DELETECASE') == 1) {

                $xmlfile = $filesList['Alldelete'];

            } else {

                $xmlfile = $filesList['all'];

            }

        } else {

            $xmlfile = $filesList[$sTypeList];

        }



        if ($ClearSession) {

            //OPCION_1: claening the $_SESSION and updating the List.... only case List

            foreach ($filesList as $file) {

                $id = G::createUID('', $file . '.xml');

                unset($_SESSION['pagedTable[' . $id . ']']);

                unset($_SESSION[$id]);

            }

            //OPTION_2: cleaning the $_SESSION and whole List and xmls

            $cur = array_keys($_SESSION);

            foreach ($cur as $key) {

                if (substr($key, 0, 11) === "pagedTable[") {

                    unset($_SESSION[$key]);

                } else {

                    $xml = G::getUIDName($key, '');

                    if (strpos($xml, '.xml') !== false) {

                        unset($_SESSION[$key]);

                    }

                }

            }

        }

        return array($c, $xmlfile);

    }
            return array();
        }
        if (!isset($G_FORM->fields[$grid]->fields[$k]->dependentFields)) {
            return array();
        }
        $myDependentFields = $G_FORM->fields[$grid]->fields[$k]->dependentFields;
        $myDependentFields = explode(',', $G_FORM->fields[$grid]->fields[$k]->dependentFields);
    }
    return $myDependentFields;
}
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
// the script responds an ajax request in order to check the dependent fields,
// and generate a json output of the values that the dependent field must have.
$sDynUid = G::getUIDName(urlDecode($_POST['DYN_UID']));
//$json = new Services_JSON();
$formValues = Bootstrap::json_decode($_POST['fields']);
$sFieldName = $_POST['fieldName'];
$sMasterField = '';
$sPath = PATH_DYNAFORM;
$G_FORM = new form($sDynUid, $sPath);
$aux = array();
$newValues = Bootstrap::json_decode(urlDecode(stripslashes($_POST['form'])));
if (isset($_POST['grid'])) {
    $_POST['row'] = (int) $_POST['row'];
    $aAux = array();
    foreach ($newValues as $sKey => $newValue) {
        $newValue = (array) $newValue;
        $aKeys = array_keys($newValue);
        $aValues = array();
Ejemplo n.º 5
0
 /**
  * @covers G::getUIDName
  * @todo   Implement testGetUIDName().
  */
 public function testGetUIDName()
 {
     $uidTest001 = 'cDhpajRHQ2paUQ______';
     $responseUID = G::getUIDName($uidTest001);
     $this->assertEquals($responseUID, 'test' . '001');
 }
    define('DB_XMLDB_USER', '');
    define('DB_XMLDB_PASS', '');
    define('DB_XMLDB_NAME', '');
    define('DB_XMLDB_TYPE', 'myxml');
    /* End Block*/
}
require_once PATH_GULLIVER_HOME . 'methods/pagedTableAjax.php';
die;
G::LoadSystem('pagedTable');
G::LoadInclude('ajax');
$id = get_ajax_value('ptID');
$ntable = unserialize($_SESSION['pagedTable[' . $id . ']']);
$page = get_ajax_value('page');
$function = get_ajax_value('function');
if (isset($ntable->filterForm_Id) && $ntable->filterForm_Id !== '') {
    $filterForm = new filterForm(G::getUIDName($ntable->filterForm_Id));
    $filterForm->values = $_SESSION[$filterForm->id];
    parse_str(urldecode(get_ajax_value('filter')), $newValues);
    if (isset($newValues['form'])) {
        $filterForm->setValues($newValues['form']);
        $filter = array();
        foreach ($filterForm->fields as $fieldName => $field) {
            if ($field->dataCompareField !== '' && isset($newValues['form'][$fieldName])) {
                $filter[$field->dataCompareField] = $filterForm->values[$fieldName];
            }
            $ntable->filterType[$field->dataCompareField] = $field->dataCompareType;
        }
        $ntable->filter = $filter;
        //G::http_build_query($filter);
    }
}
Ejemplo n.º 7
0
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/
if (isset($_SESSION['CURRENT_PAGE_INITILIZATION'])) {
    eval($_SESSION['CURRENT_PAGE_INITILIZATION']);
}
// G::LoadThirdParty('pear/json','class.json');
// $json=new Services_JSON();
if (!defined('XMLFORM_AJAX_PATH')) {
    define('XMLFORM_AJAX_PATH', PATH_XMLFORM);
}
$_DBArray = array();
if (isset($_SESSION['_DBArray'])) {
    $_DBArray = $_SESSION['_DBArray'];
}
$xmlFile = G::getUIDName(urlDecode($_POST['form']));
$sPath = XMLFORM_AJAX_PATH;
//if the xmlform file doesn't exist, then try with the plugins folders
if (!is_file(XMLFORM_AJAX_PATH . $xmlFile)) {
    $aux = explode(PATH_SEP, $xmlFile);
    //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
    if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) {
        $oPluginRegistry =& PMPluginRegistry::getSingleton();
        if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
            $sPath = PATH_PLUGINS;
        }
    }
}
$G_FORM = new form($xmlFile, $sPath);
$G_FORM->id = urlDecode($_POST['form']);
$G_FORM->values = isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array();
Ejemplo n.º 8
0
 /**
  * Function prepareQuery
  *
  * @author David S. Callizaya S. <*****@*****.**>
  * @access public
  * @param string $limitPage
  * @return string
  */
 public function prepareQuery($limitPage = false)
 {
     // process the QuickSearch string and add the fields and expression needed to run the search
     if ($this->searchBy !== '') {
         $aSB = explode('|', $this->searchBy);
         //fields are separated by pipes
         //subfilter
         $subFilter = '';
         foreach ($aSB as $sBy) {
             $subFilter .= $subFilter !== '' ? ' OR ' : '';
             //TODO: Get DATABASE type from Criteria, I think sql delimeter is needed too
             $subFilter .= $sBy . ' LIKE "%' . G::sqlEscape($this->fastSearch) . '%"';
         }
         if ($subFilter !== '') {
             //Get the first defined table in Criteria.
             $aCurrentTables = $this->criteria->getTables();
             if (isset($aCurrentTables[0])) {
                 $this->criteria->add($aCurrentTables[0] . ".*", '(' . $subFilter . ')', Criteria::CUSTOM);
             }
         }
     }
     //Merge sort array defined by USER with the array defined by SQL
     parse_str($this->order, $orderFields);
     parse_str($this->orderBy, $orderFields2);
     //User sort is more important (first in merge).
     $orderFields3 = array_merge($orderFields2, $orderFields);
     //User sort is overwrites XMLs definition.
     $orderFields = array_merge($orderFields3, $orderFields2);
     //Order (BY SQL DEFINITION AND USER'S DEFINITION)
     $this->aOrder = array();
     $order = '';
     foreach ($orderFields as $field => $fieldOrder) {
         $field = G::getUIDName($field, '');
         $fieldOrder = strtoupper($fieldOrder);
         if ($fieldOrder === 'A') {
             $fieldOrder = 'ASC';
         }
         if ($fieldOrder === 'D') {
             $fieldOrder = 'DESC';
         }
         switch ($fieldOrder) {
             case 'ASC':
             case 'DESC':
                 if ($order !== '') {
                     $order .= ', ';
                 }
                 $order .= $field . ' ' . $fieldOrder;
                 $this->aOrder[$field] = $fieldOrder;
         }
     }
     //master detail :O
     if (count($this->masterdetail) > 0) {
         $this->criteria->clearOrderByColumns();
         foreach ($this->masterdetail as $idMasterDetail => $fieldMasterDetail) {
             $this->criteria->addAscendingOrderByColumn($fieldMasterDetail);
         }
     }
     if (!empty($this->aOrder)) {
         if (count($this->masterdetail) <= 0) {
             $this->criteria->clearOrderByColumns();
         }
         foreach ($this->aOrder as $field => $ascending) {
             if ($ascending == 'ASC') {
                 $this->criteria->addAscendingOrderByColumn($field);
             } else {
                 $this->criteria->addDescendingOrderByColumn($field);
             }
         }
     }
     /**
      * Add limits
      */
     $this->criteria->setLimit(0);
     $this->criteria->setOffset(0);
     if ($this->criteria->getDbName() == 'dbarray') {
         $this->totRows = ArrayBasePeer::doCount($this->criteria);
     } else {
         $this->totRows = GulliverBasePeer::doCount($this->criteria);
     }
     $this->totPages = ceil($this->totRows / $this->rowsPerPage);
     if ($limitPage) {
         $this->criteria->setLimit($this->rowsPerPage);
         $this->criteria->setOffset(($this->currentPage - 1) * $this->rowsPerPage);
     }
     return;
 }
Ejemplo n.º 9
0
 /**
  * Function prepareQuery
  * @author David S. Callizaya S. <*****@*****.**>
  * @access public
  * @return string
  */
 function prepareQuery()
 {
     //DBConnection
     if (!$this->sqlConnection) {
         $this->dbc = new DBConnection();
     } else {
         if (defined('DB_' . $this->sqlConnection . '_USER')) {
             if (defined('DB_' . $this->sqlConnection . '_HOST')) {
                 eval('$res[\'DBC_SERVER\'] = DB_' . $this->sqlConnection . '_HOST;');
             } else {
                 $res['DBC_SERVER'] = DB_HOST;
             }
             if (defined('DB_' . $this->sqlConnection . '_USER')) {
                 eval('$res[\'DBC_USERNAME\'] = DB_' . $this->sqlConnection . '_USER;');
             }
             if (defined('DB_' . $this->sqlConnection . '_PASS')) {
                 eval('$res[\'DBC_PASSWORD\'] = DB_' . $this->sqlConnection . '_PASS;');
             } else {
                 $res['DBC_PASSWORD'] = DB_PASS;
             }
             if (defined('DB_' . $this->sqlConnection . '_NAME')) {
                 eval('$res[\'DBC_DATABASE\'] = DB_' . $this->sqlConnection . '_NAME;');
             } else {
                 $res['DBC_DATABASE'] = DB_NAME;
             }
             if (defined('DB_' . $this->sqlConnection . '_TYPE')) {
                 eval('$res[\'DBC_TYPE\'] = DB_' . $this->sqlConnection . '_TYPE;');
             } else {
                 $res['DBC_TYPE'] = defined('DB_TYPE') ? DB_TYPE : 'mysql';
             }
             $this->dbc = new DBConnection($res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE'], $res['DBC_TYPE']);
         } else {
             $dbc = new DBConnection();
             $dbs = new DBSession($dbc);
             $res = $dbs->execute("select * from  DB_CONNECTION WHERE DBC_UID=" . $this->sqlConnection);
             $res = $res->read();
             $this->dbc = new DBConnection($res['DBC_SERVER'], $res['DBC_USERNAME'], $res['DBC_PASSWORD'], $res['DBC_DATABASE']);
         }
     }
     $this->ses = new DBSession($this->dbc);
     //Query
     //Filter
     if (is_array($this->filter)) {
         $filterFields = $this->filter;
     } else {
         parse_str($this->filter, $filterFields);
     }
     $this->aFilter = $filterFields;
     $filter = '';
     foreach ($filterFields as $field => $like) {
         if ($like != '') {
             if ($filter !== '') {
                 $filter .= ' AND ';
             }
             if (isset($this->filterType[$field])) {
                 switch ($this->filterType[$field]) {
                     case '=':
                         $filter .= $field . ' = "' . mysql_real_escape_string($like) . '"';
                         break;
                     case '<>':
                         $filter .= $field . ' <> "' . mysql_real_escape_string($like) . '"';
                         break;
                     case 'contains':
                         $filter .= $field . ' LIKE "%' . mysql_real_escape_string($like) . '%"';
                         break;
                     case 'like':
                         $filter .= $field . ' LIKE "' . mysql_real_escape_string($like) . '"';
                         break;
                 }
             } else {
                 $filter .= $field . ' = "' . mysql_real_escape_string($like) . '"';
             }
         }
     }
     /*
      * QuickSearch
      */
     if ($this->searchBy !== '') {
         $aSB = explode('|', $this->searchBy);
         $subFilter = '';
         foreach ($aSB as $sBy) {
             $subFilter .= $subFilter !== '' ? ' OR ' : '';
             $subFilter .= $sBy . ' LIKE "%' . G::sqlEscape($this->fastSearch, $this->dbc->type) . '%"';
         }
         if ($subFilter !== '') {
             $filter .= $filter !== '' ? ' AND ' : '';
             $filter .= '(' . $subFilter . ')';
         }
     }
     //Merge sort array defined by USER with the array defined by SQL
     parse_str($this->order, $orderFields);
     parse_str($this->orderBy, $orderFields2);
     //User sort is more important (first in merge).
     $orderFields3 = array_merge($orderFields2, $orderFields);
     //User sort is overwrites XMLs definition.
     $orderFields = array_merge($orderFields3, $orderFields2);
     //Order (BY SQL DEFINITION AND USER'S DEFINITION)
     $this->aOrder = array();
     $order = '';
     foreach ($orderFields as $field => $fieldOrder) {
         $field = G::getUIDName($field, '');
         $fieldOrder = strtoupper($fieldOrder);
         if ($fieldOrder === 'A') {
             $fieldOrder = 'ASC';
         }
         if ($fieldOrder === 'D') {
             $fieldOrder = 'DESC';
         }
         switch ($fieldOrder) {
             case 'ASC':
             case 'DESC':
                 if ($order !== '') {
                     $order .= ', ';
                 }
                 $order .= $field . ' ' . $fieldOrder;
                 $this->aOrder[$field] = $fieldOrder;
         }
     }
     $this->sql = $this->sqlSelect . ($this->sqlWhere != '' || $filter != '' ? ' WHERE ' : '') . ($this->sqlWhere != '' ? '(' . $this->sqlWhere . ')' : '') . ($this->sqlWhere != '' && $filter != '' ? ' AND ' : '') . ($filter != '' ? '(' . $filter . ')' : '') . ($this->sqlGroupBy != '' ? ' GROUP BY ' . $this->sqlGroupBy : '') . ($order != '' ? ' ORDER BY ' . $order : '');
     //$this->query=$this->ses->execute($this->sql);
     //$this->totpages=ceil($this->query->count()/$this->rowsPerPage);
     return;
 }
Ejemplo n.º 10
0
$t->can_ok($obj, 'LoadClass', 'LoadClass()');
$t->can_ok($obj, 'LoadThirdParty', 'LoadThirdParty()');
$t->can_ok($obj, 'encryptlink', 'encryptlink()');
$t->is(G::encryptlink("normal url"), "normal url", 'encryptlink() normal url');
$t->todo('more tests with encryplink and remove ENABLE_ENCRYPT dependency');
$t->can_ok($obj, 'parseURI', 'parseURI()');
G::parseURI("http:/192.168.0.9/sysos/en/wf5/login/login/abc?ab=123&bc=zy");
$t->todo('more tests with parseURI');
$t->can_ok($obj, 'streamFile', 'streamFile()');
$t->can_ok($obj, 'sendHeaders', 'sendHeaders()');
$t->todo('more tests with sendHeaders');
$t->can_ok($obj, 'virtualURI', 'virtualURI()');
$t->can_ok($obj, 'createUID', 'createUID()');
$t->is(G::createUID('directory', 'filename'), 'bDh5aTBaUG5vNkxwMnByWjJxT2EzNVk___', 'createUID() normal');
$t->can_ok($obj, 'getUIDName', 'getUIDName()');
$t->is(G::getUIDName('bDh5aTBaUG5vNkxwMnByWjJxT2EzNVk___', '12345678901234567890'), false, 'getUIDName() normal?');
$t->can_ok($obj, 'formatNumber', 'formatNumber()');
$t->is(G::formatNumber('100000'), '100000', 'formatNumber() normal');
$t->todo('is useful the function formatNumber??');
$t->can_ok($obj, 'formatDate', 'formatDate()');
$t->is(G::formatDate('2001-02-29'), '2001-02-29', 'formatDate() ');
$t->is(G::formatDate('2001-02-29', 'F d, Y'), 'Februar01 29, 2001', 'formatDate() ');
//is not working
$t->is(G::formatDate('2001-02-29', 'd.m.Y'), '29.02.2001', 'formatDate() ');
$t->todo(" the month literal text is defined here!! ");
$t->todo('review all methods in class G');
$i = 1;
$t->diag('class G');
$t->is(count($methods), 95, "class database " . count($methods) . " methods.");
$t->is($methods[0], 'is_https', $i++ . ' is_https');
$t->is($methods[1], 'array_fill_value', $i++ . ' array_fill_value');