mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
Merge branch 'seeddms-4.3.x' into seeddms-5.0.x
This commit is contained in:
commit
7d7bff7b22
|
@ -125,7 +125,17 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
*/
|
||||
function getValueAsArray() { /* {{{ */
|
||||
if($this->_attrdef->getMultipleValues()) {
|
||||
return explode($this->_value[0], substr($this->_value, 1));
|
||||
/* If the value doesn't start with the separator used in the value set,
|
||||
* then assume that the value was not saved with a leading separator.
|
||||
* This can happen, if the value was previously a single value from
|
||||
* the value set and later turned into a multi value attribute.
|
||||
*/
|
||||
$sep = substr($this->_value, 0, 1);
|
||||
$vsep = $this->_attrdef->getValueSetSeparator();
|
||||
if($sep == $vsep)
|
||||
return(explode($sep, substr($this->_value, 1)));
|
||||
else
|
||||
return(array($this->_value));
|
||||
} else {
|
||||
return array($this->_value);
|
||||
}
|
||||
|
@ -728,6 +738,35 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Parse a given value according to attribute definition
|
||||
*
|
||||
* The return value is always an array, even if the attribute is single
|
||||
* value attribute.
|
||||
*
|
||||
* @return array list of single values
|
||||
*/
|
||||
function parseValue($value) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
if($this->getMultipleValues()) {
|
||||
/* If the value doesn't start with the separator used in the value set,
|
||||
* then assume that the value was not saved with a leading separator.
|
||||
* This can happen, if the value was previously a single value from
|
||||
* the value set and later turned into a multi value attribute.
|
||||
*/
|
||||
$sep = substr($value, 0, 1);
|
||||
$vsep = $this->getValueSetSeparator();
|
||||
if($sep == $vsep)
|
||||
return(explode($sep, substr($value, 1)));
|
||||
else
|
||||
return(array($value));
|
||||
} else {
|
||||
return array($value);
|
||||
}
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return a list of documents, folders, document contents where this
|
||||
* attribute definition is used
|
||||
|
|
|
@ -136,7 +136,16 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
$value = $this->_attributes[$attrdef->getId()]->getValue();
|
||||
if($attrdef->getMultipleValues()) {
|
||||
$sep = substr($value, 0, 1);
|
||||
return(explode($sep, substr($value, 1)));
|
||||
$vsep = $attrdef->getValueSetSeparator();
|
||||
/* If the value doesn't start with the separator used in the value set,
|
||||
* then assume that the value was not saved with a leading separator.
|
||||
* This can happen, if the value was previously a single value from
|
||||
* the value set and later turned into a multi value attribute.
|
||||
*/
|
||||
if($sep == $vsep)
|
||||
return(explode($sep, substr($value, 1)));
|
||||
else
|
||||
return(array($value));
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
|
|
|
@ -1125,6 +1125,7 @@ SeedDMS_Core_DMS::getNotificationsByUser() are deprecated
|
|||
<notes>
|
||||
- new method SeedDMЅ_Core_WorkflowAction::getTransitions()
|
||||
- new method SeedDMЅ_Core_WorkflowState::getTransitions()
|
||||
- new method SeedDMЅ_Core_AttributeDefinition::parseValue()
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
|
@ -92,8 +92,9 @@ $(document).ready( function() {
|
|||
print "<th></th>\n";
|
||||
print "</tr></thead>\n<tbody>\n";
|
||||
foreach($res['frequencies'][$type] as $entry) {
|
||||
$value = $selattrdef->parseValue($entry['value']);
|
||||
echo "<tr>";
|
||||
echo "<td>".$entry['value']."</td><td>".$entry['c']."</td>";
|
||||
echo "<td>".implode(';', $value)."</td><td>".$entry['c']."</td>";
|
||||
/* various checks, if the value is valid */
|
||||
echo "<td>";
|
||||
/* Check if value is in value set */
|
||||
|
|
Loading…
Reference in New Issue
Block a user