26if (!defined(
'NOTOKENRENEWAL')) {
27 define(
'NOTOKENRENEWAL',
'1');
29if (!defined(
'NOREQUIREMENU')) {
30 define(
'NOREQUIREMENU',
'1');
32if (!defined(
'NOREQUIREAJAX')) {
33 define(
'NOREQUIREAJAX',
'1');
35if (!defined(
'NOREQUIRESOC')) {
36 define(
'NOREQUIRESOC',
'1');
40require
'../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/genericobject.class.php';
51$field =
GETPOST(
'field',
'alpha');
52$element =
GETPOST(
'element',
'alpha');
53$table_element =
GETPOST(
'table_element',
'alpha');
54$fk_element =
GETPOST(
'fk_element',
'alpha');
58if (is_numeric($fk_element)) {
59 $id = (int) $fk_element;
61 $element_ref = $fk_element;
64$object = fetchObjectByElement($id, $element, $element_ref);
68$usesublevelpermission = ($module != $element ? $element :
'');
69if ($usesublevelpermission && !$user->hasRight($module, $element)) {
70 $usesublevelpermission =
'';
95if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_element)) {
96 $ext_element =
GETPOST(
'ext_element',
'alpha');
97 $field = substr($field, 8);
98 $type =
GETPOST(
'type',
'alpha');
99 $loadmethod = (
GETPOST(
'loadmethod',
'alpha') ?
GETPOST(
'loadmethod',
'alpha') :
'getValueFrom');
101 if ($element !=
'order_supplier' && $element !=
'invoice_supplier' && preg_match(
'/^([^_]+)_([^_]+)/i', $element, $regs)) {
103 $subelement = $regs[2];
106 if ($element ==
'propal') {
107 $element =
'propale';
108 } elseif ($element ==
'fichinter') {
109 $element =
'ficheinter';
110 } elseif ($element ==
'product') {
111 $element =
'produit';
112 } elseif ($element ==
'member') {
113 $element =
'adherent';
114 } elseif ($element ==
'order_supplier') {
115 $element =
'fournisseur';
116 $subelement =
'commande';
117 } elseif ($element ==
'invoice_supplier') {
118 $element =
'fournisseur';
119 $subelement =
'facture';
122 if ($user->hasRight($element,
'lire') || $user->hasRight($element,
'read')
123 || (isset($subelement) && ($user->hasRight($element, $subelement,
'lire') || $user->hasRight($element, $subelement,
'read')))
124 || ($element ==
'payment' && $user->hasRight(
'facture',
'lire'))
125 || ($element ==
'payment_supplier' && $user->hasRight(
'fournisseur',
'facture',
'lire'))) {
126 if ($type ==
'select') {
127 $methodname =
'load_cache_'.$loadmethod;
128 $cachename =
'cache_'.GETPOST(
'loadmethod',
'alpha');
130 $form =
new Form($db);
131 if (method_exists($form, $methodname)) {
132 $ret = $form->$methodname();
134 echo json_encode($form->$cachename);
136 } elseif (!empty($ext_element)) {
137 $module = $subelement = $ext_element;
139 if (preg_match(
'/^([^_]+)_([^_]+)/i', $ext_element, $regs)) {
141 $subelement = $regs[2];
145 $classname =
'Actions'.ucfirst($subelement);
147 '@phan-var-force ActionsMulticompany|ActionsAdherentCardCommon|ActionsContactCardCommon|CommonHookActions|ActionsCardProduct|ActionsCardService|ActionsCardCommon $object';
148 $ret =
$object->$methodname($fk_element);
150 echo json_encode(
$object->$cachename);
155 $value =
$object->$loadmethod($table_element, (
int) $fk_element, $field);
159 echo $langs->transnoentities(
'NotEnoughPermissions');
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class of a generic business object.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.