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

@@ -192,6 +192,9 @@ export default {
if ( e.data === "redirect=todo" || e.message === "redirect=todo"){ if ( e.data === "redirect=todo" || e.message === "redirect=todo"){
that.OnClickSidebarItem(that.getItemMenuByValue("page","inbox")); that.OnClickSidebarItem(that.getItemMenuByValue("page","inbox"));
} }
if ( e.data === "redirect=MyCases" || e.message === "redirect=MyCases"){
that.OnClickSidebarItem(that.getItemMenuByValue("page","MyCases"));
}
if ( e.data === "update=debugger" || e.message === "update=debugger"){ if ( e.data === "update=debugger" || e.message === "update=debugger"){
if(that.$refs["component"].updateView){ if(that.$refs["component"].updateView){
that.$refs["component"].updateView(); that.$refs["component"].updateView();
@@ -616,6 +619,9 @@ export default {
*/ */
getItemMenuByValue(key, value) { getItemMenuByValue(key, value) {
let obj = _.find(this.menu, function(o) { let obj = _.find(this.menu, function(o) {
if(o[key] == value){
return true;
}
if(o.component){ if(o.component){
return o.props.item[key] == value; return o.props.item[key] == value;
} }
@@ -624,6 +630,9 @@ export default {
if(obj.component){ if(obj.component){
return obj.props; return obj.props;
} }
if(obj.page){
return {item : obj};
}
return obj; return obj;
}, },
/** /**

View File

@@ -2642,18 +2642,18 @@ class PmDynaform
/** /**
* Get html navigation bar for steps to revise. * Get html navigation bar for steps to revise.
* @param string $appUid * @param string $appUid
* @param string $dynUid * @param string $uid
* @param int $delIndex * @param int $delIndex
* @return string * @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 = ''; $navbar = '';
$cases = new Cases(); $cases = new Cases();
$steps = $cases->getAllUrlStepsToRevise($appUid, $delIndex); $steps = $cases->getAllUrlStepsToRevise($appUid, $delIndex);
$n = count($steps); $n = count($steps);
foreach ($steps as $key => $step) { foreach ($steps as $key => $step) {
if ($step['uid'] === $dynUid) { if ($step['uid'] === $uid) {
$previousLabel = ''; $previousLabel = '';
$previousUrl = ''; $previousUrl = '';
$nextLabel = ''; $nextLabel = '';
@@ -2666,6 +2666,14 @@ class PmDynaform
$nextLabel = G::LoadTranslation('ID_NEXT'); $nextLabel = G::LoadTranslation('ID_NEXT');
$nextUrl = $steps[$key + 1]['url']; $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;'>" . $navbar = "<div style='width:100%;padding:0px 10px 0px 10px;margin:15px 0px 0px 0px;'>" .
" <img src='/images/bulletButtonLeft.gif' style='float:left;'>&nbsp;" . " <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;'>" . " <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 <?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\Plugins\PluginRegistry;
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]); $dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
@@ -210,6 +188,21 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
//Define the STEP_POSITION //Define the STEP_POSITION
$ex = isset($_GET['ex']) ? $_GET['ex'] : 0; $ex = isset($_GET['ex']) ? $_GET['ex'] : 0;
//go to the next step //go to the next step
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] ); $nextSteps = $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'] ); $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(); die();

View File

@@ -4483,36 +4483,34 @@ class Cases
{ {
$result = []; $result = [];
$dynaformStep = $this->getStepsToRevise($appUid, 'DYNAFORM'); $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'); $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; $i = 0;
foreach ($inputDocumentStep as $step) { $endPoint = '';
$url = "cases_StepToReviseInputs?" $uidName = '';
. "type=INPUT_DOCUMENT&" 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}&" . "ex={$i}&"
. "PRO_UID={$step["PRO_UID"]}&" . "PRO_UID={$step["PRO_UID"]}&"
. "INP_DOC_UID={$step['STEP_UID_OBJ']}&" . "{$uidName}={$step['STEP_UID_OBJ']}&"
. "APP_UID={$appUid}&" . "APP_UID={$appUid}&"
. "position={$step['STEP_POSITION']}&" . "position={$step['STEP_POSITION']}&"
. "DEL_INDEX={$delIndex}"; . "DEL_INDEX={$delIndex}";
$result[] = [ $result[] = [
'uid' => $step['STEP_UID_OBJ'], 'uid' => $step['STEP_UID_OBJ'],
'type' => $step['STEP_TYPE_OBJ'],
'url' => $url 'url' => $url
]; ];
$i++; $i++;

View File

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