dolibarr  13.0.2
ajaxcountries.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) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
25 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
26 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
27 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
28 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
29 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
30 if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
31 
32 require '../main.inc.php';
33 
34 $country = GETPOST('country', 'alpha');
35 
36 
37 /*
38  * View
39  */
40 
41 // Ajout directives pour resoudre bug IE
42 //header('Cache-Control: Public, must-revalidate');
43 //header('Pragma: public');
44 
45 //top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
46 top_httphead();
47 
48 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
49 
50 dol_syslog(join(',', $_POST));
51 
52 // Generate list of countries
53 if (!empty($country))
54 {
55  global $langs;
56  $langs->load("dict");
57 
58  $sql = "SELECT rowid, code, label, active";
59  $sql .= " FROM ".MAIN_DB_PREFIX."c_country";
60  $sql .= " WHERE active = 1 AND label LIKE '%".$db->escape(utf8_decode($country))."%'";
61  $sql .= " ORDER BY label ASC";
62 
63  $resql = $db->query($sql);
64  if ($resql)
65  {
66  print '<ul>';
67  while ($country = $db->fetch_object($resql))
68  {
69  print '<li>';
70  // Si traduction existe, on l'utilise, sinon on prend le libellĂ© par dĂ©faut
71  print ($country->code && $langs->trans("Country".$country->code) != "Country".$country->code ? $langs->trans("Country".$country->code) : ($country->label != '-' ? $country->label : '&nbsp;'));
72  print '<span class="informal" style="display:none">'.$country->rowid.'-idcache</span>';
73  print '</li>';
74  }
75  print '</ul>';
76  }
77 }
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.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
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
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...