mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
f7bedcdbd8
|
@ -1136,15 +1136,21 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
|
|||
* definition.
|
||||
* If the validation fails the validation error will be set which
|
||||
* can be requested by SeedDMS_Core_Attribute::getValidationError()
|
||||
* Set $new to true if the value to be checked isn't saved to the database
|
||||
* already. It will just be passed to the callback onAttributeValidate where
|
||||
* it could be used to, e.g. check if a value is unique once it is saved to
|
||||
* the database.
|
||||
*
|
||||
* @param string|array $attrvalue attribute value
|
||||
* @param boolean $new set to true if the value is new value and not taken from
|
||||
* an existing attribute
|
||||
* @return boolean true if validation succeds, otherwise false
|
||||
*/
|
||||
function validate($attrvalue) { /* {{{ */
|
||||
function validate($attrvalue, $new=false) { /* {{{ */
|
||||
/* Check if 'onAttributeValidate' callback is set */
|
||||
if(isset($this->_dms->callbacks['onAttributeValidate'])) {
|
||||
foreach($this->_dms->callbacks['onAttributeValidate'] as $callback) {
|
||||
$ret = call_user_func($callback[0], $callback[1], $this, $attrvalue);
|
||||
$ret = call_user_func($callback[0], $callback[1], $this, $attrvalue, $new);
|
||||
if(is_bool($ret))
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
@ -1856,6 +1856,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
|||
<notes>
|
||||
- SeedDMS_Folder_DMS::getAccessList() and getDefaultAccess() do not return fals anymore if the parent does not exists. They just stop inheritance.
|
||||
- pass attribute value to callback 'onAttributeValidate'
|
||||
- new paramter 'new' of methode SeedDMЅ_Core_AttributeDefinition::validate()
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
|
@ -120,7 +120,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
|
|||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||
if(null === ($ret = $this->callHook('validateAttribute', $attrdef, $attribute))) {
|
||||
if($attribute) {
|
||||
if(!$attrdef->validate($attribute)) {
|
||||
if(!$attrdef->validate($attribute, true)) {
|
||||
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user