dolibarr  9.0.0
contacts.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2016 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 <http://www.gnu.org/licenses/>.
17  */
18 
24 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25 if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
26 if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
27 
28 require '../../main.inc.php';
29 
30 $id = GETPOST('id','int');
31 $action = GETPOST('action','alpha');
32 $htmlname = GETPOST('htmlname','alpha');
33 $showempty = GETPOST('showempty','int');
34 
35 /*
36  * View
37  */
38 
39 top_httphead();
40 
41 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
42 
43 // Load original field value
44 if (! empty($id) && ! empty($action) && ! empty($htmlname))
45 {
46  $form = new Form($db);
47 
48  $return=array();
49  if (empty($showempty)) $showempty=0;
50 
51  $return['value'] = $form->selectcontacts($id,'',$htmlname,$showempty,'','',0,'',true);
52  $return['num'] = $form->num;
53  $return['error'] = $form->error;
54 
55  echo json_encode($return);
56 }
57 
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(! defined('NOREQUIREMENU')) if(! function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1107
Class to manage generation of HTML components Only common components must be here.