23if (!defined(
'NOTOKENRENEWAL')) {
24 define(
'NOTOKENRENEWAL', 1);
26if (!defined(
'NOREQUIREMENU')) {
27 define(
'NOREQUIREMENU',
'1');
29if (!defined(
'NOREQUIREHTML')) {
30 define(
'NOREQUIREHTML',
'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/html.form.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46$objectdesc =
GETPOST(
'objectdesc',
'alphanohtml', 0,
null,
null, 1);
47$htmlname =
GETPOST(
'htmlname',
'aZ09');
48$outjson = (
GETPOST(
'outjson',
'int') ?
GETPOST(
'outjson',
'int') : 0);
50$objectfield =
GETPOST(
'objectfield',
'alpha');
52if (empty($htmlname)) {
56if (!empty($objectfield)) {
60 $tmparray = explode(
':', $objectfield);
67 if (preg_match(
'/^options_(.*)$/', $tmparray[1], $reg)) {
71 $extrafields->fetch_name_optionals_label($objectforfieldstmp->table_element);
73 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key]) && $extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key] ==
'link') {
74 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options'])) {
75 $tmpextrafields = array_keys($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options']);
76 $objectdesc = $tmpextrafields[0];
81 $objectdesc = $objectforfieldstmp->fields[$tmparray[1]][
'type'];
82 $objectdesc = preg_replace(
'/^integer[^:]*:/',
'', $objectdesc);
91 $InfoFieldList = explode(
":", $objectdesc, 4);
92 $vartmp = (empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3]);
94 if (preg_match(
'/^.*:(\w*)$/', $vartmp, $reg)) {
95 $InfoFieldList[4] = $reg[1];
97 $InfoFieldList[3] = preg_replace(
'/:\w*$/',
'', $vartmp);
99 $classname = $InfoFieldList[0];
100 $classpath = $InfoFieldList[1];
102 $filter = empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3];
103 $sortfield = empty($InfoFieldList[4]) ?
'' : $InfoFieldList[4];
109 if (empty($objecttmp) && !empty($classpath)) {
112 if ($classname && class_exists($classname)) {
113 $objecttmp =
new $classname($db);
119$sharedentities =
getEntity(strtolower($objecttmp->element));
121$filter = str_replace(
122 array(
'__ENTITY__',
'__SHARED_ENTITIES__',
'__USER_ID__',
'$ID$'),
123 array($conf->entity, $sharedentities, $user->id, $id),
137$searchkey = (($id &&
GETPOST($id,
'alpha')) ?
GETPOST($id,
'alpha') : (($htmlname &&
GETPOST($htmlname,
'alpha')) ?
GETPOST($htmlname,
'alpha') :
''));
140if (!empty($objecttmp->module)) {
141 restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element);
151$form =
new Form($db);
153top_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 value of a param into GET or POST supervariable.
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='')
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.
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.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.