check if attributes are posted

This commit is contained in:
Uwe Steinmann 2013-06-16 20:34:43 +02:00
parent cb7ca87c6c
commit 9df1a1eb08

View File

@ -168,6 +168,7 @@ if ($_FILES['userfile']['error'] == 0) {
} }
} }
if(isset($_POST["attributes"]) && $_POST["attributes"]) {
$attributes = $_POST["attributes"]; $attributes = $_POST["attributes"];
foreach($attributes as $attrdefid=>$attribute) { foreach($attributes as $attrdefid=>$attribute) {
$attrdef = $dms->getAttributeDefinition($attrdefid); $attrdef = $dms->getAttributeDefinition($attrdefid);
@ -179,6 +180,9 @@ if ($_FILES['userfile']['error'] == 0) {
} }
} }
} }
} else {
$attributes = array();
}
$contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes); $contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes);
if (is_bool($contentResult) && !$contentResult) { if (is_bool($contentResult) && !$contentResult) {