示例#1
0
     $apk_file_name = basename($apk_file['name']);
     $apk_final = str_replace(" ", "", $apptitle);
     $apk_type = $apk_file['type'];
     $apk_path = $apk_target_dir . "/" . $apk_final . ".apk";
     chmod($apk_tmp_file, 0777);
     //chmod($apk_path, 0777);
     if (move_uploaded_file($apk_tmp_file, $apk_path)) {
         $application->apk_path = $apk_final . ".apk";
     } else {
         echo "an error occured while trying to upload.";
         //header('Location: error.php');
     }
 } else {
     $application->apk_path = $_POST['old_apk'];
 }
 if ($application->update()) {
     echo "updated";
 } else {
     echo "not updated";
 }
 $dis_app = Application::find_by_sql("SELECT * FROM `applications` WHERE `app_name`='{$apptitle}'");
 //screenshots
 if (isset($_FILES['shot'])) {
     $shots = $_FILES['shot'];
     $scr_target_dir = "../screenshots";
     $i = 1;
     foreach ($shots['error'] as $key => $error) {
         if ($error == UPLOAD_ERR_OK) {
             $tmp_name = $_FILES["shot"]["tmp_name"][$key];
             $name = basename($_FILES["shot"]["name"][$key]);
             $scr_id = $_POST['scr_id'][$i - 1];
示例#2
0
 $licensedFeatures =& PMLicensedFeatures::getSingleton();
 if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
     G::LoadClass("pmDrive");
     $pmDrive = new PMDrive();
     if ($pmDrive->getStatusService()) {
         $app = new Application();
         $user = new Users();
         $dataUser = $user->load($_SESSION['USER_LOGGED']);
         $pmDrive->setDriveUser($dataUser['USR_EMAIL']);
         $appData = $app->Load($_SESSION['APPLICATION']);
         if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
             $process = new Process();
             $process->setProUid($appData['PRO_UID']);
             $result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'], $pmDrive->getFolderIdPMDrive($_SESSION['USER_LOGGED']));
             $appData['APP_DRIVE_FOLDER_UID'] = $result->id;
             $app->update($appData);
         }
         $result = $pmDrive->uploadFile('application/' . $sExtension, $arrayFileTmpName[$i], $arrayFileName[$i], $appData['APP_DRIVE_FOLDER_UID']);
         $oAppDocument->setDriveDownload('ATTACHED', $result->webContentLink);
         $fileIdDrive = $result->id;
         $aFields['DOC_VERSION'] = $iDocVersion;
         $aFields['APP_DOC_UID'] = $sAppDocUid;
         $oAppDocument->update($aFields);
         //add permissions
         $criteria = new Criteria('workflow');
         $criteria->addSelectColumn(ApplicationPeer::PRO_UID);
         $criteria->addSelectColumn(TaskUserPeer::TAS_UID);
         $criteria->addSelectColumn(TaskUserPeer::USR_UID);
         $criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
         $criteria->add(ApplicationPeer::APP_UID, $_SESSION['APPLICATION']);
         $criteria->addJoin(ApplicationPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN);
示例#3
0
    public function reactivateCase($sApplicationUID, $iIndex, $user_logged)

    {

        $oApplication = new Application();

        $aFields = $oApplication->load(

                (isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION'])

        );

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

        $oApplication->update($aFields);

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

        $c = new Criteria('workflow');

        $c->clearSelectColumns();

        $c->addSelectColumn(AppDelayPeer::APP_DELAY_UID);



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

        $c->add(AppDelayPeer::PRO_UID, $aFields['PRO_UID']);

        $c->add(AppDelayPeer::APP_DEL_INDEX, $iIndex);

        $c->add(AppDelayPeer::APP_TYPE, 'CANCEL');

        $c->add(AppDelayPeer::APP_DISABLE_ACTION_USER, 0);

        $c->add(AppDelayPeer::APP_DISABLE_ACTION_DATE, null, Criteria::ISNULL);



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

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

        $oDataset->next();

        $aRow = $oDataset->getRow();

        //var_dump($aRow);

        $aFields = array();

        $aFields['APP_DELAY_UID'] = $aRow['APP_DELAY_UID'];

        $aFields['APP_DISABLE_ACTION_USER'] = $user_logged;

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



        $delay = new AppDelay();

        $delay->update($aFields);

        //$this->ReactivateCurrentDelegation($sApplicationUID);

        $con = Propel::getConnection('workflow');

        $sql = "UPDATE APP_THREAD SET APP_THREAD_STATUS = 'OPEN' WHERE APP_UID =  '$sApplicationUID' " .

                " AND DEL_INDEX  ='$iIndex' ";

        $stmt = $con->createStatement();

        $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);



        //update searchindex

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

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

        }

    }
示例#4
0
     $app->ap_key = $_POST['ap_key'];
     $app->ap_pkey = $_POST['ap_pkey'];
     $app->custom_salt = $_POST['custom_salt'];
     $app->license_type = $_POST['license_type'];
     $app->from_email = $_POST['from_email'];
     $app->email_subject = $_POST['email_subject'];
     $app->email_body = $_POST['email_body'];
     $app->license_filename = $_POST['license_filename'];
     $app->return_url = $_POST['return_url'];
     $app->fs_security_key = $_POST['fs_security_key'];
     $app->tweet_terms = $_POST['tweet_terms'];
     $app->cf_product_code = $_POST['cf_product_code'];
     $app->cf_license_url = $_POST['cf_license_url'];
     $app->of_email_notify = $_POST['of_email_notify'];
     $app->fs_license_key = $_POST['fs_license_key'];
     $app->update();
     redirect('application.php?id=' . $app->id);
 } else {
     $name = $_POST['name'];
     $link = $_POST['link'];
     $bundle_name = $_POST['bundle_name'];
     $i_use_this_key = $_POST['i_use_this_key'];
     $s3key = $_POST['s3key'];
     $s3pkey = $_POST['s3pkey'];
     $s3bucket = $_POST['s3bucket'];
     $s3path = $_POST['s3path'];
     $sparkle_key = $_POST['sparkle_key'];
     $sparkle_pkey = $_POST['sparkle_pkey'];
     $ap_key = $_POST['ap_key'];
     $ap_pkey = $_POST['ap_pkey'];
     $custom_salt = $_POST['custom_salt'];
    $res = $obj->update(NULL);
} catch (Exception $e) {
    //#23
    $t->isa_ok($e, 'Exception', 'update() returns error when APP_UID is not defined');
    //#24
    $t->is($e->getMessage(), "The row '' in table APPLICATION doesn't exist!", "update() This row doesn't exist!");
}
//update with $fields
$newTitle = 'new title';
$Fields['APP_UID'] = $appUid;
$Fields['APP_TITLE'] = $newTitle;
$Fields['APP_PARENT'] = rand(1000, 5000);
$Fields['APP_INIT_DATE'] = 'now';
try {
    $obj = new Application();
    $res = $obj->update($Fields);
    //#25
    $t->is($res, 1, "update() update 1 row");
    $Fields = $obj->Load($appUid);
    //#26
    $t->is($obj->getAppUid(), $appUid, "update() APP_UID = " . $appUid);
    //#27
    $t->is($obj->getAppTitle(), $newTitle, "update() getAppTitle");
    //#28
    $t->is($Fields['APP_TITLE'], $newTitle, "update() APP_TITLE= " . $newTitle);
    //#29
    $t->is($Fields['APP_INIT_DATE'], date('Y-m-d H:i:s'), "update() APP_INIT_DATE= " . date('Y-m-d H:i:s'));
} catch (Exception $e) {
    //#14
    // $t->isa_ok( $e,      'PropelException',   'update() return error ' . $e->getMessage() );
    $t->isa_ok($e, 'Exception', 'update() return error ' . $e->getMessage());
 public function executeUpdate($request)
 {
     $object = $this->getRequestParameter('object');
     $user = User::getByApiKey($request->getParameter('login_id'), $request->getParameter('api_key'));
     if (!$user) {
         $output = '<rsp stat="fail"><err code="2" msg="login_id and api_key do not match" /></rsp>';
     } elseif ($object == 'application') {
         $form = new ApplicationForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description'), 'source_url' => $request->getParameter('source_url')));
         if ($form->isValid()) {
             $application = Application::update($form->getValues(), $user);
             if ($application) {
                 $output = '<rsp stat="ok">' . $application->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="4" msg="Unable to update application." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="4" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'comment') {
         $form = new CommentForm();
         $application_id = $module_id = $theme_id = null;
         if ($request->getParameter('application_id')) {
             $application_id = $request->getParameter('application_id');
         }
         if ($request->getParameter('module_id')) {
             $module_id = $request->getParameter('module_id');
         }
         if ($request->getParameter('theme_id')) {
             $theme_id = $request->getParameter('theme_id');
         }
         $form->bind(array('comment' => $request->getParameter('comment'), 'application_id' => $application_id, 'module_id' => $module_id, 'theme_id' => $theme_id));
         if ($form->isValid()) {
             $comment = Comment::update($form->getValues(), $user);
             $output = '<rsp stat="ok">' . $comment->getXML() . '</rsp>';
         } else {
             $output = '<rsp stat="fail"><err code="3" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'module') {
         $form = new ModuleForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description'), 'source_url' => $request->getParameter('source_url'), 'application_id' => $request->getParameter('application_id')));
         if ($form->isValid()) {
             $module = Madule::update($form->getValues(), $user);
             if ($module) {
                 $output = '<rsp stat="ok">' . $module->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="4" msg="Unable to update module." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="4" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'theme') {
         $form = new ThemeForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'description' => $request->getParameter('description')), $request->getFiles());
         if ($form->isValid()) {
             $theme = Theme::update($form->getValues(), $user);
             if ($theme) {
                 $output = '<rsp stat="ok">' . $theme->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="5" msg="Unable to update theme." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="5" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     } elseif ($object == 'theme_group') {
         $output = '<rsp stat="fail"><err code="6" msg="This object is not supported for update" /></rsp>';
     } elseif ($object == 'user') {
         $form = new UserForm();
         $form->bind(array('id' => $request->getParameter('id'), 'name' => $request->getParameter('name'), 'password' => $request->getParameter('password'), 'password2' => $request->getParameter('password'), 'email' => $request->getParameter('email'), 'role' => null));
         if ($form->isValid()) {
             $update_user = User::update($form->getValues(), $user);
             if ($update_user) {
                 $output = '<rsp stat="ok">' . $update_user->getXML() . '</rsp>';
             } else {
                 $output = '<rsp stat="fail"><err code="7" msg="Unable to update user." /></rsp>';
             }
         } else {
             $output = '<rsp stat="fail"><err code="7" msg="' . $form->getErrorSchema() . '" /></rsp>';
         }
     }
     $this->output = $output;
     $this->setTemplate('index');
 }
示例#7
0
 /**
  * Get data of Cases OutputDocument
  *
  * @param string $applicationUid
  * @param string $outputDocumentUid
  * @param string $userUid
  *
  * return object Return an object with data of an OutputDocument
  */
 public function addCasesOutputDocument($applicationUid, $outputDocumentUid, $userUid)
 {
     try {
         $sApplication = $applicationUid;
         $index = \AppDelegation::getCurrentIndex($applicationUid);
         $sUserLogged = $userUid;
         $outputID = $outputDocumentUid;
         $g = new \G();
         $g->sessionVarSave();
         \G::LoadClass('case');
         $oCase = new \Cases();
         $oCase->thisIsTheCurrentUser($sApplication, $index, $sUserLogged, '', 'casesListExtJs');
         //require_once 'classes/model/OutputDocument.php';
         $oOutputDocument = new \OutputDocument();
         $aOD = $oOutputDocument->load($outputID);
         $Fields = $oCase->loadCase($sApplication);
         $sFilename = preg_replace('[^A-Za-z0-9_]', '_', \G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
         require_once PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppFolder.php";
         require_once PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppDocument.php";
         //Get the Custom Folder ID (create if necessary)
         $oFolder = new \AppFolder();
         $folderId = $oFolder->createFromPath($aOD['OUT_DOC_DESTINATION_PATH'], $sApplication);
         //Tags
         $fileTags = $oFolder->parseTags($aOD['OUT_DOC_TAGS'], $sApplication);
         //Get last Document Version and apply versioning if is enabled
         $oAppDocument = new \AppDocument();
         $lastDocVersion = $oAppDocument->getLastDocVersion($outputID, $sApplication);
         $oCriteria = new \Criteria('workflow');
         $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplication);
         $oCriteria->add(\AppDocumentPeer::DOC_UID, $outputID);
         $oCriteria->add(\AppDocumentPeer::DOC_VERSION, $lastDocVersion);
         $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
         $oDataset = \AppDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         if ($aOD['OUT_DOC_VERSIONING'] && $lastDocVersion != 0) {
             //Create new Version of current output
             $lastDocVersion++;
             if ($aRow = $oDataset->getRow()) {
                 $aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion + 1, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
                 $oAppDocument = new \AppDocument();
                 $oAppDocument->create($aFields);
                 $sDocUID = $aRow['APP_DOC_UID'];
             }
         } else {
             ////No versioning so Update a current Output or Create new if no exist
             if ($aRow = $oDataset->getRow()) {
                 //Update
                 $aFields = array('APP_DOC_UID' => $aRow['APP_DOC_UID'], 'APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
                 $oAppDocument = new \AppDocument();
                 $oAppDocument->update($aFields);
                 $sDocUID = $aRow['APP_DOC_UID'];
             } else {
                 //we are creating the appdocument row
                 //create
                 if ($lastDocVersion == 0) {
                     $lastDocVersion++;
                 }
                 $aFields = array('APP_UID' => $sApplication, 'DEL_INDEX' => $index, 'DOC_UID' => $outputID, 'DOC_VERSION' => $lastDocVersion, 'USR_UID' => $sUserLogged, 'APP_DOC_TYPE' => 'OUTPUT', 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), 'APP_DOC_FILENAME' => $sFilename, 'FOLDER_UID' => $folderId, 'APP_DOC_TAGS' => $fileTags);
                 $oAppDocument = new \AppDocument();
                 $aFields['APP_DOC_UID'] = $sDocUID = $oAppDocument->create($aFields);
             }
         }
         $sFilename = $aFields['APP_DOC_UID'] . "_" . $lastDocVersion;
         $pathOutput = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP . 'outdocs' . PATH_SEP;
         //G::pr($sFilename);die;
         \G::mk_dir($pathOutput);
         $aProperties = array();
         if (!isset($aOD['OUT_DOC_MEDIA'])) {
             $aOD['OUT_DOC_MEDIA'] = 'Letter';
         }
         if (!isset($aOD['OUT_DOC_LEFT_MARGIN'])) {
             $aOD['OUT_DOC_LEFT_MARGIN'] = '15';
         }
         if (!isset($aOD['OUT_DOC_RIGHT_MARGIN'])) {
             $aOD['OUT_DOC_RIGHT_MARGIN'] = '15';
         }
         if (!isset($aOD['OUT_DOC_TOP_MARGIN'])) {
             $aOD['OUT_DOC_TOP_MARGIN'] = '15';
         }
         if (!isset($aOD['OUT_DOC_BOTTOM_MARGIN'])) {
             $aOD['OUT_DOC_BOTTOM_MARGIN'] = '15';
         }
         $aProperties['media'] = $aOD['OUT_DOC_MEDIA'];
         $aProperties['margins'] = array('left' => $aOD['OUT_DOC_LEFT_MARGIN'], 'right' => $aOD['OUT_DOC_RIGHT_MARGIN'], 'top' => $aOD['OUT_DOC_TOP_MARGIN'], 'bottom' => $aOD['OUT_DOC_BOTTOM_MARGIN']);
         if (isset($aOD['OUT_DOC_REPORT_GENERATOR'])) {
             $aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
         }
         $this->generate($outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (bool) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties, $applicationUid);
         /*----------------------------------********---------------------------------*/
         $licensedFeatures =& \PMLicensedFeatures::getSingleton();
         if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
             \G::LoadClass("pmDrive");
             $pmDrive = new \PMDrive();
             if ($pmDrive->getStatusService()) {
                 $app = new \Application();
                 $user = new \Users();
                 $dataUser = $user->load($userUid);
                 $pmDrive->setDriveUser($dataUser['USR_EMAIL']);
                 $appData = $app->Load($applicationUid);
                 if ($appData['APP_DRIVE_FOLDER_UID'] == null) {
                     $process = new \Process();
                     $process->setProUid($appData['PRO_UID']);
                     $result = $pmDrive->createFolder($process->getProTitle() . ' - ' . G::LoadTranslation("ID_CASE") . ' #' . $appData['APP_NUMBER'], $pmDrive->getFolderIdPMDrive($userUid));
                     $appData['APP_DRIVE_FOLDER_UID'] = $result->id;
                     $app->update($appData);
                 }
                 $fileIdDriveDoc = '';
                 $fileIdDrivePdf = '';
                 $sFilenameOriginal = preg_replace('[^A-Za-z0-9_]', '_', \G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
                 switch ($aOD['OUT_DOC_GENERATE']) {
                     case "BOTH":
                         $result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf', $sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
                         $oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
                         $fileIdDrivePdf = $result->id;
                         $result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc', $sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
                         $oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
                         $fileIdDriveDoc = $result->id;
                         break;
                     case "PDF":
                         $result = $pmDrive->uploadFile('application/pdf', $pathOutput . $sFilename . '.pdf', $sFilenameOriginal . '.pdf', $appData['APP_DRIVE_FOLDER_UID']);
                         $oAppDocument->setDriveDownload('OUTPUT_PDF', $result->webContentLink);
                         $fileIdDrivePdf = $result->id;
                         break;
                     case "DOC":
                         $result = $pmDrive->uploadFile('application/doc', $pathOutput . $sFilename . '.doc', $sFilenameOriginal . '.doc', $appData['APP_DRIVE_FOLDER_UID']);
                         $oAppDocument->setDriveDownload('OUTPUT_DOC', $result->webContentLink);
                         $fileIdDriveDoc = $result->id;
                         break;
                 }
                 $aFields['DOC_VERSION'] = $oAppDocument->getDocVersion();
                 // $docVersion;
                 $aFields['APP_DOC_UID'] = $oAppDocument->getAppDocUid();
                 //$appDocUid;
                 $appDocUid = $aFields['APP_DOC_UID'];
                 $oAppDocument->update($aFields);
                 //$option = 'pmDrive';
                 //add permissions
                 $criteria = new \Criteria('workflow');
                 $criteria->addSelectColumn(\ApplicationPeer::PRO_UID);
                 $criteria->addSelectColumn(\TaskUserPeer::TAS_UID);
                 $criteria->addSelectColumn(\TaskUserPeer::USR_UID);
                 $criteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
                 $criteria->add(\ApplicationPeer::APP_UID, $applicationUid);
                 $criteria->addJoin(\ApplicationPeer::PRO_UID, \TaskPeer::PRO_UID, \Criteria::LEFT_JOIN);
                 $criteria->addJoin(\TaskPeer::TAS_UID, \TaskUserPeer::TAS_UID, \Criteria::LEFT_JOIN);
                 $dataset = \ApplicationPeer::doSelectRS($criteria);
                 $dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                 $userPermission = array();
                 $case = new \Cases();
                 while ($dataset->next()) {
                     $row = $dataset->getRow();
                     if ($row['TU_RELATION'] == 1) {
                         //users
                         $dataUser = $user->load($row['USR_UID']);
                         if (array_search($dataUser['USR_EMAIL'], $userPermission) === false) {
                             $objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid, $row['TAS_UID'], $row['USR_UID']);
                             if (array_search($appDocUid, $objectPermissions['OUTPUT_DOCUMENTS']) !== false) {
                                 $userPermission[] = $dataUser['USR_EMAIL'];
                             }
                         }
                     } else {
                         //Groups
                         $criteria = new \Criteria('workflow');
                         $criteria->addSelectColumn(\UsersPeer::USR_EMAIL);
                         $criteria->addSelectColumn(\UsersPeer::USR_UID);
                         $criteria->add(\GroupUserPeer::GRP_UID, $row['USR_UID']);
                         $criteria->addJoin(\GroupUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
                         $oDataset = \AppDelegationPeer::doSelectRS($criteria);
                         $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                         while ($oDataset->next()) {
                             $aRow = $oDataset->getRow();
                             if (array_search($aRow['USR_EMAIL'], $userPermission) === false) {
                                 $objectPermissions = $case->getAllObjects($row['PRO_UID'], $applicationUid, $row['TAS_UID'], $aRow['USR_UID']);
                                 if (array_search($appDocUid, $objectPermissions['OUTPUT_DOCUMENTS']) !== false) {
                                     $userPermission[] = $aRow['USR_EMAIL'];
                                 }
                             }
                         }
                     }
                 }
                 $userPermission = array_unique($userPermission);
                 foreach ($userPermission as $key => $val) {
                     $pmDrive->setPermission($appData['APP_DRIVE_FOLDER_UID'], $val, 'user', 'writer');
                     $pmDrive->setPermission($fileIdDrivePdf, $val);
                     $pmDrive->setPermission($fileIdDriveDoc, $val);
                 }
             }
         }
         /*----------------------------------********---------------------------------*/
         //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
         //G::LoadClass('plugin');
         $oPluginRegistry =& \PMPluginRegistry::getSingleton();
         if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
             $triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
             $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
             $oAppDocument1 = new \AppDocument();
             $oAppDocument1->update($aFields);
             $sPathName = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP;
             $oData['APP_UID'] = $sApplication;
             $oData['ATTACHMENT_FOLDER'] = true;
             switch ($aOD['OUT_DOC_GENERATE']) {
                 case "BOTH":
                     $documentData = new \uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
                     $documentData->sFileType = "PDF";
                     $documentData->bUseOutputFolder = true;
                     $uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
                     if ($uploadReturn) {
                         //Only delete if the file was saved correctly
                         unlink($pathOutput . $sFilename . '.pdf');
                     }
                     $documentData = new \uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion());
                     $documentData->sFileType = "DOC";
                     $documentData->bUseOutputFolder = true;
                     $uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
                     if ($uploadReturn) {
                         //Only delete if the file was saved correctly
                         unlink($pathOutput . $sFilename . '.doc');
                     }
                     break;
                 case "PDF":
                     $documentData = new \uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.pdf', $sFilename . '.pdf', $sDocUID, $oAppDocument->getDocVersion());
                     $documentData->sFileType = "PDF";
                     $documentData->bUseOutputFolder = true;
                     $uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
                     if ($uploadReturn) {
                         //Only delete if the file was saved correctly
                         unlink($pathOutput . $sFilename . '.pdf');
                     }
                     break;
                 case "DOC":
                     $documentData = new \uploadDocumentData($sApplication, $sUserLogged, $pathOutput . $sFilename . '.doc', $sFilename . '.doc', $sDocUID, $oAppDocument->getDocVersion());
                     $documentData->sFileType = "DOC";
                     $documentData->bUseOutputFolder = true;
                     $uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
                     if ($uploadReturn) {
                         //Only delete if the file was saved correctly
                         unlink($pathOutput . $sFilename . '.doc');
                     }
                     break;
             }
         }
         $g->sessionVarRestore();
         $oAppDocument = \AppDocumentPeer::retrieveByPK($aFields['APP_DOC_UID'], $lastDocVersion);
         if ($oAppDocument->getAppDocStatus() == 'DELETED') {
             $oAppDocument->setAppDocStatus('ACTIVE');
             $oAppDocument->save();
         }
         $response = $this->getCasesOutputDocument($applicationUid, $userUid, $aFields['APP_DOC_UID']);
         return $response;
     } catch (\Exception $e) {
         throw $e;
     }
 }
 public function executeUpdate($request)
 {
     $this->prepareUpdate();
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->form->bind($request->getParameter('application'), $request->getFiles('application'));
         if ($this->form->isValid()) {
             $application = Application::update($this->form->getValues(), $this->getUser()->getUser());
             $this->redirect('/application/read?id=' . $application->getId());
         }
     }
 }