25if (!defined(
'NOTOKENRENEWAL')) {
26 define(
'NOTOKENRENEWAL', 1);
28if (!defined(
'NOREQUIREMENU')) {
29 define(
'NOREQUIREMENU',
'1');
31if (!defined(
'NOREQUIREHTML')) {
32 define(
'NOREQUIREHTML',
'1');
34if (!defined(
'NOREQUIREAJAX')) {
35 define(
'NOREQUIREAJAX',
'1');
37if (!defined(
'NOREQUIRESOC')) {
38 define(
'NOREQUIRESOC',
'1');
42include
'../../main.inc.php';
52$objectType =
GETPOST(
'objectType',
'aZ09');
53$objectId =
GETPOST(
'objectId',
'aZ09');
54$field =
GETPOST(
'field',
'aZ09');
55$value =
GETPOST(
'value',
'alpha');
59if (is_numeric($objectId)) {
60 $objectId = (int) $objectId;
62 $element_ref = $objectId;
65$object = fetchObjectByElement($objectId, $objectType, $element_ref);
67 httponly_accessforbidden(
'Failed to get object with fetchObjectByElement(id=' . $objectId .
', objecttype=' . $objectType .
')');
74$usesublevelpermission = ($module != $element ? $element :
'');
75if ($usesublevelpermission && !$user->hasRight($module, $element,
'write') && !$user->hasRight($module,
'write')) {
76 $usesublevelpermission =
'';
89dol_syslog(
"Call ajax core/ajax/updateextrafield.php");
94if (
$object->id > 0 && $field && isset($value)) {
96 $extrafields->fetch_name_optionals_label(
$object->table_element);
101 $object->array_options[
'options_'.$field] = $value;
102 if ($object instanceof
Societe) {
105 $result =
$object->update($user);
109 print json_encode([
'status' =>
'error',
'message' =>
'Error updating '. $field]);
111 print json_encode([
'status' =>
'success',
'message' => $field .
' updated successfully']);
if(! $sortfield) if(! $sortorder) $object
Class to manage third parties objects (customers, suppliers, prospects...)
getElementProperties($elementType)
Get an array with properties of an element.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.