Merged in bugfix/PMCORE-4084 (pull request #8663)
PMCORE-4084 Supervisor > multiple step > Previous and Next step buttons are not displayed Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
@@ -1377,8 +1377,16 @@ class PmDynaform
|
||||
exit();
|
||||
}
|
||||
|
||||
public function printEditSupervisor()
|
||||
/**
|
||||
* Print edit supervisor forms.
|
||||
* @param array $param
|
||||
*/
|
||||
public function printEditSupervisor(array $param = [])
|
||||
{
|
||||
$navbar = '';
|
||||
if (isset($param['DEL_INDEX'])) {
|
||||
$navbar = self::navigationBarForStepsToRevise($this->fields["APP_UID"], $this->fields["CURRENT_DYNAFORM"], $param['DEL_INDEX']);
|
||||
}
|
||||
ob_clean();
|
||||
$json = G::json_decode($this->record["DYN_CONTENT"]);
|
||||
$this->jsonr($json);
|
||||
@@ -1405,6 +1413,7 @@ class PmDynaform
|
||||
" . $this->getTheStringVariableForGoogleMaps() . "
|
||||
</script>
|
||||
<script type=\"text/javascript\" src=\"/jscore/cases/core/pmDynaform.js\"></script>
|
||||
{$navbar}
|
||||
<div>
|
||||
" . $this->getSessionMessageForSupervisor() . "
|
||||
<div style=\"display: none;\">
|
||||
@@ -2629,4 +2638,46 @@ class PmDynaform
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get html navigation bar for steps to revise.
|
||||
* @param string $appUid
|
||||
* @param string $dynUid
|
||||
* @param int $delIndex
|
||||
* @return string
|
||||
*/
|
||||
public static function navigationBarForStepsToRevise(string $appUid, string $dynUid, int $delIndex): string
|
||||
{
|
||||
$navbar = '';
|
||||
$cases = new Cases();
|
||||
$steps = $cases->getAllUrlStepsToRevise($appUid, $delIndex);
|
||||
$n = count($steps);
|
||||
foreach ($steps as $key => $step) {
|
||||
if ($step['uid'] === $dynUid) {
|
||||
$previousLabel = '';
|
||||
$previousUrl = '';
|
||||
$nextLabel = '';
|
||||
$nextUrl = '';
|
||||
if ($key - 1 >= 0) {
|
||||
$previousLabel = G::LoadTranslation('ID_PREVIOUS');
|
||||
$previousUrl = $steps[$key - 1]['url'];
|
||||
}
|
||||
if ($key + 1 < $n) {
|
||||
$nextLabel = G::LoadTranslation('ID_NEXT');
|
||||
$nextUrl = $steps[$key + 1]['url'];
|
||||
}
|
||||
$navbar = "<div style='width:100%;padding:0px 10px 0px 10px;margin:15px 0px 0px 0px;'>" .
|
||||
" <img src='/images/bulletButtonLeft.gif' style='float:left;'> " .
|
||||
" <a href='{$previousUrl}' style='float:left;font-size:12px;line-height:1;margin:0px 0px 1px 5px;text-decoration:none;!important;'>" .
|
||||
" {$previousLabel}" .
|
||||
" </a>" .
|
||||
" <img src='/images/bulletButton.gif' style='float:right;'> " .
|
||||
" <a href='{$nextUrl}' style='float:right;font-size:12px;line-height:1;margin:0px 5px 1px 0px;text-decoration:none;!important;'>" .
|
||||
" {$nextLabel}" .
|
||||
" </a>" .
|
||||
"</div>";
|
||||
}
|
||||
}
|
||||
return $navbar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Step.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.
|
||||
*/
|
||||
// die("first");
|
||||
/* Permissions */
|
||||
|
||||
$filter = new InputFilter();
|
||||
$_GET = $filter->xssFilterHard($_GET, "url");
|
||||
@@ -151,7 +127,7 @@ if ($_GET['DYN_UID'] != '') {
|
||||
$FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID'];
|
||||
$a = new PmDynaform($FieldsPmDynaform);
|
||||
if ($a->isResponsive()) {
|
||||
$a->printEditSupervisor();
|
||||
$a->printEditSupervisor(['DEL_INDEX' => $_GET['DEL_INDEX']]);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID=' . $_GET['DYN_UID'] . '&ex=' . $_GET['ex']);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Step.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.
|
||||
*/
|
||||
//die("second");
|
||||
/* Permissions */
|
||||
|
||||
$filter = new InputFilter();
|
||||
$_GET = $filter->xssFilterHard($_GET, "url");
|
||||
@@ -119,13 +95,8 @@ if (! isset($_GET['INP_DOC_UID'])) {
|
||||
$Fields['MESSAGE2'] = G::LoadTranslation('ID_PLEASE_SELECT_FILE');
|
||||
$docName = $Fields['INP_DOC_TITLE'];
|
||||
$oHeadPublisher->addScriptCode('var documentName=\'Reviewing Input Document<br>' . $docName . '\';');
|
||||
// $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', $Fields, 'cases_SupervisorSaveDocument?UID=' .
|
||||
//$_GET['INP_DOC_UID'] . '&APP_UID=' . $_GET['APP_UID'] . '&position=' . $_GET['position']);
|
||||
$G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), array_merge(array('DOC_UID' => $_GET['INP_DOC_UID']
|
||||
), $Fields));
|
||||
//$aFields
|
||||
// $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList',
|
||||
//$oCase->getInputDocumentsCriteria($_SESSION['APPLICATION']));//$aFields
|
||||
$G_PUBLISH->AddContent('view','cases/paged-table-inputDocumentsToReviseNavBar');
|
||||
$G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), array_merge(['DOC_UID' => $_GET['INP_DOC_UID']], $Fields));
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
@@ -58,6 +58,7 @@ use ProcessMaker\Model\GroupUser;
|
||||
use ProcessMaker\Model\ListUnassigned;
|
||||
use ProcessMaker\Model\Triggers;
|
||||
use ProcessMaker\Model\ProcessUser;
|
||||
use ProcessMaker\Model\StepSupervisor;
|
||||
use ProcessMaker\Model\Task;
|
||||
use ProcessMaker\Model\User;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
@@ -4453,4 +4454,70 @@ class Cases
|
||||
// Return results
|
||||
return $dynaForms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get objects that they have send it.
|
||||
* @param string $appUid
|
||||
* @param string $typeObject
|
||||
* @return array
|
||||
*/
|
||||
public function getStepsToRevise(string $appUid, string $typeObject): array
|
||||
{
|
||||
$application = ModelApplication::where('APP_UID', '=', $appUid)
|
||||
->first();
|
||||
$result = StepSupervisor::where('PRO_UID', '=', $application['PRO_UID'])->
|
||||
where('STEP_TYPE_OBJ', '=', $typeObject)->
|
||||
orderBy('STEP_POSITION', 'ASC')->
|
||||
get()->
|
||||
toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all url steps to revise.
|
||||
* @param string $appUid
|
||||
* @param int $delIndex
|
||||
* @return array
|
||||
*/
|
||||
public function getAllUrlStepsToRevise(string $appUid, int $delIndex): array
|
||||
{
|
||||
$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');
|
||||
$i = 0;
|
||||
foreach ($inputDocumentStep as $step) {
|
||||
$url = "cases_StepToReviseInputs?"
|
||||
. "type=INPUT_DOCUMENT&"
|
||||
. "ex={$i}&"
|
||||
. "PRO_UID={$step["PRO_UID"]}&"
|
||||
. "INP_DOC_UID={$step['STEP_UID_OBJ']}&"
|
||||
. "APP_UID={$appUid}&"
|
||||
. "position={$step['STEP_POSITION']}&"
|
||||
. "DEL_INDEX={$delIndex}";
|
||||
$result[] = [
|
||||
'uid' => $step['STEP_UID_OBJ'],
|
||||
'url' => $url
|
||||
];
|
||||
$i++;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
17
workflow/engine/src/ProcessMaker/Model/StepSupervisor.php
Normal file
17
workflow/engine/src/ProcessMaker/Model/StepSupervisor.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use App\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StepSupervisor extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'STEP_SUPERVISOR';
|
||||
protected $primaryKey = 'STEP_UID';
|
||||
public $incrementing = false;
|
||||
public $timestamps = false;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
$navbar = PmDynaform::navigationBarForStepsToRevise($_GET['APP_UID'], $_GET['INP_DOC_UID'], $_GET['DEL_INDEX']);
|
||||
|
||||
echo '<div class="pagedTableDefault" style="border:none;margin:0px;padding:0px;margin-right:20px;margin-top:-3px;">'
|
||||
. '<div class="headerContent" style="border:none;margin:0px;padding:0px;">'
|
||||
. '<div class="tableOption" style="border:none;margin:0px;padding:0px;">'
|
||||
. $navbar
|
||||
. '</div>'
|
||||
. '</div>'
|
||||
. '</div>';
|
||||
Reference in New Issue
Block a user