25 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL', 1);
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');
32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50 dol_syslog(
"GET is ".join(
',', $_GET).
', MAIN_USE_ZIPTOWN_DICTIONNARY='.(empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY) ?
'' : $conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY));
54 if (!empty($_GET[
'zipcode']) || !empty($_GET[
'town']))
56 $return_arr = array();
60 $zipcode = $_GET[
'zipcode'] ? $_GET[
'zipcode'] :
'';
61 $town = $_GET[
'town'] ? $_GET[
'town'] :
'';
63 if (!empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY))
65 $sql =
"SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country";
66 $sql .=
", c.rowid as fk_country, c.code as country_code, c.label as country";
67 $sql .=
", d.rowid as fk_county, d.code_departement as county_code, d.nom as county";
68 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_ziptown as z";
69 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as d ON z.fk_county = d.rowid";
70 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_regions as r ON d.fk_region = r.code_region,";
71 $sql .=
" ".MAIN_DB_PREFIX.
"c_country as c";
72 $sql .=
" WHERE z.fk_pays = c.rowid";
73 $sql .=
" AND z.active = 1 AND c.active = 1";
74 if ($zipcode) $sql .=
" AND z.zip LIKE '".$db->escape($zipcode).
"%'";
75 if ($town) $sql .=
" AND z.town LIKE '%".$db->escape($town).
"%'";
76 $sql .=
" ORDER BY z.zip, z.town";
77 $sql .= $db->plimit(100);
80 $sql =
"SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country";
81 $sql .=
", c.code as country_code, c.label as country";
82 $sql .=
", d.code_departement as county_code , d.nom as county";
83 $sql .=
" FROM ".MAIN_DB_PREFIX.
'societe as s';
84 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as d ON s.fk_departement = d.rowid";
85 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
87 if ($zipcode) $sql .=
" s.zip LIKE '".$db->escape($zipcode).
"%'";
88 if ($town) $sql .=
" s.town LIKE '%".$db->escape($town).
"%'";
89 $sql .=
" ORDER BY s.fk_pays, s.zip, s.town";
90 $sql .= $db->plimit(100);
98 while ($row = $db->fetch_array(
$resql))
100 $country = $row[
'fk_country'] ? ($langs->transnoentitiesnoconv(
'Country'.$row[
'country_code']) !=
'Country'.$row[
'country_code'] ? $langs->transnoentitiesnoconv(
'Country'.$row[
'country_code']) : $row[
'country']) :
'';
101 $county = $row[
'fk_county'] ? ($langs->transnoentitiesnoconv($row[
'county_code']) != $row[
'county_code'] ? $langs->transnoentitiesnoconv($row[
'county_code']) : ($row[
'county'] !=
'-' ? $row[
'county'] :
'')) :
'';
103 $row_array[
'label'] = $row[
'zip'].
' '.$row[
'town'];
104 $row_array[
'label'] .= ($county || $country) ?
' (' :
'';
105 $row_array[
'label'] .= $county;
106 $row_array[
'label'] .= ($county && $country ?
' - ' :
'');
107 $row_array[
'label'] .= $country;
108 $row_array[
'label'] .= ($county || $country) ?
')' :
'';
111 $row_array[
'value'] = $row[
'zip'];
112 $row_array[
'town'] = $row[
'town'];
116 $row_array[
'value'] = $row[
'town'];
117 $row_array[
'zipcode'] = $row[
'zip'];
119 $row_array[
'selectcountry_id'] = $row[
'fk_country'];
120 $row_array[
'state_id'] = $row[
'fk_county'];
123 $row_array[
'states'] = $formcompany->select_state(
'', $row[
'fk_country'],
'');
125 array_push($return_arr, $row_array);
129 echo json_encode($return_arr);
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
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.