Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
4aafa3f44f | |||
aff20099aa | |||
950a6b8b2c | |||
4ee3f65d0a | |||
060802a43d | |||
f63f3b6ecd | |||
6e2ee31670 | |||
38494a1a85 | |||
6248904bd8 | |||
f6eef8897e | |||
201682f4d7 | |||
77180a38ff | |||
16daac2e24 | |||
46d0c838ae | |||
da713cc06d | |||
72999b9fc6 | |||
f321e83e20 |
@ -1,3 +1,11 @@
|
||||
0.12
|
||||
- Ajout Mollie à la table moyens de paiement
|
||||
0.11
|
||||
- Changement mention finale pour devis
|
||||
0.9
|
||||
- Ajout possibilité choisir champs identité et adresse membre
|
||||
0.8.8
|
||||
- correction typo
|
||||
0.8.7
|
||||
- correction typo
|
||||
0.8.6
|
||||
|
@ -24,7 +24,7 @@ le dossier plugins de Paheko.
|
||||
- **Configuration** :
|
||||
- Possibilité d'ajouter un numéro RNA et SIRET de l'association si elle en possède (apparait alors sur les documents)
|
||||
- Possibilité de choisir certains champs à faire figurer sur la facture (adresse, code postal, ville)
|
||||
- Modification du pied de page des documents (notament pour y inscrire des mentions légales)
|
||||
- Modification du pied de page des documents (notamment pour y inscrire des mentions légales)
|
||||
- Vérifier le code postal : si coché, lors d'ajout ou de modification de client, le plugin vérifiera que le code postal entré est bien formaté (par rapport aux codes postaux français seulement)
|
||||
- Noms de client·es uniques : si coché, lors d'ajout ou de modification de client·e, le nom du/de la client·e ne pourra pas être le même que celui d'un·e client·e déjà existant
|
||||
- (obsolète) Informations relatives au CERFA pour les reçus fiscaux
|
||||
|
@ -4,6 +4,28 @@ namespace Paheko;
|
||||
|
||||
require_once __DIR__ . '/_inc.php';
|
||||
|
||||
function toArray($array, $cle, $sep=",")
|
||||
{
|
||||
$result = array();
|
||||
foreach ($array as $elem)
|
||||
{
|
||||
$ro = new \ReflectionObject($elem);
|
||||
$proprietes = $ro->getProperties();
|
||||
$ligne = "";
|
||||
foreach ($proprietes as $p)
|
||||
{
|
||||
if ($p->getName() == $cle) {
|
||||
$key = $p->getValue($elem);
|
||||
}
|
||||
else {
|
||||
$ligne .= $sep . $p->getValue($elem);
|
||||
}
|
||||
}
|
||||
$result[$key] = substr($ligne, strlen($sep));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (!isset($target) || !in_array( $target, ['new', 'edit'])) {
|
||||
throw new Exception('blabla illegal call'); // Fix: exception type?
|
||||
} else {
|
||||
@ -67,6 +89,7 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
||||
'reglee' => f('reglee') == 1?1:0,
|
||||
'archivee' => f('archivee') == 1?1:0,
|
||||
'moyen_paiement' => f('moyen_paiement'),
|
||||
'nom_contact' => f('nom_contact'),
|
||||
'toto' => 0
|
||||
];
|
||||
$data['type_facture'] = f('type');
|
||||
@ -74,8 +97,13 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
||||
{
|
||||
foreach(f('designation') as $k=>$value)
|
||||
{
|
||||
if ($value != '' && f('prix')[$k] == null) {
|
||||
if (empty($value) && f('prix')[$k] != null) {
|
||||
throw new UserException("Il manque la désignation de la ligne " . $k+1 . " !!");
|
||||
}
|
||||
elseif ($value != '' && f('prix')[$k] == null) {
|
||||
throw new UserException('Il manque le prix sur la ligne '. $k+1 . ' !!');
|
||||
} elseif (empty($value) && f('prix')[$k] == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data['contenu'][$k]['designation'] = $value;
|
||||
@ -84,6 +112,13 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
||||
}
|
||||
$data['total'] = $data['toto'];
|
||||
unset($data['toto']);
|
||||
if (! isset($data['contenu'])) {
|
||||
throw new UserException("Aucune désignation ni aucun prix saisi !!");
|
||||
}
|
||||
if (f('type') == FACT) {
|
||||
$data['numero_commande'] = f('numero_commande');
|
||||
$data['reference_acheteur'] = f('reference_acheteur');
|
||||
}
|
||||
}
|
||||
elseif ( f('type') == CERFA )
|
||||
{
|
||||
@ -246,6 +281,9 @@ else
|
||||
|
||||
$doc['date_emission'] = f('date_emission') ?: $f->date_emission;
|
||||
$doc['date_echeance'] = f('date_echeance')?: $f->date_echeance; // Smarty m'a saoulé pour utiliser form_field|date_fr:---
|
||||
$doc['nom_contact'] = $f->nom_contact;
|
||||
$doc['numero_commande'] = $f->numero_commande;
|
||||
$doc['reference_acheteur'] = $f->reference_acheteur;
|
||||
/* modif DD -- CERFA -------------------------------------- */
|
||||
if ( $f->type_facture == CERFA ) {
|
||||
$doc['total'] = $f->total;
|
||||
@ -292,8 +330,10 @@ if (in_array($radio['type'], [DEVIS, FACT]))
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
$designations = ['Exemple'];
|
||||
$prix = [250];
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -301,10 +341,10 @@ $date = new \DateTime;
|
||||
$date->setTimestamp(time());
|
||||
$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', $db->getAssoc('SELECT id, '.$identite.' FROM users WHERE id_category != -2 NOT IN (SELECT id FROM users_categories WHERE hidden = 1) ORDER BY ' .$identite. ';'));
|
||||
$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')]);
|
||||
|
||||
|
@ -28,7 +28,9 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
||||
'ville' => f('ville'),
|
||||
'siret' => f('siret'),
|
||||
'telephone' => f('telephone'),
|
||||
'email' => f('email')
|
||||
'email' => f('email'),
|
||||
'nom_contact' => f('nom_contact'),
|
||||
'note' => f('note')
|
||||
]);
|
||||
|
||||
$r ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
||||
|
@ -18,7 +18,9 @@ $form->runIf(f('add') && !$form->hasErrors(),
|
||||
'ville' => f('ville'),
|
||||
'siret' => f('siret'),
|
||||
'telephone' => f('telephone'),
|
||||
'email' => f('email')
|
||||
'email' => f('email'),
|
||||
'nom_contact' => f('nom_contact'),
|
||||
'note' => f('note')
|
||||
]);
|
||||
|
||||
$id ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
||||
|
@ -20,18 +20,9 @@ $form->runIf('save', function () use ($plugin) {
|
||||
$plugin->setConfigProperty('cp_asso', trim(f('cp_asso')));
|
||||
$plugin->setConfigProperty('ville_asso', trim(f('ville_asso')));
|
||||
|
||||
$plugin->setConfigProperty('droit_art200', (bool)f('droit_art200'));
|
||||
$plugin->setConfigProperty('droit_art238bis', (bool)f('droit_art238bis'));
|
||||
$plugin->setConfigProperty('droit_art885_0VbisA', (bool)f('droit_art885_0VbisA'));
|
||||
$plugin->setConfigProperty('objet_0', trim(f('objet_0')));
|
||||
$plugin->setConfigProperty('objet_1', trim(f('objet_1')));
|
||||
$plugin->setConfigProperty('objet_2', trim(f('objet_2')));;
|
||||
|
||||
$plugin->setConfigProperty('logo', (bool)f('logo'));
|
||||
$plugin->setConfigProperty('footer', f('footer'));
|
||||
|
||||
$plugin->setConfigProperty('nom_client', f('nom_client'));
|
||||
$plugin->setConfigProperty('prenom_client', f('prenom_client'));
|
||||
$plugin->setConfigProperty('adresse_client', f('adresse_client'));
|
||||
$plugin->setConfigProperty('code_postal_client', f('code_postal_client'));
|
||||
$plugin->setConfigProperty('ville_client', f('ville_client'));
|
||||
|
@ -27,9 +27,12 @@ try
|
||||
// l'identité du membre peut être redéfinie dans la configuration des membres
|
||||
$name_fields = \Paheko\Users\DynamicFields::getNameFields();
|
||||
array_walk($name_fields, function(&$elem) use ($c) {
|
||||
$elem = $c->$elem ?? '** ABSENT **';
|
||||
$elem = $c->$elem;
|
||||
});
|
||||
$c->nom = implode(" ", $name_fields);
|
||||
$nom_client = implode(" ", $name_fields);
|
||||
if (preg_match('/^ +$/', $nom_client)) {
|
||||
$nom_client = "** ABSENT **";
|
||||
}
|
||||
|
||||
// adresse, code postal et ville peuvent être redéfini(e)s dans la configuration du plugin
|
||||
$adresse_client = $plugin->getConfig('adresse_client');
|
||||
@ -50,6 +53,7 @@ try
|
||||
else
|
||||
{
|
||||
$c = $client->get($f->receveur_id);
|
||||
$nom_client = $c->nom;
|
||||
}
|
||||
}
|
||||
catch(UserException $e)
|
||||
@ -123,20 +127,29 @@ if ($f->type_facture != CERFA)
|
||||
|
||||
$receveur =
|
||||
$txtdest.'<br>'.
|
||||
'<b>'.$c->nom.'</b><br>'.
|
||||
'<b>'.$nom_client.'</b><br>'.
|
||||
(($t = $f->nom_contact)?"Contact : $t<br>":'').
|
||||
$c->adresse."<br>".
|
||||
$c->code_postal.' '.$c->ville."<br>".
|
||||
(($t = $c->siret)?"SIREN/SIRET : " . implode(' ', str_split($t, 3)) . "<br>":'').
|
||||
(($t = $c->email)?"Email : $t<br>":'').
|
||||
(($t = $c->telephone)?"Tel : $t<br>":'');
|
||||
|
||||
if ($f->type_facture == FACT) {
|
||||
$receveur .=
|
||||
(($t = $f->numero_commande)?"Commande N° : $t<br>":'').
|
||||
(($t = $f->reference_acheteur)?"Référence : $t<br>":'');
|
||||
}
|
||||
$total = Utils::money_format($f->total, ',', ' ');
|
||||
|
||||
// Devis et facture
|
||||
if ($f->type_facture != COTIS)
|
||||
{
|
||||
$echeance = ($f->type_facture?'Échéance de paiement':'Échéance du devis')." : ".$echeance;
|
||||
if ($f->type_facture == FACT) {
|
||||
$reglee = !$f->reglee?'Cette facture est en attente de règlement.':'Cette facture a été réglée.';
|
||||
} else {
|
||||
$reglee = "";
|
||||
}
|
||||
$footer = str_replace("\n", '<br>', $plugin->getConfig('footer') ?? '[Pied de page à configurer]');
|
||||
$ttc = $plugin->getConfig('ttc') ? 'TTC':'HT';
|
||||
|
||||
@ -189,12 +202,17 @@ EOF;
|
||||
$echeance <br>
|
||||
$reglee
|
||||
Moyen de paiement : $moyen_paiement
|
||||
|
||||
<p>
|
||||
$footer
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
EOF;
|
||||
if ($f->type_facture == DEVIS) {
|
||||
echo <<<EOF
|
||||
<p><b>Bon pour accord, date et signature<b></p>
|
||||
EOF;
|
||||
}
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
@ -375,7 +393,7 @@ elseif ($f->type_facture == CERFA)
|
||||
$t['objet1'] = $plugin->getConfig('objet_1');
|
||||
$t['objet2'] = $plugin->getConfig('objet_2');
|
||||
|
||||
$t['nom'] = $c->nom;
|
||||
$t['nom'] = $nom_client;
|
||||
$t['adresse'] = $c->adresse;
|
||||
$t['cp'] = $c->code_postal;
|
||||
$t['ville'] = $c->ville;
|
||||
@ -546,7 +564,7 @@ if(qg('d') !== null)
|
||||
{
|
||||
$filename = 'Print';
|
||||
if (preg_match('!<title>(.*)</title>!U', $html, $match)) {
|
||||
$filename = trim($match[1]);
|
||||
$filename = str_replace(" ", "_", trim($match[1]));
|
||||
}
|
||||
|
||||
header('Content-type: application/pdf');
|
||||
|
@ -10,7 +10,10 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_factures (
|
||||
archivee INTEGER DEFAULT 0, -- bool
|
||||
moyen_paiement TEXT NOT NULL,
|
||||
contenu TEXT NOT NULL,
|
||||
total INTEGER DEFAULT 0
|
||||
total INTEGER DEFAULT 0,
|
||||
nom_contact TEXT,
|
||||
numero_commande TEXT,
|
||||
reference_acheteur TEXT
|
||||
|
||||
-- FOREIGN KEY(moyen_paiement) REFERENCES compta_moyens_paiement(code)
|
||||
);
|
||||
@ -24,7 +27,9 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients (
|
||||
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
|
||||
email TEXT,
|
||||
nom_contact TEXT,
|
||||
note TEXT
|
||||
);
|
||||
|
||||
|
||||
@ -43,6 +48,7 @@ INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('PR', 'Pr
|
||||
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 ('MO', 'Mollie');
|
||||
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
|
||||
|
||||
-- Modif DD -- ajout de la table des textes associés aux CERFA
|
||||
|
@ -17,7 +17,9 @@ class Client
|
||||
'ville',
|
||||
'siret',
|
||||
'telephone',
|
||||
'email'
|
||||
'email',
|
||||
'nom_contact',
|
||||
'note'
|
||||
];
|
||||
|
||||
private $config = [
|
||||
@ -40,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é.');
|
||||
}
|
||||
@ -136,6 +138,12 @@ class Client
|
||||
'email' => [
|
||||
'label' => 'E-Mail',
|
||||
],
|
||||
'nom_contact' => [
|
||||
'label' => 'Contact',
|
||||
],
|
||||
'note' => [
|
||||
'label' => 'Note',
|
||||
],
|
||||
'nb_documents' => [
|
||||
'label' => 'Nombre de documents',
|
||||
'select' => '(SELECT COUNT(*) FROM plugin_facturation_factures WHERE receveur_id = c.id)',
|
||||
|
@ -30,7 +30,10 @@ class Facture
|
||||
'archivee',
|
||||
'moyen_paiement',
|
||||
'contenu',
|
||||
'total'
|
||||
'total',
|
||||
'nom_contact',
|
||||
'numero_commande',
|
||||
'reference_acheteur'
|
||||
];
|
||||
|
||||
public $types = [
|
||||
@ -44,16 +47,6 @@ class Facture
|
||||
'accounts' => [],
|
||||
'label' => 'Facture',
|
||||
'help' => ''],
|
||||
CERFA => [
|
||||
'id' => CERFA,
|
||||
'accounts' => [],
|
||||
'label' => 'Reçu fiscal',
|
||||
'help' => 'Reçu fiscal pour un don (membre ou client)'],
|
||||
COTIS => [
|
||||
'id' => COTIS,
|
||||
'accounts' => [],
|
||||
'label' => 'Reçu de cotisation',
|
||||
'help' => 'Reçu pour une cotisation payée par un·e membre'],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
@ -75,7 +68,7 @@ class Facture
|
||||
if(!is_array($data) && null !== $data){
|
||||
$datas[$k] = trim($data);
|
||||
}
|
||||
if ($datas[$k] === '' && $k != 'numero')
|
||||
if ($datas[$k] === '' && ! in_array($k, ['numero', 'nom_contact', 'numero_commande', 'reference_acheteur']))
|
||||
{
|
||||
throw new UserException("La valeur de $k est vide");
|
||||
}
|
||||
@ -144,10 +137,13 @@ class Facture
|
||||
unset($datas[$k]['prix']);
|
||||
continue;
|
||||
}
|
||||
elseif (empty($r['prix']))
|
||||
elseif (! is_numeric($r['prix']) && empty($r['prix']))
|
||||
{
|
||||
$datas[$k]['prix'] = 0;
|
||||
}
|
||||
elseif (empty($r['designation'])) {
|
||||
throw new UserException("Une au moins des désignations est absente.");
|
||||
}
|
||||
|
||||
if (!is_int($r['prix']))
|
||||
{
|
||||
@ -157,7 +153,7 @@ class Facture
|
||||
$total += $r['prix'];
|
||||
}
|
||||
|
||||
if($fac && !$total)
|
||||
if ($fac && count($datas['contenu']) == 0)
|
||||
{
|
||||
throw new UserException("Toutes les désignations/prix sont vides.");
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
name="Facturation"
|
||||
description="Permet d'éditer des factures, devis et reçus à ses membres ainsi qu'à une base de clients supplémentaire."
|
||||
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.8.7"
|
||||
version="0.15"
|
||||
menu=true
|
||||
restrict_section="accounting"
|
||||
restrict_level="read"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<form method="post" action="{$self_url}">
|
||||
|
||||
<fieldset>
|
||||
<legend>Type d'écriture</legend>
|
||||
<legend>Type de document</legend>
|
||||
<dl>
|
||||
{foreach from=$types_details item="type"}
|
||||
<dd class="radio-btn">
|
||||
@ -24,15 +24,13 @@
|
||||
<fieldset>
|
||||
<legend data-types="t0">Créer un devis</legend>
|
||||
<legend data-types="t1">Créer une facture</legend>
|
||||
<legend data-types="t2">Créer un reçu fiscal</legend>
|
||||
<legend data-types="t3">Créer un reçu de cotisation</legend>
|
||||
<dl>
|
||||
|
||||
{input type="text" name="numero_facture" maxlength=18 label="Numéro du document" required=$require_number source=$doc}
|
||||
|
||||
<dd class="help">
|
||||
{if $require_number}
|
||||
Chaque document doit comporter un numéro unique délivré chronologiquement et de façon continue. Il faut que le système adopté par l'association garantisse que deux factures émises la même année ne peuvent pas porter le même numéro.
|
||||
Chaque document doit comporter un numéro unique délivré chronologiquement et de façon continue. Il faut que le système adopté par l'association garantisse que deux factures émises la même année ne puissent pas porter le même numéro.
|
||||
{else}
|
||||
Laisser vide pour qu'un numéro soit automatiquement affecté au format <code>{$number_pattern}</code>.
|
||||
{/if}
|
||||
@ -59,7 +57,7 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset data-types="t0 t1 t2">
|
||||
<legend>Client</legend>
|
||||
<legend>Destinataire</legend>
|
||||
|
||||
<dl>
|
||||
<dt><label>Document adressé à :</label></dt>
|
||||
@ -72,18 +70,30 @@
|
||||
</dl>
|
||||
|
||||
<dl class="type_membre">
|
||||
{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 —"}
|
||||
</dl>
|
||||
|
||||
{if !empty($clients)}
|
||||
<dl class="type_client">
|
||||
{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 —"}
|
||||
</dl>
|
||||
{else}
|
||||
<input type="hidden" name="base_receveur" value="membre" />
|
||||
{/if}
|
||||
</fieldset>
|
||||
|
||||
<fieldset data-types="t0 t1">
|
||||
<legend>Autres informations</legend>
|
||||
{input type="text" name="nom_contact" label="Nom du contact" source=$doc}
|
||||
<div class="hidden">
|
||||
{input type="select" name="contact_list" options=$contacts}
|
||||
</div>
|
||||
<div data-types="t1">
|
||||
{input type="text" name="numero_commande" label="Numéro de commande" source=$doc}
|
||||
{input type="text" name="reference_acheteur" label="Référence acheteur" source=$doc}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset data-types="t0 t1">
|
||||
<legend>Contenu</legend>
|
||||
|
||||
|
@ -51,6 +51,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
function modifierContact(client, idlist, idcontact)
|
||||
{
|
||||
let contactlist = document.querySelector(idlist);
|
||||
let options = contactlist.querySelectorAll('option');
|
||||
for (i=0; i < options.length; ++i) {
|
||||
if (options[i].value == client.value) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.querySelector(idcontact).value = options[i].textContent;
|
||||
}
|
||||
|
||||
const form = document.querySelector('#f_numero_facture').form;
|
||||
changeTypeSaisie(form.base_receveur.value);
|
||||
|
||||
@ -63,6 +75,11 @@
|
||||
};
|
||||
}
|
||||
|
||||
const selclient = document.querySelector('#f_client');
|
||||
selclient.addEventListener("change", () => {
|
||||
modifierContact(selclient, '#f_contact_list', '#f_nom_contact');
|
||||
});
|
||||
|
||||
} ());
|
||||
|
||||
|
||||
|
@ -48,6 +48,24 @@
|
||||
{/if}
|
||||
</dd>
|
||||
|
||||
<dt>Nom du contact</dt>
|
||||
<dd>
|
||||
{if empty($client.nom_contact)}
|
||||
<em>(Non renseigné)</em>
|
||||
{else}
|
||||
{$client.nom_contact}
|
||||
{/if}
|
||||
</dd>
|
||||
|
||||
<dt>Note</dt>
|
||||
<dd>
|
||||
{if empty($client.note)}
|
||||
<em>(Non renseigné)</em>
|
||||
{else}
|
||||
{$client.note}
|
||||
{/if}
|
||||
</dd>
|
||||
|
||||
<dt>Date d'ajout</dt>
|
||||
<dd>{$client.date_creation|date:'d/m/Y'}</dd>
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
{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}
|
||||
{input type="text" name="nom_contact" label="Nom du contact" source=$client}
|
||||
{input type="textarea" cols="60" rows="3" name="note" label="Note" source=$client}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
@ -61,6 +61,8 @@
|
||||
{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"}
|
||||
{input type="text" name="nom_contact" label="Nom contact"}
|
||||
{input type="textarea" cols="60" rows="3" name="note" label="Note"}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
@ -19,7 +19,10 @@
|
||||
</dl>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>Adresse</legend>
|
||||
<legend>Adresse de l'association</legend>
|
||||
<dd class="help">
|
||||
à saisir uniquement si elle n'est pas dans la configuration de la compta ou si elle doit remplacer celle qui est définie dans la configuration de la compta
|
||||
</dd>
|
||||
<dl>
|
||||
{input type="text" name="numero_rue_asso" source=$conf label="Numéro de rue" maxlength=5}
|
||||
{input type="text" name="rue_asso" source=$conf label="Nom de rue"}
|
||||
@ -27,37 +30,17 @@
|
||||
{input type="text" name="ville_asso" source=$conf label="Ville"}
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Objet</legend>
|
||||
<dl>
|
||||
<dt><label>L'objet (but) de l'association doit tenir sur 3 lignes, chaque ligne pouvant accueillir un maximum de 100 caractères.</label><b title="(Champ obligatoire)">obligatoire pour reçus fiscaux</b></dt>
|
||||
{input type="text" name="objet_0" source=$conf label="Ligne 1" maxlength=95}
|
||||
{input type="text" name="objet_1" source=$conf label="Ligne 2" maxlength=95}
|
||||
{input type="text" name="objet_2" source=$conf label="Ligne 3" maxlength=95}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Droit à la réduction d'impôt</legend>
|
||||
<dl>
|
||||
<dt><label>Articles concernés par l'association :</label> <b title="(Champ obligatoire)">obligatoire pour reçus fiscaux</b></dt>
|
||||
{input type="checkbox" name="droit_art200" value="1" source=$conf label="Article 200"}
|
||||
{input type="checkbox" name="droit_art238bis" value="1" source=$conf label="Article 238 bis"}
|
||||
{input type="checkbox" name="droit_art885_0VbisA" value="1" source=$conf label="Article 885-0V bis A"}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Factures</legend>
|
||||
<legend>Factures et devis</legend>
|
||||
<dl>
|
||||
{input type="checkbox" name="logo" value="1" source=$conf label="Imprimer le logo de l'association"}
|
||||
{input type="textarea" class="full-width" rows="5" name="footer" source=$conf label="Pied de document — informations légales" required=true}
|
||||
</dl>
|
||||
<fieldset>
|
||||
<legend>
|
||||
Choisir les champs à faire figurer sur la facture
|
||||
Choisir les champs à faire figurer sur la facture ou le devis pour l'adresse d'un membre
|
||||
</legend>
|
||||
<dl>
|
||||
{input type="select" name="adresse_client" label="Adresse" required=true options=$champsPaheko source=$conf}
|
||||
@ -74,7 +57,7 @@
|
||||
{input type="checkbox" name="unique_client_name" value="1" source=$conf label="Noms des clients uniques"}
|
||||
{input type="select" name="pattern" label="Format de numéro de document" required=false options=$patterns source=$conf}
|
||||
<dd class="help">
|
||||
F = Facture, D = Devis, RF = Reçu fiscal, RC = Reçu cotisation
|
||||
F = Facture, D = Devis
|
||||
</dd>
|
||||
</dl>
|
||||
<i>Pour personnaliser l'apparence de la facture, il faut pour l'instant se retrousser les manches et éditer soi-même le fichier www/admin/pdf.php du plugin ! </i>
|
||||
|
85
upgrade.php
85
upgrade.php
@ -6,7 +6,7 @@ use Paheko\Entities\Files\File;
|
||||
|
||||
$db = DB::getInstance();
|
||||
$old_version = $plugin->oldVersion();
|
||||
error_log("upgrade::version = " . $old_version);
|
||||
error_log("upgrade:: à partir de la version = " . $old_version);
|
||||
|
||||
// 0.2.0 - Stock le contenu en json plutôt qu'en serialized
|
||||
if (version_compare($old_version, '0.2.0', '<'))
|
||||
@ -74,7 +74,7 @@ if (version_compare($old_version, '0.4.0', '<'))
|
||||
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
||||
|
||||
EOT
|
||||
);
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -211,7 +211,6 @@ if (version_compare($old_version, '0.8.1', '<'))
|
||||
}
|
||||
|
||||
// 0.8.5 Ajout champs SIREN/SIRET à la table clients
|
||||
|
||||
if (version_compare($old_version, '0.8.5', '<'))
|
||||
{
|
||||
$db->exec(<<<EOT
|
||||
@ -243,3 +242,83 @@ if (version_compare($old_version, '0.8.5', '<'))
|
||||
);
|
||||
}
|
||||
|
||||
// 0.12 Ajout Mollie à la table moyens de paiement
|
||||
if (version_compare($old_version, '0.12', '<'))
|
||||
{
|
||||
$db->exec(<<<EOT
|
||||
INSERT OR IGNORE INTO plugin_facturation_paiement
|
||||
(code, nom) VALUES ('MO', 'Mollie');
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
// version 0.15
|
||||
// Ajout champs note et contact à la table clients
|
||||
// Ajout divers champs à la table factures
|
||||
if (version_compare($old_version, '0.15', '<'))
|
||||
{
|
||||
$db->exec(<<<EOT
|
||||
CREATE TABLE IF NOT EXISTS plugin_facturation_clients_tmp
|
||||
(
|
||||
id INTEGER PRIMARY KEY,
|
||||
nom TEXT NOT NULL,
|
||||
adresse TEXT NOT NULL,
|
||||
code_postal TEXT NOT NULL,
|
||||
ville 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,
|
||||
nom_contact TEXT,
|
||||
note TEXT
|
||||
);
|
||||
EOT
|
||||
);
|
||||
// copier les clients dans la table temporaire
|
||||
$sql = 'SELECT * FROM plugin_facturation_clients';
|
||||
foreach ($db->iterate($sql) as $client)
|
||||
{
|
||||
$db->insert('plugin_facturation_clients_tmp', $client);
|
||||
}
|
||||
// remplacer l'ancienne table par la nouvelle
|
||||
$db->exec(<<<EOT
|
||||
DROP TABLE plugin_facturation_clients;
|
||||
ALTER TABLE plugin_facturation_clients_tmp RENAME TO plugin_facturation_clients;
|
||||
EOT
|
||||
);
|
||||
|
||||
$db->exec(<<<EOT
|
||||
CREATE TABLE IF NOT EXISTS plugin_facturation_factures_tmp(
|
||||
id INTEGER PRIMARY KEY,
|
||||
type_facture INTEGER NOT NULL DEFAULT 0,
|
||||
numero TEXT NOT NULL UNIQUE,
|
||||
receveur_membre INTEGER NOT NULL, -- bool
|
||||
receveur_id INTEGER NOT NULL,
|
||||
date_emission TEXT NOT NULL, -- CHECK (date(date_emission) IS NOT NULL AND date(date_emission) = date_emission),
|
||||
date_echeance TEXT NOT NULL, -- CHECK (date(date_echeance) IS NOT NULL AND date(date_echeance) = date_echeance),
|
||||
reglee INTEGER DEFAULT 0, -- bool
|
||||
archivee INTEGER DEFAULT 0, -- bool
|
||||
moyen_paiement TEXT NOT NULL,
|
||||
contenu TEXT NOT NULL,
|
||||
total INTEGER DEFAULT 0,
|
||||
nom_contact TEXT,
|
||||
numero_commande TEXT,
|
||||
reference_acheteur TEXT
|
||||
);
|
||||
EOT
|
||||
);
|
||||
|
||||
// copier les factures dans la table temporaire
|
||||
$sql = 'SELECT * FROM plugin_facturation_factures';
|
||||
foreach ($db->iterate($sql) as $facture)
|
||||
{
|
||||
$db->insert('plugin_facturation_factures_tmp', $facture);
|
||||
}
|
||||
// remplacer l'ancienne table par la nouvelle
|
||||
$db->exec(<<<EOT
|
||||
DROP TABLE plugin_facturation_factures;
|
||||
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
||||
EOT
|
||||
);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user