BUG 9088 "KnowledgeTree and webEntry don't work when we try..." SOLVED
- KnowledgeTree and webEntry don't work when you try to upload some files - Added the missing code in this section when the KnowledgeTree plugin is enabled
This commit is contained in:
@@ -1248,6 +1248,16 @@ class wsBase
|
||||
*/
|
||||
public function newCase($processId, $userId, $taskId, $variables) {
|
||||
try {
|
||||
//GET, POST & $_SESSION Vars
|
||||
//Unset any variable, because we are starting a new case
|
||||
if (isset($_SESSION['APPLICATION'])) unset($_SESSION['APPLICATION']);
|
||||
if (isset($_SESSION['PROCESS'])) unset($_SESSION['PROCESS']);
|
||||
if (isset($_SESSION['TASK'])) unset($_SESSION['TASK']);
|
||||
if (isset($_SESSION['INDEX'])) unset($_SESSION['INDEX']);
|
||||
if (isset($_SESSION['USER_LOGGED'])) unset($_SESSION['USER_LOGGED']);
|
||||
//if (isset($_SESSION['USR_USERNAME'])) unset($_SESSION['USR_USERNAME']);
|
||||
//if (isset($_SESSION['STEP_POSITION'])) unset($_SESSION['STEP_POSITION']);
|
||||
|
||||
$Fields = array();
|
||||
if ( is_array($variables) && count($variables)>0 ) {
|
||||
$Fields = $variables;
|
||||
@@ -1288,6 +1298,15 @@ class wsBase
|
||||
}
|
||||
|
||||
$case = $oCase->startCase($taskId, $userId);
|
||||
|
||||
$_SESSION['APPLICATION'] = $case['APPLICATION'];
|
||||
$_SESSION['PROCESS'] = $case['PROCESS'];
|
||||
$_SESSION['TASK'] = $taskId;
|
||||
$_SESSION['INDEX'] = $case['INDEX'];
|
||||
$_SESSION['USER_LOGGED'] = $userId;
|
||||
//$_SESSION['USR_USERNAME'] = $case['USR_USERNAME'];
|
||||
//$_SESSION['STEP_POSITION'] = 0;
|
||||
|
||||
$caseId = $case['APPLICATION'];
|
||||
$caseNr = $case['CASE_NUMBER'];
|
||||
|
||||
|
||||
@@ -32,11 +32,13 @@
|
||||
|
||||
if (isset($_FILES) && $_FILES['ATTACH_FILE']['error'] == 0) {
|
||||
try{
|
||||
G::loadClass('case');
|
||||
$folderId = $fileTags = "";
|
||||
if ( isset($_POST['DOC_UID']) && $_POST['DOC_UID'] != - 1) {
|
||||
/* the document is of an Specific Input Document. Get path and Tag information*/
|
||||
G::LoadClass('case');
|
||||
|
||||
$folderId = '';
|
||||
$fileTags = '';
|
||||
|
||||
if (isset($_POST['DOC_UID']) && $_POST['DOC_UID'] != -1) {
|
||||
//The document is of an Specific Input Document. Get path and Tag information
|
||||
require_once ('classes/model/AppFolder.php');
|
||||
require_once ('classes/model/InputDocument.php');
|
||||
|
||||
@@ -52,7 +54,9 @@ if (isset($_FILES) && $_FILES['ATTACH_FILE']['error'] == 0) {
|
||||
}
|
||||
|
||||
$oAppDocument = new AppDocument();
|
||||
if (isset($_POST['APP_DOC_UID']) && trim($_POST['APP_DOC_UID']) != '') { //is update
|
||||
|
||||
if (isset($_POST['APP_DOC_UID']) && trim($_POST['APP_DOC_UID']) != '') {
|
||||
//Update
|
||||
echo '[update]';
|
||||
$aFields['APP_DOC_UID'] = $_POST['APP_DOC_UID'];
|
||||
$aFields['DOC_VERSION'] = $_POST['DOC_VERSION'];
|
||||
@@ -68,17 +72,16 @@ if (isset($_FILES) && $_FILES['ATTACH_FILE']['error'] == 0) {
|
||||
$aFields['DOC_UID'] = $_POST['DOC_UID'];
|
||||
if (isset($_POST['APP_DOC_TYPE']))
|
||||
$aFields['APP_DOC_TYPE']= $_POST['APP_DOC_TYPE'];
|
||||
$aFields['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
|
||||
|
||||
$aFields['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
|
||||
$aFields['APP_DOC_COMMENT'] = isset($_POST['COMMENT'])? $_POST['COMMENT'] : '';
|
||||
$aFields['APP_DOC_TITLE'] = isset($_POST['TITLE'])? $_POST['TITLE'] : '';
|
||||
|
||||
//$aFields['FOLDER_UID'] = $folderId,
|
||||
//$aFields['APP_DOC_TAGS']= $fileTags
|
||||
|
||||
$oAppDocument->create($aFields);
|
||||
|
||||
} else { //new record
|
||||
}
|
||||
else {
|
||||
//New record
|
||||
$aFields = array(
|
||||
'APP_UID' => $_POST['APPLICATION'],
|
||||
'DEL_INDEX' => $_POST['INDEX'],
|
||||
@@ -92,35 +95,62 @@ if (isset($_FILES) && $_FILES['ATTACH_FILE']['error'] == 0) {
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
);
|
||||
}
|
||||
|
||||
$oAppDocument->create($aFields);
|
||||
}
|
||||
|
||||
$sAppUid = $oAppDocument->getAppUid();
|
||||
$sAppDocUid = $oAppDocument->getAppDocUid();
|
||||
$iDocVersion = $oAppDocument->getDocVersion();
|
||||
$info = pathinfo($oAppDocument->getAppDocFilename());
|
||||
$ext = (isset($info['extension']) ? $info['extension'] : '');
|
||||
$ext = isset($info['extension'])? $info['extension'] : '';
|
||||
|
||||
//save the file
|
||||
//Save the file
|
||||
echo $sPathName = PATH_DOCUMENT . $sAppUid . PATH_SEP;
|
||||
echo $sFileName = $sAppDocUid . '_' . $iDocVersion . '.' . $ext;
|
||||
print G::uploadFile($_FILES['ATTACH_FILE']['tmp_name'], $sPathName, $sFileName);
|
||||
print("* The file {$_FILES['ATTACH_FILE']['name']} was uploaded successfully in case {$sAppUid} as input document..\n");
|
||||
|
||||
//Get current Application Fields
|
||||
$application = new Application();
|
||||
$appFields = $application->Load($_POST['APPLICATION']);
|
||||
$appFields = unserialize($appFields['APP_DATA']);
|
||||
|
||||
$_SESSION['APPLICATION'] = $appFields['APPLICATION'];
|
||||
$_SESSION['PROCESS'] = $appFields['PROCESS'];
|
||||
$_SESSION['TASK'] = $appFields['TASK'];
|
||||
$_SESSION['INDEX'] = $appFields['INDEX'];
|
||||
$_SESSION['USER_LOGGED'] = $appFields['USER_LOGGED']; //$_POST['USR_UID']
|
||||
//$_SESSION['USR_USERNAME'] = $appFields['USR_USERNAME'];
|
||||
//$_SESSION['STEP_POSITION'] = 0;
|
||||
|
||||
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
||||
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
|
||||
$oData['APP_UID'] = $_POST['APPLICATION'];
|
||||
$documentData = new uploadDocumentData($_POST['APPLICATION'], $_POST['USR_UID'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid);
|
||||
|
||||
$oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
|
||||
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
|
||||
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
|
||||
$documentData = new uploadDocumentData($_POST["APPLICATION"], $_POST["USR_UID"], $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;
|
||||
}
|
||||
|
||||
$oAppDocument->update($aFields);
|
||||
|
||||
unlink($sPathName . $sFileName);
|
||||
}
|
||||
/*end plugin*/
|
||||
} catch ( Exception $e) {
|
||||
}
|
||||
//End plugin
|
||||
}
|
||||
catch (Exception $e) {
|
||||
print($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,9 +30,21 @@
|
||||
if ($result->status_code == 0) {
|
||||
$caseId = $result->caseId;
|
||||
$caseNr = $result->caseNumber;
|
||||
|
||||
{USR_VAR}
|
||||
|
||||
#save files
|
||||
if ($USR_UID == -1) {
|
||||
G::LoadClass("sessions");
|
||||
|
||||
global $sessionId;
|
||||
|
||||
$sessions = new Sessions();
|
||||
$session = $sessions->getSessionUser($sessionId);
|
||||
|
||||
$USR_UID = $session["USR_UID"];
|
||||
}
|
||||
|
||||
//Save files
|
||||
if ( isset($_FILES['form']) ) {
|
||||
foreach ($_FILES['form']['name'] as $sFieldName => $vValue) {
|
||||
if ( $_FILES['form']['error'][$sFieldName] == 0 ){
|
||||
|
||||
Reference in New Issue
Block a user