From 2471aab8ccee52254b89b99ad022c1e70f78800a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 27 Jun 2017 17:06:32 +0200 Subject: [PATCH 1/8] check for callback onAttributeValidate --- SeedDMS_Core/Core/inc.ClassAttribute.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassAttribute.php b/SeedDMS_Core/Core/inc.ClassAttribute.php index d8842c1f8..58bb5b027 100644 --- a/SeedDMS_Core/Core/inc.ClassAttribute.php +++ b/SeedDMS_Core/Core/inc.ClassAttribute.php @@ -258,6 +258,13 @@ class SeedDMS_Core_Attribute { /* {{{ */ */ function getValidationError() { return $this->_validation_error; } + /** + * Set validation error + * + * @param integer error code + */ + function setValidationError($error) { $this->_validation_error = $error; } + /** * Get definition of attribute * @@ -916,6 +923,15 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ * @return boolean true if validation succeds, otherwise false */ 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(is_string($attrvalue)) { $sep = $attrvalue[0]; From 8c0e832414be1ffbfa8f80c3ed6b3b0fddfb34b2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 27 Jun 2017 17:08:23 +0200 Subject: [PATCH 2/8] add note --- SeedDMS_Core/package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 883dda435..426468942 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -30,6 +30,7 @@ Check return value of onPreRemove[Document|Folder], return from calling method i Add SeedDMS_Core_DMS::getDocumentList() Limit number of duplicate files to 1000 Add hook on(Pre|Post)RemoveContent +Add hook onAttributeValidate From a2fc405eae7952833bb3f44946ba3f1562e502c6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 28 Jun 2017 14:59:29 +0200 Subject: [PATCH 3/8] do not sort some temp. tables anymore it causes an error if sql_mode=only_full_group_by is set in mysql --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index 76a5366a1..568b549cd 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -358,16 +358,16 @@ class SeedDMS_Core_DatabaseAccess { "SELECT `tblDocumentReviewLog`.`reviewID`, ". "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". "FROM `tblDocumentReviewLog` ". - "GROUP BY `tblDocumentReviewLog`.`reviewID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentReviewLog`.`reviewID` "; //. +// "ORDER BY `maxLogID`"; break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentReviewLog`.`reviewID`, ". "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". "FROM `tblDocumentReviewLog` ". - "GROUP BY `tblDocumentReviewLog`.`reviewID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentReviewLog`.`reviewID` "; //. +// "ORDER BY `maxLogID`"; } if (!$this->_ttreviewid) { if (!$this->getResult($queryStr)) @@ -391,16 +391,16 @@ class SeedDMS_Core_DatabaseAccess { "SELECT `tblDocumentApproveLog`.`approveID`, ". "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". "FROM `tblDocumentApproveLog` ". - "GROUP BY `tblDocumentApproveLog`.`approveID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentApproveLog`.`approveID` "; //. +// "ORDER BY `maxLogID`"; break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (PRIMARY KEY (`approveID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentApproveLog`.`approveID`, ". "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". "FROM `tblDocumentApproveLog` ". - "GROUP BY `tblDocumentApproveLog`.`approveID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentApproveLog`.`approveID` "; //. +// "ORDER BY `maxLogID`"; } if (!$this->_ttapproveid) { if (!$this->getResult($queryStr)) @@ -424,16 +424,16 @@ class SeedDMS_Core_DatabaseAccess { "SELECT `tblDocumentStatusLog`.`statusID` AS `statusID`, ". "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". "FROM `tblDocumentStatusLog` ". - "GROUP BY `tblDocumentStatusLog`.`statusID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentStatusLog`.`statusID` "; //. +// "ORDER BY `maxLogID`"; break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (PRIMARY KEY (`statusID`), INDEX (`maxLogID`)) ". "SELECT `tblDocumentStatusLog`.`statusID`, ". "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". "FROM `tblDocumentStatusLog` ". - "GROUP BY `tblDocumentStatusLog`.`statusID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentStatusLog`.`statusID` "; //. +// "ORDER BY `maxLogID`"; } if (!$this->_ttstatid) { if (!$this->getResult($queryStr)) From 17c8163972ce38157762f5f4e5f96f40e698d61c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 28 Jun 2017 15:00:07 +0200 Subject: [PATCH 4/8] add note for 4.3.35 --- CHANGELOG | 2 ++ SeedDMS_Core/package.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 44c35548d..d99fc60e8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,8 @@ - update last access time only once a minute - run action 'css' in view if it exists, move css code for timeline - 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 diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index c6f354b28..9700a6a6b 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -24,7 +24,7 @@ GPL License -??? +do not sort some temporary tables anymore, because it causes an error in mysql if sql_mode=only_full_group_by is set From 8531371f675c19bb19b30b82171d1a7ca12af521 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 28 Jun 2017 15:29:17 +0200 Subject: [PATCH 5/8] also take out ORDER BY in temp. tables for pgsql driver --- SeedDMS_Core/Core/inc.DBAccessPDO.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SeedDMS_Core/Core/inc.DBAccessPDO.php b/SeedDMS_Core/Core/inc.DBAccessPDO.php index e17734f9d..8dc8a2e63 100644 --- a/SeedDMS_Core/Core/inc.DBAccessPDO.php +++ b/SeedDMS_Core/Core/inc.DBAccessPDO.php @@ -381,8 +381,8 @@ class SeedDMS_Core_DatabaseAccess { "INSERT INTO `ttreviewid` SELECT `tblDocumentReviewLog`.`reviewID`, ". "MAX(`tblDocumentReviewLog`.`reviewLogID`) AS `maxLogID` ". "FROM `tblDocumentReviewLog` ". - "GROUP BY `tblDocumentReviewLog`.`reviewID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentReviewLog`.`reviewID` ";//. +// "ORDER BY `maxLogID`"; break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttreviewid` (PRIMARY KEY (`reviewID`), INDEX (`maxLogID`)) ". @@ -422,8 +422,8 @@ class SeedDMS_Core_DatabaseAccess { "INSERT INTO `ttapproveid` SELECT `tblDocumentApproveLog`.`approveID`, ". "MAX(`tblDocumentApproveLog`.`approveLogID`) AS `maxLogID` ". "FROM `tblDocumentApproveLog` ". - "GROUP BY `tblDocumentApproveLog`.`approveID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentApproveLog`.`approveID` "; //. +// "ORDER BY `maxLogID`"; break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttapproveid` (PRIMARY KEY (`approveID`), INDEX (`maxLogID`)) ". @@ -463,8 +463,8 @@ class SeedDMS_Core_DatabaseAccess { "INSERT INTO `ttstatid` SELECT `tblDocumentStatusLog`.`statusID`, ". "MAX(`tblDocumentStatusLog`.`statusLogID`) AS `maxLogID` ". "FROM `tblDocumentStatusLog` ". - "GROUP BY `tblDocumentStatusLog`.`statusID` ". - "ORDER BY `maxLogID`"; + "GROUP BY `tblDocumentStatusLog`.`statusID` "; //. +// "ORDER BY `maxLogID`"; break; default: $queryStr = "CREATE TEMPORARY TABLE IF NOT EXISTS `ttstatid` (PRIMARY KEY (`statusID`), INDEX (`maxLogID`)) ". From 258c3fae0bfdd27c48792ca63069a6424dc56bb7 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 29 Jun 2017 16:32:42 +0200 Subject: [PATCH 6/8] change field name of attributes to 'attributes_version' makes much more sense because the attributes are version attributes. --- op/op.UpdateDocument.php | 4 ++-- views/bootstrap/class.UpdateDocument.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/op/op.UpdateDocument.php b/op/op.UpdateDocument.php index dfa08811a..8c6fb4c39 100644 --- a/op/op.UpdateDocument.php +++ b/op/op.UpdateDocument.php @@ -265,8 +265,8 @@ default: } } - if(isset($_POST["attributes"]) && $_POST["attributes"]) { - $attributes = $_POST["attributes"]; + if(isset($_POST["attributes_version"]) && $_POST["attributes_version"]) { + $attributes = $_POST["attributes_version"]; foreach($attributes as $attrdefid=>$attribute) { $attrdef = $dms->getAttributeDefinition($attrdefid); if($attribute) { diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index 9bf21f8c0..a94dcdc12 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -289,7 +289,7 @@ console.log(element); ?> getName()); ?>: - printAttributeEditField($attrdef, '') ?> + printAttributeEditField($attrdef, '', 'attributes_version') ?> getAttributeValue($attrdef)) { switch($attrdef->getType()) { @@ -297,10 +297,10 @@ console.log(element); case SeedDMS_Core_AttributeDefinition::type_date: case SeedDMS_Core_AttributeDefinition::type_int: 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; case SeedDMS_Core_AttributeDefinition::type_boolean: - $this->printCheckboxPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef)); + $this->printCheckboxPresetButtonHtml('attributes_version'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef)); break; } // print_r($latestContent->getAttributeValue($attrdef)); From fd55920c5225fe11fa4290f6f9285f228d15c558 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 29 Jun 2017 16:38:16 +0200 Subject: [PATCH 7/8] fix error in preset button --- views/bootstrap/class.UpdateDocument.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index a94dcdc12..ffdd032d0 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -297,10 +297,10 @@ console.log(element); case SeedDMS_Core_AttributeDefinition::type_date: case SeedDMS_Core_AttributeDefinition::type_int: case SeedDMS_Core_AttributeDefinition::type_float: - $this->printInputPresetButtonHtml('attributes_version'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator()); + $this->printInputPresetButtonHtml('attributes_versiont_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator()); break; case SeedDMS_Core_AttributeDefinition::type_boolean: - $this->printCheckboxPresetButtonHtml('attributes_version'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef)); + $this->printCheckboxPresetButtonHtml('attributes_version_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef)); break; } // print_r($latestContent->getAttributeValue($attrdef)); From 78cbe8ad5dbc56eb8aaed5f9507efd79a3f22c8b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 29 Jun 2017 16:42:06 +0200 Subject: [PATCH 8/8] fix typo --- views/bootstrap/class.UpdateDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index ffdd032d0..4133de761 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -297,7 +297,7 @@ console.log(element); case SeedDMS_Core_AttributeDefinition::type_date: case SeedDMS_Core_AttributeDefinition::type_int: case SeedDMS_Core_AttributeDefinition::type_float: - $this->printInputPresetButtonHtml('attributes_versiont_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator()); + $this->printInputPresetButtonHtml('attributes_version_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator()); break; case SeedDMS_Core_AttributeDefinition::type_boolean: $this->printCheckboxPresetButtonHtml('attributes_version_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef));