diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php
index b731cac28..250ebe228 100755
--- a/workflow/engine/classes/class.case.php
+++ b/workflow/engine/classes/class.case.php
@@ -3467,6 +3467,201 @@ class Cases
}
}
+ /**
+ * Add a input document
+ *
+ * Return the application document ID
+ *
+ * @param string $inputDocumentUid Input document ID
+ * @param string $appDocUid Application document ID
+ * @param int $docVersion Document version
+ * @param string $appDocType Document type
+ * @param string $appDocComment Document comment
+ * @param string $inputDocumentAction Action, posible values: null or empty (Add), "R" (Replace), "NV" (New Version)
+ * @param string $applicationUid Application ID
+ * @param int $delIndex Delegation index
+ * @param string $taskUid Task ID
+ * @param string $userUid User ID
+ * @param string $option Option, posible values: "xmlform", "file"
+ * @param string $file File ($_FILES["form"]["name"]["APP_DOC_FILENAME"] or path to file)
+ * @param int $fileError File error ($_FILES["form"]["error"]["APP_DOC_FILENAME"] or 0)
+ * @param string $fileTmpName File temporal name ($_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"] or null)
+ * @return string Return application document ID
+ */
+ public function addInputDocument(
+ $inputDocumentUid,
+ $appDocUid,
+ $docVersion,
+ $appDocType,
+ $appDocComment,
+ $inputDocumentAction,
+ $applicationUid,
+ $delIndex,
+ $taskUid,
+ $userUid,
+ $option,
+ $file,
+ $fileError = 0,
+ $fileTmpName = null
+ ) {
+ $appDocFileName = null;
+ $sw = 0;
+
+ switch ($option) {
+ case "xmlform":
+ $appDocFileName = $file;
+
+ if ($fileError == 0) {
+ $sw = 1;
+ }
+ break;
+ case "file":
+ $appDocFileName = basename($file);
+
+ if (file_exists($file) && is_file($file)) {
+ $sw = 1;
+ }
+ break;
+ }
+
+ if ($sw == 0) {
+ return null;
+ }
+
+ //Info
+ $inputDocument = new InputDocument();
+ $arrayInputDocumentData = $inputDocument->load($inputDocumentUid);
+
+ //Get the Custom Folder ID (create if necessary)
+ $appFolder = new AppFolder();
+ $folderId = $appFolder->createFromPath($arrayInputDocumentData["INP_DOC_DESTINATION_PATH"], $applicationUid);
+
+ $tags = $appFolder->parseTags($arrayInputDocumentData["INP_DOC_TAGS"], $applicationUid);
+
+ $appDocument = new AppDocument();
+ $arrayField = array();
+
+ switch ($inputDocumentAction) {
+ case "R":
+ //Replace
+ $arrayField = array(
+ "APP_DOC_UID" => $appDocUid,
+ "APP_UID" => $applicationUid,
+ "DOC_VERSION" => $docVersion,
+ "DEL_INDEX" => $delIndex,
+ "USR_UID" => $userUid,
+ "DOC_UID" => $inputDocumentUid,
+ "APP_DOC_TYPE" => $appDocType,
+ "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),
+ "APP_DOC_COMMENT" => $appDocComment,
+ "APP_DOC_TITLE" => "",
+ "APP_DOC_FILENAME" => $appDocFileName,
+ "FOLDER_UID" => $folderId,
+ "APP_DOC_TAGS" => $tags
+ );
+
+ $appDocument->update($arrayField);
+ break;
+ case "NV":
+ //New Version
+ $arrayField = array(
+ "APP_DOC_UID" => $appDocUid,
+ "APP_UID" => $applicationUid,
+ "DEL_INDEX" => $delIndex,
+ "USR_UID" => $userUid,
+ "DOC_UID" => $inputDocumentUid,
+ "APP_DOC_TYPE" => $appDocType,
+ "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),
+ "APP_DOC_COMMENT" => $appDocComment,
+ "APP_DOC_TITLE" => "",
+ "APP_DOC_FILENAME" => $appDocFileName,
+ "FOLDER_UID" => $folderId,
+ "APP_DOC_TAGS" => $tags
+ );
+
+ $appDocument->create($arrayField);
+ break;
+ default:
+ //New
+ $arrayField = array(
+ "APP_UID" => $applicationUid,
+ "DEL_INDEX" => $delIndex,
+ "USR_UID" => $userUid,
+ "DOC_UID" => $inputDocumentUid,
+ "APP_DOC_TYPE" => $appDocType,
+ "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),
+ "APP_DOC_COMMENT" => $appDocComment,
+ "APP_DOC_TITLE" => "",
+ "APP_DOC_FILENAME" => $appDocFileName,
+ "FOLDER_UID" => $folderId,
+ "APP_DOC_TAGS" => $tags
+ );
+
+ $appDocument->create($arrayField);
+ break;
+ }
+
+ //Save the file
+ $appDocUid = $appDocument->getAppDocUid();
+ $docVersion = $appDocument->getDocVersion();
+ $arrayInfo = pathinfo($appDocument->getAppDocFilename());
+ $extension = (isset($arrayInfo["extension"]))? $arrayInfo["extension"] : null;
+ $strPathName = PATH_DOCUMENT . $applicationUid . PATH_SEP;
+ $strFileName = $appDocUid . "_" . $docVersion . "." . $extension;
+
+ switch ($option) {
+ case "xmlform":
+ G::uploadFile($fileTmpName, $strPathName, $strFileName);
+ break;
+ case "file":
+ $umaskOld = umask(0);
+
+ if (!is_dir($strPathName)) {
+ G::verifyPath($strPathName, true);
+ }
+
+ copy($file, $strPathName . $strFileName);
+ chmod($strPathName . $strFileName, 0666);
+ umask($umaskOld);
+ break;
+ }
+
+ //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
+ $pluginRegistry = &PMPluginRegistry::getSingleton();
+
+ if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
+ $triggerDetail = $pluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
+ $documentData = new uploadDocumentData(
+ $applicationUid,
+ $userUid,
+ $strPathName . $strFileName,
+ $arrayField["APP_DOC_FILENAME"],
+ $appDocUid,
+ $docVersion
+ );
+ $uploadReturn = $pluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
+
+ if ($uploadReturn) {
+ $arrayField["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
+
+ if (!isset($arrayField["APP_DOC_UID"])) {
+ $arrayField["APP_DOC_UID"] = $appDocUid;
+ }
+
+ if (!isset($arrayField["DOC_VERSION"])) {
+ $arrayField["DOC_VERSION"] = $docVersion;
+ }
+
+ $appDocument->update($arrayField);
+
+ unlink($strPathName . $strFileName);
+ }
+ }
+ //End plugin
+
+ return $appDocUid;
+ }
+
/*
* Return the input documents list to Review
*
@@ -4717,10 +4912,10 @@ class Cases
if ($sTo != null) {
$oSpool = new spoolRun();
- if ($aConfiguration['MESS_RAUTH'] == false || (is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false')) {
- $aConfiguration['MESS_RAUTH'] = 0;
- } else {
- $aConfiguration['MESS_RAUTH'] = 1;
+ if ($aConfiguration['MESS_RAUTH'] == false || (is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false')) {
+ $aConfiguration['MESS_RAUTH'] = 0;
+ } else {
+ $aConfiguration['MESS_RAUTH'] = 1;
}
$oSpool->setConfig(array(
diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php
index 1e6437032..937b8bdd5 100755
--- a/workflow/engine/classes/class.pmFunctions.php
+++ b/workflow/engine/classes/class.pmFunctions.php
@@ -1446,6 +1446,65 @@ function PMFUserList () //its test was successfull
return $rows;
}
+/**
+ * @method
+ *
+ * Add a input document.
+ *
+ * @name PMFAddInputDocument
+ * @label PMF Add a input document.
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddInputDocument.28.29
+ *
+ * @param string(32) | $inputDocumentUid | ID of the input document | The unique ID of the input document.
+ * @param string(32) | $appDocUid | ID of the application document | The unique ID of the application document; if action is set to null or empty (Add), then this parameter it set to null or empty.
+ * @param int | $docVersion | Document version | Document version.
+ * @param string | $appDocType = "INPUT" | Document type | Document type.
+ * @param string | $appDocComment | Document comment | Document comment.
+ * @param string | $inputDocumentAction | Action | Action, posible values: null or empty (Add), "R" (Replace), "NV" (New Version).
+ * @param string(32) | $caseUid | ID of the case | The unique ID of the case.
+ * @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case.
+ * @param string(32) | $taskUid | ID of the task | The unique ID of the task.
+ * @param string(32) | $userUid | ID user | The unique ID of the user who will add a input document.
+ * @param string | $option = "file" | Option | Option, value: "file".
+ * @param string | $file = "path_to_file/myfile.txt" | File, path to file | File, path to file.
+ * @return string | $appDocUid | ID of the application document | Returns ID if it has added the input document successfully; otherwise, returns null or empty if an error occurred.
+ *
+ */
+function PMFAddInputDocument(
+ $inputDocumentUid,
+ $appDocUid,
+ $docVersion,
+ $appDocType = "INPUT",
+ $appDocComment,
+ $inputDocumentAction,
+ $caseUid,
+ $delIndex,
+ $taskUid,
+ $userUid,
+ $option = "file",
+ $file = "path_to_file/myfile.txt"
+) {
+ G::LoadClass("case");
+ $case = new Cases();
+
+ $appDocUid = $case->addInputDocument(
+ $inputDocumentUid,
+ $appDocUid,
+ $docVersion,
+ $appDocType,
+ $appDocComment,
+ $inputDocumentAction,
+ $caseUid,
+ $delIndex,
+ $taskUid,
+ $userUid,
+ $option,
+ $file
+ );
+
+ return $appDocUid;
+}
+
/**
*
* @method Generates an Output Document
@@ -2365,10 +2424,13 @@ function PMFGetCaseNotes ($applicationID, $type = 'array', $userUid = '')
/**
*
- * @method Delete a specified case.
+ * @method
+ *
+ * Delete a specified case.
*
* @name PMFDeleteCase
* @label PMF Delete a specified case.
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFDeleteCase.28.29
*
* @param string(32) | $caseUid | ID of the case | The unique ID of the case.
* @return int | $result | Result of the elimination | Returns 1 if the case is delete successfully; otherwise, returns 0 if an error occurred.
@@ -2390,10 +2452,13 @@ function PMFDeleteCase ($caseUid)
/**
*
- * @method Cancel a specified case.
+ * @method
+ *
+ * Cancel a specified case.
*
* @name PMFCancelCase
* @label PMF Cancel a specified case.
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFCancelCase.28.29
*
* @param string(32) | $caseUid | ID of the case | The unique ID of the case.
* @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case.
@@ -2427,10 +2492,13 @@ function PMFCancelCase ($caseUid, $delIndex, $userUid)
/**
*
- * @method Pauses a specified case.
+ * @method
+ *
+ * Pauses a specified case.
*
* @name PMFPauseCase
* @label PMF Pauses a specified case.
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFPauseCase.28.29
*
* @param string(32) | $caseUid | ID of the case | The unique ID of the case.
* @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case.
@@ -2465,10 +2533,13 @@ function PMFPauseCase ($caseUid, $delIndex, $userUid, $unpauseDate = null)
/**
*
- * @method Unpause a specified case.
+ * @method
+ *
+ * Unpause a specified case.
*
* @name PMFUnpauseCase
* @label PMF Unpause a specified case.
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFUnpauseCase.28.29
*
* @param string(32) | $caseUid | ID of the case | The unique ID of the case.
* @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case.
@@ -2492,10 +2563,13 @@ function PMFUnpauseCase ($caseUid, $delIndex, $userUid)
/**
*
- * @method Add case note.
+ * @method
+ *
+ * Add case note.
*
* @name PMFAddCaseNote
* @label PMF Add case note
+ * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddCaseNote.28.29
*
* @param string(32) | $caseUid | ID of the case | The unique ID of the case.
* @param string(32) | $processUid | ID of the process | The unique ID of the process.
diff --git a/workflow/engine/methods/cases/cases_SaveDocument.php b/workflow/engine/methods/cases/cases_SaveDocument.php
index d4209dd10..21f64884f 100755
--- a/workflow/engine/methods/cases/cases_SaveDocument.php
+++ b/workflow/engine/methods/cases/cases_SaveDocument.php
@@ -59,136 +59,86 @@ if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME']
die();
}
-$docUid = $_POST['form']['DOC_UID'];
-$appDocUid = $_POST['form']['APP_DOC_UID'];
-$docVersion = $_POST['form']['docVersion'];
-$actionType = $_POST['form']['actionType'];
+G::LoadClass("case");
-//load the variables
-G::LoadClass( 'case' );
-$oCase = new Cases();
-$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'cases_List' );
-$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] );
-$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() );
+$inputDocumentUid = $_GET["UID"]; //$_POST["form"]["DOC_UID"]
+$appDocUid = $_POST["form"]["APP_DOC_UID"];
+$docVersion = intval($_POST["form"]["docVersion"]);
+$appDocType = $_POST["form"]["APP_DOC_TYPE"];
+$appDocComment = (isset($_POST["form"]["APP_DOC_COMMENT"]))? $_POST["form"]["APP_DOC_COMMENT"] : "";
+$actionType = $_POST["form"]["actionType"];
-#trigger debug routines...
+$case = new Cases();
+$case->thisIsTheCurrentUser($_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "cases_List");
+//Load the fields
+$arrayField = $case->loadCase($_SESSION["APPLICATION"]);
+$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], G::getSystemConstants());
-//cleaning debug variables
-$_SESSION['TRIGGER_DEBUG']['ERRORS'] = Array ();
-$_SESSION['TRIGGER_DEBUG']['DATA'] = Array ();
-$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array ();
-$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array ();
+//Triggers
+$arrayTrigger = $case->loadTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
-$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER' );
+//Trigger debug routines
+//Cleaning debug variables
+$_SESSION["TRIGGER_DEBUG"]["ERRORS"] = array();
+$_SESSION["TRIGGER_DEBUG"]["DATA"] = array();
+$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = array();
+$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = array();
-$_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers );
-$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
-if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
- $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers );
- $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers;
+$_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] = count($arrayTrigger);
+$_SESSION["TRIGGER_DEBUG"]["TIME"] = "AFTER";
+
+if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
+ $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = $case->getTriggerNames($arrayTrigger);
+ $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger;
}
-if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) {
- //Execute after triggers - Start
- $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'INPUT_DOCUMENT', $_GET['UID'], 'AFTER', $Fields['APP_DATA'] );
- //Execute after triggers - End
+if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
+ //Trigger - Execute after - Start
+ $arrayField["APP_DATA"] = $case->executeTriggers(
+ $_SESSION["TASK"],
+ "INPUT_DOCUMENT",
+ $inputDocumentUid,
+ "AFTER",
+ $arrayField["APP_DATA"]
+ );
+ //Trigger - Execute after - End
}
-//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 = $oCase->loadCase($_SESSION['APPLICATION']);
-$oCase->updateCase( $_SESSION['APPLICATION'], $aData );
+//Save data
+$arrayData = array();
+$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
+$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
+$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
+$arrayData["DEL_INDEX"] = $_SESSION["INDEX"];
+$arrayData["TAS_UID"] = $_SESSION["TASK"];
-//save info
+$case->updateCase($_SESSION["APPLICATION"], $arrayData);
-
-//require_once ("classes/model/AppDocument.php");
-//require_once ('classes/model/AppFolder.php');
-//require_once ('classes/model/InputDocument.php');
-
-$oInputDocument = new InputDocument();
-$aID = $oInputDocument->load( $_GET['UID'] );
-
-$oAppDocument = new AppDocument();
-
-//Get the Custom Folder ID (create if necessary)
-$oFolder = new AppFolder();
-$folderId = $oFolder->createFromPath( $aID['INP_DOC_DESTINATION_PATH'] );
-
-//Tags
-$fileTags = $oFolder->parseTags( $aID['INP_DOC_TAGS'] );
-
-switch ($actionType) {
- case "R": //replace
- $aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DOC_VERSION' => $docVersion,'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
- );
-
- $oAppDocument->update( $aFields );
- break;
- case "NV": //New Version
-
-
- $aFields = array ('APP_DOC_UID' => $appDocUid,'APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
- );
-
- $oAppDocument->create( $aFields );
- break;
- default: //New
- $aFields = array ('APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'USR_UID' => $_SESSION['USER_LOGGED'],'DOC_UID' => $docUid,'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'],'APP_DOC_CREATE_DATE' => date( 'Y-m-d H:i:s' ),'APP_DOC_COMMENT' => isset( $_POST['form']['APP_DOC_COMMENT'] ) ? $_POST['form']['APP_DOC_COMMENT'] : '','APP_DOC_TITLE' => '','APP_DOC_FILENAME' => isset( $_FILES['form']['name']['APP_DOC_FILENAME'] ) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '','FOLDER_UID' => $folderId,'APP_DOC_TAGS' => $fileTags
- );
-
- $oAppDocument->create( $aFields );
- break;
-}
-
-$sAppDocUid = $oAppDocument->getAppDocUid();
-$iDocVersion = $oAppDocument->getDocVersion();
-$info = pathinfo( $oAppDocument->getAppDocFilename() );
-$ext = (isset( $info['extension'] ) ? $info['extension'] : '');
-
-//save the file
-if (! empty( $_FILES['form'] )) {
- if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
- $sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
- $sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext;
- G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
-
- //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
- if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
- $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
- $oData['APP_UID'] = $_SESSION['APPLICATION'];
- $documentData = new uploadDocumentData( $_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid, $iDocVersion );
-
- $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
- if ($uploadReturn) {
- $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
- if (! isset( $aFields['APP_DOC_UID'] )) {
- $aFields['APP_DOC_UID'] = $sAppDocUid;
- }
- if (! isset( $aFields['DOC_VERSION'] )) {
- $aFields['DOC_VERSION'] = $iDocVersion;
- }
- //$oAppDocument1 = new AppDocument();
- //G::pr($aFields);die;
- $oAppDocument->update( $aFields );
- unlink( $sPathName . $sFileName );
- }
- }
- //end plugin
- }
+//Add Input Document
+if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
+ $appDocUid = $case->addInputDocument(
+ $inputDocumentUid,
+ $appDocUid,
+ $docVersion,
+ $appDocType,
+ $appDocComment,
+ $actionType,
+ $_SESSION["APPLICATION"],
+ $_SESSION["INDEX"],
+ $_SESSION["TASK"],
+ $_SESSION["USER_LOGGED"],
+ "xmlform",
+ $_FILES["form"]["name"]["APP_DOC_FILENAME"],
+ $_FILES["form"]["error"]["APP_DOC_FILENAME"],
+ $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]
+ );
}
//go to the next step
//if (!isset($_POST['form']['MORE'])) {
if (false) {
- $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
+ $aNextStep = $case->getNextStep($_SESSION["PROCESS"], $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["STEP_POSITION"]);
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
@@ -212,7 +162,7 @@ if (false) {
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
die();
} else {
- $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 );
+ $aNextStep = $case->getNextStep($_SESSION["PROCESS"], $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["STEP_POSITION"] - 1);
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
@@ -225,7 +175,7 @@ if (false) {
die();
}
} else {
- $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] - 1 );
+ $aNextStep = $case->getNextStep($_SESSION["PROCESS"], $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["STEP_POSITION"] - 1);
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
diff --git a/workflow/engine/templates/triggers/triggersTree.php b/workflow/engine/templates/triggers/triggersTree.php
index f5d39b062..3d840e026 100755
--- a/workflow/engine/templates/triggers/triggersTree.php
+++ b/workflow/engine/templates/triggers/triggersTree.php
@@ -70,9 +70,6 @@ try {
}
}
- // error_log("\n*****\n", 3, "/home/victor/MyLog.log");
- // error_log(print_r($oTree, true), 3, "/home/victor/MyLog.log");
-
echo $oTree->render();
} catch (Exception $e) {
die($e->getMessage());
diff --git a/workflow/engine/xmlform/triggers/triggerCopy.xml b/workflow/engine/xmlform/triggers/triggerCopy.xml
index a675c6229..d45f947e7 100644
--- a/workflow/engine/xmlform/triggers/triggerCopy.xml
+++ b/workflow/engine/xmlform/triggers/triggerCopy.xml
@@ -13,10 +13,12 @@
+
Process
@@ -25,11 +27,13 @@
+
Trigger
@@ -42,17 +46,21 @@
+
Description of the new trigger
+
Script