diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php
index 0325f807a..83ec04b26 100644
--- a/SeedDMS_Core/Core/inc.ClassDMS.php
+++ b/SeedDMS_Core/Core/inc.ClassDMS.php
@@ -3385,17 +3385,30 @@ class SeedDMS_Core_DMS {
/**
* Return list of all attributes definitions
*
- * @param integer $objtype select those attributes defined for an object type
+ * @param integer|array $objtype select those attributes defined for an object type
+ * @param integer|array $type select those attributes defined for a type
* @return bool|SeedDMS_Core_AttributeDefinition[] of instances of SeedDMS_Core_AttributeDefinition or false
* or false
*/
- function getAllAttributeDefinitions($objtype=0) { /* {{{ */
+ function getAllAttributeDefinitions($objtype=0, $type=0) { /* {{{ */
$queryStr = "SELECT * FROM `tblAttributeDefinitions`";
- if($objtype) {
- if(is_array($objtype))
- $queryStr .= ' WHERE `objtype` in (\''.implode("','", $objtype).'\')';
- else
- $queryStr .= ' WHERE `objtype`='.intval($objtype);
+ if($objtype || $type) {
+ $queryStr .= ' WHERE ';
+ if($objtype) {
+ if(is_array($objtype))
+ $queryStr .= '`objtype` in (\''.implode("','", $objtype).'\')';
+ else
+ $queryStr .= '`objtype`='.intval($objtype);
+ }
+ if($objtype && $type) {
+ $queryStr .= ' AND ';
+ }
+ if($type) {
+ if(is_array($type))
+ $queryStr .= '`type` in (\''.implode("','", $type).'\')';
+ else
+ $queryStr .= '`type`='.intval($type);
+ }
}
$queryStr .= ' ORDER BY `name`';
$resArr = $this->db->getResultArray($queryStr);
diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml
index 1e6c192d9..73a54a541 100644
--- a/SeedDMS_Core/package.xml
+++ b/SeedDMS_Core/package.xml
@@ -12,7 +12,7 @@
uwe@steinmann.cx
yes
- 2022-05-19
+ 2022-05-20
6.0.19
@@ -1973,7 +1973,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
- 2022-04-22
+ 2022-05-20
5.1.26
@@ -1990,6 +1990,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
- add more types to getStatisticalData()
- add optional parameter $op to SeedDMS_Core_AttributeDefinition::getObjects()
- SeedDMS_Core_AttributeDefinition::getObjects() will not filter by value if null is passed
+- SeedDMS_Core_DMS::getAllAttributeDefinitions() has second parameter to filter attributes by type
diff --git a/views/bootstrap/class.Calendar.php b/views/bootstrap/class.Calendar.php
index 9684ba085..ff1bfa920 100644
--- a/views/bootstrap/class.Calendar.php
+++ b/views/bootstrap/class.Calendar.php
@@ -196,7 +196,30 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
}
}
break;
+ case 'attrdate':
+ if(mktime(23,59,59, $end[1], $end[2], $end[0]) > time()) {
+ $attrdefs = $dms->getAllAttributeDefinitions(\SeedDMS_Core_AttributeDefinition::objtype_document);
+ foreach($attrdefs as $attrdef) {
+ if($attrdef->getType() == \SeedDMS_Core_AttributeDefinition::type_date) {
+ $documents = $attrdef->getObjects($this->params['start'], 0, O_GTEQ);
+ foreach ($documents['docs'] as $document){
+ $arr[] = array(
+ 'start'=>$document->getAttribute($attrdef)->getValue(),
+ 'allDay'=>true,
+ 'color'=>'#4455ff',
+ 'title'=>$document->getName()."\n".$attrdef->getName(),
+ 'documentid'=> $document->getID(),
+ 'eventtype'=> $eventtype,
+ );
+ }
+ }
+ }
+ }
+ break;
case 'action':
+ /* These are all operations which added a new version, an attachment
+ * or any kind of status change
+ */
if($this->params['start']) {
$from = makeTsFromLongDate($this->params['start'].' 00:00:00');
} else {
@@ -325,6 +348,10 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
url: 'out.Calendar.php?action=events&eventtype=action',
editable: false
},
+ {
+ url: 'out.Calendar.php?action=events&eventtype=attrdate',
+ editable: false
+ },
{
url: 'out.Calendar.php?action=events&eventtype=expires',
editable: true
diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php
index 59db9042e..5d45ea510 100644
--- a/views/bootstrap/class.Settings.php
+++ b/views/bootstrap/class.Settings.php
@@ -646,10 +646,9 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
}
break;
case "attributedefinitions":
- if(empty($conf['objtype']))
- $recs = $dms->getAllAttributeDefinitions();
- else
- $recs = $dms->getAllAttributeDefinitions(explode(',', $conf['objtype']));
+ $objtype = empty($conf['objtype']) ? 0 : $conf['objtype'];
+ $attrtype = empty($conf['attrtype']) ? 0 : $conf['attrtype'];
+ $recs = $dms->getAllAttributeDefinitions(explode(',', $objtype), explode(',', $attrtype));
if($recs) {
echo "