27if (!defined(
'NOTOKENRENEWAL')) {
28 define(
'NOTOKENRENEWAL', 1);
30if (!defined(
'NOREQUIREMENU')) {
31 define(
'NOREQUIREMENU',
'1');
33if (!defined(
'NOREQUIREHTML')) {
34 define(
'NOREQUIREHTML',
'1');
36if (!defined(
'NOREQUIREAJAX')) {
37 define(
'NOREQUIREAJAX',
'1');
39if (!defined(
'NOREQUIRESOC')) {
40 define(
'NOREQUIRESOC',
'1');
44require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
47$htmlname =
GETPOST(
'htmlname',
'aZ09');
49$action =
GETPOST(
'action',
'aZ09');
53$exclude =
GETPOST(
'exclude',
'intcomma');
62if ($user->socid > 0) {
64 $socid = $user->socid;
69$permissiontoread = $user->hasRight(
'societe',
'lire');
80if ($action ==
'fetch' && !empty($id) && $permissiontoread) {
81 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
87 $outfirstname =
$object->firstname;
88 $outlastname =
$object->lastname;
91 $outjson = array(
'ref' => $outref,
'firstname' => $outfirstname,
'lastname' => $outlastname,
'desc' => $outdesc);
94 echo json_encode($outjson);
95} elseif ($permissiontoread) {
96 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
98 if (empty($htmlname)) {
99 return 'Error value for parameter htmlname';
105 $match = preg_grep(
'/('.preg_quote($htmlname,
'/').
'[0-9]+)/', array_keys($_GET));
108 $id = (!empty($match[0]) ? $match[0] :
'');
111 $searchkey = ((
$id &&
GETPOST($id,
'alpha')) ?
GETPOST($id,
'alpha') : (($htmlname &&
GETPOST($htmlname,
'alpha')) ?
GETPOST($htmlname,
'alpha') :
''));
116 if (empty($form) || !is_object($form)) {
117 $form =
new Form($db);
122 $morecss =
'minwidth100';
135 $listofsearchkey = preg_split(
'/\s+/', $searchkey);
136 foreach ($listofsearchkey as $searchkey) {
137 $nbchar += strlen($searchkey);
139 $filter .= ($filter ?
' AND ' :
'');
141 $filter .=
"(lastname:like:'".$prefix.$searchkey.
"%') OR (firstname:like:'".$prefix.$searchkey.
"%')";
143 $filter .=
" OR (s.nom:like:'".$prefix.$searchkey.
"%')";
150 print json_encode(array());
152 $arrayresult = $form->selectcontacts($socid, array(), $htmlname, 1, $exclude, $limitto, $showfunction, $morecss, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid, $multiple, $disableifempty, $filter);
154 print json_encode($arrayresult);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.