dolibarr  19.0.0-dev
contacts.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
24 if (!defined('NOTOKENRENEWAL')) {
25  define('NOTOKENRENEWAL', '1'); // Disables token renewal
26 }
27 if (!defined('NOREQUIREMENU')) {
28  define('NOREQUIREMENU', '1');
29 }
30 if (!defined('NOREQUIREAJAX')) {
31  define('NOREQUIREAJAX', '1');
32 }
33 
34 // Load Dolibarr environment
35 require '../../main.inc.php';
36 
37 $id = GETPOST('id', 'int'); // id of thirdparty
38 $action = GETPOST('action', 'aZ09');
39 $htmlname = GETPOST('htmlname', 'alpha');
40 $showempty = GETPOST('showempty', 'int');
41 
42 // Security check
43 $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
44 
45 
46 /*
47  * View
48  */
49 
50 top_httphead();
51 
52 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
53 
54 // Load original field value
55 if (!empty($id) && !empty($action) && !empty($htmlname)) {
56  $form = new Form($db);
57 
58  $return = array();
59  if (empty($showempty)) {
60  $showempty = 0;
61  }
62 
63  $return['value'] = $form->selectcontacts($id, '', $htmlname, $showempty, '', '', 0, '', true);
64  $return['num'] = $form->num;
65  $return['error'] = $form->error;
66 
67  echo json_encode($return);
68 }
Class to manage generation of HTML components Only common components must be here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1494
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.