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

This commit is contained in:
Uwe Steinmann 2017-07-10 07:50:33 +02:00
commit 99682a11d1
6 changed files with 43 additions and 23 deletions

View File

@ -149,6 +149,8 @@
- update last access time only once a minute - update last access time only once a minute
- run action 'css' in view if it exists, move css code for timeline - run action 'css' in view if it exists, move css code for timeline
- show role of users in user list and substitute user list - show role of users in user list and substitute user list
- mysql sql_mode=only_full_group_by can be set without causing errors when
creating a temporary table
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 4.3.34 Changes in version 4.3.34

View File

@ -258,6 +258,13 @@ class SeedDMS_Core_Attribute { /* {{{ */
*/ */
function getValidationError() { return $this->_validation_error; } function getValidationError() { return $this->_validation_error; }
/**
* Set validation error
*
* @param integer error code
*/
function setValidationError($error) { $this->_validation_error = $error; }
/** /**
* Get definition of attribute * Get definition of attribute
* *
@ -916,6 +923,15 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
* @return boolean true if validation succeds, otherwise false * @return boolean true if validation succeds, otherwise false
*/ */
function validate($attrvalue) { /* {{{ */ function validate($attrvalue) { /* {{{ */
/* Check if 'onAttributeValidate' callback is set */
if(isset($this->_dms->callbacks['onAttributeValidate'])) {
foreach($this->_dms->callbacks['onAttributeValidate'] as $callback) {
$ret = call_user_func($callback[0], $callback[1], $this);
if(is_bool($ret))
return $ret;
}
}
if($this->getMultipleValues()) { if($this->getMultipleValues()) {
if(is_string($attrvalue)) { if(is_string($attrvalue)) {
$sep = $attrvalue[0]; $sep = $attrvalue[0];

View File

@ -391,24 +391,24 @@ class SeedDMS_Core_DatabaseAccess {
"SELECT `tblDocumentReviewLog`.`reviewID`, ". "SELECT `tblDocumentReviewLog`.`reviewID`, ".
"MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ".
"FROM `tblDocumentReviewLog` ". "FROM `tblDocumentReviewLog` ".
"GROUP BY `tblDocumentReviewLog`.`reviewID` ". "GROUP BY `tblDocumentReviewLog`.`reviewID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
break; break;
case 'pgsql': case 'pgsql':
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (`reviewID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`reviewID`));". $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (`reviewID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`reviewID`));".
"INSERT INTO `ttreviewid` SELECT `tblDocumentReviewLog`.`reviewID`, ". "INSERT INTO `ttreviewid` SELECT `tblDocumentReviewLog`.`reviewID`, ".
"MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ".
"FROM `tblDocumentReviewLog` ". "FROM `tblDocumentReviewLog` ".
"GROUP BY `tblDocumentReviewLog`.`reviewID` ". "GROUP BY `tblDocumentReviewLog`.`reviewID` ";//.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
break; break;
default: default:
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ". $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ".
"SELECT `tblDocumentReviewLog`.`reviewID`, ". "SELECT `tblDocumentReviewLog`.`reviewID`, ".
"MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ".
"FROM `tblDocumentReviewLog` ". "FROM `tblDocumentReviewLog` ".
"GROUP BY `tblDocumentReviewLog`.`reviewID` ". "GROUP BY `tblDocumentReviewLog`.`reviewID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
} }
if (!$this->_ttreviewid) { if (!$this->_ttreviewid) {
if (!$this->getResult($queryStr)) if (!$this->getResult($queryStr))
@ -432,24 +432,24 @@ class SeedDMS_Core_DatabaseAccess {
"SELECT `tblDocumentApproveLog`.`approveID`, ". "SELECT `tblDocumentApproveLog`.`approveID`, ".
"MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ".
"FROM `tblDocumentApproveLog` ". "FROM `tblDocumentApproveLog` ".
"GROUP BY `tblDocumentApproveLog`.`approveID` ". "GROUP BY `tblDocumentApproveLog`.`approveID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
break; break;
case 'pgsql': case 'pgsql':
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (`approveID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`approveID`));". $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (`approveID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`approveID`));".
"INSERT INTO `ttapproveid` SELECT `tblDocumentApproveLog`.`approveID`, ". "INSERT INTO `ttapproveid` SELECT `tblDocumentApproveLog`.`approveID`, ".
"MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ".
"FROM `tblDocumentApproveLog` ". "FROM `tblDocumentApproveLog` ".
"GROUP BY `tblDocumentApproveLog`.`approveID` ". "GROUP BY `tblDocumentApproveLog`.`approveID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
break; break;
default: default:
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (PRIMARY KEY (`approveID`), INDEX (`maxLogID`)) ". $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (PRIMARY KEY (`approveID`), INDEX (`maxLogID`)) ".
"SELECT `tblDocumentApproveLog`.`approveID`, ". "SELECT `tblDocumentApproveLog`.`approveID`, ".
"MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ".
"FROM `tblDocumentApproveLog` ". "FROM `tblDocumentApproveLog` ".
"GROUP BY `tblDocumentApproveLog`.`approveID` ". "GROUP BY `tblDocumentApproveLog`.`approveID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
} }
if (!$this->_ttapproveid) { if (!$this->_ttapproveid) {
if (!$this->getResult($queryStr)) if (!$this->getResult($queryStr))
@ -473,24 +473,24 @@ class SeedDMS_Core_DatabaseAccess {
"SELECT `tblDocumentStatusLog`.`statusID` AS `statusID`, ". "SELECT `tblDocumentStatusLog`.`statusID` AS `statusID`, ".
"MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ".
"FROM `tblDocumentStatusLog` ". "FROM `tblDocumentStatusLog` ".
"GROUP BY `tblDocumentStatusLog`.`statusID` ". "GROUP BY `tblDocumentStatusLog`.`statusID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
break; break;
case 'pgsql': case 'pgsql':
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (`statusID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`statusID`));". $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (`statusID` INTEGER, `maxLogID` INTEGER, PRIMARY KEY (`statusID`));".
"INSERT INTO `ttstatid` SELECT `tblDocumentStatusLog`.`statusID`, ". "INSERT INTO `ttstatid` SELECT `tblDocumentStatusLog`.`statusID`, ".
"MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ".
"FROM `tblDocumentStatusLog` ". "FROM `tblDocumentStatusLog` ".
"GROUP BY `tblDocumentStatusLog`.`statusID` ". "GROUP BY `tblDocumentStatusLog`.`statusID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
break; break;
default: default:
$queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (PRIMARY KEY (`statusID`), INDEX (`maxLogID`)) ". $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (PRIMARY KEY (`statusID`), INDEX (`maxLogID`)) ".
"SELECT `tblDocumentStatusLog`.`statusID`, ". "SELECT `tblDocumentStatusLog`.`statusID`, ".
"MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ".
"FROM `tblDocumentStatusLog` ". "FROM `tblDocumentStatusLog` ".
"GROUP BY `tblDocumentStatusLog`.`statusID` ". "GROUP BY `tblDocumentStatusLog`.`statusID` "; //.
"ORDER BY `maxLogID`"; // "ORDER BY `maxLogID`";
} }
if (!$this->_ttstatid) { if (!$this->_ttstatid) {
if (!$this->getResult($queryStr)) if (!$this->getResult($queryStr))

View File

@ -1201,6 +1201,7 @@ SeedDMS_Core_DMS::getDuplicateDocumentContent() returns complete document
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
do not sort some temporary tables anymore, because it causes an error in mysql if sql_mode=only_full_group_by is set
</notes> </notes>
</release> </release>
<release> <release>
@ -1432,6 +1433,7 @@ if the owner tries to access them
- Add SeedDMS_Core_DMS::getDocumentList() - Add SeedDMS_Core_DMS::getDocumentList()
- Limit number of duplicate files to 1000 - Limit number of duplicate files to 1000
- Add hook on(Pre|Post)RemoveContent - Add hook on(Pre|Post)RemoveContent
- Add hook onAttributeValidate
</notes> </notes>
</release> </release>
<release> <release>

View File

@ -285,8 +285,8 @@ default:
} }
} }
if(isset($_POST["attributes"]) && $_POST["attributes"]) { if(isset($_POST["attributes_version"]) && $_POST["attributes_version"]) {
$attributes = $_POST["attributes"]; $attributes = $_POST["attributes_version"];
foreach($attributes as $attrdefid=>$attribute) { foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $dms->getAttributeDefinition($attrdefid); $attrdef = $dms->getAttributeDefinition($attrdefid);
if($attribute) { if($attribute) {

View File

@ -295,7 +295,7 @@ console.log(element);
?> ?>
<tr> <tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td> <td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, '') ?> <td><?php $this->printAttributeEditField($attrdef, '', 'attributes_version') ?>
<?php <?php
if($latestContent->getAttributeValue($attrdef)) { if($latestContent->getAttributeValue($attrdef)) {
switch($attrdef->getType()) { switch($attrdef->getType()) {
@ -303,10 +303,10 @@ console.log(element);
case SeedDMS_Core_AttributeDefinition::type_date: case SeedDMS_Core_AttributeDefinition::type_date:
case SeedDMS_Core_AttributeDefinition::type_int: case SeedDMS_Core_AttributeDefinition::type_int:
case SeedDMS_Core_AttributeDefinition::type_float: case SeedDMS_Core_AttributeDefinition::type_float:
$this->printInputPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator()); $this->printInputPresetButtonHtml('attributes_version_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator());
break; break;
case SeedDMS_Core_AttributeDefinition::type_boolean: case SeedDMS_Core_AttributeDefinition::type_boolean:
$this->printCheckboxPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef)); $this->printCheckboxPresetButtonHtml('attributes_version_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef));
break; break;
} }
// print_r($latestContent->getAttributeValue($attrdef)); // print_r($latestContent->getAttributeValue($attrdef));