24if (!defined(
'NOTOKENRENEWAL')) {
25 define(
'NOTOKENRENEWAL', 1);
27if (!defined(
'NOREQUIREMENU')) {
28 define(
'NOREQUIREMENU',
'1');
30if (!defined(
'NOREQUIREHTML')) {
31 define(
'NOREQUIREHTML',
'1');
33if (!defined(
'NOREQUIREAJAX')) {
34 define(
'NOREQUIREAJAX',
'1');
36if (!defined(
'NOREQUIRESOC')) {
37 define(
'NOREQUIRESOC',
'1');
41require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
47$objectdesc =
GETPOST(
'objectdesc',
'alphanohtml', 0,
null,
null, 1);
48$htmlname =
GETPOST(
'htmlname',
'aZ09');
51$objectfield =
GETPOST(
'objectfield',
'alpha');
53if (empty($htmlname)) {
57if (!empty($objectfield)) {
61 $tmparray = explode(
':', $objectfield);
68 if (preg_match(
'/^options_(.*)$/', $tmparray[1], $reg)) {
72 $extrafields->fetch_name_optionals_label($objectforfieldstmp->table_element);
74 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key]) && $extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key] ==
'link') {
75 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options'])) {
76 $tmpextrafields = array_keys($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options']);
77 $objectdesc = $tmpextrafields[0];
82 $objectdesc = $objectforfieldstmp->fields[$tmparray[1]][
'type'];
83 $objectdesc = preg_replace(
'/^integer[^:]*:/',
'', $objectdesc);
92 $InfoFieldList = explode(
":", $objectdesc, 4);
93 $vartmp = (empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3]);
95 if (preg_match(
'/^.*:(\w*)$/', $vartmp, $reg)) {
96 $InfoFieldList[4] = $reg[1];
98 $InfoFieldList[3] = preg_replace(
'/:\w*$/',
'', $vartmp);
100 $classname = $InfoFieldList[0];
101 $classpath = $InfoFieldList[1];
103 $filter = empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3];
104 $sortfield = empty($InfoFieldList[4]) ?
'' : $InfoFieldList[4];
110 if (empty($objecttmp) && !empty($classpath)) {
113 if ($classname && class_exists($classname)) {
114 $objecttmp =
new $classname($db);
120$sharedentities =
getEntity(strtolower($objecttmp->element));
122$filter = str_replace(
123 array(
'__ENTITY__',
'__SHARED_ENTITIES__',
'__USER_ID__',
'$ID$'),
124 array($conf->entity, $sharedentities, $user->id, $id),
138$searchkey = ((
$id &&
GETPOST((
string) $id,
'alpha')) ?
GETPOST((
string)
$id,
'alpha') : (($htmlname &&
GETPOST($htmlname,
'alpha')) ?
GETPOST($htmlname,
'alpha') :
''));
141if (!empty($objecttmp->module)) {
142 restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element);
152$form =
new Form($db);
154top_httphead($outjson ?
'application/json' :
'text/html');
158$arrayresult = $form->selectForFormsList($objecttmp, $htmlname,
'', 0, $searchkey,
'',
'',
'', 0, 1, 0,
'', $filter);
163 print json_encode($arrayresult);
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
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.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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.