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')) {
66dol_syslog(
'location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.
getDolGlobalString(
'MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY',
''));
69if (
GETPOST(
'location_incoterms')) {
70 $return_arr = array();
73 $location_incoterms =
GETPOST(
'location_incoterms');
76 $sql =
"SELECT z.location as location_incoterms, z.label as label";
77 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_location_incoterms as z";
78 $sql .=
" WHERE z.active = 1 AND z.location LIKE '%".$db->escape($db->escapeforlike($location_incoterms)).
"%'";
79 $sql .=
" ORDER BY z.location";
80 $sql .= $db->plimit(100);
82 $sql =
"SELECT DISTINCT s.location_incoterms FROM ".MAIN_DB_PREFIX.
'commande as s';
83 $sql .=
" WHERE s.location_incoterms LIKE '%".$db->escape($db->escapeforlike($location_incoterms)).
"%'";
90 $sql .=
" ORDER BY s.location_incoterms";
91 $sql .= $db->plimit(100);
95 $resql = $db->query($sql);
99 while ($row = $db->fetch_array($resql)) {
100 $row_array[
'label'] = $row[
'location_incoterms'].($row[
'label'] ?
' - '.$row[
'label'] :
'');
101 if ($location_incoterms) {
102 $row_array[
'value'] = $row[
'location_incoterms'];
106 array_push($return_arr, $row_array);
110 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 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.