Skip to content

Commit 542f897

Browse files
committed
Fix controlli su numerazione Attività
1 parent 0e1fabb commit 542f897

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/interventi/modutil.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,20 @@ function verifica_numero_intervento(Intervento $intervento)
302302
}
303303

304304
$data = $intervento->data_richiesta;
305-
$documenti = Intervento::where('data_richiesta', '=', $data)
305+
$documenti = Intervento::whereDate('data_richiesta', '=', $data->format('Y-m-d'))
306306
->get();
307307

308308
// Recupero maschera per questo segmento
309309
$maschera = setting('Formato codice attività');
310310

311311
if ((strpos($maschera, 'YYYY') !== false) or (strpos($maschera, 'yy') !== false)) {
312312
$ultimo = Generator::getPreviousFrom($maschera, 'in_interventi', 'codice', [
313-
'DATE(data_richiesta) < '.prepare(date('Y-m-d', strtotime($data))),
314-
'YEAR(data_richiesta) = '.prepare(date('Y', strtotime($data))),
313+
'DATE(data_richiesta) < '.prepare($data->format('Y-m-d')),
314+
'YEAR(data_richiesta) = '.prepare($data->format('Y')),
315315
], $data);
316316
} else {
317317
$ultimo = Generator::getPreviousFrom($maschera, 'in_interventi', 'codice', [
318-
'DATE(data_richiesta) < '.prepare(date('Y-m-d', strtotime($data))),
318+
'DATE(data_richiesta) < '.prepare($data->format('Y-m-d')),
319319
]);
320320
}
321321

0 commit comments

Comments
 (0)