Merged in dheeyi/processmaker/PM-3567 (pull request #2837)

PM-3567
This commit is contained in:
Julio Cesar Laura Avendaño
2015-09-25 15:44:29 -04:00
5 changed files with 97 additions and 79 deletions

View File

@@ -2377,7 +2377,6 @@ class Cases
public function getNextSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM')
{
$iPosition += 1;
$oCriteria = new Criteria();
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType);
@@ -2390,7 +2389,7 @@ class Cases
$oCriteria = new Criteria();
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
$oCriteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $sType);
$oCriteria->add(StepSupervisorPeer::STEP_POSITION, 1);
$oCriteria->add(StepSupervisorPeer::STEP_POSITION, ($iPosition+1));
$oDataset = StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();

View File

@@ -3331,7 +3331,7 @@ class processMap
public function assignSupervisorStep($sProcessUID, $sObjType, $sObjUID)
{
$oStepSupervisor = new StepSupervisor();
$oStepSupervisor->create(array('PRO_UID' => $sProcessUID, 'STEP_TYPE_OBJ' => $sObjType, 'STEP_UID_OBJ' => $sObjUID, 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, $sObjType)));
$oStepSupervisor->create(array('PRO_UID' => $sProcessUID, 'STEP_TYPE_OBJ' => $sObjType, 'STEP_UID_OBJ' => $sObjUID, 'STEP_POSITION' => $oStepSupervisor->getNextPositionAll($sProcessUID, $sObjType)));
}
/**

View File

@@ -956,9 +956,6 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$Fields['actionType'] = $_POST['actionType'];
$Fields["docVersion"] = (int)($_POST["docVersion"]);
$appDocument = new AppDocument();
$arrayAppDocumentData = $appDocument->load($_POST["appDocId"]);
$oInputDocument = new InputDocument();
$InpDocData = $oInputDocument->load( $Fields['DOC_UID'] );
@@ -971,7 +968,13 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) {
$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_SupervisorSaveDocument?APP_DOC_UID=' . $_POST['appDocId'] . "&DOC_VERSION=" . ($Fields['docVersion'] + 1) . '&APP_UID=' . $arrayAppDocumentData["APP_UID"] . '&UID=' . $_POST['docID']);
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'] );
}
G::RenderPage( 'publish', 'raw' );
break;
case "inputDocumentVersionHistory":

View File

@@ -1,68 +1,68 @@
<?php
/**
* cases_SaveData.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//validate the data post
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
$flagDynaFormNewVersion = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
if ($flagDynaFormNewVersion) {
$dataForm = $_POST["form"];
}
$oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM );
$oForm->validatePost();
/* Includes */
G::LoadClass( 'case' );
//load the variables
$oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] );
if ($flagDynaFormNewVersion) {
$Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], $dataForm);
}
$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] );
//save data
$aData = array ();
$aData['APP_NUMBER'] = $Fields['APP_NUMBER'];
$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS'];
$aData['APP_DATA'] = $Fields['APP_DATA'];
$aData['DEL_INDEX'] = $_SESSION['INDEX'];
$aData['TAS_UID'] = $_SESSION['TASK'];
$aData['CURRENT_DYNAFORM'] = $_GET['UID'];
$aData['PRO_UID'] = $Fields['PRO_UID'];
$aData['USER_UID'] = $_SESSION['USER_LOGGED'];
$aData['APP_STATUS'] = $Fields['APP_STATUS'];
//$aData = $oCase->loadCase( $_SESSION['APPLICATION'] );
<?php
/**
* cases_SaveData.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//validate the data post
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
$flagDynaFormNewVersion = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
if ($flagDynaFormNewVersion) {
$dataForm = $_POST["form"];
}
$oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM );
$oForm->validatePost();
/* Includes */
G::LoadClass( 'case' );
//load the variables
$oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] );
if ($flagDynaFormNewVersion) {
$Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], $dataForm);
}
$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] );
//save data
$aData = array ();
$aData['APP_NUMBER'] = $Fields['APP_NUMBER'];
$aData['APP_PROC_STATUS'] = $Fields['APP_PROC_STATUS'];
$aData['APP_DATA'] = $Fields['APP_DATA'];
$aData['DEL_INDEX'] = $_SESSION['INDEX'];
$aData['TAS_UID'] = $_SESSION['TASK'];
$aData['CURRENT_DYNAFORM'] = $_GET['UID'];
$aData['PRO_UID'] = $Fields['PRO_UID'];
$aData['USER_UID'] = $_SESSION['USER_LOGGED'];
$aData['APP_STATUS'] = $Fields['APP_STATUS'];
//$aData = $oCase->loadCase( $_SESSION['APPLICATION'] );
$oCase->updateCase( $_SESSION['APPLICATION'], $aData );
G::SendTemporalMessage( 'ID_SAVED_SUCCESSFULLY', 'info' );
G::SendTemporalMessage( 'ID_SAVED_SUCCESSFULLY', 'info' );
//Save files
if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$arrayField = array ();
@@ -204,10 +204,9 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
}
}
}
}
//go to the next step
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
G::header( 'location: cases_StepToRevise?DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );
}
//go to the next step
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
G::header( 'location: cases_StepToRevise?DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );

View File

@@ -96,7 +96,24 @@ if (! isset( $_GET['type'] )) {
$_GET['type'] = 'DYNAFORM';
}
if (! isset( $_GET['position'] )) {
$_GET['position'] = 1;
$_GET['position'] = $_SESSION['STEP_POSITION'];
}else{
if($_GET['type'] == 'DYNAFORM'){
$criteria = new Criteria();
$criteria->addSelectColumn(StepSupervisorPeer::STEP_POSITION);
$criteria->add(StepSupervisorPeer::PRO_UID, $_SESSION['PROCESS'], Criteria::EQUAL);
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $_GET['DYN_UID'], Criteria::EQUAL);
$rsCriteria = StepSupervisorPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$aRow = $rsCriteria->getRow();
$_GET['position'] = $aRow['STEP_POSITION'];
}else{
$_GET['position'] = 1;
}
}
$_SESSION['STEP_POSITION'] = (int) $_GET['position'];