diff --git a/data/schema.sql b/data/schema.sql
index cf3fa58..b108bb3 100644
--- a/data/schema.sql
+++ b/data/schema.sql
@@ -42,6 +42,25 @@ INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('ES', 'Esp
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('PR', 'Prélèvement');
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('TI', 'TIP');
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('VI', 'Virement');
+INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('HA', 'HelloAsso');
+INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
+
+-- Modif DD -- ajout de la table des textes associés aux CERFA
+CREATE TABLE IF NOT EXISTS plugin_facturation_txt_cerfa
+-- Textes explicatifs associés aux CERFA
+(
+ id PRIMARY KEY,
+ menu TEXT NOT NULL UNIQUE,
+ texte TEXT NOT NULL
+);
+
+----
+-- Data dump for plugin_facturation_txt_cerfa, a total of 4 rows
+----
+INSERT OR IGNORE INTO "plugin_facturation_txt_cerfa" ("id","menu","texte") VALUES ('0','Aucun','');
+INSERT OR IGNORE INTO "plugin_facturation_txt_cerfa" ("id","menu","texte") VALUES ('1','HelloAsso','Don via HelloAsso');
+INSERT OR IGNORE INTO "plugin_facturation_txt_cerfa" ("id","menu","texte") VALUES ('2','Frais de déplacement','Renonciation aux remboursements de frais de déplacement');
+INSERT OR IGNORE INTO "plugin_facturation_txt_cerfa" ("id","menu","texte") VALUES ('3','Don en nature','Don en nature');
-- CREATE TABLE IF NOT EXISTS plugin_facturation_produits (
-- id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
diff --git a/data/schema_remove.sql b/data/schema_remove.sql
index 2a3e2dc..e346aa2 100644
--- a/data/schema_remove.sql
+++ b/data/schema_remove.sql
@@ -1,4 +1,5 @@
DROP TABLE `plugin_facturation_factures`;
DROP TABLE `plugin_facturation_clients`;
DROP TABLE `plugin_facturation_paiement`;
+DROP TABLE `plugin_facturation_txt_cerfa`;
-- DROP TABLE `plugin_facturation_produits`;
\ No newline at end of file
diff --git a/lib/Facture.php b/lib/Facture.php
index ece72c0..e1ecae7 100644
--- a/lib/Facture.php
+++ b/lib/Facture.php
@@ -79,7 +79,7 @@ class Facture
{
throw new UserException("La valeur de $k est vide");
}
-
+
switch($k)
{
case 'type_facture':
@@ -205,7 +205,7 @@ class Facture
{
throw new UserException('Un document avec ce numéro existe déjà, hors le numéro doit être unique.');
}
-
+
$db->insert('plugin_facturation_factures', $data);
$id = $db->lastInsertRowId();
@@ -384,11 +384,15 @@ class Facture
Utils::date_fr($content->souscription, 'd/m/Y')
);
}
- else {
+ elseif ($row->type_facture != CERFA) {
$row->contenu = implode("\n", array_map(function ($row) use ($currency) {
return sprintf('%s : %s %s', $row->designation, Utils::money_format($row->prix), $currency);
}, (array)$content));
}
+ else
+ {
+ $row->contenu = '';
+ }
});
$list->setPageSize(1000);
@@ -498,6 +502,17 @@ class Facture
}
}
+ /* modif DD -- lecture et retour des textes de CERFA -- */
+ public function listTextesCerfa($menu = true)
+ {
+ $db = DB::getInstance();
+
+ $sel = ($menu) ? 'id, menu' : 'id, texte';
+ $query = 'SELECT '.$sel.' FROM "plugin_facturation_txt_cerfa" WHERE 1 ORDER BY id ;';
+
+ return $db->getAssoc($query);
+ }
+
public function getMoyenPaiement($code)
{
$db = DB::getInstance();
diff --git a/templates/_form.tpl b/templates/_form.tpl
index 8a55b0c..666e85e 100644
--- a/templates/_form.tpl
+++ b/templates/_form.tpl
@@ -84,7 +84,7 @@
{/if}
-