function loadTest($aTestData, $aFields)
 {
     $oInputDocument = new InputDocument();
     try {
         return $oInputDocument->load($aFields['INP_DOC_UID']);
     } catch (Exception $oError) {
         return $oError;
     }
 }
Esempio n. 2
0
 /**
  * Function render
  *
  * @author David S. Callizaya S. <*****@*****.**>
  * @access public
  * @param string value
  * @return string
  */
 public function render($value = null, $owner = null, $rowId = null, $row = -1, $therow = -1)
 {
     $permission = false;
     $url = null;
     switch ($owner->type) {
         case "xmlform":
             $pmtype = $this->NSFieldType();
             break;
         case "grid":
             $pmtype = $this->NSGridType();
             break;
     }
     if (isset($_SESSION["APPLICATION"]) && isset($_SESSION["USER_LOGGED"]) && isset($_SESSION["TASK"]) && isset($this->input) && $this->input != null && $this->mode == "view") {
         require_once "classes/model/AppDocument.php";
         G::LoadClass("case");
         $case = new Cases();
         $arrayField = $case->loadCase($_SESSION["APPLICATION"]);
         $arrayPermission = $case->getAllObjects($arrayField["PRO_UID"], $_SESSION["APPLICATION"], $_SESSION["TASK"], $_SESSION["USER_LOGGED"]);
         $criteria = new Criteria();
         $criteria->add(AppDocumentPeer::APP_DOC_UID, $arrayPermission["INPUT_DOCUMENTS"], Criteria::IN);
         switch ($owner->type) {
             case "xmlform":
                 break;
             case "grid":
                 $criteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $owner->name . "_" . $row . "_" . $this->name);
                 break;
         }
         $criteria->addDescendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);
         $rsCriteria = AppDocumentPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $sw = 0;
         while ($rsCriteria->next() && $sw == 0) {
             $row = $rsCriteria->getRow();
             if ($row["DOC_UID"] == $this->input) {
                 $permission = true;
                 $url = (G::is_https() ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . "/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"];
                 $sw = 1;
             }
         }
     }
     $html1 = null;
     $html2 = null;
     $mode = $this->mode == "view" ? " disabled=\"disabled\"" : null;
     $styleDisplay = null;
     if ($this->mode == "view") {
         if ($permission) {
             $html1 = "<a href=\"" . $url . "\"" . ($owner->type == "grid" ? " class=\"tableOption\" style=\"color: #006699; text-decoration: none; font-weight: normal;\"" : null) . ">";
             $html2 = "</a>";
         }
         $html1 = $html1 . $value;
         $styleDisplay = "display: none;";
     }
     $html = $html1 . "<input type=\"file\" " . $pmtype . " id=\"form" . $rowId . "[" . $this->name . "]\" name=\"form" . $rowId . "[" . $this->name . "]\" value=\"" . $value . "\" class=\"module_app_input___gray_file\" style=\"" . $styleDisplay . "\"" . $mode . " " . $this->NSRequiredValue() . " />" . $html2;
     if (isset($this->input) && $this->input != null) {
         require_once "classes/model/InputDocument.php";
         try {
             $indoc = new InputDocument();
             $aDoc = $indoc->load($this->input);
             $aDoc["INP_DOC_TITLE"] = isset($aDoc["INP_DOC_TITLE"]) ? $aDoc["INP_DOC_TITLE"] : null;
             $html = $html . "<label><img src=\"/images/inputdocument.gif\" width=\"22px\" width=\"22px\" alt=\"\" /><font size=\"1\">(" . trim($aDoc["INP_DOC_TITLE"]) . ")</font></label>";
         } catch (Exception $e) {
             //Then the input document doesn"t exits, id referencial broken
             $html = $html . "&nbsp;<font color=\"red\"><img src=\"/images/alert_icon.gif\" width=\"16px\" width=\"16px\" alt=\"\" /><font size=\"1\">(" . G::loadTranslation("ID_INPUT_DOC_DOESNT_EXIST") . ")</font></font>";
         }
     }
     $html = $html . $this->renderHint();
     return $html;
 }
Esempio n. 3
0
 /**
  * Function render
  * @author David S. Callizaya S. <*****@*****.**>
  * @access public
  * @param string value
  * @return string
  */
 function render($value = NULL)
 {
     $mode = $this->mode == 'view' ? ' disabled="disabled"' : '';
     if ($this->mode == 'view') {
         $displayStyle = 'display:none;';
         $html = $value . '<input class="module_app_input___gray_file" ' . $mode . 'style=' . $displayStyle . ' id="form[' . $this->name . ']" name="form[' . $this->name . ']" type=\'file\' value=\'' . $value . '\' />';
     } else {
         $html = '<input class="module_app_input___gray_file" ' . $mode . 'id="form[' . $this->name . ']" name="form[' . $this->name . ']" type=\'file\' value=\'' . $value . '\'/>';
     }
     if (isset($this->input) && $this->input != '') {
         require_once 'classes/model/InputDocument.php';
         $oiDoc = new InputDocument();
         try {
             $aDoc = $oiDoc->load($this->input);
             $aDoc['INP_DOC_TITLE'] = isset($aDoc['INP_DOC_TITLE']) ? $aDoc['INP_DOC_TITLE'] : '';
             $html .= '<label><img src="/images/inputdocument.gif" width="22px" width="22px"/><font size="1">(' . trim($aDoc['INP_DOC_TITLE']) . ')</font></label>';
         } catch (Exception $e) {
             // then the input document doesn't exits, id referencial broken
             $html .= '&nbsp;<font color="red"><img src="/images/alert_icon.gif" width="16px" width="16px"/><font size="1">(' . G::loadTranslation('ID_INPUT_DOC_DOESNT_EXIST') . ')</font></font>';
         }
     }
     $html .= $this->renderHint();
     return $html;
 }
