From b2e63c03831c0842fa6c3ca0e56dfaefd994b850 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 12 Jan 2024 12:05:38 +0100 Subject: [PATCH] =?UTF-8?q?Ne=20pas=20rendre=20la=20saisie=20du=20SIRET=20?= =?UTF-8?q?obligatoire=20pour=20les=20cas=20o=C3=B9=20il=20ne=20serait=20p?= =?UTF-8?q?as=20disponible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/schema.sql | 2 +- lib/Client.php | 4 ++-- templates/client_modifier.tpl | 2 +- templates/clients.tpl | 2 +- upgrade.php | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/data/schema.sql b/data/schema.sql index 37097b9..0cc7a67 100644 --- a/data/schema.sql +++ b/data/schema.sql @@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients ( adresse TEXT NOT NULL, code_postal TEXT NOT NULL, ville TEXT NOT NULL, - siret TEXT NOT NULL, + siret TEXT, date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), -- Date d\'inscription telephone TEXT, email TEXT diff --git a/lib/Client.php b/lib/Client.php index e1bd682..66aabf3 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -40,7 +40,7 @@ class Client { $data[$key] = trim($data[$key]); - if($data[$key] == '' && ($key != 'telephone' && $key != 'email')) + if($data[$key] == '' && ($key != 'siret' && $key != 'telephone' && $key != 'email')) { throw new UserException('Le champs '.$key.' doit être renseigné.'); } @@ -128,7 +128,7 @@ class Client 'label' => 'Ville', ], 'siret' => [ - 'label' => 'Siret', + 'label' => 'SIRET', ], 'telephone' => [ 'label' => 'Téléphone', diff --git a/templates/client_modifier.tpl b/templates/client_modifier.tpl index 08f16aa..42e6f1c 100644 --- a/templates/client_modifier.tpl +++ b/templates/client_modifier.tpl @@ -11,7 +11,7 @@ {input type="text" name="adresse" label="Adresse" required=true source=$client} {input type="text" name="code_postal" label="Code postal" required=true source=$client} {input type="text" name="ville" label="Ville" required=true source=$client} - {input type="text" name="siret" label="SIREN/SIRET" required=true source=$client} + {input type="text" name="siret" label="SIREN/SIRET" source=$client} {input type="tel" name="telephone" label="Téléphone" source=$client} {input type="email" name="email" label="Adresse e-mail" source=$client} diff --git a/templates/clients.tpl b/templates/clients.tpl index 47ccce2..306b044 100644 --- a/templates/clients.tpl +++ b/templates/clients.tpl @@ -55,7 +55,7 @@ {input type="text" name="adresse" label="Adresse" required=true} {input type="text" name="code_postal" label="Code postal" required=true} {input type="text" name="ville" label="Ville" required=true} - {input type="text" name="siret" label="SIREN/SIRET" required=true} + {input type="text" name="siret" label="SIREN/SIRET"} {input type="tel" name="telephone" label="Téléphone"} {input type="email" name="email" label="Adresse e-mail"} diff --git a/upgrade.php b/upgrade.php index 6cd4ff5..5df22ea 100644 --- a/upgrade.php +++ b/upgrade.php @@ -222,7 +222,7 @@ if (version_compare($old_version, '0.8.5', '<')) adresse TEXT NOT NULL, code_postal TEXT NOT NULL, ville TEXT NOT NULL, - siret TEXT NOT NULL, + siret TEXT, date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), telephone TEXT, email TEXT @@ -233,7 +233,6 @@ if (version_compare($old_version, '0.8.5', '<')) $sql = 'SELECT * FROM plugin_facturation_clients'; foreach ($db->iterate($sql) as $client) { - $client->siret = ""; $db->insert('plugin_facturation_clients_tmp', $client); } // remplacer l'ancienne table par la nouvelle