26if (!defined(
'NOTOKENRENEWAL')) {
27 define(
'NOTOKENRENEWAL', 1);
29if (!defined(
'NOREQUIREMENU')) {
30 define(
'NOREQUIREMENU',
'1');
32if (!defined(
'NOREQUIREHTML')) {
33 define(
'NOREQUIREHTML',
'1');
35if (!defined(
'NOREQUIREAJAX')) {
36 define(
'NOREQUIREAJAX',
'1');
38if (!defined(
'NOREQUIRESOC')) {
39 define(
'NOREQUIRESOC',
'1');
43require
'../../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
56$objectdesc =
GETPOST(
'objectdesc',
'alphanohtml', 0,
null,
null, 1);
57$htmlname =
GETPOST(
'htmlname',
'aZ09');
60$objectfield =
GETPOST(
'objectfield',
'alpha');
62if (empty($htmlname)) {
66if (!empty($objectfield)) {
70 $tmparray = explode(
':', $objectfield);
74 $objectforfieldstmp = fetchObjectByElement(0, strtolower($tmparray[0]));
77 if (preg_match(
'/^options_(.*)$/', $tmparray[1], $reg)) {
81 $extrafields->fetch_name_optionals_label($objectforfieldstmp->table_element);
83 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key]) && $extrafields->attributes[$objectforfieldstmp->table_element][
'type'][$key] ==
'link') {
84 if (!empty($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options'])) {
85 $tmpextrafields = array_keys($extrafields->attributes[$objectforfieldstmp->table_element][
'param'][$key][
'options']);
86 $objectdesc = $tmpextrafields[0];
91 $objectdesc = $objectforfieldstmp->fields[$tmparray[1]][
'type'];
92 $objectdesc = preg_replace(
'/^integer[^:]*:/',
'', $objectdesc);
102 $InfoFieldList = explode(
":", $objectdesc, 4);
103 $vartmp = (empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3]);
105 if (preg_match(
'/^.*:(\w*)$/', $vartmp, $reg)) {
106 $InfoFieldList[4] = $reg[1];
108 $InfoFieldList[3] = preg_replace(
'/:\w*$/',
'', $vartmp);
110 $classname = $InfoFieldList[0];
112 if (!empty($InfoFieldList[1])) {
117 $filter = empty($InfoFieldList[3]) ?
'' : $InfoFieldList[3];
118 $sortfield = empty($InfoFieldList[4]) ?
'' : $InfoFieldList[4];
121 $objecttmp = fetchObjectByElement(0, strtolower($InfoFieldList[0]));
124 if (empty($objecttmp) && !empty($classpath) && preg_match(
'/\.class\.php$/', $classpath)) {
127 if ($classname && class_exists($classname)) {
128 $objecttmp =
new $classname($db);
134$sharedentities =
getEntity(strtolower($objecttmp->element));
136$filter = str_replace(
137 array(
'__ENTITY__',
'__SHARED_ENTITIES__',
'__USER_ID__',
'$ID$'),
138 array($conf->entity, $sharedentities, $user->id, $id),
152$searchkey = ((
$id &&
GETPOST((
string) $id,
'alpha')) ?
GETPOST((
string)
$id,
'alpha') : (($htmlname &&
GETPOST($htmlname,
'alpha')) ?
GETPOST($htmlname,
'alpha') :
''));
155$allowModules = [
'bom'];
156if ($objecttmp !==
null && !empty($objecttmp->module) && !in_array($objecttmp->module, $allowModules)) {
157 restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element);
159 restrictedArea($user, $objecttmp !==
null ? $objecttmp->element :
'unknownobject',
$id);
167$form =
new Form($db);
169top_httphead($outjson ?
'application/json' :
'text/html');
173$arrayresult = $form->selectForFormsList($objecttmp, (
string) $htmlname, 0, 0, $searchkey,
'',
'',
'', 0, 1, 0,
'', $filter);
178 print json_encode($arrayresult);
$id
Support class for third parties, contacts, members, users or resources.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
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.
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.