Archivage plusieurs documents et interdiction modifier doc archivé

This commit is contained in:
Jean-Christophe Engel 2026-02-25 13:40:05 +01:00
parent a80bebcc4e
commit 79b3a72cca
7 changed files with 60 additions and 17 deletions

View file

@ -343,6 +343,9 @@ class Facture
'receveur_id' => [
],
// Créer une colonne virtuelle
'select' => [
'label' => '',
],
'type' => [
'label' => 'Type',
'select' => null,
@ -376,9 +379,6 @@ class Facture
'reglee' => [
'label' => 'Réglée',
],
'archivee' => [
'label' => 'Archivée',
],
'moyen_paiement' => [
'label' => 'Moyen de paiement',
'select' => 'mp.nom',
@ -410,7 +410,6 @@ class Facture
// Remplir la colonne virtuelle
$row->type = self::TYPES_NAMES[$row->type_facture] ?? null;
$row->reglee = $row->reglee ? 'Réglée' : 'Non';
$row->archivee = $row->archivee ? 'Archivée' : 'Non';
// Remplir le contenu
$content = json_decode((string)$row->contenu);
@ -559,4 +558,19 @@ class Facture
{
return DB::getInstance()->delete('plugin_facturation_factures', 'id = '. (int)$id);
}
public function archiver($id)
{
$f = $this->get($id);
$f->archivee = 1;
$f->date_emission = $f->date_emission->format('d/m/Y');
$f->date_echeance = $f->date_echeance->format('d/m/Y');
$id = $f->id;
unset($f->id);
$datas = (array)$f;
$this->_checkFields($datas);
$datas["id"] = $id;
$db = DB::getInstance();
return $db->update('plugin_facturation_factures', $datas, $db->where('id', (int)$id));
}
}