mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
check for propper number of attribute values
This commit is contained in:
parent
f4bb51933f
commit
834a8118e6
|
@ -75,6 +75,14 @@ foreach($attributes as $attrdefid=>$attribute) {
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_no_regex_match"));
|
||||
}
|
||||
}
|
||||
if(is_array($attribute)) {
|
||||
if($attrdef->getMinValues() > count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
if($attrdef->getMaxValues() < count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,6 +98,14 @@ foreach($attributes_version as $attrdefid=>$attribute) {
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_no_regex_match"));
|
||||
}
|
||||
}
|
||||
if(is_array($attribute)) {
|
||||
if($attrdef->getMinValues() > count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
if($attrdef->getMaxValues() < count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,14 @@ foreach($attributes as $attrdefid=>$attribute) {
|
|||
UI::exitError(getMLText("folder_title", array("foldername" => $document->getName())),getMLText("attr_no_regex_match"));
|
||||
}
|
||||
}
|
||||
if(is_array($attribute)) {
|
||||
if($attrdef->getMinValues() > count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
if($attrdef->getMaxValues() < count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,6 +252,14 @@ if($attributes) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_no_regex_match"));
|
||||
}
|
||||
}
|
||||
if(is_array($attribute)) {
|
||||
if($attrdef->getMinValues() > count($attribute)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
if($attrdef->getMaxValues() < count($attribute)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
|
||||
if(!$document->setAttributeValue($dms->getAttributeDefinition($attrdefid), $attribute))
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
|
|
|
@ -160,7 +160,15 @@ if($attributes) {
|
|||
if($attribute) {
|
||||
if($attrdef->getRegex()) {
|
||||
if(!preg_match($attrdef->getRegex(), $attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $document->getName())),getMLText("attr_no_regex_match"));
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_no_regex_match"));
|
||||
}
|
||||
}
|
||||
if(is_array($attribute)) {
|
||||
if($attrdef->getMinValues() > count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
if($attrdef->getMaxValues() < count($attribute)) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
if(!isset($oldattributes[$attrdefid]) || $attribute != $oldattributes[$attrdefid]->getValue()) {
|
||||
|
|
|
@ -183,6 +183,14 @@ if ($_FILES['userfile']['error'] == 0) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $folder->getName())),getMLText("attr_no_regex_match"));
|
||||
}
|
||||
}
|
||||
if(is_array($attribute)) {
|
||||
if($attrdef->getMinValues() > count($attribute)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
if($attrdef->getMaxValues() < count($attribute)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("attr_max_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user