26if (!defined(
'NOTOKENRENEWAL')) {
27 define(
'NOTOKENRENEWAL', 1);
29if (!defined(
'NOREQUIREMENU')) {
30 define(
'NOREQUIREMENU',
'1');
32if (!defined(
'NOREQUIREHTML')) {
33 define(
'NOREQUIREHTML',
'1');
35if (!defined(
'NOREQUIREAJAX')) {
36 define(
'NOREQUIREAJAX',
'1');
38if (!defined(
'NOREQUIRESOC')) {
39 define(
'NOREQUIRESOC',
'1');
43require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
47if (!isModEnabled(
'incoterm')) {
67dol_syslog(
'location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.
getDolGlobalString(
'MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY',
''));
70if (
GETPOST(
'location_incoterms')) {
71 $return_arr = array();
74 $location_incoterms =
GETPOST(
'location_incoterms');
77 $sql =
"SELECT z.location as location_incoterms, z.label as label";
78 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_location_incoterms as z";
79 $sql .=
" WHERE z.active = 1 AND z.location LIKE '%".$db->escape($db->escapeforlike($location_incoterms)).
"%'";
80 $sql .=
" ORDER BY z.location";
81 $sql .= $db->plimit(1000);
83 $sql =
"SELECT DISTINCT s.location_incoterms FROM ".MAIN_DB_PREFIX.
'commande as s';
84 $sql .=
" WHERE s.location_incoterms LIKE '%".$db->escape($db->escapeforlike($location_incoterms)).
"%'";
91 $sql .=
" ORDER BY s.location_incoterms";
92 $sql .= $db->plimit(100);
96 $resql = $db->query($sql);
100 while ($row = $db->fetch_array($resql)) {
101 $row_array[
'label'] = $row[
'location_incoterms'].($row[
'label'] ?
' - '.$row[
'label'] :
'');
102 if ($location_incoterms) {
103 $row_array[
'value'] = $row[
'location_incoterms'];
107 array_push($return_arr, $row_array);
111 echo json_encode($return_arr);
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.