add optional parameter $op to SeedDMS_Core_AttributeDefinition::getObjects(), SeedDMS_Core_AttributeDefinition::getObjects() will not filter by value if null is passed

This commit is contained in:
Uwe Steinmann 2022-05-19 19:23:10 +02:00
parent afddc5a4d6
commit 55126a689b
2 changed files with 13 additions and 8 deletions

View File

@ -1066,18 +1066,21 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
* @param integer $limit limit number of documents/folders
* @return array array containing list of documents and folders
*/
public function getObjects($attrvalue, $limit=0) { /* {{{ */
public function getObjects($attrvalue, $limit=0, $op=O_EQ) { /* {{{ */
$db = $this->_dms->getDB();
$result = array('docs'=>array(), 'folders'=>array(), 'contents'=>array());
if($this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_all ||
$this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_document) {
$queryStr = "SELECT * FROM `tblDocumentAttributes` WHERE `attrdef`=".$this->_id." AND ";
if($this->getMultipleValues()) {
$sep = $this->getValueSetSeparator();
$queryStr .= "(`value` like ".$db->qstr($sep.$attrvalue.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue.$sep.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue).")";
} else {
$queryStr .= "`value`=".$db->qstr($attrvalue);
$this->_objtype == SeedDMS_Core_AttributeDefinition::objtype_document) {
$queryStr = "SELECT * FROM `tblDocumentAttributes` WHERE `attrdef`=".$this->_id;
if($attrvalue != null) {
$queryStr .= " AND ";
if($this->getMultipleValues()) {
$sep = $this->getValueSetSeparator();
$queryStr .= "(`value` like ".$db->qstr($sep.$attrvalue.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue.$sep.'%')." OR `value` like ".$db->qstr('%'.$sep.$attrvalue).")";
} else {
$queryStr .= "`value`".$op.$db->qstr($attrvalue);
}
}
if($limit)
$queryStr .= " limit ".(int) $limit;

View File

@ -27,6 +27,8 @@
- fix validating multi value attributes
- SeedDMS_Core_User::removeFromProcesses() can be limited to a list of documents. In that case only the last version will be modified.
- 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
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">