2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
switch ($resource) {
|
|
|
|
case 'an_anagrafiche':
|
|
|
|
$table = 'an_anagrafiche';
|
|
|
|
|
|
|
|
if (empty($order)) {
|
|
|
|
$order[] = 'idanagrafica';
|
|
|
|
}
|
|
|
|
|
2018-02-18 19:53:23 +01:00
|
|
|
if (empty($where['deleted'])) {
|
2017-09-04 17:18:54 +02:00
|
|
|
$where['deleted'] = 0;
|
|
|
|
}
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
break;
|
2018-06-26 14:30:26 +02:00
|
|
|
|
|
|
|
case 'clienti':
|
2018-07-17 08:05:19 +02:00
|
|
|
$q = 'SELECT AN.idanagrafica,
|
2018-05-18 23:42:20 +02:00
|
|
|
AN.ragione_sociale,
|
2018-07-17 08:05:19 +02:00
|
|
|
AN.piva,
|
|
|
|
AN.codice_fiscale,
|
|
|
|
AN.indirizzo,
|
|
|
|
AN.indirizzo2,
|
|
|
|
AN.citta,
|
|
|
|
AN.cap,
|
|
|
|
AN.provincia,
|
2018-05-18 23:42:20 +02:00
|
|
|
AN.km,
|
|
|
|
IFNULL(AN.lat, 0.00) AS latitudine,
|
|
|
|
IFNULL(AN.lng, 0.00) AS longitudine,
|
|
|
|
NAZIONE.nome AS nazione,
|
|
|
|
AN.telefono,
|
|
|
|
AN.fax,
|
|
|
|
AN.cellulare,
|
|
|
|
AN.email,
|
|
|
|
AN.sitoweb,
|
|
|
|
AN.note,
|
|
|
|
AN.idzona,
|
2018-07-17 11:15:31 +02:00
|
|
|
AN.deleted_at
|
2018-07-17 08:05:19 +02:00
|
|
|
FROM (an_anagrafiche AS AN
|
2018-05-18 23:42:20 +02:00
|
|
|
LEFT OUTER JOIN an_nazioni NAZIONE ON AN.id_nazione=NAZIONE.id)
|
2018-07-17 08:05:19 +02:00
|
|
|
HAVING 1=1 AND
|
|
|
|
AN.deleted_at IS NULL AND
|
2018-05-18 23:42:20 +02:00
|
|
|
AN.idanagrafica IN (SELECT idanagrafica FROM an_tipianagrafiche_anagrafiche WHERE idtipoanagrafica=1)
|
2018-06-26 14:30:26 +02:00
|
|
|
ORDER BY AN.ragione_sociale';
|
2018-05-18 23:42:20 +02:00
|
|
|
|
2018-06-26 14:30:26 +02:00
|
|
|
$results = $dbo->fetchArray($q);
|
2018-05-18 23:42:20 +02:00
|
|
|
|
|
|
|
break;
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return [
|
2018-06-26 14:30:26 +02:00
|
|
|
'an_anagrafiche',
|
|
|
|
'clienti',
|
2017-08-04 16:28:16 +02:00
|
|
|
];
|