Esempio n. 4
0
 /**
  * Get data of an InputDocument from a record
  *
  * @param array $record Record
  *
  * return array Return an array with data InputDocument
  */
 public function getInputDocumentDataFromRecord($record)
 {
     try {
         if ($record["INP_DOC_TITLE"] . "" == "") {
             //Load InputDocument
             $inputDocument = new \InputDocument();
             $arrayInputDocumentData = $inputDocument->load($record["INP_DOC_UID"]);
             //There is no transaltion for this Document name, try to get/regenerate the label
             $record["INP_DOC_TITLE"] = $arrayInputDocumentData["INP_DOC_TITLE"];
             $record["INP_DOC_DESCRIPTION"] = $arrayInputDocumentData["INP_DOC_DESCRIPTION"];
         }
         return array($this->getFieldNameByFormatFieldName("INP_DOC_UID") => $record["INP_DOC_UID"], $this->getFieldNameByFormatFieldName("INP_DOC_TITLE") => $record["INP_DOC_TITLE"], $this->getFieldNameByFormatFieldName("INP_DOC_DESCRIPTION") => $record["INP_DOC_DESCRIPTION"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_FORM_NEEDED") => $record["INP_DOC_FORM_NEEDED"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_ORIGINAL") => $record["INP_DOC_ORIGINAL"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_PUBLISHED") => $record["INP_DOC_PUBLISHED"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_VERSIONING") => (int) $record["INP_DOC_VERSIONING"], $this->getFieldNameByFormatFieldName("INP_DOC_DESTINATION_PATH") => $record["INP_DOC_DESTINATION_PATH"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_TAGS") => $record["INP_DOC_TAGS"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_TYPE_FILE") => $record["INP_DOC_TYPE_FILE"] . "", $this->getFieldNameByFormatFieldName("INP_DOC_MAX_FILESIZE") => (int) $record["INP_DOC_MAX_FILESIZE"], $this->getFieldNameByFormatFieldName("INP_DOC_MAX_FILESIZE_UNIT") => $record["INP_DOC_MAX_FILESIZE_UNIT"] . "");
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 5
0
     $oCase = new Cases();
     global $G_PUBLISH;
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_AllInputdocsList', $oCase->getAllUploadedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']));
     G::RenderPage('publish', 'raw');
     break;
 case 'showUploadedDocument':
     //require_once 'classes/model/AppDocument.php';
     //require_once 'classes/model/AppDelegation.php';
     //require_once 'classes/model/InputDocument.php';
     //require_once 'classes/model/Users.php';
     $oAppDocument = new AppDocument();
     $oAppDocument->Fields = $oAppDocument->load($_POST['APP_DOC_UID']);
     $oInputDocument = new InputDocument();
     if ($oAppDocument->Fields['DOC_UID'] != -1) {
         $Fields = $oInputDocument->load($oAppDocument->Fields['DOC_UID']);
     } else {
         $Fields = array('INP_DOC_FORM_NEEDED' => '', 'FILENAME' => $oAppDocument->Fields['APP_DOC_FILENAME']);
     }
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(AppDelegationPeer::APP_UID, $oAppDocument->Fields['APP_UID']);
     $oCriteria->add(AppDelegationPeer::DEL_INDEX, $oAppDocument->Fields['DEL_INDEX']);
     $oDataset = AppDelegationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     $oTask = new Task();
     try {
         $aTask = $oTask->load($aRow['TAS_UID']);
         $Fields['ORIGIN'] = $aTask['TAS_TITLE'];
         $oAppDocument->Fields['VIEW'] = G::LoadTranslation('ID_OPEN');
Esempio n. 6
0
    /**

     * Add a input document

     *

     * Return the application document ID

     *

     * @param string $inputDocumentUid Input document ID

     * @param string $appDocUid Application document ID

     * @param int $docVersion Document version

     * @param string $appDocType Document type

     * @param string $appDocComment Document comment

     * @param string $inputDocumentAction Action, posible values: null or empty (Add), "R" (Replace), "NV" (New Version)

     * @param string $applicationUid Application ID

     * @param int $delIndex Delegation index

     * @param string $taskUid Task ID

     * @param string $userUid User ID

     * @param string $option Option, posible values: "xmlform", "file"

     * @param string $file File ($_FILES["form"]["name"]["APP_DOC_FILENAME"] or path to file)

     * @param int $fileError File error ($_FILES["form"]["error"]["APP_DOC_FILENAME"] or 0)

     * @param string $fileTmpName File temporal name ($_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"] or null)

     * @param string $fileSize    File size ($_FILES["form"]["size"]["APP_DOC_FILENAME"] or 0)

     * @return string Return application document ID

     */

    public function addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $inputDocumentAction, $applicationUid, $delIndex, $taskUid, $userUid, $option, $file, $fileError = 0, $fileTmpName = null, $fileSize = 0)

    {

        $appDocFileName = null;

        $sw = 0;



        switch ($option) {

            case "xmlform":

                $appDocFileName = $file;



                if ($fileError == 0) {

                    $sw = 1;

                }

                break;

            case "file":

                $appDocFileName = basename($file);



                if (file_exists($file) && is_file($file)) {

                    $sw = 1;

                }

                break;

        }



        if ($sw == 0) {

            return null;

        }



        //Info

        $inputDocument = new InputDocument();

        $arrayInputDocumentData = $inputDocument->load($inputDocumentUid);



        //--- Validate Filesize of $_FILE

        $inpDocMaxFilesize = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE"];

        $inpDocMaxFilesizeUnit = $arrayInputDocumentData["INP_DOC_MAX_FILESIZE_UNIT"];



        $inpDocMaxFilesize = $inpDocMaxFilesize * (($inpDocMaxFilesizeUnit == "MB")? 1024 *1024 : 1024); //Bytes



        if ($inpDocMaxFilesize > 0 && $fileSize > 0) {

            if ($fileSize > $inpDocMaxFilesize) {

                throw new Exception(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"));

            }

        }



        //Get the Custom Folder ID (create if necessary)

        $appFolder = new AppFolder();

        $folderId = $appFolder->createFromPath($arrayInputDocumentData["INP_DOC_DESTINATION_PATH"], $applicationUid);



        $tags = $appFolder->parseTags($arrayInputDocumentData["INP_DOC_TAGS"], $applicationUid);



        $appDocument = new AppDocument();

        $arrayField = array();



        switch ($inputDocumentAction) {

            case "R":

                //Replace

                $arrayField = array(

                    "APP_DOC_UID" => $appDocUid,

                    "APP_UID" => $applicationUid,

                    "DOC_VERSION" => $docVersion,

                    "DEL_INDEX" => $delIndex,

                    "USR_UID" => $userUid,

                    "DOC_UID" => $inputDocumentUid,

                    "APP_DOC_TYPE" => $appDocType,

                    "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),

                    "APP_DOC_COMMENT" => $appDocComment,

                    "APP_DOC_TITLE" => "",

                    "APP_DOC_FILENAME" => $appDocFileName,

                    "FOLDER_UID" => $folderId,

                    "APP_DOC_TAGS" => $tags

                );



                $appDocument->update($arrayField);

                break;

            case "NV":

                //New Version

                $arrayField = array(

                    "APP_DOC_UID" => $appDocUid,

                    "APP_UID" => $applicationUid,

                    "DEL_INDEX" => $delIndex,

                    "USR_UID" => $userUid,

                    "DOC_UID" => $inputDocumentUid,

                    "APP_DOC_TYPE" => $appDocType,

                    "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),

                    "APP_DOC_COMMENT" => $appDocComment,

                    "APP_DOC_TITLE" => "",

                    "APP_DOC_FILENAME" => $appDocFileName,

                    "FOLDER_UID" => $folderId,

                    "APP_DOC_TAGS" => $tags

                );



                $appDocument->create($arrayField);

                break;

            default:

                //New

                $arrayField = array(

                    "APP_UID" => $applicationUid,

                    "DEL_INDEX" => $delIndex,

                    "USR_UID" => $userUid,

                    "DOC_UID" => $inputDocumentUid,

                    "APP_DOC_TYPE" => $appDocType,

                    "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),

                    "APP_DOC_COMMENT" => $appDocComment,

                    "APP_DOC_TITLE" => "",

                    "APP_DOC_FILENAME" => $appDocFileName,

                    "FOLDER_UID" => $folderId,

                    "APP_DOC_TAGS" => $tags

                );



                $appDocument->create($arrayField);

                break;

        }



        //Save the file

        $appDocUid = $appDocument->getAppDocUid();

        $docVersion = $appDocument->getDocVersion();

        $arrayInfo = pathinfo($appDocument->getAppDocFilename());

        $extension = (isset($arrayInfo["extension"])) ? $arrayInfo["extension"] : null;

        $strPathName = PATH_DOCUMENT . G::getPathFromUID($applicationUid) . PATH_SEP;

        $strFileName = $appDocUid . "_" . $docVersion . "." . $extension;



        switch ($option) {

            case "xmlform":

                G::uploadFile($fileTmpName, $strPathName, $strFileName);

                break;

            case "file":

                $umaskOld = umask(0);



                if (!is_dir($strPathName)) {

                    G::verifyPath($strPathName, true);

                }



                G::LoadSystem('inputfilter');

                $filter = new InputFilter();

                $file = $filter->xssFilterHard($file, 'path');



                copy($file, $strPathName . $strFileName);

                chmod($strPathName . $strFileName, 0666);

                umask($umaskOld);

                break;

        }



        //Plugin Hook PM_UPLOAD_DOCUMENT for upload document

        $pluginRegistry = &PMPluginRegistry::getSingleton();



        if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {

            $triggerDetail = $pluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);

            $documentData = new uploadDocumentData(

                            $applicationUid,

                            $userUid,

                            $strPathName . $strFileName,

                            $arrayField["APP_DOC_FILENAME"],

                            $appDocUid,

                            $docVersion

            );

            $uploadReturn = $pluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);



            if ($uploadReturn) {

                $arrayField["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;



                if (!isset($arrayField["APP_DOC_UID"])) {

                    $arrayField["APP_DOC_UID"] = $appDocUid;

                }



                if (!isset($arrayField["DOC_VERSION"])) {

                    $arrayField["DOC_VERSION"] = $docVersion;

                }



                $appDocument->update($arrayField);



                unlink($strPathName . $strFileName);

            }

        }

        //End plugin



        return $appDocUid;

    }
 *
 */
