add name of attribute def. in error msg when setting an attribute

This commit is contained in:
Uwe Steinmann 2023-12-13 08:24:30 +01:00
parent 1ac232476a
commit 08415039ca

View File

@ -1669,7 +1669,7 @@ class RestapiController { /* {{{ */
$doc = $dms->getDocument($args['id']);
if($doc && $attrdef) {
if($attrdef->getObjType() !== SeedDMS_Core_AttributeDefinition::objtype_document) {
return $response->withJson(array('success'=>false, 'message'=>'Attribute definition not suitable for documents', 'data'=>''), 409);
return $response->withJson(array('success'=>false, 'message'=>'Attribute definition "'.$attrdef->getName().'" not suitable for documents', 'data'=>''), 409);
}
$params = $request->getParsedBody();
@ -1726,7 +1726,7 @@ class RestapiController { /* {{{ */
$version = $doc->getContentByVersion($args['version']);
if($doc && $attrdef && $version) {
if($attrdef->getObjType() !== SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
return $response->withJson(array('success'=>false, 'message'=>'Attribute definition not suitable for document versions', 'data'=>''), 409);
return $response->withJson(array('success'=>false, 'message'=>'Attribute definition "'.$attrdef->getName().'" not suitable for document versions', 'data'=>''), 409);
}
$params = $request->getParsedBody();
@ -1780,7 +1780,7 @@ class RestapiController { /* {{{ */
$obj = $dms->getFolder($args['id']);
if($obj && $attrdef) {
if($attrdef->getObjType() !== SeedDMS_Core_AttributeDefinition::objtype_folder) {
return $response->withJson(array('success'=>false, 'message'=>'Attribute definition not suitable for folders', 'data'=>''), 409);
return $response->withJson(array('success'=>false, 'message'=>'Attribute definition "'.$attrdef->getName().'" not suitable for folders', 'data'=>''), 409);
}
$params = $request->getParsedBody();