This commit is contained in:
MatteoPistorello 2021-03-23 10:31:20 +01:00
commit 3f72467555
3 changed files with 48 additions and 4 deletions

View File

@ -40,11 +40,13 @@ class Clienti extends AppResource
INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica = an_tipianagrafiche.idtipoanagrafica
WHERE an_tipianagrafiche.descrizione = 'Cliente' AND an_anagrafiche.deleted_at IS NULL";
// Sincronizzazione limitata ai Clienti con Interventi di interesse per il Tecnico corrente
$sincronizza_lavorati = setting('Sincronizza solo i Clienti per cui il Tecnico ha lavorato in passato');
if (!empty($sincronizza_lavorati)) {
// Elenco di interventi di interesse
$risorsa_interventi = $this->getRisorsaInterventi();
$interventi = $risorsa_interventi->getModifiedRecords(null);
// Da applicazione, i Clienti sono sincronizzati prima degli Interventi: last_sync_at permette di identificare le stesse modifiche
$interventi = $risorsa_interventi->getModifiedRecords($last_sync_at);
if (empty($interventi)) {
return [];
}
@ -57,8 +59,8 @@ class Clienti extends AppResource
)';
}
// Filtro per data
if ($last_sync_at) {
// Filtro per data (solo nel caso in cui la sincronizzazione non sia totale)
elseif ($last_sync_at) {
$query .= ' AND an_anagrafiche.updated_at > '.prepare($last_sync_at);
}

View File

@ -0,0 +1,38 @@
<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.r.l.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace API\App\v1;
use API\App\AppResource;
use API\Interfaces\RetrieveInterface;
use API\Resource;
use Illuminate\Database\Eloquent\Builder;
use Modules\Anagrafiche\Anagrafica;
class Revisione extends Resource implements RetrieveInterface
{
const REVISION = '1';
public function retrieve($request)
{
return [
'revisione' => self::REVISION,
];
}
}

View File

@ -56,4 +56,8 @@ INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `e
UPDATE `zz_segments` SET `clause` = '(orario_inizio BETWEEN \'|period_start|\' AND \'|period_end|\' OR orario_fine BETWEEN \'|period_start|\' AND \'|period_end|\')' WHERE `zz_segments`.`name` = 'Attività';
-- Aumentato limite per campo note in scheda anagrafica
ALTER TABLE `an_anagrafiche` CHANGE `note` `note` TEXT NOT NULL;
ALTER TABLE `an_anagrafiche` CHANGE `note` `note` TEXT NOT NULL;
-- Aggiunta risorsa APi per revisione applicazione
INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `enabled`) VALUES
(NULL, 'app-v1', 'retrieve', 'revisione', 'API\\App\\v1\\Revisione', '1')