23 if (!defined(
'NOTOKENRENEWAL')) {
24 define(
'NOTOKENRENEWAL',
'1');
26 if (!defined(
'NOREQUIREMENU')) {
27 define(
'NOREQUIREMENU',
'1');
29 if (!defined(
'NOREQUIREAJAX')) {
30 define(
'NOREQUIREAJAX',
'1');
32 if (!defined(
'NOREQUIRESOC')) {
33 define(
'NOREQUIRESOC',
'1');
37 require
'../../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/genericobject.class.php';
40 $field =
GETPOST(
'field',
'alpha');
41 $element =
GETPOST(
'element',
'alpha');
42 $table_element =
GETPOST(
'table_element',
'alpha');
43 $fk_element =
GETPOST(
'fk_element',
'alpha');
54 if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_element)) {
55 $ext_element =
GETPOST(
'ext_element',
'alpha');
56 $field = substr($field, 8);
57 $type =
GETPOST(
'type',
'alpha');
58 $loadmethod = (
GETPOST(
'loadmethod',
'alpha') ?
GETPOST(
'loadmethod',
'alpha') :
'getValueFrom');
60 if ($element !=
'order_supplier' && $element !=
'invoice_supplier' && preg_match(
'/^([^_]+)_([^_]+)/i', $element, $regs)) {
62 $subelement = $regs[2];
65 if ($element ==
'propal') {
67 } elseif ($element ==
'fichinter') {
68 $element =
'ficheinter';
69 } elseif ($element ==
'product') {
71 } elseif ($element ==
'member') {
72 $element =
'adherent';
73 } elseif ($element ==
'order_supplier') {
74 $element =
'fournisseur';
75 $subelement =
'commande';
76 } elseif ($element ==
'invoice_supplier') {
77 $element =
'fournisseur';
78 $subelement =
'facture';
81 if ($user->rights->$element->lire || $user->rights->$element->read
82 || (isset($subelement) && ($user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read))
83 || ($element ==
'payment' && $user->rights->facture->lire)
84 || ($element ==
'payment_supplier' && $user->rights->fournisseur->facture->lire)) {
85 if ($type ==
'select') {
86 $methodname =
'load_cache_'.$loadmethod;
87 $cachename =
'cache_'.GETPOST(
'loadmethod',
'alpha');
90 if (method_exists(
$form, $methodname)) {
91 $ret =
$form->$methodname();
93 echo json_encode(
$form->$cachename);
95 } elseif (!empty($ext_element)) {
96 $module = $subelement = $ext_element;
97 if (preg_match(
'/^([^_]+)_([^_]+)/i', $ext_element, $regs)) {
99 $subelement = $regs[2];
103 $classname =
'Actions'.ucfirst($subelement);
104 $object =
new $classname($db);
105 $ret = $object->$methodname($fk_element);
107 echo json_encode($object->$cachename);
112 $value = $object->$loadmethod($table_element, $fk_element, $field);
116 echo $langs->transnoentities(
'NotEnoughPermissions');
Class of a generic business object.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.