LSrelation: fix error codes prefix

This commit is contained in:
Benjamin Renard 2020-09-03 18:38:08 +02:00
parent 9db67eb2ba
commit 88d8d7f026
3 changed files with 45 additions and 45 deletions

View file

@ -1353,7 +1353,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
**/
public static function getObjectKeyValueInRelation($object,$objectType,$attrValues='dn') {
if (!$objectType) {
LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
LSerror :: addErrorCode('LSrelation_05','getObjectKeyValueInRelation');
return;
}
if (!is_array($attrValues)) $attrValues=array($attrValues);
@ -1395,7 +1395,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
**/
public function listObjectsInRelation($object,$attr,$objectType,$attrValues='dn') {
if ((!$attr)||(!$objectType)) {
LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation');
LSerror :: addErrorCode('LSrelation_05','listObjectsInRelation');
return;
}
if (!is_array($attrValues)) $attrValues=array($attrValues);
@ -1428,7 +1428,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
**/
public function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL) {
if ((!$attr)||(!$objectType)) {
LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation');
LSerror :: addErrorCode('LSrelation_05','addOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@ -1493,7 +1493,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
**/
public function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL,$attrValues=null) {
if ((!$attr)||(!$objectType)) {
LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation');
LSerror :: addErrorCode('LSrelation_05','deleteOneObjectInRelation');
return;
}
if ($object instanceof $objectType) {
@ -1544,7 +1544,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
*/
public function renameOneObjectInRelation($object,$oldValues,$attr,$objectType,$attrValue='dn') {
if ((!$attr)||(!$objectType)) {
LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation');
LSerror :: addErrorCode('LSrelation_05','renameOneObjectInRelation');
return;
}
if (!is_array($oldValues)) $oldValues=array($oldValues);
@ -1600,7 +1600,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
**/
public function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL,$attrValues=null) {
if ((!$attr)||(!$objectType)) {
LSerror :: addErrorCode('LSrelations_05','updateObjectsInRelation');
LSerror :: addErrorCode('LSrelation_05','updateObjectsInRelation');
return;
}
if (!is_array($attrValues)) $attrValues=array($attrValue);
@ -2999,7 +2999,7 @@ ___("LSldapObject : Error during generating container DN : %{error}")
);
// LSrelation
LSerror :: defineError('LSrelations_05',
LSerror :: defineError('LSrelation_05',
___("LSrelation : Some parameters are missing in the call of methods to handle standard relations (Method : %{meth}).")
);

View file

@ -52,7 +52,7 @@ class LSrelation extends LSlog_staticLoggerClass {
if (!is_array($this -> config) || !$this -> checkConfig()) {
$this -> config = null;
LSerror :: addErrorCode(
'LSrelations_02',
'LSrelation_02',
array(
'relation' => $relationName,
'LSobject' => $obj -> getType()
@ -119,7 +119,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Check LSobject parameter
if (!$this -> LSobject) {
LSerror :: addErrorCode(
'LSrelations_07',
'LSrelation_07',
array(
'parameter' => 'LSobject',
'relation' => $this -> name,
@ -132,7 +132,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Load related object type
if (!LSsession :: loadLSobject($this -> LSobject)) {
LSerror :: addErrorCode(
'LSrelations_04',
'LSrelation_04',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject
@ -146,7 +146,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Check linkAttribute refered to an existing related object type attribute
if (!call_user_func(array($this -> LSobject, 'hasAttr'), $this -> linkAttribute)) {
LSerror :: addErrorCode(
'LSrelations_08',
'LSrelation_08',
array(
'parameter' => 'linkAttribute',
'relation' => $this -> name,
@ -159,7 +159,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Check linkAttributeValue
if ($this -> linkAttributeValue != 'dn' && !$this -> obj -> hasAttr($this -> linkAttributeValue)) {
LSerror :: addErrorCode(
'LSrelations_08',
'LSrelation_08',
array(
'parameter' => 'linkAttributeValue',
'relation' => $this -> name,
@ -182,7 +182,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Check parameter is defined
if (!$this -> $p) {
LSerror :: addErrorCode(
'LSrelations_07',
'LSrelation_07',
array(
'parameter' => $p,
'relation' => $this -> name,
@ -195,7 +195,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Check parameter refered to an existing related object class method
if (!method_exists($this -> LSobject, $this -> $p)) {
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => $p,
'function' => $this -> $p,
@ -260,7 +260,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Load related object type
if (!LSsession :: loadLSobject($this -> LSobject)) {
LSerror :: addErrorCode(
'LSrelations_04',
'LSrelation_04',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject
@ -281,7 +281,7 @@ class LSrelation extends LSlog_staticLoggerClass {
);
}
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => 'list_function',
'function' => $this -> list_function,
@ -304,7 +304,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Configuration problem
LSerror :: addErrorCode(
'LSrelations_05',
'LSrelation_05',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject,
@ -323,7 +323,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Load related object type
if (!LSsession :: loadLSobject($this -> LSobject)) {
LSerror :: addErrorCode(
'LSrelations_04',
'LSrelation_04',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject
@ -344,7 +344,7 @@ class LSrelation extends LSlog_staticLoggerClass {
);
}
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => 'getkeyvalue_function',
'function' => $this -> getkeyvalue_function,
@ -366,7 +366,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Configuration problem
LSerror :: addErrorCode(
'LSrelations_05',
'LSrelation_05',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject,
@ -392,7 +392,7 @@ class LSrelation extends LSlog_staticLoggerClass {
return call_user_func(array($objRel, $this -> canEdit_function));
}
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => 'canEdit_function',
'function' => $this -> canEdit_function,
@ -414,7 +414,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Configuration problem
LSerror :: addErrorCode(
'LSrelations_05',
'LSrelation_05',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject,
@ -441,7 +441,7 @@ class LSrelation extends LSlog_staticLoggerClass {
);
}
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => 'remove_function',
'function' => $this -> remove_function,
@ -459,7 +459,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Configuration problem
LSerror :: addErrorCode(
'LSrelations_05',
'LSrelation_05',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject,
@ -484,7 +484,7 @@ class LSrelation extends LSlog_staticLoggerClass {
return call_user_func_array(array($objRel, $this -> rename_function), array(&$this -> obj, $oldKeyValue));
}
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => 'rename_function',
'function' => $this -> rename_function,
@ -508,7 +508,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Configuration problem
LSerror :: addErrorCode(
'LSrelations_05',
'LSrelation_05',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject,
@ -529,7 +529,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Load related objects type
if (!LSsession :: loadLSobject($this -> LSobject)) {
LSerror :: addErrorCode(
'LSrelations_04',
'LSrelation_04',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject
@ -550,7 +550,7 @@ class LSrelation extends LSlog_staticLoggerClass {
);
}
LSerror :: addErrorCode(
'LSrelations_01',
'LSrelation_01',
array(
'parameter' => 'update_function',
'function' => $this -> update_function,
@ -576,7 +576,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Configuration problem
LSerror :: addErrorCode(
'LSrelations_05',
'LSrelation_05',
array(
'relation' => $this -> name,
'LSobject' => $this -> LSobject,
@ -622,7 +622,7 @@ class LSrelation extends LSlog_staticLoggerClass {
return;
$LSrelations=array();
$LSrelations_JSparams=array();
$LSrelation_JSparams=array();
foreach($object -> getConfig('LSrelation') as $relationName => $relationConf) {
// Check user access
if (!LSsession :: relationCanAccess($object -> getValue('dn'), $object->getType(), $relationName)) {
@ -644,7 +644,7 @@ class LSrelation extends LSlog_staticLoggerClass {
$id=rand();
$return['id']=$id;
$LSrelations_JSparams[$id]=array(
$LSrelation_JSparams[$id]=array(
'emptyText' => $return['emptyText']
);
$_SESSION['LSrelation'][$id] = array(
@ -692,7 +692,7 @@ class LSrelation extends LSlog_staticLoggerClass {
self :: loadDependenciesDisplay();
LStemplate :: assign('LSrelations',$LSrelations);
LStemplate :: addJSconfigParam('LSrelations',$LSrelations_JSparams);
LStemplate :: addJSconfigParam('LSrelations',$LSrelation_JSparams);
}
/*
@ -857,7 +857,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Update related objects
if (!$relation -> updateRelations(array_keys($selected_objects))) {
LSerror :: addErrorCode('LSrelations_03', $conf['relationName']);
LSerror :: addErrorCode('LSrelation_03', $conf['relationName']);
self :: log_warning("Fail to update objects in relation");
return;
}
@ -907,7 +907,7 @@ class LSrelation extends LSlog_staticLoggerClass {
$list = $relation -> listRelatedObjects();
if (!is_array($list)) {
self :: log_warning('Fail to list related objects');
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
LSerror :: addErrorCode('LSrelation_03',$conf['relationName']);
return;
}
@ -923,7 +923,7 @@ class LSrelation extends LSlog_staticLoggerClass {
return;
}
if (!$relation -> removeRelationWithObject($o)) {
LSerror :: addErrorCode('LSrelations_03', $conf['relationName']);
LSerror :: addErrorCode('LSrelation_03', $conf['relationName']);
return;
}
else {
@ -936,7 +936,7 @@ class LSrelation extends LSlog_staticLoggerClass {
// Check object found
if (!$found) {
self :: log_warning("Object '".$_REQUEST['dn']."' not found in related objects list.");
LSerror :: addErrorCode('LSrelations_03', $conf['relationName']);
LSerror :: addErrorCode('LSrelation_03', $conf['relationName']);
return;
}
@ -950,27 +950,27 @@ class LSrelation extends LSlog_staticLoggerClass {
/**
* Error Codes
**/
LSerror :: defineError('LSrelations_01',
LSerror :: defineError('LSrelation_01',
___("LSrelation : Invalid parameter '%{parameter}' of the relation %{relation}: objects %{LSobject} have no function '%{function}'.")
);
LSerror :: defineError('LSrelations_02',
LSerror :: defineError('LSrelation_02',
___("LSrelation : Relation %{relation} of object type %{LSobject} unknown.")
);
LSerror :: defineError('LSrelations_03',
LSerror :: defineError('LSrelation_03',
___("LSrelation : Error during relation update of the relation %{relation}.")
);
LSerror :: defineError('LSrelations_04',
LSerror :: defineError('LSrelation_04',
___("LSrelation : Object type %{LSobject} unknown (Relation : %{relation}).")
);
LSerror :: defineError('LSrelations_05',
LSerror :: defineError('LSrelation_05',
___("LSrelation : Incomplete configuration for LSrelation %{relation} of object type %{LSobject} for action : %{action}.")
);
LSerror :: defineError('LSrelations_06',
LSerror :: defineError('LSrelation_06',
___("LSrelation : Invalid editable attribute for LSrelation %{relation} with LSobject %{LSobject}.")
);
LSerror :: defineError('LSrelations_07',
LSerror :: defineError('LSrelation_07',
___("LSrelation : The configuration parameter '%{parameter}' of the relation %{relation} of %{LSobject} is missing.")
);
LSerror :: defineError('LSrelations_08',
LSerror :: defineError('LSrelation_08',
___("LSrelation : The configuration parameter '%{parameter}' of the relation %{relation} of %{LSobject} is invalid.")
);

View file

@ -862,7 +862,7 @@ function handle_LSobject_create($request) {
$object -> attrs[$attr] -> data = array($value);
}
else {
LSerror :: addErrorCode('LSrelations_06',array('relation' => $relation -> getName(),'LSobject' => $obj -> getType()));
LSerror :: addErrorCode('LSrelation_06',array('relation' => $relation -> getName(),'LSobject' => $obj -> getType()));
}
}
else {