diff --git a/admin/_facture_common.php b/admin/_facture_common.php
index 09d2e1a..b729f34 100644
--- a/admin/_facture_common.php
+++ b/admin/_facture_common.php
@@ -344,6 +344,7 @@ $tpl->assign('date', $date->format('d/m/Y'));
$tpl->assign(compact('liste', 'radio', 'step', 'designations', 'prix', 'from_user', 'identite', 'csrf_key', 'doc'));
$tpl->assign('users', toArray($db->get('SELECT id, '.$identite.' FROM users WHERE id_category != -2 NOT IN (SELECT id FROM users_categories WHERE hidden = 1) ORDER BY ' .$identite. ';'), 'id', " "));
$tpl->assign('clients', $db->getAssoc('SELECT id, nom FROM plugin_facturation_clients;'));
+$tpl->assign('contacts', $db->getAssoc('SELECT id, nom_contact FROM plugin_facturation_clients;'));
$tpl->assign('require_number', $require_number);
$tpl->assign('number_pattern', PATTERNS_LIST[$plugin->getConfig('pattern')]);
diff --git a/admin/client_modifier.php b/admin/client_modifier.php
index 5f98dd1..587f9f3 100644
--- a/admin/client_modifier.php
+++ b/admin/client_modifier.php
@@ -29,6 +29,7 @@ $form->runIf(f('save') && !$form->hasErrors(),
'siret' => f('siret'),
'telephone' => f('telephone'),
'email' => f('email'),
+ 'nom_contact' => f('nom_contact'),
'note' => f('note')
]);
diff --git a/admin/clients.php b/admin/clients.php
index c8c1a4c..ae8808f 100644
--- a/admin/clients.php
+++ b/admin/clients.php
@@ -19,6 +19,7 @@ $form->runIf(f('add') && !$form->hasErrors(),
'siret' => f('siret'),
'telephone' => f('telephone'),
'email' => f('email'),
+ 'nom_contact' => f('nom_contact'),
'note' => f('note')
]);
diff --git a/data/schema.sql b/data/schema.sql
index 3263c43..923b4eb 100644
--- a/data/schema.sql
+++ b/data/schema.sql
@@ -28,6 +28,7 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients (
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,
+ nom_contact TEXT,
note TEXT
);
diff --git a/lib/Client.php b/lib/Client.php
index edb4994..66e7d75 100644
--- a/lib/Client.php
+++ b/lib/Client.php
@@ -18,6 +18,7 @@ class Client
'siret',
'telephone',
'email',
+ 'nom_contact',
'note'
];
@@ -41,7 +42,7 @@ class Client
{
$data[$key] = trim($data[$key]);
- if($data[$key] == '' && ($key != 'siret' && $key != 'telephone' && $key != 'email'))
+ if($data[$key] == '' && ! in_array($key, ['siret', 'telephone', 'email', 'nom_contact', 'note']))
{
throw new UserException('Le champs '.$key.' doit être renseigné.');
}
@@ -137,6 +138,9 @@ class Client
'email' => [
'label' => 'E-Mail',
],
+ 'nom_contact' => [
+ 'label' => 'Contact',
+ ],
'note' => [
'label' => 'Note',
],
diff --git a/plugin.ini b/plugin.ini
index dc6f8e1..db7f979 100644
--- a/plugin.ini
+++ b/plugin.ini
@@ -2,7 +2,7 @@ name="Facturation"
description="Permet d'éditer des factures et devis à ses membres ainsi qu'à une base de clients supplémentaire."
author="zou ; adapté par jce"
url="https://git.roflcopter.fr/lesanges/paheko-plugin-facturation"
-version="0.14"
+version="0.15"
menu=true
restrict_section="accounting"
restrict_level="read"
diff --git a/templates/_form.tpl b/templates/_form.tpl
index 6410a2b..f533acf 100644
--- a/templates/_form.tpl
+++ b/templates/_form.tpl
@@ -70,12 +70,12 @@
- {input type="select" name="membre" label="Membre" options=$users required=1 source=$doc}
+ {input type="select" name="membre" label="Membre" options=$users required=1 source=$doc default_empty="— Choisir un membre —"}
{if !empty($clients)}
- {input type="select" name="client" label="Client" options=$clients required=1 class="type_client" source=$doc}
+ {input type="select" name="client" label="Client" options=$clients required=1 class="type_client" source=$doc default_empty="— Choisir un client —"}
{else}
@@ -85,6 +85,9 @@