diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php index e25409106..b5546c23f 100644 --- a/workflow/engine/classes/class.processMap.php +++ b/workflow/engine/classes/class.processMap.php @@ -2916,13 +2916,15 @@ class processMap if ($archivo != '..') { $one = 0; $two = 0; + $three = 0; $alink = $link . $archivo; $one = count(explode('wsClient.php', $archivo)); $two = count(explode('Post.php', $archivo)); + $three = count(explode('Info.php', $archivo)); - if ($one == 1 && $two == 1) { + if ($one == 1 && $two == 1 && $three == 1) { $arlink = "" . $alink . ""; $linkdelete = sprintf("delete", $alink, $archivo, $sProcessUID); $row[] = array('W_LINK' => $arlink, 'W_FILENAME' => $archivo, 'W_PRO_UID' => $sProcessUID ); diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index 551c0cd87..6d24135fe 100644 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -60,6 +60,10 @@ try { $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "G::RenderPage('publish', 'blank');"; file_put_contents( $pathProcess . $dynTitle . '.php', $sContent ); + + //Create file to display information and prevent resubmission data (Post/Redirect/Get). + \ProcessMaker\BusinessModel\WebEntry::createFileInfo($pathProcess . $dynTitle . "Info.php"); + //creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); @@ -72,6 +76,7 @@ try { $template->assign( 'wsUser', $sWS_USER ); $template->assign( 'wsPass', Bootstrap::hashPassword($sWS_PASS, '', true) ); $template->assign( 'wsRoundRobin', $sWS_ROUNDROBIN ); + $template->assign( 'weTitle', $dynTitle); G::auditLog('WebEntry','Generate web entry with web services ('.$dynTitle.'.php) in process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index d6e6add93..bc8fb90c1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -398,10 +398,10 @@ class WebEntry $weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]); $fileName = $weTitle; - $fileContent = " \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n"; - $fileContent .= "if (\$a->isResponsive()) {"; - $fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");"; - $fileContent .= "} else {"; - $fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; - $fileContent .= " G::RenderPage(\"publish\", \"blank\");"; - $fileContent .= "}"; + $fileContent .= "if (\$a->isResponsive()) {\n"; + $fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");\n"; + $fileContent .= "} else {\n"; + $fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; + $fileContent .= " G::RenderPage(\"publish\", \"blank\");\n"; + $fileContent .= "}\n"; file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent); + //Create file to display information and prevent resubmission data (Post/Redirect/Get). + self::createFileInfo($pathDataPublicProcess . PATH_SEP . $weTitle . "Info.php"); + //Creating the second file, the post file who receive the post form. $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl"; @@ -432,6 +435,7 @@ class WebEntry $template->assign("wsUser", $usrUsername); $template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword); $template->assign("wsRoundRobin", $wsRoundRobin); + $template->assign("weTitle", $weTitle); if ($webEntryInputDocumentAccess == 0) { //Restricted to process permissions @@ -1033,5 +1037,30 @@ class WebEntry return $result; } + /** + * Create file to display information and prevent resubmission data (Post/Redirect/Get). + * @param string $pathFileName + */ + public static function createFileInfo($pathFileName) + { + $code = "" + . "AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n" + . "G::RenderPage(\"publish\", \"blank\");\n" + . "\n"; + file_put_contents($pathFileName, $code); + } + } diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index 079bf370e..772f5d021 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -193,13 +193,11 @@ try { exit( 0 ); } /*----------------------------------********---------------------------------*/ - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage); - G::RenderPage("publish", "blank"); + $_SESSION["__webEntrySuccess__"] = $aMessage; + G::header("location:{weTitle}Info.php"); } catch (Exception $e) { - $G_PUBLISH = new Publisher(); $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; $aMessage["MESSAGE"] = "
" . $e->getMessage() . "
" . $suggest_message . "
"; - $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showMessage", "", $aMessage); - G::RenderPage("publish", "blank"); + $_SESSION["__webEntryError__"] = $aMessage; + G::header("location:{weTitle}Info.php"); }