mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 07:22:11 +00:00
add SeedDMS_Core_Attribute::getParsedValue() and use it in SeedDMS_Core_Object:: getAttributeValue()
This commit is contained in:
parent
3571d97f2f
commit
5438d95eb5
|
@ -120,6 +120,27 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
|||
*/
|
||||
function getValue() { return $this->_value; }
|
||||
|
||||
/**
|
||||
* Return attribute value parsed into a php type or object
|
||||
*
|
||||
* This function will return the value of multi value attributes
|
||||
* including the separator char.
|
||||
*
|
||||
* @return string the attribute value as it is stored in the database.
|
||||
*/
|
||||
function getParsedValue() { /* {{{ */
|
||||
switch($this->_attrdef->getType()) {
|
||||
case SeedDMS_Core_AttributeDefinition::type_float:
|
||||
return (float) $this->_value;
|
||||
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
||||
return (bool) $this->_value;
|
||||
case SeedDMS_Core_AttributeDefinition::type_int:
|
||||
return (int) $this->_value;
|
||||
default:
|
||||
return $this->_value;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return attribute values as an array
|
||||
*
|
||||
|
|
|
@ -152,7 +152,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
}
|
||||
|
||||
if (isset($this->_attributes[$attrdef->getId()])) {
|
||||
$value = $this->_attributes[$attrdef->getId()]->getValue();
|
||||
$value = $this->_attributes[$attrdef->getId()]->getValue();
|
||||
if($attrdef->getMultipleValues()) {
|
||||
$sep = substr($value, 0, 1);
|
||||
$vsep = $attrdef->getValueSetSeparator();
|
||||
|
@ -166,7 +166,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
|||
else
|
||||
return(array($value));
|
||||
} else {
|
||||
return $value;
|
||||
return $this->_attributes[$attrdef->getId()]->getParsedValue();
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
- fix SeedDMS_Core_File::fileExtension()
|
||||
- SeedDMS_Core_DMS::createPasswordRequest() creates a cryptographically secure hash
|
||||
- fix sql error when deleting a folder attribute
|
||||
- add SeedDMS_Core_Attribute::getParsedValue() and use it in SeedDMS_Core_Object::getAttributeValue()
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
Loading…
Reference in New Issue
Block a user