try {
    $docUid = $_POST['form']['DOC_UID'];
    $appDocUid = $_POST['form']['APP_DOC_UID'];
    $docVersion = $_POST['form']['docVersion'];
    $actionType = $_POST['form']['actionType'];
    $appId = $_GET['appId'];
    $docType = isset($_GET['docType']) ? $_GET['docType'] : "";
    //save info
    require_once "classes/model/AppDocument.php";
    require_once 'classes/model/AppFolder.php';
    require_once 'classes/model/InputDocument.php';
    $oInputDocument = new InputDocument();
    if ($_GET['UID'] != -1) {
        $aID = $oInputDocument->load($_GET['UID']);
    } else {
        $oFolder = new AppFolder();
        $folderStructure = $oFolder->getFolderStructure(isset($_GET['folderId']) ? $_GET['folderId'] : "/");
        $aID = array('INP_DOC_DESTINATION_PATH' => $folderStructure['PATH']);
    }
    $oAppDocument = new AppDocument();
    //Get the Custom Folder ID (create if necessary)
    $oFolder = new AppFolder();
    if ($_GET['UID'] != -1) {
        //krumo("jhl");
        $folderId = $oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $appId);
        //Tags
        $fileTags = $oFolder->parseTags($aID['INP_DOC_TAGS'], $appId);
    } else {
        $folderId = isset($_GET['folderId']) ? $_GET['folderId'] : "/";
Esempio n. 8
0
 public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
 {
     G::LoadClass('case');
     $oCase = new Cases();
     $oCase->verifyTable();
     $aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']);
     if (!is_array($aObjectPermissions)) {
         $aObjectPermissions = array('DYNAFORMS' => array(-1), 'INPUT_DOCUMENTS' => array(-1), 'OUTPUT_DOCUMENTS' => array(-1));
     }
     if (!isset($aObjectPermissions['DYNAFORMS'])) {
         $aObjectPermissions['DYNAFORMS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['DYNAFORMS'])) {
             $aObjectPermissions['DYNAFORMS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
         $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
             $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
         $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
             $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
         }
     }
     $appDocument = new AppDocument();
     foreach (array("INPUT_DOCUMENTS", "OUTPUT_DOCUMENTS") as $value) {
         $key = $value;
         if ($aObjectPermissions[$key]) {
             foreach ($aObjectPermissions[$key] as $key2 => $value2) {
                 $appDocumentUid = $value2;
                 try {
                     $arrayAppDocumentData = $appDocument->load($appDocumentUid);
                     $aObjectPermissions[$key][$key2] = $arrayAppDocumentData["DOC_UID"];
                 } catch (Exception $e) {
                 }
             }
         }
     }
     $dynaForm = new Dynaform();
     $inputDocument = new InputDocument();
     $outputDocument = new OutputDocument();
     $c = new Criteria('workflow');
     $c->addSelectColumn(AppHistoryPeer::APP_UID);
     $c->addSelectColumn(AppHistoryPeer::DEL_INDEX);
     $c->addSelectColumn(AppHistoryPeer::PRO_UID);
     $c->addSelectColumn(AppHistoryPeer::TAS_UID);
     $c->addSelectColumn(AppHistoryPeer::DYN_UID);
     $c->addSelectColumn(AppHistoryPeer::OBJ_TYPE);
     $c->addSelectColumn(AppHistoryPeer::USR_UID);
     $c->addSelectColumn(AppHistoryPeer::APP_STATUS);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATE);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATA);
     $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $c->addSelectColumn(UsersPeer::USR_LASTNAME);
     $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
     $c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
     //WHERE
     $c->add($c->getNewCriterion(AppHistoryPeer::DYN_UID, $aObjectPermissions["DYNAFORMS"], Criteria::IN)->addOr($c->getNewCriterion(AppHistoryPeer::DYN_UID, $aObjectPermissions["INPUT_DOCUMENTS"], Criteria::IN))->addOr($c->getNewCriterion(AppHistoryPeer::DYN_UID, $aObjectPermissions["OUTPUT_DOCUMENTS"], Criteria::IN)));
     $c->add(AppHistoryPeer::PRO_UID, $PRO_UID);
     $c->add(AppHistoryPeer::APP_UID, $APP_UID);
     $c->add(AppHistoryPeer::TAS_UID, $TAS_UID);
     if (isset($DYN_UID) && $DYN_UID != "") {
         $c->add(AppHistoryPeer::DYN_UID, $DYN_UID);
     }
     //Execute
     $oDataset = AppHistoryPeer::doSelectRS($c);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aDynHistory = array();
     $aDynHistory[] = array('DYN_TITLE' => 'char');
     while ($oDataset->next()) {
         $aRow = $oDataset->getRow();
         $title = "";
         switch ($aRow["OBJ_TYPE"]) {
             case "DYNAFORM":
                 $arrayDynaFormData = $dynaForm->Load($aRow["DYN_UID"]);
                 $title = $arrayDynaFormData["DYN_TITLE"] . " (" . G::LoadTranslation("ID_DYNAFORM") . ")";
                 break;
             case "INPUT_DOCUMENT":
                 $arrayInputDocumentData = $inputDocument->load($aRow["DYN_UID"]);
                 $title = $arrayInputDocumentData["INP_DOC_TITLE"] . " (" . G::LoadTranslation("ID_INPUT_DOCUMENT") . ")";
                 break;
             case "OUTPUT_DOCUMENT":
                 $arrayOutputDocumentData = $outputDocument->load($aRow["DYN_UID"]);
                 $title = $arrayOutputDocumentData["OUT_DOC_TITLE"] . " (" . G::LoadTranslation("ID_OUTPUT_DOCUMENT") . ")";
                 break;
             case "ASSIGN_TASK":
                 $title = G::LoadTranslation("ID_ASSIGN_TASK") . " (" . G::LoadTranslation("ID_TRIGGERS") . ")";
                 break;
         }
         $aRow["DYN_TITLE"] = $title;
         $changedValues = unserialize($aRow['HISTORY_DATA']);
         $html = "<table border='0' cellpadding='0' cellspacing='0'>";
         $sw_add = false;
         foreach ($changedValues as $key => $value) {
             if ($value != null && !is_array($value)) {
                 $sw_add = true;
                 $html .= "<tr>";
                 $html .= "<td><b>{$key}:</b> </td>";
                 $html .= "<td>{$value}</td>";
                 $html .= "</tr>";
             }
             if (is_array($value)) {
                 $html .= "<tr>";
                 $html .= "<td><b>{$key} (grid):</b> </td>";
                 $html .= "<td>";
                 $html .= "<table>";
                 foreach ($value as $key1 => $value1) {
                     $html .= "<tr>";
                     $html .= "<td><b>{$key1}</b></td>";
                     $html .= "<td>";
                     if (is_array($value1)) {
                         $sw_add = true;
                         $html .= "<table>";
                         foreach ($value1 as $key2 => $value2) {
                             $html .= "<tr>";
                             $html .= "<td><b>{$key2}</b></td>";
                             $html .= "<td>{$value2}</td>";
                             $html .= "</tr>";
                         }
                         $html .= "</table>";
                     }
                     $html .= "</td>";
                     $html .= "</tr>";
                 }
                 $html .= "</table>";
                 $html .= "</td>";
                 $html .= "</tr>";
                 $html .= "</td>";
             }
         }
         $html .= "</table>";
         $aRow['FIELDS'] = $html;
         if ($sw_add) {
             $aDynHistory[] = $aRow;
         }
     }
     global $_DBArray;
     $_DBArray['DynaformsHistory'] = $aDynHistory;
     $_SESSION['_DBArray'] = $_DBArray;
     G::LoadClass('ArrayPeer');
     $oCriteria = new Criteria('dbarray');
     $oCriteria->setDBArrayTable('DynaformsHistory');
     $oCriteria->addAscendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
     return $oCriteria;
 }
