27if (!defined(
'NOTOKENRENEWAL')) {
28 define(
'NOTOKENRENEWAL', 1);
30if (!defined(
'NOREQUIREMENU')) {
31 define(
'NOREQUIREMENU',
'1');
33if (!defined(
'NOREQUIREHTML')) {
34 define(
'NOREQUIREHTML',
'1');
36if (!defined(
'NOREQUIREAJAX')) {
37 define(
'NOREQUIREAJAX',
'1');
39if (!defined(
'NOREQUIRESOC')) {
40 define(
'NOREQUIRESOC',
'1');
44require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
56if (!isModEnabled(
'incoterm')) {
76dol_syslog(
'location_incoterms call with MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY='.
getDolGlobalString(
'MAIN_USE_LOCATION_INCOTERMS_DICTIONNARY',
''));
79if (
GETPOST(
'location_incoterms')) {
80 $return_arr = array();
83 $location_incoterms =
GETPOST(
'location_incoterms');
86 $sql =
"SELECT z.location as location_incoterms, z.label as label";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_location_incoterms as z";
88 $sql .=
" WHERE z.active = 1 AND z.location LIKE '%".$db->escape($db->escapeforlike($location_incoterms)).
"%'";
89 $sql .=
" ORDER BY z.location";
90 $sql .= $db->plimit(1000);
92 $sql =
"SELECT DISTINCT s.location_incoterms FROM ".MAIN_DB_PREFIX.
'commande as s';
93 $sql .=
" WHERE s.location_incoterms LIKE '%".$db->escape($db->escapeforlike($location_incoterms)).
"%'";
100 $sql .=
" ORDER BY s.location_incoterms";
101 $sql .= $db->plimit(100);
105 $resql = $db->query($sql);
108 $row_array = array();
109 while ($row = $db->fetch_array($resql)) {
110 $row_array[
'label'] = $row[
'location_incoterms'].($row[
'label'] ?
' - '.$row[
'label'] :
'');
111 if ($location_incoterms) {
112 $row_array[
'value'] = $row[
'location_incoterms'];
116 array_push($return_arr, $row_array);
120 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.