26if (!defined(
'NOTOKENRENEWAL')) {
27 define(
'NOTOKENRENEWAL',
'1');
29if (!defined(
'NOREQUIREMENU')) {
30 define(
'NOREQUIREMENU',
'1');
32if (!defined(
'NOREQUIREHTML')) {
33 define(
'NOREQUIREHTML',
'1');
35if (!defined(
'NOREQUIREAJAX')) {
36 define(
'NOREQUIREAJAX',
'1');
38if (!defined(
'NOREQUIRESOC')) {
39 define(
'NOREQUIRESOC',
'1');
43require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/genericobject.class.php';
54$action =
GETPOST(
'action',
'aZ09');
55$backtopage =
GETPOST(
'backtopage');
58$element =
GETPOST(
'element',
'alpha');
59$field =
GETPOST(
'field',
'alpha');
65if (!is_object($object)) {
68'@phan-var-force CommonObject $object';
70$object->fields[$field] = array(
'type' => $format,
'enabled' => 1);
74$usesublevelpermission = ($module != $element ? $element :
'');
75if ($usesublevelpermission && !$user->hasRight($module, $element)) {
76 $usesublevelpermission =
'';
82if (!empty($user->socid)) {
83 $socid = $user->socid;
91if (preg_match(
'/stat[u][st]$/', $field) || ($field ==
'evenunsubscribe' &&
$object->table_element ==
'mailing')) {
93} elseif ($element ==
'product' && in_array($field, array(
'tosell',
'tobuy',
'tobatch'))) {
94 restrictedArea($user,
'produit|service', $object,
'product&product',
'',
'',
'rowid');
113print
'<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER[
"PHP_SELF"]).
'?'.
dol_escape_htmltag($_SERVER[
"QUERY_STRING"]).
' -->'.
"\n";
116if (($action ==
'set') && !empty($id)) {
117 $triggerkey = strtoupper(($module != $element ? $module.
'_' :
'').$element).
'_UPDATE';
119 if ($triggerkey ==
'SOCIETE_UPDATE') {
120 $triggerkey =
'COMPANY_MODIFY';
122 if ($triggerkey ==
'PRODUCT_UPDATE') {
123 $triggerkey =
'PRODUCT_MODIFY';
126 $result =
$object->setValueFrom($field, $value,
$object->table_element, $id, $format,
'', $user, $triggerkey);
130 http_response_code(500);
135 header(
'Location: '.$backtopage);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
fetchObjectByElement($element_id, $element_type, $element_ref='', $useCache=0, $maxCacheByType=10)
Fetch an object from its id and element_type Inclusion of classes is automatic.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.