Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2020-05-08 07:44:49 +02:00
commit 8ae40fbc9e
12 changed files with 98 additions and 32 deletions

View File

@ -148,6 +148,7 @@
Changes in version 5.1.17
--------------------------------------------------------------------------------
- new version 5.16.2 of fine uploader
- obey max_upload_size whenever a file is uploaded
--------------------------------------------------------------------------------
Changes in version 5.1.16

View File

@ -1062,8 +1062,8 @@ class SeedDMS_Core_DMS {
* 'AppRevOwner', 'ReceiptByMe', 'ReviseByMe', 'LockedByMe', 'MyDocs'
* @param SeedDMS_Core_User $param1 user
* @param bool $param2 set to true
* if 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe' shall return even documents
* І have already taken care of.
* if 'ReviewByMe', 'ApproveByMe', 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe'
* shall return even documents І have already taken care of.
* @param string $param3 sort list by this field
* @param string $param4 order direction
* @return array|bool
@ -1101,7 +1101,7 @@ class SeedDMS_Core_DMS {
* It doesn't need the where clause anymore. Hence the statement could be
* extended with further left joins.
*/
$selectStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".
$selectStr = "`tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".
"`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ".
"`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ".
"`tblDocumentStatusLog`.`userID`, `oTbl`.`fullName` AS `ownerName`, `sTbl`.`fullName` AS `statusName` ";
@ -1176,9 +1176,11 @@ class SeedDMS_Core_DMS {
$orderdir = 'ASC';
$groups = array();
$tmp = $user->getGroups();
foreach($tmp as $group)
$groups[] = $group->getID();
if($user) {
$tmp = $user->getGroups();
foreach($tmp as $group)
$groups[] = $group->getID();
}
$selectStr .= ", `tblDocumentReviewLog`.`date` as `duedate` ";
$queryStr .=
@ -1187,10 +1189,12 @@ class SeedDMS_Core_DMS {
"LEFT JOIN `tblDocumentReviewLog` ON `tblDocumentReviewLog`.`reviewLogID`=`ttreviewid`.`maxLogID` ";
if(1) {
$queryStr .= "WHERE (`tblDocumentReviewers`.`type` = 0 AND `tblDocumentReviewers`.`required` = ".$user->getID()." ";
if($groups)
$queryStr .= "OR `tblDocumentReviewers`.`type` = 1 AND `tblDocumentReviewers`.`required` IN (".implode(',', $groups).") ";
$queryStr .= ") ";
if($user) {
$queryStr .= "WHERE (`tblDocumentReviewers`.`type` = 0 AND `tblDocumentReviewers`.`required` = ".$user->getID()." ";
if($groups)
$queryStr .= "OR `tblDocumentReviewers`.`type` = 1 AND `tblDocumentReviewers`.`required` IN (".implode(',', $groups).") ";
$queryStr .= ") ";
}
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_EXPIRED.") ";
if(!$param2)
$queryStr .= " AND `tblDocumentReviewLog`.`status` = 0 ";
@ -1251,9 +1255,11 @@ class SeedDMS_Core_DMS {
$orderdir = 'ASC';
$groups = array();
$tmp = $user->getGroups();
foreach($tmp as $group)
$groups[] = $group->getID();
if($user) {
$tmp = $user->getGroups();
foreach($tmp as $group)
$groups[] = $group->getID();
}
$selectStr .= ", `tblDocumentApproveLog`.`date` as `duedate` ";
$queryStr .=
@ -1262,10 +1268,12 @@ class SeedDMS_Core_DMS {
"LEFT JOIN `tblDocumentApproveLog` ON `tblDocumentApproveLog`.`approveLogID`=`ttapproveid`.`maxLogID` ";
if(1) {
if($user) {
$queryStr .= "WHERE (`tblDocumentApprovers`.`type` = 0 AND `tblDocumentApprovers`.`required` = ".$user->getID()." ";
if($groups)
$queryStr .= "OR `tblDocumentApprovers`.`type` = 1 AND `tblDocumentApprovers`.`required` IN (".implode(',', $groups).")";
$queryStr .= ") ";
}
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_APP.", ".S_EXPIRED.") ";
if(!$param2)
$queryStr .= " AND `tblDocumentApproveLog`.`status` = 0 ";
@ -1483,9 +1491,39 @@ class SeedDMS_Core_DMS {
$queryStr .= ", `tblDocumentContent`.`revisiondate` ASC";
break; // }}}
case 'WorkflowByMe': // Documents I to trigger in Worklflow {{{
$queryStr .= "WHERE 1=1 ";
$user = $param1;
$orderby = $param3;
if($param4 == 'desc')
$orderdir = 'DESC';
else
$orderdir = 'ASC';
if(1) {
$groups = array();
if($user) {
$tmp = $user->getGroups();
foreach($tmp as $group)
$groups[] = $group->getID();
}
$selectStr = 'distinct '.$selectStr;
$queryStr .=
"LEFT JOIN `tblWorkflowDocumentContent` on `ttcontentid`.`document`=`tblWorkflowDocumentContent`.`document` AND `ttcontentid`.`maxVersion`=`tblWorkflowDocumentContent`.`version` ".
"LEFT JOIN `tblWorkflowTransitions` on `tblWorkflowDocumentContent`.`workflow`=`tblWorkflowTransitions`.`workflow` AND `tblWorkflowDocumentContent`.`state`=`tblWorkflowTransitions`.`state` ".
"LEFT JOIN `tblWorkflowTransitionUsers` on `tblWorkflowTransitionUsers`.`transition` = `tblWorkflowTransitions`.`id` ".
"LEFT JOIN `tblWorkflowTransitionGroups` on `tblWorkflowTransitionGroups`.`transition` = `tblWorkflowTransitions`.`id` ";
if($user) {
$queryStr .= "WHERE (`tblWorkflowTransitionUsers`.`userid` = ".$user->getID()." ";
if($groups)
$queryStr .= "OR `tblWorkflowTransitionGroups`.`groupid` IN (".implode(',', $groups).")";
$queryStr .= ") ";
}
// echo 'SELECT '.$selectStr." ".$queryStr;
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
else $queryStr .= "ORDER BY `name`";
} else {
$queryStr .= "WHERE 1=1 ";
// Get document list for the current user.
$workflowStatus = $user->getWorkflowStatus();
@ -1515,6 +1553,7 @@ class SeedDMS_Core_DMS {
} else {
$queryStr = '';
}
}
break; // }}}
case 'AppRevOwner': // Documents waiting for review/approval/revision I'm owning {{{
$queryStr .= "WHERE 1=1 ";
@ -1804,7 +1843,7 @@ class SeedDMS_Core_DMS {
}
if($queryStr) {
$resArr = $this->db->getResultArray($selectStr.$queryStr);
$resArr = $this->db->getResultArray('SELECT '.$selectStr.$queryStr);
if (is_bool($resArr) && !$resArr) {
return false;
}

View File

@ -137,8 +137,8 @@ class UI extends UI_Default {
$view->setParam('enablesessionlist', $settings->_enableSessionList);
$view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('checkoutdir', $settings->_checkOutDir);
$view->setParam('partitionsize', (int) $settings->_partitionSize);
$view->setParam('maxuploadsize', (int) $settings->_maxUploadSize);
$view->setParam('partitionsize', SeedDMS_Core_File::parse_filesize( $settings->_partitionSize));
$view->setParam('maxuploadsize', SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize));
$view->setParam('showmissingtranslations', $settings->_showMissingTranslations);
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
$view->setParam('cachedir', $settings->_cacheDir);

View File

@ -408,10 +408,14 @@ if(!empty($_POST['notification_groups'])) {
}
/* Check files for Errors first */
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
if ($_FILES["userfile"]["size"][$file_num]==0) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_zerosize"));
}
if ($maxuploadsize && $_FILES["userfile"]["size"][$file_num] > $maxuploadsize) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_maxsize"));
}
if (/* is_uploaded_file($_FILES["userfile"]["tmp_name"][$file_num]) && */$_FILES['userfile']['error'][$file_num]!=0){
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("uploading_failed"));
}

View File

@ -62,10 +62,14 @@ if(isset($_POST[$prefix.'-fine-uploader-uuids']) && $_POST[$prefix.'-fine-upload
}
}
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
if ($_FILES["userfile"]["size"][$file_num]==0) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
}
if ($maxuploadsize && $_FILES["userfile"]["size"][$file_num] > $maxuploadsize) {
UI::exitError(getMLText("folder_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
}
if (is_uploaded_file($_FILES["userfile"]["tmp_name"][$file_num]) && $_FILES['userfile']['error'][$file_num] != 0){
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_failed"));
}

View File

@ -91,6 +91,11 @@ if (isset($_FILES['userfile']) && $_FILES['userfile']['error'] == 0) {
if($_FILES["userfile"]["size"] == 0)
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_zerosize"));
$maxuploadsize = SeedDMS_Core_File::parse_filesize($settings->_maxUploadSize);
if ($maxuploadsize && $_FILES["userfile"]["size"] > $maxuploadsize) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("uploading_maxsize"));
}
$userfiletmp = $_FILES["userfile"]["tmp_name"];
$userfiletype = $_FILES["userfile"]["type"];
$userfilename = $_FILES["userfile"]["name"];

View File

@ -91,7 +91,6 @@ if($view) {
$view->setParam('presetexpiration', $settings->_presetExpirationDate);
$view->setParam('sortusersinlist', $settings->_sortUsersInList);
$view->setParam('defaultposition', $settings->_defaultDocPosition);
$view->setParam('maxuploadsize', $settings->_maxUploadSize);
$view->setParam('orderby', $settings->_sortFoldersDefault);
$view->setParam('accessobject', $accessop);
$view($_GET);

View File

@ -158,6 +158,7 @@ $(document).ready(function() {
$folder = $this->params['folder'];
$enablelargefileupload = $this->params['enablelargefileupload'];
$enablemultiupload = $this->params['enablemultiupload'];
$maxuploadsize = $this->params['maxuploadsize'];
$enableadminrevapp = $this->params['enableadminrevapp'];
$enableownerrevapp = $this->params['enableownerrevapp'];
$enableselfrevapp = $this->params['enableselfrevapp'];
@ -188,7 +189,11 @@ $(document).ready(function() {
$this->contentStart();
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize");
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
else
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
$this->warningMsg($msg);
$this->contentHeading(getMLText("add_document"));

View File

@ -126,6 +126,7 @@ $(document).ready( function() {
$document = $this->params['document'];
$strictformcheck = $this->params['strictformcheck'];
$enablelargefileupload = $this->params['enablelargefileupload'];
$maxuploadsize = $this->params['maxuploadsize'];
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/validate/jquery.validate.js"></script>'."\n", 'js');
if($enablelargefileupload) {
@ -139,16 +140,13 @@ $(document).ready( function() {
$this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document);
$this->contentHeading(getMLText("linked_files"));
?>
<div class="alert alert-warning">
<?php echo getMLText("max_upload_size").": ".ini_get( "upload_max_filesize"); ?>
<?php
if(0 && $enablelargefileupload) {
printf('<p>'.getMLText('link_alt_updatedocument').'</p>', "out.AddFile2.php?documentid=".$document->getId());
}
?>
</div>
<?php
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
else
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
$this->warningMsg($msg);
$this->contentContainerStart();
?>

View File

@ -212,6 +212,12 @@ console.log(element);
} else {
$msg = getMLText("max_upload_size").": ".ini_get( "upload_max_filesize");
}
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize);
else
$msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2);
if(0 && $enablelargefileupload) {
$msg .= "<p>".sprintf(getMLText('link_alt_updatedocument'), "out.AddMultiDocument.php?folderid=".$folder->getID()."&showtree=".showtree())."</p>";
}

View File

@ -1128,7 +1128,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
echo "<td>";
if($latestContent->triggerWorkflowTransitionIsAllowed($user, $transition)) {
$action = $transition->getAction();
print "<form action=\"../out/out.TriggerWorkflow.php\" method=\"get\"><input type=\"hidden\" name=\"documentid\" value=\"".$latestContent->getDocument()->getId()."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><input type=\"hidden\" name=\"transition\" value=\"".$transition->getID()."\" /><input type=\"submit\" class=\"btn\" value=\"".getMLText('action_'.strtolower($action->getName()), array(), $action->getName())."\" /></form>";
print "<form action=\"../out/out.TriggerWorkflow.php\" method=\"get\"><input type=\"hidden\" name=\"documentid\" value=\"".$latestContent->getDocument()->getId()."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><input type=\"hidden\" name=\"transition\" value=\"".$transition->getID()."\" /><input type=\"submit\" class=\"btn\" value=\"".getMLText('action_'.strtolower($action->getName()), array(), htmlspecialchars($action->getName()))."\" /></form>";
$allowedtransitions[] = $transition;
}
echo "</td>";

View File

@ -109,6 +109,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
$expandFolderTree = $this->params['expandFolderTree'];
$enableDropUpload = $this->params['enableDropUpload'];
$maxItemsPerPage = $this->params['maxItemsPerPage'];
$maxuploadsize = $this->params['maxuploadsize'];
$showtree = $this->params['showtree'];
$onepage = $this->params['onepage'];
$sitename = trim(strip_tags($this->params['sitename']));
@ -214,7 +215,11 @@ $('body').on('click', '.order-btn', function(ev) {
echo "SeedDMSUpload.setUrl('../op/op.Ajax.php');";
echo "SeedDMSUpload.setAbortBtnLabel('".getMLText("cancel")."');";
echo "SeedDMSUpload.setEditBtnLabel('".getMLText("edit_document_props")."');";
echo "SeedDMSUpload.setMaxFileSize(".SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")).");";
$mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
if($maxuploadsize && $maxuploadsize < $mus2)
echo "SeedDMSUpload.setMaxFileSize($maxuploadsize);";
else
echo "SeedDMSUpload.setMaxFileSize($mus2);";
echo "SeedDMSUpload.setMaxFileSizeMsg('".getMLText("uploading_maxsize")."');";
}