Esempio n. 9
0
 $oDataset = StepPeer::doSelectRS($oCriteria);
 $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
 $oDataset->next();
 $i = 0;
 while ($aRow = $oDataset->getRow()) {
     switch ($aRow['STEP_TYPE_OBJ']) {
         case 'DYNAFORM':
             require_once 'classes/model/Dynaform.php';
             $oObject = new Dynaform();
             $aFields = $oObject->load($aRow['STEP_UID_OBJ']);
             $aRow['STEP_NAME'] = $aFields['DYN_TITLE'];
             break;
         case 'INPUT_DOCUMENT':
             require_once 'classes/model/InputDocument.php';
             $oObject = new InputDocument();
             $aFields = $oObject->load($aRow['STEP_UID_OBJ']);
             $aRow['STEP_NAME'] = $aFields['INP_DOC_TITLE'];
             break;
         case 'OUTPUT_DOCUMENT':
             require_once 'classes/model/OutputDocument.php';
             $oObject = new OutputDocument();
             $aFields = $oObject->load($aRow['STEP_UID_OBJ']);
             $aRow['STEP_NAME'] = $aFields['OUT_DOC_TITLE'];
             break;
         case 'EXTERNAL':
             $aRow['STEP_NAME'] = 'unknown ' . $aRow['STEP_UID'];
             foreach ($externalSteps as $key => $val) {
                 if ($val->sStepId == $aRow['STEP_UID_OBJ']) {
                     $aRow['STEP_NAME'] = $val->sStepTitle;
                 }
             }
Esempio n. 10
0
 *
 * The point of this application is upload the file and create the input document record
 *
 * if the post attached file has error code 0 continue in other case nothing to do.
 */
if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
    try {
        G::LoadClass("case");
        $folderId = "";
        $fileTags = "";
        if (isset($_POST["DOC_UID"]) && $_POST["DOC_UID"] != -1) {
            //The document is of an Specific Input Document. Get path and Tag information
            require_once "classes/model/AppFolder.php";
            require_once "classes/model/InputDocument.php";
            $oInputDocument = new InputDocument();
            $aID = $oInputDocument->load($_POST["DOC_UID"]);
            //Get the Custom Folder ID (create if necessary)
            $oFolder = new AppFolder();
            $folderId = $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"], $_POST["APPLICATION"]);
            //Tags
            $fileTags = $oFolder->parseTags($aID["INP_DOC_TAGS"], $_POST["APPLICATION"]);
        }
        $oAppDocument = new AppDocument();
        if (isset($_POST["APP_DOC_UID"]) && trim($_POST["APP_DOC_UID"]) != "") {
            //Update
            echo "[update]";
            $aFields["APP_DOC_UID"] = $_POST["APP_DOC_UID"];
            $aFields["DOC_VERSION"] = $_POST["DOC_VERSION"];
            $aFields["APP_DOC_FILENAME"] = $_FILES["ATTACH_FILE"]["name"];
            if (isset($_POST["APPLICATION"])) {
                $aFields["APP_UID"] = $_POST["APPLICATION"];
$arrayTrigger = $case->loadTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
//Trigger debug routines
//Cleaning debug variables
$_SESSION["TRIGGER_DEBUG"]["ERRORS"] = array();
$_SESSION["TRIGGER_DEBUG"]["DATA"] = array();
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = array();
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = array();
$_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] = count($arrayTrigger);
$_SESSION["TRIGGER_DEBUG"]["TIME"] = "AFTER";
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
    $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = $case->getTriggerNames($arrayTrigger);
    $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger;
}
//***Validating the file allowed extensions***
$oInputDocument = new InputDocument();
$InpDocData = $oInputDocument->load($inputDocumentUid);
if (isset($_FILES["form"]["name"]["APP_DOC_FILENAME"]) && isset($_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"])) {
    $res = G::verifyInputDocExtension($InpDocData['INP_DOC_TYPE_FILE'], $_FILES["form"]["name"]["APP_DOC_FILENAME"], $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]);
} else {
    $res = new stdclass();
    $res->status = false;
    $res->message = G::LoadTranslation('ID_UPLOAD_ERR_INI_SIZE');
}
if ($res->status == 0) {
    $message = $res->message;
    G::SendMessageText($message, "ERROR");
    $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
    G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
    die;
}
//Add Input Document
Esempio n. 12
0
 $aData['CURRENT_DYNAFORM'] = $_GET['UID'];
 $aData['USER_UID'] = $_SESSION['USER_LOGGED'];
 $aData['APP_STATUS'] = $Fields['APP_STATUS'];
 $aData['PRO_UID'] = $_SESSION['PROCESS'];
 $oCase->updateCase($_SESSION['APPLICATION'], $aData);
 //save files
 require_once 'classes/model/AppDocument.php';
 if (isset($_FILES['form'])) {
     foreach ($_FILES['form']['name'] as $sFieldName => $vValue) {
         if ($_FILES['form']['error'][$sFieldName] == 0) {
             $oAppDocument = new AppDocument();
             if (isset($_POST['INPUTS'][$sFieldName]) && $_POST['INPUTS'][$sFieldName] != '') {
                 require_once 'classes/model/AppFolder.php';
                 require_once 'classes/model/InputDocument.php';
                 $oInputDocument = new InputDocument();
                 $aID = $oInputDocument->load($_POST['INPUTS'][$sFieldName]);
                 //Get the Custom Folder ID (create if necessary)
                 $oFolder = new AppFolder();
                 $folderId = $oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH']);
                 //Tags
                 $fileTags = $oFolder->parseTags($aID['INP_DOC_TAGS']);
                 $aFields = array('APP_UID' => $_SESSION['APPLICATION'], 'DEL_INDEX' => $_SESSION['INDEX'], 'USR_UID' => $_SESSION['USER_LOGGED'], 'DOC_UID' => $_POST['INPUTS'][$sFieldName], 'APP_DOC_TYPE' => 'INPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_COMMENT' => '', 'APP_DOC_TITLE' => '', 'APP_DOC_FILENAME' => $_FILES['form']['name'][$sFieldName], 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
             } else {
                 $aFields = array('APP_UID' => $_SESSION['APPLICATION'], 'DEL_INDEX' => $_SESSION['INDEX'], 'USR_UID' => $_SESSION['USER_LOGGED'], 'DOC_UID' => -1, 'APP_DOC_TYPE' => 'ATTACHED', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_COMMENT' => '', 'APP_DOC_TITLE' => '', 'APP_DOC_FILENAME' => $_FILES['form']['name'][$sFieldName]);
             }
             $oAppDocument->create($aFields);
             $iDocVersion = $oAppDocument->getDocVersion();
             $sAppDocUid = $oAppDocument->getAppDocUid();
             $aInfo = pathinfo($oAppDocument->getAppDocFilename());
             $sExtension = isset($aInfo['extension']) ? $aInfo['extension'] : '';
             $sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
Esempio n. 13
0
 * @Updated Dec 14, 2009 by Erik <*****@*****.**>
 * 
 * The point of this application is upload the file and create the input document record
 * 
 * if the post attached file has error code 0 continue in other case nothing to do. */
if (isset($_FILES) && $_FILES['ATTACH_FILE']['error'] == 0) {
    try {
        G::LoadClass('case');
        $folderId = '';
        $fileTags = '';
        if (isset($_POST['DOC_UID']) && $_POST['DOC_UID'] != -1) {
            //The document is of an Specific Input Document. Get path and Tag information
            require_once 'classes/model/AppFolder.php';
            require_once 'classes/model/InputDocument.php';
            $oInputDocument = new InputDocument();
            $aID = $oInputDocument->load($_POST['DOC_UID']);
            //Get the Custom Folder ID (create if necessary)
            $oFolder = new AppFolder();
            $folderId = $oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $_POST['APPLICATION']);
            //Tags
            $fileTags = $oFolder->parseTags($aID['INP_DOC_TAGS'], $_POST['APPLICATION']);
        }
        $oAppDocument = new AppDocument();
        if (isset($_POST['APP_DOC_UID']) && trim($_POST['APP_DOC_UID']) != '') {
            //Update
            echo '[update]';
            $aFields['APP_DOC_UID'] = $_POST['APP_DOC_UID'];
            $aFields['DOC_VERSION'] = $_POST['DOC_VERSION'];
            $aFields['APP_DOC_FILENAME'] = $_FILES['ATTACH_FILE']['name'];
            if (isset($_POST['APPLICATION'])) {
                $aFields['APP_UID'] = $_POST['APPLICATION'];
Esempio n. 14
0
function uploadExternalDocument()
{
    $response['action']=$_POST['action']. " - ".$_POST['option'];
    $response['error']="error";
    $response['message']="error";
    $response['success']=false;
    $overwrite = (isset($_REQUEST['overwrite_files'])) ? $_REQUEST['overwrite_files'] : false;
    if (isset($_POST["confirm"]) && $_POST["confirm"] == "true") {
        if (isset($_FILES['uploadedFile'])) {
            $uploadedInstances=count($_FILES['uploadedFile']['name']);
            $sw_error=false;
            $sw_error_exists=isset($_FILES['uploadedFile']['error']);
            $emptyInstances=0;
            $quequeUpload=array();
            //overwrite files
            if ($overwrite) {
                for ($i=0; $i<$uploadedInstances; $i++) {
                    overwriteFile($_REQUEST['dir'], stripslashes($_FILES['uploadedFile']['name'][$i]));
                }
            }
            // upload files & check for errors
            for ($i=0; $i<$uploadedInstances; $i++) {
                $errors[$i] = null;
                $tmp = $_FILES['uploadedFile']['tmp_name'][$i];
                $items[$i] = stripslashes($_FILES['uploadedFile']['name'][$i]);
                if ($sw_error_exists) {
                    $up_err = $_FILES['uploadedFile']['error'][$i];
                } else {
                    $up_err=(file_exists($tmp)?0:4);
                }
                if ($items[$i]=="" || $up_err==4) {
                    $emptyInstances++;
                    continue;
                }
                if ($up_err==1 || $up_err==2) {
                    $errors[$i]='miscfilesize';
                    $sw_error = true;
                    continue;
                }
                if ($up_err==3) {
                    $errors[$i]='miscfilepart';
                    $sw_error=true;
                    continue;
                }
                if (!@is_uploaded_file($tmp)) {
                    $errors[$i]='uploadfile';
                    $sw_error=true;
                    continue;
                }
                //The uplaoded files seems to be correct and ready to be uploaded. Add to the Queque
                $fileInfo=array("tempName"=>$tmp,"fileName"=>$items[$i]);
                $quequeUpload[]=$fileInfo;
            }
        } elseif (isset($_POST['selitems'])) {
            $response="";
            $response['msg']= "correct reload";
            $response['success']=true;
            if (isset($_REQUEST['option']) && isset($_REQUEST['copyMove'])) {
                if ($_REQUEST['option'] == 'directory' && $_REQUEST['copyMove'] == 'all') {
                    $response['action'] = $_POST['action']. " - ".$_POST['option'];
                    $response['error']  = "Complete";
                    $response['message']= str_replace("Execute", "", $_POST['action']). " ". "Complete";
                    $response['success']= 'success';
                    $response['node']   = '';
                    $_POST ['node']     = "";
                    $newFolderUid = checkTree($_REQUEST['dir'], $_REQUEST['new_dir']);
                }
                $_POST['selitems'] = array();
            } else {
                require_once ("classes/model/AppDocument.php");
                $oAppDocument = new AppDocument();
                if (isset($_POST['selitems']) && is_array($_POST['selitems'])) {
                    foreach ($_POST['selitems'] as $docId) {
                        $arrayDocId = explode ('_',$docId);
                        $docInfo=$oAppDocument->load($arrayDocId[0]);
                        $docInfo['FOLDER_UID'] =  $_POST['new_dir'];
                        $docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
                        $oAppDocument->update($docInfo);
                    }
                }
            }
        }
        //G::pr($quequeUpload);

        //Read. Instance Document classes
        if (!empty($quequeUpload)) {
            $docUid=$_POST['docUid'];
            $appDocUid=isset($_POST['APP_DOC_UID'])?$_POST['APP_DOC_UID']:"";
            $docVersion=isset($_POST['docVersion'])?$_POST['docVersion']:"";
            $actionType=isset($_POST['actionType'])?$_POST['actionType']:"";
            $folderId=$_POST['dir']==""?"/":$_POST['dir'];
            $appId=$_POST['appId'];
            $docType=isset($_POST['docType'])?$_GET['docType']:"INPUT";
            //save info

            require_once ("classes/model/AppDocument.php");
            require_once ('classes/model/AppFolder.php');
            require_once ('classes/model/InputDocument.php');

            $oInputDocument = new InputDocument();
            if ($docUid != -1) {
                $aID = $oInputDocument->load($docUid);
            } else {
                $oFolder=new AppFolder();
                $folderStructure=$oFolder->getFolderStructure($folderId);
                $aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']);
            }



            //Get the Custom Folder ID (create if necessary)
            $oFolder=new AppFolder();
            if ($docUid!=-1) {
                //krumo("jhl");
                $folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'],$appId);
                //Tags
                $fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS'],$appId);
            } else {
                $folderId=$folderId;
                $fileTags="EXTERNAL";
            }
            foreach ($quequeUpload as $key => $fileObj) {
                $oAppDocument = new AppDocument();
                switch ($actionType) {
                    case "R":
                        //replace
                        $aFields = array(
                            'APP_DOC_UID'           => $appDocUid,
                            'APP_UID'               => $appId,
                            'DOC_VERSION'           => $docVersion,
                            'DEL_INDEX'             => 1,
                            'USR_UID'               => $_SESSION['USER_LOGGED'],
                            'DOC_UID'               => $docUid,
                            'APP_DOC_TYPE'          => $docType,
                            'APP_DOC_CREATE_DATE'   => date('Y-m-d H:i:s'),
                            'APP_DOC_COMMENT'       => isset($_POST['form']['APP_DOC_COMMENT']) ?
                                $_POST['form']['APP_DOC_COMMENT'] : '',
                            'APP_DOC_TITLE'         => '',
                            'APP_DOC_FILENAME'      => $fileObj['fileName'],
                            'FOLDER_UID'            => $folderId,
                            'APP_DOC_TAGS'          => $fileTags
                        );
                        $oAppDocument->update($aFields);
                        break;
                    case "NV":
                        //New Version
                        $aFields = array(
                            'APP_DOC_UID'           => $appDocUid,
                            'APP_UID'               => $appId,
                            'DEL_INDEX'             => 1,
                            'USR_UID'               => $_SESSION['USER_LOGGED'],
                            'DOC_UID'               => $docUid,
                            'APP_DOC_TYPE'          => $docType,
                            'APP_DOC_CREATE_DATE'   => date('Y-m-d H:i:s'),
                            'APP_DOC_COMMENT'       => isset($_POST['form']['APP_DOC_COMMENT']) ?
                                $_POST['form']['APP_DOC_COMMENT'] : '',
                            'APP_DOC_TITLE'         => '',
                            'APP_DOC_FILENAME'      => $fileObj['fileName'],
                            'FOLDER_UID'            => $folderId,
                            'APP_DOC_TAGS'          => $fileTags
                        );
                        $oAppDocument->create($aFields);
                        break;
                    default:
                        //New
                        $aFields = array(
                            'APP_UID'               => $appId,
                            'DEL_INDEX'             => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1,
                            'USR_UID'               => $_SESSION['USER_LOGGED'],
                            'DOC_UID'               => $docUid,
                            'APP_DOC_TYPE'          => $docType,
                            'APP_DOC_CREATE_DATE'   => date('Y-m-d H:i:s'),
                            'APP_DOC_COMMENT'       => isset($_POST['form']['APP_DOC_COMMENT']) ?
                                $_POST['form']['APP_DOC_COMMENT'] : '',
                            'APP_DOC_TITLE'         => '',
                            'APP_DOC_FILENAME'      => $fileObj['fileName'],
                            'FOLDER_UID'            => $folderId,
                            'APP_DOC_TAGS'          => $fileTags
                        );
                        $oAppDocument->create($aFields);
                        break;
                }
                $sAppDocUid = $oAppDocument->getAppDocUid();
                $iDocVersion = $oAppDocument->getDocVersion();

                $info = pathinfo($oAppDocument->getAppDocFilename());
                $ext = (isset($info['extension']) ? $info['extension'] : '');
                //save the file
                //if (!empty($_FILES['form'])) {
                //if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
                $sPathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
                $file = G::getPathFromFileUID($appId, $sAppDocUid);
                $sPathName .= $file[0];
                $sFileName = $file[1] . "_" . $iDocVersion . '.' . $ext;

                G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload

                //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
                $oPluginRegistry =& PMPluginRegistry::getSingleton();
                if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
                    $oData['APP_UID']   = $appId;
                    $documentData = new uploadDocumentData (
                        $appId,
                        $_SESSION['USER_LOGGED'],
                        $sPathName . $sFileName,
                        $fileObj['fileName'],
                        $sAppDocUid
                    );
                    //$oPluginRegistry->executeTriggers (PM_UPLOAD_DOCUMENT , $documentData);
                    //unlink ($sPathName . $sFileName);
                }
                //end plugin
                if ($sw_error) {
                    // there were errors
                    $err_msg="";
                    for ($i=0; $i<$uploadedInstances; $i++) {
                        if ($errors[$i]==null) {
                            continue;
                        }
                        $err_msg .= $items[$i]." : ".$errors[$i]."\n";
                    }
                    $response['error']=$err_msg;
                    $response['message']=$err_msg;
                    $response['success']=false;
                } elseif ($emptyInstances==$uploadedInstances) {
                    $response['error']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
                    $response['message']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
                    $response['success']=false;
                } else {
                    $response['error']= G::LoadTranslation('ID_UPLOAD_COMPLETE');
                    $response['message']="Upload complete";
                    $response['success']=true;
                }
            }
        }
    }
    print_r(G::json_encode($response));
    /*
     G::LoadClass ('case');
     $oCase = new Cases ();

     $G_PUBLISH = new Publisher ();
     $Fields ['DOC_UID'] = "-1";

     $Fields ['appId'] = "00000000000000000000000000000000";

     $G_PUBLISH->AddContent ('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields,
     'appFolderSaveDocument?UID=-1&appId=' . $Fields ['appId'] . "&folderId=" . $_POST ['folderID']);
     G::RenderPage ('publish', 'raw');
     */
}
Esempio n. 15
0
     $rows = $oProcessMap->getExtAdditionalTablesList();
     $result['totalCount'] = count($rows);
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'getInputDocumentList':
     $rows = $oProcessMap->getExtInputDocumentsCriteria($start, $limit, $_GET['pid']);
     $result['totalCount'] = $oProcessMap->getAllInputDocumentCount();
     array_shift($rows);
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'editInputDocument':
     require_once 'classes/model/InputDocument.php';
     $oInputDocument = new InputDocument();
     $rows = $oInputDocument->load($_GET['INP_DOC_UID']);
     $tmpData = G::json_encode($rows);
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
     $result = $tmpData;
     echo $result;
     break;
 case 'getOutputDocument':
     $rows = $oProcessMap->getExtOutputDocumentsCriteria($start, $limit, $_GET['pid']);
     $result['totalCount'] = $oProcessMap->getAllOutputDocumentCount();
     array_shift($rows);
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'editObjectPermission':
     $rows = $oProcessMap->editExtObjectPermission($_GET['pid'], $_GET['op_uid']);
Esempio n. 16
0
     $Fields["INP_DOC_SUPPORTED_EXTENSIONS_FILENAME_LABEL"] = "[" . $InpDocData["INP_DOC_TYPE_FILE"] . "]";
     $Fields["INP_DOC_MAX_FILESIZE"] = $inpDocMaxFilesize;
     $Fields["INP_DOC_MAX_FILESIZE_LABEL"] = $inpDocMaxFilesize > 0 ? "[" . $InpDocData["INP_DOC_MAX_FILESIZE"] . " " . $InpDocData["INP_DOC_MAX_FILESIZE_UNIT"] . "]" : "";
     $Fields['fileTypes'] = $InpDocData['INP_DOC_TYPE_FILE'];
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'cases_SaveDocument?UID=' . $_POST['docID']);
     G::RenderPage('publish', 'raw');
     break;
 case "uploadToReviseInputDocument":
     //krumo($_POST);
     $G_PUBLISH = new Publisher();
     $Fields['DOC_UID'] = $_POST['docID'];
     $Fields['APP_DOC_UID'] = $_POST['appDocId'];
     $Fields['actionType'] = $_POST['actionType'];
     $Fields["docVersion"] = (int) $_POST["docVersion"];
     $oInputDocument = new InputDocument();
     $InpDocData = $oInputDocument->load($Fields['DOC_UID']);
     $inpDocMaxFilesize = $InpDocData["INP_DOC_MAX_FILESIZE"];
     $inpDocMaxFilesizeUnit = $InpDocData["INP_DOC_MAX_FILESIZE_UNIT"];
     $inpDocMaxFilesize = $inpDocMaxFilesize * ($inpDocMaxFilesizeUnit == "MB" ? 1024 * 1024 : 1024);
     //Bytes
     $Fields["INP_DOC_SUPPORTED_EXTENSIONS_FILENAME_LABEL"] = "[" . $InpDocData["INP_DOC_TYPE_FILE"] . "]";
     $Fields["INP_DOC_MAX_FILESIZE"] = $inpDocMaxFilesize;
     $Fields["INP_DOC_MAX_FILESIZE_LABEL"] = $inpDocMaxFilesize > 0 ? "[" . $InpDocData["INP_DOC_MAX_FILESIZE"] . " " . $InpDocData["INP_DOC_MAX_FILESIZE_UNIT"] . "]" : "";
     $Fields['fileTypes'] = $InpDocData['INP_DOC_TYPE_FILE'];
     if ($_POST['actionType'] == 'NV') {
         $appDocument = new AppDocument();
         $arrayAppDocumentData = $appDocument->load($_POST["appDocId"]);
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'cases_SupervisorSaveDocument?APP_DOC_UID=' . $_POST['appDocId'] . "&DOC_VERSION=" . ($Fields['docVersion'] + 1) . '&APP_UID=' . $arrayAppDocumentData["APP_UID"] . '&UID=' . $_POST['docID']);
     } else {
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_AttachInputDocumentGeneral', '', $Fields, 'cases_SupervisorSaveDocument?UID=' . $_POST['docID'] . '&APP_UID=' . $_POST['appDocId']);
     }
Esempio n. 17
0
 if (is_array($arrayField[$i])) {
     if (isset($_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]) && !empty($_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]])) {
         $indocUid = $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]];
     }
     $fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"];
 } else {
     if (isset($_POST["INPUTS"][$arrayField[$i]]) && !empty($_POST["INPUTS"][$arrayField[$i]])) {
         $indocUid = $_POST["INPUTS"][$arrayField[$i]];
     }
     $fieldName = $arrayField[$i];
 }
 if ($indocUid != null) {
     //require_once ("classes/model/AppFolder.php");
     //require_once ("classes/model/InputDocument.php");
     $oInputDocument = new InputDocument();
     $aID = $oInputDocument->load($indocUid);
     //Get the Custom Folder ID (create if necessary)
     $oFolder = new AppFolder();
     $documentFileStructure = $oFolder->getFolderStructure();
     $aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => $indocUid, "APP_DOC_TYPE" => "INPUT", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "FOLDER_UID" => $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"]), "APP_DOC_TAGS" => $oFolder->parseTags($aID["INP_DOC_TAGS"]), "APP_DOC_FIELDNAME" => $fieldName);
 } else {
     $aFields = array("APP_UID" => $_SESSION["APPLICATION"], "DEL_INDEX" => $_SESSION["INDEX"], "USR_UID" => $_SESSION["USER_LOGGED"], "DOC_UID" => -1, "APP_DOC_TYPE" => "ATTACHED", "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), "APP_DOC_COMMENT" => "", "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $arrayFileName[$i], "APP_DOC_FIELDNAME" => $fieldName);
 }
 $oAppDocument = new AppDocument();
 $oAppDocument->create($aFields);
 $iDocVersion = $oAppDocument->getDocVersion();
 $sAppDocUid = $oAppDocument->getAppDocUid();
 $aInfo = pathinfo($oAppDocument->getAppDocFilename());
 $sExtension = isset($aInfo["extension"]) ? $aInfo["extension"] : "";
 $pathUID = G::getPathFromUID($_SESSION["APPLICATION"]);
 $sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
Esempio n. 18
0
    /**
     * Create the application document registry
     *
     * @param array $aData
     * @return string
     *
     */
    public function create ($aData)
    {
        $oConnection = Propel::getConnection( AppDocumentPeer::DATABASE_NAME );
        try {
            $oAppDocument = new AppDocument();

            if (! isset( $aData['APP_DOC_UID'] )) {
                $sUID = G::generateUniqueID();
                $docVersion = 1;
            } else {
                $sUID = $aData['APP_DOC_UID'];
                $docVersion = $this->getLastAppDocVersion( $aData['APP_DOC_UID'], $oAppDocument->getAppUid() );
                $oAppDocument->load( $aData['APP_DOC_UID'], $docVersion );
                switch ($oAppDocument->getAppDocType()) {
                    case "OUTPUT": //Output versioning
                        $o = new OutputDocument();
                        $oOutputDocument = $o->load( $oAppDocument->getDocUid() );

                        if (! $oOutputDocument['OUT_DOC_VERSIONING']) {
                            throw (new Exception( 'The Output document has not versioning enabled!' ));
                        }
                        break;
                    case "INPUT": // Input versioning
                        $o = new InputDocument();
                        $oInputDocument = $o->load( $oAppDocument->getDocUid() );
                        if (! $oInputDocument['INP_DOC_VERSIONING']) {
                            throw (new Exception( 'This Input document does not have the versioning enabled, for this reason this operation cannot be completed' ));
                        }
                        break;
                    default: //Not a valid type
                        throw (new Exception( 'The document is not of a valid Type' ));
                        break;
                }

                $docVersion ++;
            }

            $oAppDocument->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
            $oAppDocument->setDocVersion( $docVersion );

            $oAppDocument->setAppDocUid( $sUID );
            $oAppDocument->setAppDocIndex( $this->getLastIndex( $oAppDocument->getAppUid() ) + 1 );
            if ($oAppDocument->validate()) {
                $oConnection->begin();
                if (isset( $aData['APP_DOC_TITLE'] )) {
                    $oAppDocument->setAppDocTitle( $aData['APP_DOC_TITLE'] );
                }
                if (isset( $aData['APP_DOC_COMMENT'] )) {
                    $oAppDocument->setAppDocComment( $aData['APP_DOC_COMMENT'] );
                }
                if (isset( $aData['APP_DOC_FILENAME'] )) {
                    $oAppDocument->setAppDocFilename( $aData['APP_DOC_FILENAME'] );
                }
                $iResult = $oAppDocument->save();
                $oConnection->commit();
                $this->fromArray( $oAppDocument->toArray( BasePeer::TYPE_FIELDNAME ), BasePeer::TYPE_FIELDNAME );
                return $sUID;
            } else {
                $sMessage = '';
                $aValidationFailures = $oAppDocument->getValidationFailures();
                foreach ($aValidationFailures as $oValidationFailure) {
                    $sMessage .= $oValidationFailure->getMessage() . '<br />';
                }
                throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
            }
        } catch (Exception $oError) {
            $oConnection->rollback();
            throw ($oError);
        }
    }
 public function loadInputDoc($params)
 {
     require_once 'classes/model/InputDocument.php';
     $oInputDocument = new InputDocument();
     $fields = $oInputDocument->load($params->IDOC_UID);
     $this->success = true;
     $this->data = $fields;
 }
         }
 
         $dataAbeRequests['ABE_REQ_ANSWERED'] = 1;
         $code == 0 ? uploadAbeRequest($dataAbeRequests) : '';
 
         if (isset ( $_FILES ['form'] )) {
             foreach ($_FILES ['form'] ['name'] as $fieldName => $value) {
                 if ($_FILES ['form'] ['error'] [$fieldName] == 0) {
                     $appDocument = new AppDocument ( );
 
                     if ( isset ( $_REQUEST['INPUTS'] [$fieldName] ) && $_REQUEST['INPUTS'] [$fieldName] != '' ) {
                         require_once 'classes/model/AppFolder.php';
                         require_once 'classes/model/InputDocument.php';
 
                         $inputDocument = new InputDocument();
                         $id = $inputDocument->load($_REQUEST['INPUTS'] [$fieldName]);
 
                         //Get the Custom Folder ID (create if necessary)
                         $oFolder=new AppFolder();
                         $folderId=$oFolder->createFromPath($id['INP_DOC_DESTINATION_PATH']);
 
                         //Tags
                         $fileTags=$oFolder->parseTags($id['INP_DOC_TAGS']);
 
                         $fields = array (
                             'APP_UID' => $_REQUEST['APP_UID'],
                             'DEL_INDEX' => $_REQUEST ['DEL_INDEX'],
                             'USR_UID' => $casesFields['APP_DATA']['USER_LOGGED'],
                             'DOC_UID' => $_REQUEST['INPUTS'] [$fieldName],
                             'APP_DOC_TYPE' => 'INPUT',
                             'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ),
Esempio n. 21
0
    /**

     * input document process list

     *

     * @param string $sProcessUID

     * @return $result will return an object

     */

    public function inputDocumentProcessList ($sProcessUID)

    {

        try {

            global $_DBArray;



            $_DBArray = (isset( $_SESSION['_DBArray'] ) ? $_SESSION['_DBArray'] : '');



            $oMap = new processMap();

            $oCriteria = $oMap->getInputDocumentsCriteria( $sProcessUID );

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

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

            $oDataset->next();



            $result = array ();



            /*

            //not necesary for SOAP message

            $result[] = array(

                'guid' => 'char',

                'name' => 'name',

                'description' => 'description'

            );

            */



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

                if ($aRow['INP_DOC_TITLE'] == null) {

                    //There is no transaltion for this Document name, try to get/regenerate the label

                    $inputDocument = new InputDocument();

                    $inputDocumentObj = $inputDocument->load( $aRow['INP_DOC_UID'] );

                    $aRow['INP_DOC_TITLE'] = $inputDocumentObj['INP_DOC_TITLE'];

                    $aRow['INP_DOC_DESCRIPTION'] = $inputDocumentObj['INP_DOC_DESCRIPTION'];

                }



                $docrow = array ();

                $docrow['guid'] = $aRow['INP_DOC_UID'];

                $docrow['name'] = $aRow['INP_DOC_TITLE'];

                $docrow['description'] = $aRow['INP_DOC_DESCRIPTION'];

                $result[] = $docrow;

                $oDataset->next();

            }



            //$_DBArray['inputDocArray'] = $inputDocArray;





            return $result;

        } catch (Exception $e) {

            $result[] = array ('guid' => $e->getMessage()

            );



            return $result;

        }

    }
Esempio n. 22
0
    public function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId)
    {
        //require_once ("classes/model/AppDocument.php");
        //require_once ("classes/model/InputDocument.php");
        //require_once ("classes/model/OutputDocument.php");
        //require_once ("classes/model/Users.php");

        //**** start get Doc Info
        $oApp = new Application();
        $oAppDocument = new AppDocument();
        G::LoadClass( 'case' );
        $oCase = new Cases();
        G::LoadClass( 'process' );
        $oProcess = new Process();
        if (($oApp->exists( $appUid )) || ($appUid == "00000000000000000000000000000000")) {
            if ($appUid == "00000000000000000000000000000000") {
                //External Files
                $row1 = $oAppDocument->load( $appDocUid, $docVersion );
                $row2 = array ('PRO_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
                $row3 = array ('APP_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
            } else {
                $row1 = $oAppDocument->load( $appDocUid, $docVersion );
                $row2 = $oCase->loadCase( $appUid );
                $row3 = $oProcess->Load( $row2['PRO_UID'] );
            }
            $lastVersion = $oAppDocument->getLastAppDocVersion( $appDocUid, $appUid );

            switch ($row1['APP_DOC_TYPE']) {
                case "OUTPUT":
                    $oOutputDocument = new OutputDocument();

                    $row4 = array();
                    $swOutDocExists = 0;

                    if ($oOutputDocument->OutputExists($docUid)) {
                        $row4 = $oOutputDocument->load($docUid);
                        $swOutDocExists = 1;
                    }

                    if ($swOutDocExists == 0) {
                        $swpdf = 0;
                        $swdoc = 0;

                        $info = pathinfo($oAppDocument->getAppDocFilename());

                        $version = (!empty($docVersion))? "_" . $docVersion : "_1";
                        $outDocPath = PATH_DOCUMENT . G::getPathFromUID($row1["APP_UID"]) . PATH_SEP . "outdocs" . PATH_SEP;

                        if (file_exists($outDocPath . $appDocUid . $version . ".pdf") ||
                            file_exists($outDocPath . $info["basename"] . $version . ".pdf") ||
                            file_exists($outDocPath . $info["basename"] . ".pdf")
                        ) {
                            $swpdf = 1;
                        }

                        if (file_exists($outDocPath . $appDocUid . $version . ".doc") ||
                            file_exists($outDocPath . $info["basename"] . $version . ".doc") ||
                            file_exists($outDocPath . $info["basename"] . ".doc")
                        ) {
                            $swdoc = 1;
                        }

                        if ($swpdf == 1 && $swdoc == 1) {
                            $row4["OUT_DOC_GENERATE"] = "BOTH";
                        } else {
                            if ($swpdf == 1) {
                                $row4["OUT_DOC_GENERATE"] = "PDF";
                            } else {
                                if ($swdoc == 1) {
                                    $row4["OUT_DOC_GENERATE"] = "DOC";
                                } else {
                                    $row4["OUT_DOC_GENERATE"] = "NOFILE";
                                }
                            }
                        }
                    }

                    $versioningEnabled = false; //$row4['OUT_DOC_VERSIONING']; //Only enabled for Input or Attached documents. Need to study the best way for Output docs.

                    switch ($row4['OUT_DOC_GENERATE']) {
                        case "PDF":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
                            $downloadLink1 = "";
                            $downloadLabel = ".pdf";
                            $downloadLabel1 = "";
                            break;
                        case "DOC":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
                            $downloadLink1 = "";
                            $downloadLabel = ".doc";
                            $downloadLabel1 = "";
                            break;
                        case "BOTH":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
                            $downloadLink1 = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
                            $downloadLabel = ".pdf";
                            $downloadLabel1 = ".doc";
                            break;
                        case "NOFILE":
                            $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                            $downloadLink1 = "";
                            $downloadLabel = G::LoadTranslation("ID_DOWNLOAD");
                            $downloadLabel1 = "";
                            break;
                    }

                    if ($swOutDocExists == 0) {
                        $row4 = array();
                    }
                    break;
                case "INPUT":
                    $oInputDocument = new InputDocument();
                    if ($docUid != - 1) {
                        if ($oInputDocument->InputExists( $docUid )) {
                            $row4 = $oInputDocument->load( $docUid );
                            $versioningEnabled = $row4['INP_DOC_VERSIONING'];
                        } else {
                            $row4 = array ();
                            $versioningEnabled = false;
                        }
                        $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                        $downloadLink1 = "";
                        $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                        $downloadLabel1 = "";
                    } else {
                        $row4 = array ();
                        $versioningEnabled = false;
                        $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                        $downloadLink1 = "";
                        $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                        $downloadLabel1 = "";
                    }

                    if (! empty( $row1["APP_DOC_PLUGIN"] )) {
                        $pluginRegistry = &PMPluginRegistry::getSingleton();
                        $pluginName = $row1["APP_DOC_PLUGIN"];
                        $fieldValue = "";

                        if (file_exists( PATH_PLUGINS . $pluginName . ".php" )) {
                            $pluginDetail = $pluginRegistry->getPluginDetails( $pluginName . ".php" );

                            if ($pluginDetail) {
                                if ($pluginDetail->enabled) {
                                    require_once (PATH_PLUGINS . $pluginName . ".php");
                                    $pluginNameClass = $pluginName . "Plugin";
                                    $objPluginClass = new $pluginNameClass( $pluginName );

                                    if (isset( $objPluginClass->sMethodGetUrlDownload ) && ! empty( $objPluginClass->sMethodGetUrlDownload )) {
                                        if (file_exists( PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php" )) {
                                            require_once (PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php");
                                            $pluginNameClass = $pluginName . "Class";
                                            $objClass = new $pluginNameClass();

                                            if (method_exists( $objClass, $objPluginClass->sMethodGetUrlDownload )) {
                                                eval( "\$url = \$objClass->" . $objPluginClass->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");" );
                                                $downloadLink = $url;
                                                $fieldValue = $row1["APP_DOC_PLUGIN"];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        $row1["APP_DOC_PLUGIN"] = $fieldValue;
                    }
                    break;
                default:
                    $row4 = array ();
                    $versioningEnabled = false;
                    $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                    $downloadLink1 = "";
                    $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                    $downloadLabel1 = "";
                    break;
            }
            $oUser = new Users();
            if (($usrId != "-1") && ($oUser->userExists( $usrId ))) {
                $row5 = $oUser->load( $usrId );
            } else {
                $row5['USR_USERNAME'] = "******";
            }

            //Labels/Links
            $row6 = array ();
            $row6['DELETE_LABEL'] = G::LoadTranslation( 'ID_DELETE' );
            $row6['DOWNLOAD_LABEL'] = $downloadLabel;
            $row6['DOWNLOAD_LINK'] = $downloadLink;
            $row6['DOWNLOAD_LABEL1'] = $downloadLabel1;
            $row6['DOWNLOAD_LINK1'] = $downloadLink1;
            //if(($docVersion>1)&&($row1['APP_DOC_TYPE']!="OUTPUT")){
            if (($docVersion > 1)) {
                $row6['VERSIONHISTORY_LABEL'] = G::LoadTranslation( 'ID_VERSION_HISTORY' );
            }
            if ($versioningEnabled) {
                $row6['NEWVERSION_LABEL'] = G::LoadTranslation( 'ID_NEW_VERSION' );
            }
            $row6['APP_DOC_UID_VERSION'] = $appDocUid . "_" . $docVersion;

            if ($appUid == "00000000000000000000000000000000") {
                //External Files
                $row1['APP_DOC_TYPE'] = G::LoadTranslation( 'ID_EXTERNAL_FILE' );
            }
            //**** End get docinfo
            $infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 );

            $sUserUID = $_SESSION['USER_LOGGED'];
            $aObjectPermissions = array ();
            if (isset( $infoMerged['PRO_UID'] )) {
                $aObjectPermissions = $oCase->getAllObjects( $infoMerged['PRO_UID'], $infoMerged['APP_UID'], '', $sUserUID );
            }

            if (! is_array( $aObjectPermissions )) {
                $aObjectPermissions = array ('DYNAFORMS' => array (- 1),
                'INPUT_DOCUMENTS' => array (- 1),
                'OUTPUT_DOCUMENTS' => array (- 1)
                );
            }
            if (! isset( $aObjectPermissions['DYNAFORMS'] )) {
                $aObjectPermissions['DYNAFORMS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['DYNAFORMS'] )) {
                    $aObjectPermissions['DYNAFORMS'] = array (- 1);
                }
            }
            if (! isset( $aObjectPermissions['INPUT_DOCUMENTS'] )) {
                $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['INPUT_DOCUMENTS'] )) {
                    $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1);
                }
            }
            if (! isset( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) {
                $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) {
                    $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
                }
            }
            return array_merge( $infoMerged, $aObjectPermissions );
        }
    }
Esempio n. 23
0
         $result->msg = $e->getMessage();
     }
     print G::json_encode($result);
     break;
 case 'deleteInputDocument':
     try {
         $oStepSupervisor = new StepSupervisor();
         $fields2 = $oStepSupervisor->loadInfo($_POST['INP_DOC_UID']);
         $oStepSupervisor->remove($fields2['STEP_UID']);
         $oPermission = new ObjectPermission();
         $fields3 = $oPermission->loadInfo($_POST['INP_DOC_UID']);
         if (is_array($fields3)) {
             $oPermission->remove($fields3['OP_UID']);
         }
         $oInputDocument = new InputDocument();
         $fields = $oInputDocument->load($_POST['INP_DOC_UID']);
         $oInputDocument->remove($_POST['INP_DOC_UID']);
         $oStep = new Step();
         $oStep->removeStep('INPUT_DOCUMENT', $_POST['INP_DOC_UID']);
         $oOP = new ObjectPermission();
         $oOP->removeByObject('INPUT', $_POST['INP_DOC_UID']);
         //refresh dbarray with the last change in inputDocument
         $oMap = new processMap();
         $oCriteria = $oMap->getInputDocumentsCriteria($fields['PRO_UID']);
         $result->success = true;
         $result->msg = G::LoadTranslation('ID_INPUTDOCUMENT_REMOVED');
     } catch (Exception $e) {
         $result->success = false;
         $result->msg = $e->getMessage();
     }
     print G::json_encode($result);
 /**
  * getCaseTrackerObjectsCriteria
  *
  * @param string $sProcessUID
  * @return object(Criteria) $oCriteria
  */
 public function getExtCaseTrackerObjectsCriteria($start, $limit, $sProcessUID)
 {
     $aObjects = array();
     $aObjects[] = array('CTO_TITLE' => 'char', 'CTO_UID' => 'char', 'CTO_TYPE_OBJ' => 'char', 'CTO_UID_OBJ' => 'char', 'CTO_CONDITION' => 'char', 'CTO_POSITION' => 'integer');
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
     $oCriteria->addAscendingOrderByColumn(CaseTrackerObjectPeer::CTO_POSITION);
     $this->tmpCriteria = clone $oCriteria;
     if ($start != '') {
         $oCriteria->setOffset($start);
     }
     if ($limit != '') {
         $oCriteria->setLimit($limit);
     }
     $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         try {
             switch ($aRow['CTO_TYPE_OBJ']) {
                 case 'DYNAFORM':
                     $oDynaform = new Dynaform();
                     $aFields = $oDynaform->load($aRow['CTO_UID_OBJ']);
                     $sTitle = $aFields['DYN_TITLE'];
                     break;
                 case 'INPUT_DOCUMENT':
                     $oInputDocument = new InputDocument();
                     $aFields = $oInputDocument->load($aRow['CTO_UID_OBJ']);
                     $sTitle = $aFields['INP_DOC_TITLE'];
                     break;
                 case 'OUTPUT_DOCUMENT':
                     $oOutputDocument = new OutputDocument();
                     $aFields = $oOutputDocument->load($aRow['CTO_UID_OBJ']);
                     $sTitle = $aFields['OUT_DOC_TITLE'];
                     break;
             }
             $aObjects[] = array('CTO_TITLE' => $sTitle, 'CTO_UID' => $aRow['CTO_UID'], 'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'], 'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'], 'CTO_CONDITION' => $aRow['CTO_CONDITION'], 'CTO_POSITION' => $aRow['CTO_POSITION']);
         } catch (Exception $oError) {
             //Nothing
         }
         $oDataset->next();
     }
     // return $aObjects;
     global $_DBArray;
     $_DBArray = isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : '';
     $_DBArray['objects'] = $aObjects;
     $_SESSION['_DBArray'] = $_DBArray;
     G::LoadClass('ArrayPeer');
     $oCriteria = new Criteria('dbarray');
     $oCriteria->setDBArrayTable('objects');
     $oCriteria->addAscendingOrderByColumn('CTO_POSITION');
     return $aObjects;
 }
Esempio n. 25
0
     $oStep = new Step();
     $oStep = $oStep->loadByProcessTaskPosition($_SESSION['PROCESS'], $_SESSION['TASK'], $_GET['POSITION']);
     /** Added By erik  16-05-08
      * Description: this was added for the additional database connections */
     G::LoadClass('dbConnections');
     $oDbConnections = new dbConnections($_SESSION['PROCESS']);
     $oDbConnections->loadAdditionalConnections();
     $_SESSION['CURRENT_DYN_UID'] = $_GET['UID'];
     $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : '');
     break;
 case 'INPUT_DOCUMENT':
     if ($noShowTitle == 0) {
         $G_PUBLISH->AddContent('smarty', 'cases/cases_title', '', '', $array);
     }
     $oInputDocument = new InputDocument();
     $Fields = $oInputDocument->load($_GET['UID']);
     if (!$aPreviousStep) {
         $Fields['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = '';
         $Fields['PREVIOUS_STEP_LABEL'] = '';
     } else {
         $Fields['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] = $aPreviousStep['PAGE'];
         $Fields['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP");
         $Fields['PREVIOUS_STEP'] = $aPreviousStep['PAGE'];
         $Fields['PREVIOUS_STEP_LABEL'] = G::loadTranslation("ID_PREVIOUS_STEP");
     }
     $Fields['NEXT_STEP'] = $aNextStep['PAGE'];
     $Fields['NEXT_STEP_LABEL'] = G::loadTranslation("ID_NEXT_STEP");
     switch ($_GET['ACTION']) {
         case 'ATTACH':
             switch ($Fields['INP_DOC_FORM_NEEDED']) {
                 case 'REAL':
Esempio n. 26
0
 public function getInputDocumentsCriteria($sApplicationUID, $iDelegation, $sDocumentUID, $sAppDocuUID = '')
 {
     try {
         $listing = false;
         $oPluginRegistry =& PMPluginRegistry::getSingleton();
         if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
             $folderData = new folderData(null, null, $sApplicationUID, null, $_SESSION['USER_LOGGED']);
             $folderData->PMType = "INPUT";
             $folderData->returnList = true;
             //$oPluginRegistry      = & PMPluginRegistry::getSingleton();
             $listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
         }
         $oUser = new Users();
         $oAppDocument = new AppDocument();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(AppDocumentPeer::APP_UID, $sApplicationUID);
         //$oCriteria->add(AppDocumentPeer::DEL_INDEX, $iDelegation);
         $oCriteria->add(AppDocumentPeer::DOC_UID, $sDocumentUID);
         if ($sAppDocuUID != "") {
             $oCriteria->add(AppDocumentPeer::APP_DOC_UID, $sAppDocuUID);
         }
         $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, array('INPUT', 'ATTACHED'), CRITERIA::IN);
         $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN);
         $oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_UID);
         $oDataset = AppDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aInputDocuments = array();
         $aInputDocuments[] = array('APP_DOC_UID' => 'char', 'DOC_VERSION' => 'char', 'DOC_UID' => 'char', 'APP_DOC_COMMENT' => 'char', 'APP_DOC_FILENAME' => 'char', 'APP_DOC_INDEX' => 'integer');
         while ($aRow = $oDataset->getRow()) {
             $aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']);
             $lastVersion = $oAppDocument->getLastAppDocVersion($aRow['APP_DOC_UID'], $sApplicationUID);
             $aFields = array('APP_DOC_UID' => $aAux['APP_DOC_UID'], 'DOC_VERSION' => $aAux['DOC_VERSION'], 'DOC_UID' => $aAux['DOC_UID'], 'APP_DOC_COMMENT' => $aAux['APP_DOC_COMMENT'], 'APP_DOC_FILENAME' => $aAux['APP_DOC_FILENAME'], 'APP_DOC_INDEX' => $aAux['APP_DOC_INDEX']);
             if ($aFields['APP_DOC_FILENAME'] != '') {
                 $aFields['TITLE'] = $aFields['APP_DOC_FILENAME'];
             } else {
                 $aFields['TITLE'] = $aFields['APP_DOC_COMMENT'];
             }
             $aFields['POSITION'] = isset($_SESSION['STEP_POSITION']) ? $_SESSION['STEP_POSITION'] : 1;
             $aFields['CONFIRM'] = G::LoadTranslation('ID_CONFIRM_DELETE_INPUT_AND_HISTORY');
             //if (in_array($aRow['APP_DOC_UID'], $aDelete['INPUT_DOCUMENTS'])) {
             //  $aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE');
             //}
             $aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE');
             $aFields['REPLACE_LABEL'] = "";
             if ($aRow['DOC_VERSION'] == $lastVersion || $sAppDocuUID != "") {
                 $aFields['REPLACE_LABEL'] = G::LoadTranslation('ID_REPLACE');
                 $oInputDocument = new InputDocument();
                 $inputDocumentFields = $oInputDocument->load($aRow['DOC_UID']);
                 if ($inputDocumentFields['INP_DOC_VERSIONING']) {
                     $aFields['NEWVERSION_LABEL'] = G::LoadTranslation('ID_NEW_VERSION');
                 }
             }
             if ($aRow['DOC_VERSION'] > 1) {
                 $aFields['VERSIONHISTORY_LABEL'] = G::LoadTranslation('ID_VERSION_HISTORY');
             }
             if ($aRow['USR_UID'] != -1) {
                 $aUser = $oUser->load($aRow['USR_UID']);
                 $aFields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
             } else {
                 $aFields['CREATOR'] = '***';
             }
             $aFields['APP_DOC_CREATE_DATE'] = $aRow['APP_DOC_CREATE_DATE'];
             $aFields['DOC_VERSION_LABEL'] = $aRow['DOC_VERSION'];
             $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD');
             $aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION'];
             if (is_array($listing)) {
                 foreach ($listing as $folderitem) {
                     if ($folderitem->filename == $aRow['APP_DOC_UID']) {
                         $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_GET_EXTERNAL_FILE');
                         $aFields['DOWNLOAD_LINK'] = $folderitem->downloadScript;
                         continue;
                     }
                 }
             }
             $aFields['COMMENT'] = $aFields['APP_DOC_COMMENT'];
             if ($aRow['DOC_VERSION'] == $lastVersion || $sAppDocuUID != "") {
                 $aInputDocuments[] = $aFields;
             }
             $oDataset->next();
         }
         global $_DBArray;
         $_DBArray['inputDocuments'] = $aInputDocuments;
         $_SESSION['_DBArray'] = $_DBArray;
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('inputDocuments');
         // $oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);
         return $oCriteria;
     } catch (exception $oException) {
         throw $oException;
     }
 }