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

This commit is contained in:
Uwe Steinmann 2022-05-20 12:31:25 +02:00
commit af93db836e
4 changed files with 53 additions and 13 deletions

View File

@ -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 <a href='psi_element://SeedDMS_Core_AttributeDefinition'>SeedDMS_Core_AttributeDefinition</a> 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);

View File

@ -12,7 +12,7 @@
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2022-05-19</date>
<date>2022-05-20</date>
<time>13:44:55</time>
<version>
<release>6.0.19</release>
@ -1973,7 +1973,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
</notes>
</release>
<release>
<date>2022-04-22</date>
<date>2022-05-20</date>
<time>13:44:55</time>
<version>
<release>5.1.26</release>
@ -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
</notes>
</release>
<release>

View File

@ -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

View File

@ -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 "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"extensions[".$extname."][".$confkey."][]\"".(!empty($conf['multiple']) ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_attrdef")."\" data-no_results_text=\"".getMLText('unknown_attrdef')."\">";
if($allowempty)