Merged in feature/PMCORE-4086 (pull request #8675)

PMCORE-4086 Supervisor > multiple step > the `Case Details` is not displayed when the last dynaform passed

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Roly Gutierrez
2023-01-05 15:42:01 +00:00
committed by Julio Cesar Laura Avendaño
5 changed files with 59 additions and 50 deletions

View File

@@ -2642,18 +2642,18 @@ class PmDynaform
/**
* Get html navigation bar for steps to revise.
* @param string $appUid
* @param string $dynUid
* @param string $uid
* @param int $delIndex
* @return string
*/
public static function navigationBarForStepsToRevise(string $appUid, string $dynUid, int $delIndex): string
public static function navigationBarForStepsToRevise(string $appUid, string $uid, int $delIndex): string
{
$navbar = '';
$cases = new Cases();
$steps = $cases->getAllUrlStepsToRevise($appUid, $delIndex);
$n = count($steps);
foreach ($steps as $key => $step) {
if ($step['uid'] === $dynUid) {
if ($step['uid'] === $uid) {
$previousLabel = '';
$previousUrl = '';
$nextLabel = '';
@@ -2666,6 +2666,14 @@ class PmDynaform
$nextLabel = G::LoadTranslation('ID_NEXT');
$nextUrl = $steps[$key + 1]['url'];
}
if (empty($nextUrl)) {
$nextLabel = G::LoadTranslation('ID_FINISH');
$nextUrl = 'javascript:if(window.parent && window.parent.parent){window.parent.parent.postMessage("redirect=MyCases","*");}';
}
//this condition modify the next Url for submit action
if ($step['type'] === 'DYNAFORM') {
$nextUrl = 'javascript:document.querySelector(".pmdynaform-container .pmdynaform-form").submit();';
}
$navbar = "<div style='width:100%;padding:0px 10px 0px 10px;margin:15px 0px 0px 0px;'>" .
" <img src='/images/bulletButtonLeft.gif' style='float:left;'>&nbsp;" .
" <a href='{$previousUrl}' style='float:left;font-size:12px;line-height:1;margin:0px 0px 1px 5px;text-decoration:none;!important;'>" .

View File

@@ -1,29 +1,7 @@
<?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
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
@@ -210,6 +188,21 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
//Define the STEP_POSITION
$ex = isset($_GET['ex']) ? $_GET['ex'] : 0;
//go to the next step
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
G::header( 'Location: cases_StepToRevise?type=DYNAFORM&ex=' . $ex . '&PRO_UID=' . $_SESSION['PROCESS'] . '&DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&position=' . $aNextStep['POSITION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );
$nextSteps = $oCase->getNextSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION']);
$url = '';
$steps = (new BusinessModelCases())->getAllUrlStepsToRevise($_SESSION['APPLICATION'], $_SESSION['INDEX']);
$n = count($steps);
foreach ($steps as $key => $step) {
if ($step['uid'] === $nextSteps['UID'] && $key + 1 < $n) {
$nextUrl = $steps[$key + 1]['url'];
$url = $nextUrl;
break;
}
}
if (empty($url)) {
die('<script type="text/javascript">'
. 'if(window.parent && window.parent.parent){window.parent.parent.postMessage("redirect=MyCases","*");}'
. '</script>');
}
G::header('Location:' . $url);
die();

View File

@@ -4483,36 +4483,34 @@ class Cases
{
$result = [];
$dynaformStep = $this->getStepsToRevise($appUid, 'DYNAFORM');
$i = 0;
foreach ($dynaformStep as $step) {
$url = "cases_StepToRevise?"
. "type=DYNAFORM&"
. "ex={$i}&"
. "PRO_UID={$step["PRO_UID"]}&"
. "DYN_UID={$step['STEP_UID_OBJ']}&"
. "APP_UID={$appUid}&"
. "position={$step['STEP_POSITION']}&"
. "DEL_INDEX={$delIndex}";
$result[] = [
'uid' => $step['STEP_UID_OBJ'],
'url' => $url
];
$i++;
}
$inputDocumentStep = $this->getStepsToRevise($appUid, 'INPUT_DOCUMENT');
$objects = array_merge($dynaformStep, $inputDocumentStep);
usort($objects, function ($a, $b) {
return $a['STEP_POSITION'] > $b['STEP_POSITION'];
});
$i = 0;
foreach ($inputDocumentStep as $step) {
$url = "cases_StepToReviseInputs?"
. "type=INPUT_DOCUMENT&"
$endPoint = '';
$uidName = '';
foreach ($objects as $step) {
if ($step['STEP_TYPE_OBJ'] === 'DYNAFORM') {
$endPoint = 'cases_StepToRevise';
$uidName = 'DYN_UID';
}
if ($step['STEP_TYPE_OBJ'] === 'INPUT_DOCUMENT') {
$endPoint = 'cases_StepToReviseInputs';
$uidName = 'INP_DOC_UID';
}
$url = "{$endPoint}?"
. "type={$step['STEP_TYPE_OBJ']}&"
. "ex={$i}&"
. "PRO_UID={$step["PRO_UID"]}&"
. "INP_DOC_UID={$step['STEP_UID_OBJ']}&"
. "{$uidName}={$step['STEP_UID_OBJ']}&"
. "APP_UID={$appUid}&"
. "position={$step['STEP_POSITION']}&"
. "DEL_INDEX={$delIndex}";
$result[] = [
'uid' => $step['STEP_UID_OBJ'],
'type' => $step['STEP_TYPE_OBJ'],
'url' => $url
];
$i++;

View File

@@ -531,7 +531,8 @@ Ext.onReady(function(){
},
iconCls: 'ICON_STEPS',
toggleHandler: togglePreview,
disabled: true
disabled: true,
hidden: true
}, {
id: 'informationMenu',
text: _('ID_INFORMATION'),