BUG 9023 "Knowledgetree and ProcessMaker show error to upload some..." SOLVED

- Problem running case with field file with property value "Input" in the Dynaform, generates the following error: "This row doesn't exist!"
- Added the missing code in this section when the KnowledgeTree plugin is enabled.
This commit is contained in:
Victor Saisa Lopez
2012-04-23 19:08:09 -04:00
parent 9763b67fa7
commit 863956a815

View File

@@ -166,7 +166,7 @@ try {
if (isset ( $_FILES ['form'] )) { if (isset ( $_FILES ['form'] )) {
foreach ( $_FILES ['form'] ['name'] as $sFieldName => $vValue ) { foreach ( $_FILES ['form'] ['name'] as $sFieldName => $vValue ) {
if ($_FILES ['form'] ['error'] [$sFieldName] == 0) { if ($_FILES ['form'] ['error'] [$sFieldName] == 0) {
$oAppDocument = new AppDocument ( ); $oAppDocument = new AppDocument();
if ( isset ( $_POST ['INPUTS'] [$sFieldName] ) && $_POST ['INPUTS'] [$sFieldName] != '' ) { if ( isset ( $_POST ['INPUTS'] [$sFieldName] ) && $_POST ['INPUTS'] [$sFieldName] != '' ) {
require_once ('classes/model/AppFolder.php'); require_once ('classes/model/AppFolder.php');
@@ -201,7 +201,7 @@ try {
'APP_UID' => $_SESSION ['APPLICATION'], 'APP_UID' => $_SESSION ['APPLICATION'],
'DEL_INDEX' => $_SESSION ['INDEX'], 'DEL_INDEX' => $_SESSION ['INDEX'],
'USR_UID' => $_SESSION ['USER_LOGGED'], 'USR_UID' => $_SESSION ['USER_LOGGED'],
'DOC_UID' => - 1, 'DOC_UID' => -1,
'APP_DOC_TYPE' => 'ATTACHED', 'APP_DOC_TYPE' => 'ATTACHED',
'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ), 'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ),
'APP_DOC_COMMENT' => '', 'APP_DOC_COMMENT' => '',
@@ -210,24 +210,36 @@ try {
); );
} }
$oAppDocument->create ( $aFields ); $oAppDocument->create($aFields);
$iDocVersion = $oAppDocument->getDocVersion(); $iDocVersion = $oAppDocument->getDocVersion();
$sAppDocUid = $oAppDocument->getAppDocUid (); $sAppDocUid = $oAppDocument->getAppDocUid();
$aInfo = pathinfo ( $oAppDocument->getAppDocFilename () ); $aInfo = pathinfo($oAppDocument->getAppDocFilename());
$sExtension = (isset ( $aInfo ['extension'] ) ? $aInfo ['extension'] : ''); $sExtension = (isset ( $aInfo ['extension'] ) ? $aInfo ['extension'] : '');
$sPathName = PATH_DOCUMENT . $_SESSION ['APPLICATION'] . PATH_SEP; $sPathName = PATH_DOCUMENT . $_SESSION ['APPLICATION'] . PATH_SEP;
$sFileName = $sAppDocUid . '_'.$iDocVersion.'.' . $sExtension; $sFileName = $sAppDocUid . '_'.$iDocVersion.'.' . $sExtension;
G::uploadFile ( $_FILES ['form'] ['tmp_name'] [$sFieldName], $sPathName, $sFileName ); G::uploadFile ( $_FILES ['form'] ['tmp_name'] [$sFieldName], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = & PMPluginRegistry::getSingleton (); $oPluginRegistry = &PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ( 'uploadDocumentData' )) { if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$documentData = new uploadDocumentData ( $_SESSION ['APPLICATION'], $_SESSION ['USER_LOGGED'], $sPathName . $sFileName, $aFields ['APP_DOC_FILENAME'], $sAppDocUid ); $triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT, $documentData ); $documentData = new uploadDocumentData($_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
if($uploadReturn){ $uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
$aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace;
$oAppDocument1 = new AppDocument(); if ($uploadReturn) {
$oAppDocument1->update($aFields); $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
unlink ( $sPathName . $sFileName );
if (!isset($aFields["APP_DOC_UID"])) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
}
if (!isset($aFields["DOC_VERSION"])) {
$aFields["DOC_VERSION"] = $iDocVersion;
}
$oAppDocument->update($aFields);
unlink($sPathName . $sFileName);
} }
} }
} }
@@ -269,8 +281,7 @@ try {
G::header ( 'location: ' . $aNextStep ['PAGE'] ); G::header ( 'location: ' . $aNextStep ['PAGE'] );
} }
catch(Exception $e) { catch (Exception $e) {
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher;
$aMessage = array(); $aMessage = array();
$aMessage['MESSAGE'] = $e->getMessage(); $aMessage['MESSAGE'] = $e->getMessage();