Fix bug vari

This commit is contained in:
Thomas Zilio 2019-08-01 12:53:21 +02:00
parent d10033112d
commit 314c06079d
7 changed files with 47 additions and 17 deletions

View File

@ -80,11 +80,11 @@ if (Auth::check()) {
});
</script>';
}
echo '
<script>$(document).ready(init)</script>';
}
echo '
</body>

View File

@ -40,12 +40,10 @@ class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface
WHERE
1=1 AND an_anagrafiche.deleted_at IS NULL';
$types = $request['filter']['type'];
$types = explode(',', $types);
$types = array_clean($types);
$filters = [];
foreach ($types as $type) {
if ($request['resource'] != 'anagrafiche'){
$type = 'Cliente';
$filters[] = 'an_anagrafiche.idanagrafica IN (SELECT idanagrafica FROM an_tipianagrafiche_anagrafiche WHERE idtipoanagrafica = (SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione = '.prepare($type).'))';
}
$query .= !empty($filters) ? ' AND ('.implode('OR ', $filters).')' : '';

View File

@ -0,0 +1,21 @@
<?php
namespace Modules\Anagrafiche\API\v1;
use API\Interfaces\CreateInterface;
use API\Interfaces\DeleteInterface;
use API\Interfaces\RetrieveInterface;
use API\Interfaces\UpdateInterface;
use API\Resource;
use Modules;
use Modules\Anagrafiche\Anagrafica;
class Sedi extends Resource implements RetrieveInterface
{
public function retrieve($request)
{
return [
'table' => 'an_sedi',
];
}
}

View File

@ -11,10 +11,13 @@ class StatiInterventi extends Resource implements RetrieveInterface
{
$table = 'in_statiintervento';
$select = $request['select'];
if (empty($select)) {
$select = [
'*',
'id' => 'idstatointervento',
];
}
$where = $request['where'];
if (empty($where['deleted_at'])) {

View File

@ -11,10 +11,13 @@ class TipiInterventi extends Resource implements RetrieveInterface
{
$table = 'in_tipiintervento';
$select = $request['select'];
if (empty($select)) {
$select = [
'*',
'id' => 'idtipointervento',
];
}
return [
'select' => $select,

View File

@ -55,12 +55,11 @@ class Manager
{
$user = Auth::user();
$select = '*';
$where = [];
$order = [];
// Selezione personalizzata
$select = !empty($request['display']) ? explode(',', substr($request['display'], 1, -1)) : $select;
$select = !empty($request['display']) ? explode(',', substr($request['display'], 1, -1)) : null;
// Ricerca personalizzata
$values = isset($request['filter']) ? (array) $request['filter'] : [];
@ -94,7 +93,11 @@ class Manager
$response = $this->getResponse($data);
$parameters = $response['parameters'];
$table = $response['table'];
$select = $response['select'] ?: $select;
$select = $select ?: '*';
$query = $response['query'];
try {

View File

@ -122,10 +122,12 @@ DELETE FROM `zz_settings` WHERE `nome` = 'Tabelle escluse per la sincronizzazion
INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `enabled`) VALUES
(NULL, 'v1', 'create', 'allegato', 'Api\\Common\\Allegato', '1'),
(NULL, 'v1', 'retrieve', 'clienti', 'Modules\\Anagrafiche\\API\\v1\\Anagrafiche', '1'),
(NULL, 'v1', 'retrieve', 'anagrafiche', 'Modules\\Anagrafiche\\API\\v1\\Anagrafiche', '1'),
(NULL, 'v1', 'create', 'anagrafica', 'Modules\\Anagrafiche\\API\\v1\\Anagrafiche', '1'),
(NULL, 'v1', 'update', 'anagrafica', 'Modules\\Anagrafiche\\API\\v1\\Anagrafiche', '1'),
(NULL, 'v1', 'delete', 'anagrafica', 'Modules\\Anagrafiche\\API\\v1\\Anagrafiche', '1'),
(NULL, 'v1', 'retrieve', 'sedi', 'Modules\\Anagrafiche\\API\\v1\\Sedi', '1'),
(NULL, 'v1', 'create', 'movimento_articolo', 'Modules\\Articoli\\API\\v1\\Movimenti', '1'),
(NULL, 'v1', 'retrieve', 'articoli', 'Modules\\Articoli\\API\\v1\\Articoli', '1'),
(NULL, 'v1', 'create', 'login', 'Modules\\Utenti\\API\\v1\\Login', '1'),