dolibarr  13.0.2
cidlookup.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010 Servitux Servicios Informaticos <info@servitux.es>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
30 include '../master.inc.php';
31 
32 $phone = GETPOST('phone');
33 $notfound = $langs->trans("Unknown");
34 
35 // Security check
36 if (empty($conf->clicktodial->enabled))
37 {
38  print "Error: Module Click to dial is not enabled.\n";
39  exit;
40 }
41 
42 // Check parameters
43 if (empty($phone))
44 {
45  print "Error: Url must be called with parameter phone=phone to search\n";
46  exit;
47 }
48 
49 $sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s";
50 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
51 $sql .= " WHERE s.entity IN (".getEntity('societe').")";
52 $sql .= " AND (s.phone='".$db->escape($phone)."'";
53 $sql .= " OR sp.phone='".$db->escape($phone)."'";
54 $sql .= " OR sp.phone_perso='".$db->escape($phone)."'";
55 $sql .= " OR sp.phone_mobile='".$db->escape($phone)."')";
56 $sql .= $db->plimit(1);
57 
58 dol_syslog('cidlookup search information with phone '.$phone, LOG_DEBUG);
59 $resql = $db->query($sql);
60 if ($resql)
61 {
62  $obj = $db->fetch_object($resql);
63  if ($obj)
64  {
65  $found = $obj->name;
66  } else {
67  $found = $notfound;
68  }
69  $db->free($resql);
70 } else {
71  dol_print_error($db, 'Error');
72  $found = 'Error';
73 }
74 //Greek to Latin
75 $greek = array('α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'ς', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω', 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', 'ά', 'έ', 'ή', 'ί', 'ό', 'ύ', 'ώ', 'ϊ', 'ΐ', 'Ά', 'Έ', 'Ή', 'Ί', 'Ό', 'Ύ', 'Ώ', 'Ϊ');
76 
77 $latin = array('a', 'b', 'g', 'd', 'e', 'z', 'h', 'th', 'i', 'k', 'l', 'm', 'n', 'ks', 'o', 'p', 'r', 's', 's', 't', 'u', 'f', 'ch', 'ps', 'w', 'A', 'B', 'G', 'D', 'E', 'Z', 'H', 'TH', 'I', 'K', 'L', 'M', 'N', 'KS', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'CH', 'PS', 'W', 'a', 'e', 'h', 'i', 'o', 'u', 'w', 'i', 'i', 'A', 'E', 'H', 'I', 'O', 'U', 'W', 'I');
78 
79 print str_replace($greek, $latin, $found);
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.
print
Draft customers invoices.
Definition: index.php:89
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.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...