mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
check if attribute definition exists
This commit is contained in:
parent
25e7eaed64
commit
3d638b47a8
|
@ -84,7 +84,8 @@ $categories = isset($_POST["categories"]) ? $_POST["categories"] : null;
|
|||
$cats = array();
|
||||
if($categories) {
|
||||
foreach($categories as $catid) {
|
||||
$cats[] = $dms->getDocumentCategory($catid);
|
||||
if($cat = $dms->getDocumentCategory($catid))
|
||||
$cats[] = $cat;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,14 +94,15 @@ if(isset($_POST["attributes"]))
|
|||
else
|
||||
$attributes = array();
|
||||
foreach($attributes as $attrdefid=>$attribute) {
|
||||
$attrdef = $dms->getAttributeDefinition($attrdefid);
|
||||
if($attribute) {
|
||||
if(!$attrdef->validate($attribute)) {
|
||||
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())), $errmsg);
|
||||
if($attrdef = $dms->getAttributeDefinition($attrdefid)) {
|
||||
if($attribute) {
|
||||
if(!$attrdef->validate($attribute)) {
|
||||
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())), $errmsg);
|
||||
}
|
||||
} elseif($attrdef->getMinValues() > 0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
} elseif($attrdef->getMinValues() > 0) {
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("attr_min_values", array("attrname"=>$attrdef->getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +132,8 @@ if (!is_numeric($sequence)) {
|
|||
switch($_POST["presetexpdate"]) {
|
||||
case "date":
|
||||
$tmp = explode('-', $_POST["expdate"]);
|
||||
if(count($tmp) != 3)
|
||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("malformed_expiration_date"));
|
||||
$expires = mktime(0,0,0, $tmp[1], $tmp[2], $tmp[0]);
|
||||
break;
|
||||
case "1w":
|
||||
|
|
Loading…
Reference in New Issue
Block a user