Only save plugin info if is used (for input and input documents)
This commit is contained in:
@@ -211,6 +211,9 @@ if (isset ( $_FILES ['form'] )) {
|
|||||||
$documentData = new uploadDocumentData ( $_SESSION ['APPLICATION'], $_SESSION ['USER_LOGGED'], $sPathName . $sFileName, $aFields ['APP_DOC_FILENAME'], $sAppDocUid );
|
$documentData = new uploadDocumentData ( $_SESSION ['APPLICATION'], $_SESSION ['USER_LOGGED'], $sPathName . $sFileName, $aFields ['APP_DOC_FILENAME'], $sAppDocUid );
|
||||||
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT, $documentData );
|
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT, $documentData );
|
||||||
if($uploadReturn){
|
if($uploadReturn){
|
||||||
|
$aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace;
|
||||||
|
$oAppDocument1 = new AppDocument();
|
||||||
|
$oAppDocument1->update($aFields);
|
||||||
unlink ( $sPathName . $sFileName );
|
unlink ( $sPathName . $sFileName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
//First review if there is no error with the uploaded document
|
//First review if there is no error with the uploaded document
|
||||||
if ((isset($_FILES['form']))&&($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) {
|
if ((isset($_FILES['form']))&&($_FILES['form']['error']['APP_DOC_FILENAME'] != 0)) {
|
||||||
$code=$_FILES['form']['error']['APP_DOC_FILENAME'];
|
$code=$_FILES['form']['error']['APP_DOC_FILENAME'];
|
||||||
switch ($code) {
|
switch ($code) {
|
||||||
case UPLOAD_ERR_INI_SIZE:
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
$message = G::LoadTranslation('ID_UPLOAD_ERR_INI_SIZE');
|
$message = G::LoadTranslation('ID_UPLOAD_ERR_INI_SIZE');
|
||||||
@@ -52,8 +52,8 @@
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
$message = G::LoadTranslation('ID_UPLOAD_ERR_UNKNOWN');
|
$message = G::LoadTranslation('ID_UPLOAD_ERR_UNKNOWN');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
G::SendMessageText($message, "ERROR");
|
G::SendMessageText($message, "ERROR");
|
||||||
$backUrlObj=explode("sys".SYS_SYS,$_SERVER['HTTP_REFERER']);
|
$backUrlObj=explode("sys".SYS_SYS,$_SERVER['HTTP_REFERER']);
|
||||||
G::header("location: "."/sys".SYS_SYS.$backUrlObj[1]);
|
G::header("location: "."/sys".SYS_SYS.$backUrlObj[1]);
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
|
|
||||||
$docUid=$_POST['form']['DOC_UID'];
|
$docUid=$_POST['form']['DOC_UID'];
|
||||||
$appDocUid=$_POST['form']['APP_DOC_UID'];
|
$appDocUid=$_POST['form']['APP_DOC_UID'];
|
||||||
$docVersion=$_POST['form']['docVersion'];
|
$docVersion=$_POST['form']['docVersion'];
|
||||||
$actionType=$_POST['form']['actionType'];
|
$actionType=$_POST['form']['actionType'];
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
$oAppDocument = new AppDocument();
|
$oAppDocument = new AppDocument();
|
||||||
|
|
||||||
|
|
||||||
//Get the Custom Folder ID (create if necessary)
|
//Get the Custom Folder ID (create if necessary)
|
||||||
$oFolder=new AppFolder();
|
$oFolder=new AppFolder();
|
||||||
$folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH']);
|
$folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH']);
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
$fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS']);
|
$fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS']);
|
||||||
|
|
||||||
switch($actionType){
|
switch($actionType){
|
||||||
case "R": //replace
|
case "R": //replace
|
||||||
$aFields = array('APP_DOC_UID' => $appDocUid,
|
$aFields = array('APP_DOC_UID' => $appDocUid,
|
||||||
'APP_UID' => $_SESSION['APPLICATION'],
|
'APP_UID' => $_SESSION['APPLICATION'],
|
||||||
'DOC_VERSION' => $docVersion,
|
'DOC_VERSION' => $docVersion,
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
|
|
||||||
$oAppDocument->create($aFields);
|
$oAppDocument->create($aFields);
|
||||||
break;
|
break;
|
||||||
default: //New
|
default: //New
|
||||||
$aFields = array('APP_UID' => $_SESSION['APPLICATION'],
|
$aFields = array('APP_UID' => $_SESSION['APPLICATION'],
|
||||||
'DEL_INDEX' => $_SESSION['INDEX'],
|
'DEL_INDEX' => $_SESSION['INDEX'],
|
||||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||||
@@ -191,10 +191,10 @@
|
|||||||
$ext = (isset($info['extension']) ? $info['extension'] : '');
|
$ext = (isset($info['extension']) ? $info['extension'] : '');
|
||||||
|
|
||||||
//save the file
|
//save the file
|
||||||
if (!empty($_FILES['form'])) {
|
if (!empty($_FILES['form'])) {
|
||||||
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
|
if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
|
||||||
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
|
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
|
||||||
$sFileName = $sAppDocUid . "_".$iDocVersion. '.' . $ext;
|
$sFileName = $sAppDocUid . "_".$iDocVersion. '.' . $ext;
|
||||||
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
|
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
|
||||||
|
|
||||||
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
||||||
@@ -208,11 +208,14 @@
|
|||||||
$sPathName . $sFileName,
|
$sPathName . $sFileName,
|
||||||
$aFields['APP_DOC_FILENAME'],
|
$aFields['APP_DOC_FILENAME'],
|
||||||
$sAppDocUid,
|
$sAppDocUid,
|
||||||
$iDocVersion
|
$iDocVersion
|
||||||
);
|
);
|
||||||
|
|
||||||
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
|
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
|
||||||
if($uploadReturn){
|
if($uploadReturn){
|
||||||
|
$aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace;
|
||||||
|
$oAppDocument1 = new AppDocument();
|
||||||
|
$oAppDocument1->update($aFields);
|
||||||
unlink ( $sPathName . $sFileName );
|
unlink ( $sPathName . $sFileName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -507,10 +507,7 @@
|
|||||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||||
if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) {
|
if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) {
|
||||||
$triggerDetail=$oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
|
$triggerDetail=$oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
|
||||||
$aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace;
|
|
||||||
|
|
||||||
$oAppDocument1 = new AppDocument();
|
|
||||||
$oAppDocument1->update($aFields);
|
|
||||||
|
|
||||||
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
|
$sPathName = PATH_DOCUMENT . $_SESSION['APPLICATION'] . PATH_SEP;
|
||||||
|
|
||||||
@@ -531,6 +528,9 @@
|
|||||||
$documentData->bUseOutputFolder = true;
|
$documentData->bUseOutputFolder = true;
|
||||||
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
|
$uploadReturn=$oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData );
|
||||||
if($uploadReturn){//Only delete if the file was saved correctly
|
if($uploadReturn){//Only delete if the file was saved correctly
|
||||||
|
$aFields['APP_DOC_PLUGIN']=$triggerDetail->sNamespace;
|
||||||
|
$oAppDocument1 = new AppDocument();
|
||||||
|
$oAppDocument1->update($aFields);
|
||||||
unlink ( $pathOutput . $sFilename. '.pdf' );
|
unlink ( $pathOutput . $sFilename. '.pdf' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user