dolibarr  13.0.2
ajaxprojet.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
3  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
28 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
29 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
30 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
31 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
32 if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
33 
34 $res = 0;
35 require '../../main.inc.php';
36 
37 
38 /*
39  * View
40  */
41 
42 // Ajout directives pour resoudre bug IE
43 //header('Cache-Control: Public, must-revalidate');
44 //header('Pragma: public');
45 
46 //top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
47 top_httphead();
48 
49 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
50 
51 dol_syslog(join(',', $_GET));
52 
53 
54 // Generation liste des projets
55 if (GETPOST('fk_projet') != '')
56 {
57  $return_arr = array();
58 
59  $sql = "SELECT p.rowid, p.ref, p.title, s.nom";
60  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
61  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
62  if (!empty($_GET["fk_projet"])) $sql .= " WHERE p.ref LIKE '%".$db->escape($_GET["fk_projet"])."%' OR p.title LIKE '%".$db->escape($_GET["fk_projet"])."%' OR s.nom LIKE '%".$db->escape($_GET["fk_projet"])."%'"; // Add other filters
63  $sql .= " ORDER BY p.ref ASC";
64 
65  $resql = $db->query($sql);
66  if ($resql)
67  {
68  while ($row = $db->fetch_array($resql))
69  {
70  $label = $row['ref'].' - '.$row['title'];
71  $row_array['label'] = $label;
72  $row_array['value'] = $label;
73  $row_array['key'] = $row['rowid'];
74 
75  array_push($return_arr, $row_array);
76  }
77 
78  echo json_encode($return_arr);
79  } else {
80  echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error'));
81  }
82 } else {
83  echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter'));
84 }
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(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1214
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232