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