25if (!defined(
'NOTOKENRENEWAL')) {
26 define(
'NOTOKENRENEWAL', 1);
28if (!defined(
'NOREQUIREMENU')) {
29 define(
'NOREQUIREMENU',
'1');
31if (!defined(
'NOREQUIREHTML')) {
32 define(
'NOREQUIREHTML',
'1');
34if (!defined(
'NOREQUIREAJAX')) {
35 define(
'NOREQUIREAJAX',
'1');
37if (!defined(
'NOREQUIRESOC')) {
38 define(
'NOREQUIRESOC',
'1');
42require
'../../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
55$objectdesc =
GETPOST(
'objectdesc',
'alphanohtml', 0,
null,
null, 1);
56$htmlname =
GETPOST(
'htmlname',
'aZ09');
59$objectfield =
GETPOST(
'objectfield',
'alpha');
61if (empty($htmlname)) {
65if (!empty($objectfield)) {
69 $tmparray = explode(
':', $objectfield);
76 if (preg_match(
'/^options_(.*)$/', $tmparray[1], $reg)) {
80 $extrafields->fetch_name_optionals_label($objectforfieldstmp->table_element);
82 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key]) && $extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key] ==
'link') {
83 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options'])) {
84 $tmpextrafields = array_keys($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options']);
85 $objectdesc = $tmpextrafields[0];
90 $objectdesc = $objectforfieldstmp->fields[$tmparray[1]][
'type'];
91 $objectdesc = preg_replace(
'/^integer[^:]*:/',
'', $objectdesc);
101 $InfoFieldList = explode(
":", $objectdesc, 4);
102 $vartmp = (empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3]);
104 if (preg_match(
'/^.*:(\w*)$/', $vartmp, $reg)) {
105 $InfoFieldList[4] = $reg[1];
107 $InfoFieldList[3] = preg_replace(
'/:\w*$/',
'', $vartmp);
109 $classname = $InfoFieldList[0];
110 $classpath = $InfoFieldList[1];
112 $filter = empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3];
113 $sortfield = empty($InfoFieldList[4]) ?
'' : $InfoFieldList[4];
119 if (empty($objecttmp) && !empty($classpath)) {
122 if ($classname && class_exists($classname)) {
123 $objecttmp =
new $classname($db);
129$sharedentities =
getEntity(strtolower($objecttmp->element));
131$filter = str_replace(
132 array(
'__ENTITY__',
'__SHARED_ENTITIES__',
'__USER_ID__',
'$ID$'),
133 array(
$conf->entity, $sharedentities, $user->id, $id),
147$searchkey = ((
$id &&
GETPOST((
string) $id,
'alpha')) ?
GETPOST((
string)
$id,
'alpha') : (($htmlname &&
GETPOST($htmlname,
'alpha')) ?
GETPOST($htmlname,
'alpha') :
''));
150if ($objecttmp !==
null && !empty($objecttmp->module)) {
151 restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element);
161$form =
new Form($db);
163top_httphead($outjson ?
'application/json' :
'text/html');
167$arrayresult = $form->selectForFormsList($objecttmp, $htmlname, 0, 0, $searchkey,
'',
'',
'', 0, 1, 0,
'', $filter);
172 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.