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');
33 require
'../../main.inc.php';
54 $return_arr = array();
57 $socid = $_GET[
'newcompany'] ? $_GET[
'newcompany'] :
'';
58 if (!$socid) $socid = $_GET[
'socid'] ? $_GET[
'socid'] :
'';
59 if (!$socid) $socid = $_GET[
'id_fourn'] ? $_GET[
'id_fourn'] :
'';
61 $sql =
"SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo";
62 $sql .=
" , c.label as country, d.nom as departement";
63 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s";
64 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as c ON c.rowid = s.fk_pays";
65 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as d ON d.rowid = s.fk_departement";
66 $sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
70 if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) {
71 $sql .=
"s.nom LIKE '".$db->escape($socid).
"%'";
72 $sql .=
" OR s.code_client LIKE '".$db->escape($socid).
"%'";
73 $sql .=
" OR s.code_fournisseur LIKE '".$db->escape($socid).
"%'";
75 $sql .=
"s.nom LIKE '%".$db->escape($socid).
"%'";
76 $sql .=
" OR s.code_client LIKE '%".$db->escape($socid).
"%'";
77 $sql .=
" OR s.code_fournisseur LIKE '%".$db->escape($socid).
"%'";
79 if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .=
" OR s.rowid = '".$db->escape($socid).
"'";
83 $sql .=
" ORDER BY s.nom ASC";
89 while ($row = $db->fetch_array(
$resql)) {
91 if ($socid) $label = $label;
92 $row_array[
'label'] = $label;
93 $row_array[
'value'] = $row[
'nom'];
94 $row_array[
'key'] = $row[
'rowid'];
95 $row_array[
'name_alias'] = $row[
'name_alias'];
96 $row_array[
'code_client'] = $row[
'code_client'];
97 $row_array[
'code_fournisseur'] = $row[
'code_fournisseur'];
98 $row_array[
'address'] = $row[
'address'];
99 $row_array[
'zip'] = $row[
'zip'];
100 $row_array[
'town'] = $row[
'town'];
101 $row_array[
'email'] = $row[
'email'];
102 $row_array[
'siren'] = $row[
'siren'];
103 $row_array[
'siret'] = $row[
'siret'];
104 $row_array[
'ape'] = $row[
'ape'];
105 $row_array[
'idprof4'] = $row[
'idprof4'];
106 $row_array[
'client'] = $row[
'client'];
107 $row_array[
'fournisseur'] = $row[
'fournisseur'];
108 $row_array[
'datec'] = $row[
'datec'];
109 $row_array[
'logo'] = $row[
'logo'];
110 $row_array[
'country'] = $row[
'country'];
111 $row_array[
'departement'] = $row[
'departement'];
113 array_push($return_arr, $row_array);
116 echo json_encode($return_arr);
118 echo json_encode(array(
'nom'=>
'Error',
'label'=>
'Error',
'key'=>
'Error',
'value'=>
'Error'));
121 echo json_encode(array(
'nom'=>
'ErrorBadParameter',
'label'=>
'ErrorBadParameter',
'key'=>
'ErrorBadParameter',
'value'=>
'ErrorBadParameter'));
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.