Skip to content

Commit 425eac2

Browse files
committed
fix: firma intervento
1 parent ad755e8 commit 425eac2

5 files changed

Lines changed: 5 additions & 44 deletions

File tree

modules/interventi/actions.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,9 +1275,6 @@
12751275
$new->codice = Intervento::getNextCodice($data_richiesta, $new->id_segment);
12761276
$new->data_richiesta = $data_richiesta;
12771277
$new->data_scadenza = post('ora_scadenza') ? $date->format('Y-m-d').' '.post('ora_scadenza') : null;
1278-
$new->firma_file = '';
1279-
$new->firma_data = null;
1280-
$new->firma_nome = '';
12811278

12821279
$new->save();
12831280

modules/interventi/bulk.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@
255255

256256
// Calcolo del nuovo codice sulla base della data di richiesta
257257
$new->codice = Intervento::getNextCodice($data_richiesta, $new->id_segment);
258-
$new->firma_file = '';
259-
$new->firma_data = '';
260258
$new->save();
261259

262260
$id_record = $new->id;

modules/interventi/modals/firma.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
if ($intervento->stato->is_bloccato) {
3737
$interventi_completati[] = $id;
38-
} elseif ($intervento->firma_file) {
38+
} elseif ($intervento->signature_upload) {
3939
$interventi_firmati[] = $id;
4040
$records[] = $id;
4141
} else {

modules/interventi/src/API/v1/Firma.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,14 @@
2222

2323
use API\Interfaces\UpdateInterface;
2424
use API\Resource;
25-
use Models\Upload;
2625

2726
class Firma extends Resource implements UpdateInterface
2827
{
2928
// TODO: Da rivedere con upload in base64
3029
public function update($request)
3130
{
32-
$database = database();
33-
$data = $request['data'];
34-
35-
// $file = Upload::find($data['file_id']);
36-
$database->update('in_interventi', [
37-
'firma_file' => $data['firma_file'],
38-
'firma_data' => $data['firma_data'],
39-
'firma_nome' => $data['firma_nome'],
40-
], ['id' => $data['id']]);
31+
// Le firme sono ora gestite tramite la tabella zz_files
32+
// Non è necessario aggiornare firma_nome, firma_data, firma_file direttamente
33+
// Questo metodo è mantenuto per compatibilità ma non esegue operazioni
4134
}
4235
}

src/API/App/v1/Interventi.php

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,7 @@ public function retrieveRecord($id)
274274
idstatointervento AS id_stato_intervento,
275275
idpagamento AS id_pagamento,
276276
informazioniaggiuntive AS informazioni_aggiuntive,
277-
IF(idsede_destinazione = 0, NULL, idsede_destinazione) AS id_sede,
278-
firma_file,
279-
IF(firma_data = '0000-00-00 00:00:00', '', firma_data) AS firma_data,
280-
firma_nome
277+
IF(idsede_destinazione = 0, NULL, idsede_destinazione) AS id_sede
281278
FROM in_interventi
282279
WHERE in_interventi.id = ".prepare($id);
283280

@@ -336,15 +333,6 @@ protected function aggiornaRecord($record, $data)
336333
$record->idsede_destinazione = $data['id_sede'] ?: 0;
337334
$record->idpagamento = $data['id_pagamento'] ?: 0;
338335

339-
// Salvataggio firma eventuale
340-
if (empty($record->firma_nome) && !empty($data['firma_nome'])) {
341-
$record->firma_nome = $data['firma_nome'];
342-
$record->firma_data = $data['firma_data'];
343-
344-
// Salvataggio fisico
345-
$firma_file = $this->salvaFirma($data['firma_contenuto']);
346-
$record->firma_file = $firma_file;
347-
}
348336

349337
// Aggiornamento degli impianti collegati
350338
$database->query('DELETE FROM my_impianti_interventi WHERE idintervento = '.prepare($record->id));
@@ -371,19 +359,4 @@ protected function aggiornaRecord($record, $data)
371359
}
372360
}
373361

374-
protected function salvaFirma($firma_base64)
375-
{
376-
// Salvataggio firma
377-
$firma_file = 'firma_'.time().'.png';
378-
379-
$data = explode(',', (string) $firma_base64);
380-
381-
$manager = ImageManager::gd();
382-
$img = $manager->read(base64_decode($data[1]));
383-
$img->scale(680, 202);
384-
385-
$img->save(base_dir().'/files/interventi/'.$firma_file);
386-
387-
return $firma_file;
388-
}
389362
}

0 commit comments

Comments
 (0)