26 if (!defined(
'NOTOKENRENEWAL')) define(
'NOTOKENRENEWAL', 1);
27 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
28 if (!defined(
'NOREQUIREHTML')) define(
'NOREQUIREHTML',
'1');
29 if (!defined(
'NOREQUIREAJAX')) define(
'NOREQUIREAJAX',
'1');
30 if (!defined(
'NOREQUIRESOC')) define(
'NOREQUIRESOC',
'1');
31 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
33 require
'../main.inc.php';
55 $return_arr = array();
58 $socid = $_GET[
'newcompany'] ? $_GET[
'newcompany'] :
'';
59 if (!$socid) $socid = $_GET[
'socid'] ? $_GET[
'socid'] :
'';
60 if (!$socid) $socid = $_GET[
'id_fourn'] ? $_GET[
'id_fourn'] :
'';
62 $sql =
"SELECT rowid, nom";
63 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
64 $sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
69 if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE))
71 $sql .=
"nom LIKE '".$db->escape($socid).
"%'";
72 $sql .=
" OR code_client LIKE '".$db->escape($socid).
"%'";
73 $sql .=
" OR code_fournisseur LIKE '".$db->escape($socid).
"%'";
75 $sql .=
"nom LIKE '%".$db->escape($socid).
"%'";
76 $sql .=
" OR code_client LIKE '%".$db->escape($socid).
"%'";
77 $sql .=
" OR code_fournisseur LIKE '%".$db->escape($socid).
"%'";
79 if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .=
" OR rowid = '".$db->escape($socid).
"'";
83 $sql .=
" ORDER BY nom ASC";
89 while ($row = $db->fetch_array(
$resql))
92 if ($socid) $label = preg_replace(
'/('.preg_quote($socid,
'/').
')/i',
'<strong>$1</strong>', $label, 1);
93 $row_array[
'label'] = $label;
94 $row_array[
'value'] = $row[
'nom'];
95 $row_array[
'key'] = $row[
'rowid'];
97 array_push($return_arr, $row_array);
100 echo json_encode($return_arr);
102 echo json_encode(array(
'nom'=>
'Error',
'label'=>
'Error',
'key'=>
'Error',
'value'=>
'Error'));
105 echo json_encode(array(
'nom'=>
'ErrorBadParameter',
'label'=>
'ErrorBadParameter',
'key'=>
'ErrorBadParameter',
'value'=>
'ErrorBadParameter'));
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.
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.