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
|
0.8.7
|
||||||
- correction typo
|
- correction typo
|
||||||
0.8.6
|
0.8.6
|
||||||
|
@ -24,7 +24,7 @@ le dossier plugins de Paheko.
|
|||||||
- **Configuration** :
|
- **Configuration** :
|
||||||
- Possibilité d'ajouter un numéro RNA et SIRET de l'association si elle en possède (apparait alors sur les documents)
|
- 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)
|
- 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)
|
- 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
|
- 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
|
- (obsolète) Informations relatives au CERFA pour les reçus fiscaux
|
||||||
|
@ -4,6 +4,28 @@ namespace Paheko;
|
|||||||
|
|
||||||
require_once __DIR__ . '/_inc.php';
|
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'])) {
|
if (!isset($target) || !in_array( $target, ['new', 'edit'])) {
|
||||||
throw new Exception('blabla illegal call'); // Fix: exception type?
|
throw new Exception('blabla illegal call'); // Fix: exception type?
|
||||||
} else {
|
} else {
|
||||||
@ -67,15 +89,21 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
|||||||
'reglee' => f('reglee') == 1?1:0,
|
'reglee' => f('reglee') == 1?1:0,
|
||||||
'archivee' => f('archivee') == 1?1:0,
|
'archivee' => f('archivee') == 1?1:0,
|
||||||
'moyen_paiement' => f('moyen_paiement'),
|
'moyen_paiement' => f('moyen_paiement'),
|
||||||
|
'nom_contact' => f('nom_contact'),
|
||||||
'toto' => 0
|
'toto' => 0
|
||||||
];
|
];
|
||||||
$data['type_facture'] = f('type');
|
$data['type_facture'] = f('type');
|
||||||
if (in_array(f('type'), [DEVIS, FACT]))
|
if (in_array(f('type'), [DEVIS, FACT]))
|
||||||
{
|
{
|
||||||
foreach(f('designation') as $k=>$value)
|
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 . ' !!');
|
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;
|
$data['contenu'][$k]['designation'] = $value;
|
||||||
@ -84,7 +112,14 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
|||||||
}
|
}
|
||||||
$data['total'] = $data['toto'];
|
$data['total'] = $data['toto'];
|
||||||
unset($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 )
|
elseif ( f('type') == CERFA )
|
||||||
{
|
{
|
||||||
$data['moyen_paiement'] = f('moyen_paiement_cerfa');
|
$data['moyen_paiement'] = f('moyen_paiement_cerfa');
|
||||||
@ -120,45 +155,45 @@ $form->runIf(f('save') && !$form->hasErrors(),
|
|||||||
|
|
||||||
$form->runIf(f('select_cotis') && !$form->hasErrors(),
|
$form->runIf(f('select_cotis') && !$form->hasErrors(),
|
||||||
function () use ($step)
|
function () use ($step)
|
||||||
{
|
{
|
||||||
$step = true;
|
$step = true;
|
||||||
}, 'add_cotis_1');
|
}, 'add_cotis_1');
|
||||||
|
|
||||||
$form->runIf(f('add_cotis') && !$form->hasErrors(),
|
$form->runIf(f('add_cotis') && !$form->hasErrors(),
|
||||||
function () use ($radio, $fields, $facture, $form)
|
function () use ($radio, $fields, $facture, $form)
|
||||||
{
|
{
|
||||||
$radio['type'] = f('cotisation');
|
$radio['type'] = f('cotisation');
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$num = (int) str_replace('cotis_', '', $radio['type']);
|
$num = (int) str_replace('cotis_', '', $radio['type']);
|
||||||
foreach($fields as $field)
|
foreach($fields as $field)
|
||||||
{
|
{
|
||||||
$cotis[$field] = f($field.'_'.$num);
|
$cotis[$field] = f($field.'_'.$num);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = $facture->getCotis(f('membre_cotis'), $cotis['id']);
|
$r = $facture->getCotis(f('membre_cotis'), $cotis['id']);
|
||||||
$r = $r[0];
|
$r = $r[0];
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'type_facture' => COTIS,
|
'type_facture' => COTIS,
|
||||||
'numero' => f('numero_facture'),
|
'numero' => f('numero_facture'),
|
||||||
'receveur_membre' => 1,
|
'receveur_membre' => 1,
|
||||||
'receveur_id' => f('membre_cotis'),
|
'receveur_id' => f('membre_cotis'),
|
||||||
'date_emission' => f('date_emission'),
|
'date_emission' => f('date_emission'),
|
||||||
'moyen_paiement' => 'AU',
|
'moyen_paiement' => 'AU',
|
||||||
'total' => $r->paid_amount ?? $r->amount,
|
'total' => $r->paid_amount ?? $r->amount,
|
||||||
'contenu' => ['id' => $cotis['id'],
|
'contenu' => ['id' => $cotis['id'],
|
||||||
'intitule' => $cotis['label'],
|
'intitule' => $cotis['label'],
|
||||||
'souscription' => $cotis['date'],
|
'souscription' => $cotis['date'],
|
||||||
'expiration' => $cotis['expiry'] ]
|
'expiration' => $cotis['expiry'] ]
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (UserException $e)
|
catch (UserException $e)
|
||||||
{
|
{
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}, 'add_cotis_2');
|
}, 'add_cotis_2');
|
||||||
|
|
||||||
if (! $form->hasErrors())
|
if (! $form->hasErrors())
|
||||||
{
|
{
|
||||||
@ -246,6 +281,9 @@ else
|
|||||||
|
|
||||||
$doc['date_emission'] = f('date_emission') ?: $f->date_emission;
|
$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['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 -------------------------------------- */
|
/* modif DD -- CERFA -------------------------------------- */
|
||||||
if ( $f->type_facture == CERFA ) {
|
if ( $f->type_facture == CERFA ) {
|
||||||
$doc['total'] = $f->total;
|
$doc['total'] = $f->total;
|
||||||
@ -292,8 +330,10 @@ if (in_array($radio['type'], [DEVIS, FACT]))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$designations = ['Exemple'];
|
/*
|
||||||
$prix = [250];
|
$designations = ['Exemple'];
|
||||||
|
$prix = [250];
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,10 +341,10 @@ $date = new \DateTime;
|
|||||||
$date->setTimestamp(time());
|
$date->setTimestamp(time());
|
||||||
$tpl->assign('date', $date->format('d/m/Y'));
|
$tpl->assign('date', $date->format('d/m/Y'));
|
||||||
|
|
||||||
|
|
||||||
$tpl->assign(compact('liste', 'radio', 'step', 'designations', 'prix', 'from_user', 'identite', 'csrf_key', 'doc'));
|
$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('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('require_number', $require_number);
|
||||||
$tpl->assign('number_pattern', PATTERNS_LIST[$plugin->getConfig('pattern')]);
|
$tpl->assign('number_pattern', PATTERNS_LIST[$plugin->getConfig('pattern')]);
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ $tpl->register_function('money_fac', function (array $params)
|
|||||||
|
|
||||||
if (!isset($user)) {
|
if (!isset($user)) {
|
||||||
$user = false;
|
$user = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($name))
|
if (!isset($name))
|
||||||
{
|
{
|
||||||
$name = 'prix[]';
|
$name = 'prix[]';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $current_value && !$user) {
|
if (null !== $current_value && !$user) {
|
||||||
@ -62,7 +62,7 @@ $tpl->register_function('money_fac', function (array $params)
|
|||||||
if (null !== $current_value) {
|
if (null !== $current_value) {
|
||||||
$current_value = htmlspecialchars($current_value, ENT_QUOTES, 'UTF-8');
|
$current_value = htmlspecialchars($current_value, ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
$currency = Config::getInstance()->get('monnaie');
|
$currency = Config::getInstance()->get('monnaie');
|
||||||
return sprintf('<td><nobr><input type="text" pattern="[0-9]*([.,][0-9]{1,2})?" inputmode="decimal" size="8" class="money" style="width: 60%%" onchange="updateSum();" name="%s" value="%s" /><b>%s</b></nobr></td>', $name, $current_value, $currency);
|
return sprintf('<td><nobr><input type="text" pattern="[0-9]*([.,][0-9]{1,2})?" inputmode="decimal" size="8" class="money" style="width: 60%%" onchange="updateSum();" name="%s" value="%s" /><b>%s</b></nobr></td>', $name, $current_value, $currency);
|
||||||
}
|
}
|
||||||
|
@ -17,27 +17,29 @@ if (!$c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form->runIf(f('save') && !$form->hasErrors(),
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
function () use ($client, $id, $form)
|
function () use ($client, $id, $form)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$r = $client->edit($id,[
|
$r = $client->edit($id,[
|
||||||
'nom' => f('nom'),
|
'nom' => f('nom'),
|
||||||
'adresse' => f('adresse'),
|
'adresse' => f('adresse'),
|
||||||
'code_postal' => f('code_postal'),
|
'code_postal' => f('code_postal'),
|
||||||
'ville' => f('ville'),
|
'ville' => f('ville'),
|
||||||
'siret' => f('siret'),
|
'siret' => f('siret'),
|
||||||
'telephone' => f('telephone'),
|
'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):'';
|
$r ? Utils::redirect(PLUGIN_ADMIN_URL . 'client.php?id='.(int)$id):'';
|
||||||
}
|
}
|
||||||
catch (UserException $e)
|
catch (UserException $e)
|
||||||
{
|
{
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}, 'edit_client');
|
}, 'edit_client');
|
||||||
|
|
||||||
|
|
||||||
$tpl->assign('client', $c);
|
$tpl->assign('client', $c);
|
||||||
|
@ -18,7 +18,9 @@ $form->runIf(f('add') && !$form->hasErrors(),
|
|||||||
'ville' => f('ville'),
|
'ville' => f('ville'),
|
||||||
'siret' => f('siret'),
|
'siret' => f('siret'),
|
||||||
'telephone' => f('telephone'),
|
'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):'';
|
$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('cp_asso', trim(f('cp_asso')));
|
||||||
$plugin->setConfigProperty('ville_asso', trim(f('ville_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('logo', (bool)f('logo'));
|
||||||
$plugin->setConfigProperty('footer', f('footer'));
|
$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('adresse_client', f('adresse_client'));
|
||||||
$plugin->setConfigProperty('code_postal_client', f('code_postal_client'));
|
$plugin->setConfigProperty('code_postal_client', f('code_postal_client'));
|
||||||
$plugin->setConfigProperty('ville_client', f('ville_client'));
|
$plugin->setConfigProperty('ville_client', f('ville_client'));
|
||||||
|
@ -21,7 +21,7 @@ if (!$f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tpl->assign('type', $f->type_facture);
|
$tpl->assign('type', $f->type_facture);
|
||||||
$tpl->assign('facture', $f);
|
$tpl->assign('facture', $f);
|
||||||
$tpl->assign('id', $id);
|
$tpl->assign('id', $id);
|
||||||
$tpl->assign('footer', $plugin->getConfig('footer')?:'');
|
$tpl->assign('footer', $plugin->getConfig('footer')?:'');
|
||||||
$tpl->assign('siret_asso', $plugin->getConfig('siret_asso')?:'');
|
$tpl->assign('siret_asso', $plugin->getConfig('siret_asso')?:'');
|
||||||
|
@ -27,9 +27,12 @@ try
|
|||||||
// l'identité du membre peut être redéfinie dans la configuration des membres
|
// l'identité du membre peut être redéfinie dans la configuration des membres
|
||||||
$name_fields = \Paheko\Users\DynamicFields::getNameFields();
|
$name_fields = \Paheko\Users\DynamicFields::getNameFields();
|
||||||
array_walk($name_fields, function(&$elem) use ($c) {
|
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, code postal et ville peuvent être redéfini(e)s dans la configuration du plugin
|
||||||
$adresse_client = $plugin->getConfig('adresse_client');
|
$adresse_client = $plugin->getConfig('adresse_client');
|
||||||
@ -50,6 +53,7 @@ try
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$c = $client->get($f->receveur_id);
|
$c = $client->get($f->receveur_id);
|
||||||
|
$nom_client = $c->nom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(UserException $e)
|
catch(UserException $e)
|
||||||
@ -123,20 +127,29 @@ if ($f->type_facture != CERFA)
|
|||||||
|
|
||||||
$receveur =
|
$receveur =
|
||||||
$txtdest.'<br>'.
|
$txtdest.'<br>'.
|
||||||
'<b>'.$c->nom.'</b><br>'.
|
'<b>'.$nom_client.'</b><br>'.
|
||||||
|
(($t = $f->nom_contact)?"Contact : $t<br>":'').
|
||||||
$c->adresse."<br>".
|
$c->adresse."<br>".
|
||||||
$c->code_postal.' '.$c->ville."<br>".
|
$c->code_postal.' '.$c->ville."<br>".
|
||||||
(($t = $c->siret)?"SIREN/SIRET : " . implode(' ', str_split($t, 3)) . "<br>":'').
|
(($t = $c->siret)?"SIREN/SIRET : " . implode(' ', str_split($t, 3)) . "<br>":'').
|
||||||
(($t = $c->email)?"Email : $t<br>":'').
|
(($t = $c->email)?"Email : $t<br>":'').
|
||||||
(($t = $c->telephone)?"Tel : $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, ',', ' ');
|
$total = Utils::money_format($f->total, ',', ' ');
|
||||||
|
|
||||||
// Devis et facture
|
// Devis et facture
|
||||||
if ($f->type_facture != COTIS)
|
if ($f->type_facture != COTIS)
|
||||||
{
|
{
|
||||||
$echeance = ($f->type_facture?'Échéance de paiement':'Échéance du devis')." : ".$echeance;
|
$echeance = ($f->type_facture?'Échéance de paiement':'Échéance du devis')." : ".$echeance;
|
||||||
$reglee = !$f->reglee?'Cette facture est en attente de règlement.':'Cette facture a été réglée.';
|
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]');
|
$footer = str_replace("\n", '<br>', $plugin->getConfig('footer') ?? '[Pied de page à configurer]');
|
||||||
$ttc = $plugin->getConfig('ttc') ? 'TTC':'HT';
|
$ttc = $plugin->getConfig('ttc') ? 'TTC':'HT';
|
||||||
|
|
||||||
@ -189,12 +202,17 @@ EOF;
|
|||||||
$echeance <br>
|
$echeance <br>
|
||||||
$reglee
|
$reglee
|
||||||
Moyen de paiement : $moyen_paiement
|
Moyen de paiement : $moyen_paiement
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
$footer
|
$footer
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
|
if ($f->type_facture == DEVIS) {
|
||||||
|
echo <<<EOF
|
||||||
|
<p><b>Bon pour accord, date et signature<b></p>
|
||||||
|
EOF;
|
||||||
|
}
|
||||||
|
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
|
|
||||||
@ -375,7 +393,7 @@ elseif ($f->type_facture == CERFA)
|
|||||||
$t['objet1'] = $plugin->getConfig('objet_1');
|
$t['objet1'] = $plugin->getConfig('objet_1');
|
||||||
$t['objet2'] = $plugin->getConfig('objet_2');
|
$t['objet2'] = $plugin->getConfig('objet_2');
|
||||||
|
|
||||||
$t['nom'] = $c->nom;
|
$t['nom'] = $nom_client;
|
||||||
$t['adresse'] = $c->adresse;
|
$t['adresse'] = $c->adresse;
|
||||||
$t['cp'] = $c->code_postal;
|
$t['cp'] = $c->code_postal;
|
||||||
$t['ville'] = $c->ville;
|
$t['ville'] = $c->ville;
|
||||||
@ -546,7 +564,7 @@ if(qg('d') !== null)
|
|||||||
{
|
{
|
||||||
$filename = 'Print';
|
$filename = 'Print';
|
||||||
if (preg_match('!<title>(.*)</title>!U', $html, $match)) {
|
if (preg_match('!<title>(.*)</title>!U', $html, $match)) {
|
||||||
$filename = trim($match[1]);
|
$filename = str_replace(" ", "_", trim($match[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-type: application/pdf');
|
header('Content-type: application/pdf');
|
||||||
|
@ -10,7 +10,10 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_factures (
|
|||||||
archivee INTEGER DEFAULT 0, -- bool
|
archivee INTEGER DEFAULT 0, -- bool
|
||||||
moyen_paiement TEXT NOT NULL,
|
moyen_paiement TEXT NOT NULL,
|
||||||
contenu 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)
|
-- FOREIGN KEY(moyen_paiement) REFERENCES compta_moyens_paiement(code)
|
||||||
);
|
);
|
||||||
@ -24,7 +27,9 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients (
|
|||||||
siret TEXT,
|
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
|
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,
|
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 ('TI', 'TIP');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('VI', 'Virement');
|
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 ('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');
|
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
|
||||||
|
|
||||||
-- Modif DD -- ajout de la table des textes associés aux CERFA
|
-- Modif DD -- ajout de la table des textes associés aux CERFA
|
||||||
|
@ -17,7 +17,9 @@ class Client
|
|||||||
'ville',
|
'ville',
|
||||||
'siret',
|
'siret',
|
||||||
'telephone',
|
'telephone',
|
||||||
'email'
|
'email',
|
||||||
|
'nom_contact',
|
||||||
|
'note'
|
||||||
];
|
];
|
||||||
|
|
||||||
private $config = [
|
private $config = [
|
||||||
@ -40,7 +42,7 @@ class Client
|
|||||||
{
|
{
|
||||||
$data[$key] = trim($data[$key]);
|
$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é.');
|
throw new UserException('Le champs '.$key.' doit être renseigné.');
|
||||||
}
|
}
|
||||||
@ -136,6 +138,12 @@ class Client
|
|||||||
'email' => [
|
'email' => [
|
||||||
'label' => 'E-Mail',
|
'label' => 'E-Mail',
|
||||||
],
|
],
|
||||||
|
'nom_contact' => [
|
||||||
|
'label' => 'Contact',
|
||||||
|
],
|
||||||
|
'note' => [
|
||||||
|
'label' => 'Note',
|
||||||
|
],
|
||||||
'nb_documents' => [
|
'nb_documents' => [
|
||||||
'label' => 'Nombre de documents',
|
'label' => 'Nombre de documents',
|
||||||
'select' => '(SELECT COUNT(*) FROM plugin_facturation_factures WHERE receveur_id = c.id)',
|
'select' => '(SELECT COUNT(*) FROM plugin_facturation_factures WHERE receveur_id = c.id)',
|
||||||
|
@ -30,7 +30,10 @@ class Facture
|
|||||||
'archivee',
|
'archivee',
|
||||||
'moyen_paiement',
|
'moyen_paiement',
|
||||||
'contenu',
|
'contenu',
|
||||||
'total'
|
'total',
|
||||||
|
'nom_contact',
|
||||||
|
'numero_commande',
|
||||||
|
'reference_acheteur'
|
||||||
];
|
];
|
||||||
|
|
||||||
public $types = [
|
public $types = [
|
||||||
@ -44,16 +47,6 @@ class Facture
|
|||||||
'accounts' => [],
|
'accounts' => [],
|
||||||
'label' => 'Facture',
|
'label' => 'Facture',
|
||||||
'help' => ''],
|
'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()
|
public function __construct()
|
||||||
@ -75,7 +68,7 @@ class Facture
|
|||||||
if(!is_array($data) && null !== $data){
|
if(!is_array($data) && null !== $data){
|
||||||
$datas[$k] = trim($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");
|
throw new UserException("La valeur de $k est vide");
|
||||||
}
|
}
|
||||||
@ -144,10 +137,13 @@ class Facture
|
|||||||
unset($datas[$k]['prix']);
|
unset($datas[$k]['prix']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
elseif (empty($r['prix']))
|
elseif (! is_numeric($r['prix']) && empty($r['prix']))
|
||||||
{
|
{
|
||||||
$datas[$k]['prix'] = 0;
|
$datas[$k]['prix'] = 0;
|
||||||
}
|
}
|
||||||
|
elseif (empty($r['designation'])) {
|
||||||
|
throw new UserException("Une au moins des désignations est absente.");
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_int($r['prix']))
|
if (!is_int($r['prix']))
|
||||||
{
|
{
|
||||||
@ -157,7 +153,7 @@ class Facture
|
|||||||
$total += $r['prix'];
|
$total += $r['prix'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($fac && !$total)
|
if ($fac && count($datas['contenu']) == 0)
|
||||||
{
|
{
|
||||||
throw new UserException("Toutes les désignations/prix sont vides.");
|
throw new UserException("Toutes les désignations/prix sont vides.");
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
name="Facturation"
|
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"
|
author="zou ; adapté par jce"
|
||||||
url="https://git.roflcopter.fr/lesanges/paheko-plugin-facturation"
|
url="https://git.roflcopter.fr/lesanges/paheko-plugin-facturation"
|
||||||
version="0.8.7"
|
version="0.15"
|
||||||
menu=true
|
menu=true
|
||||||
restrict_section="accounting"
|
restrict_section="accounting"
|
||||||
restrict_level="read"
|
restrict_level="read"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<form method="post" action="{$self_url}">
|
<form method="post" action="{$self_url}">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Type d'écriture</legend>
|
<legend>Type de document</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{foreach from=$types_details item="type"}
|
{foreach from=$types_details item="type"}
|
||||||
<dd class="radio-btn">
|
<dd class="radio-btn">
|
||||||
@ -24,15 +24,13 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend data-types="t0">Créer un devis</legend>
|
<legend data-types="t0">Créer un devis</legend>
|
||||||
<legend data-types="t1">Créer une facture</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>
|
<dl>
|
||||||
|
|
||||||
{input type="text" name="numero_facture" maxlength=18 label="Numéro du document" required=$require_number source=$doc}
|
{input type="text" name="numero_facture" maxlength=18 label="Numéro du document" required=$require_number source=$doc}
|
||||||
|
|
||||||
<dd class="help">
|
<dd class="help">
|
||||||
{if $require_number}
|
{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}
|
{else}
|
||||||
Laisser vide pour qu'un numéro soit automatiquement affecté au format <code>{$number_pattern}</code>.
|
Laisser vide pour qu'un numéro soit automatiquement affecté au format <code>{$number_pattern}</code>.
|
||||||
{/if}
|
{/if}
|
||||||
@ -49,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<dt><label>Statut</label></dt>
|
<dt><label>Statut</label></dt>
|
||||||
|
|
||||||
{input type="checkbox" name="reglee" value="1" label="Réglée" source=$doc data-types="t1"}
|
{input type="checkbox" name="reglee" value="1" label="Réglée" source=$doc data-types="t1"}
|
||||||
<div data-types="t0 t1 t2">
|
<div data-types="t0 t1 t2">
|
||||||
{input type="checkbox" name="archivee" value="1" label="Archivée" source=$doc disabled="disabled"}
|
{input type="checkbox" name="archivee" value="1" label="Archivée" source=$doc disabled="disabled"}
|
||||||
@ -59,7 +57,7 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset data-types="t0 t1 t2">
|
<fieldset data-types="t0 t1 t2">
|
||||||
<legend>Client</legend>
|
<legend>Destinataire</legend>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label>Document adressé à :</label></dt>
|
<dt><label>Document adressé à :</label></dt>
|
||||||
@ -72,18 +70,30 @@
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<dl class="type_membre">
|
<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>
|
</dl>
|
||||||
|
|
||||||
{if !empty($clients)}
|
{if !empty($clients)}
|
||||||
<dl class="type_client">
|
<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>
|
</dl>
|
||||||
{else}
|
{else}
|
||||||
<input type="hidden" name="base_receveur" value="membre" />
|
<input type="hidden" name="base_receveur" value="membre" />
|
||||||
{/if}
|
{/if}
|
||||||
</fieldset>
|
</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">
|
<fieldset data-types="t0 t1">
|
||||||
<legend>Contenu</legend>
|
<legend>Contenu</legend>
|
||||||
|
|
||||||
@ -113,14 +123,14 @@
|
|||||||
<td class="fact_rm_line">{button label="Enlever" title="Enlever la ligne" shape="minus" min="2" name="remove_line"}</td>
|
<td class="fact_rm_line">{button label="Enlever" title="Enlever la ligne" shape="minus" min="2" name="remove_line"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{foreach from=$designations item=designation key=key}
|
{foreach from=$designations item=designation key=key}
|
||||||
<tr>
|
<tr>
|
||||||
<td><textarea name="designation[]" style="width:98%;">{$designation}</textarea></td>
|
<td><textarea name="designation[]" style="width:98%;">{$designation}</textarea></td>
|
||||||
{money_fac value=$prix[$key] user=$from_user}
|
{money_fac value=$prix[$key] user=$from_user}
|
||||||
<td class="fact_rm_line">{button label="Enlever" title="Enlever la ligne" shape="minus" min="2" name="remove_line"}</td>
|
<td class="fact_rm_line">{button label="Enlever" title="Enlever la ligne" shape="minus" min="2" name="remove_line"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{else}
|
{else}
|
||||||
<tr id="Line1" class="hidden">
|
<tr id="Line1" class="hidden">
|
||||||
<td><textarea name="designation_tpl[]" style="width:98%;"></textarea></td>
|
<td><textarea name="designation_tpl[]" style="width:98%;"></textarea></td>
|
||||||
{money_fac name="prix_tpl[]"}
|
{money_fac name="prix_tpl[]"}
|
||||||
@ -139,7 +149,7 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset data-types="t2">
|
<fieldset data-types="t2">
|
||||||
<legend>Contenu</legend>
|
<legend>Contenu</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
function plus(){
|
function plus(){
|
||||||
var newdiv = document.createElement('tr');
|
var newdiv = document.createElement('tr');
|
||||||
newdiv.innerHTML = document.getElementById('Line1').innerHTML;
|
newdiv.innerHTML = document.getElementById('Line1').innerHTML;
|
||||||
newdiv.getElementsByTagName('textarea')[0].setAttribute('name', 'designation[]');
|
newdiv.getElementsByTagName('textarea')[0].setAttribute('name', 'designation[]');
|
||||||
newdiv.getElementsByTagName('input')[0].setAttribute('name', 'prix[]');
|
newdiv.getElementsByTagName('input')[0].setAttribute('name', 'prix[]');
|
||||||
newdiv.querySelector('.fact_rm_line button').onclick = function(){
|
newdiv.querySelector('.fact_rm_line button').onclick = function(){
|
||||||
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
|
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
|
||||||
updateSum();
|
updateSum();
|
||||||
@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
$('#ajouter_ligne').onclick = plus;
|
$('#ajouter_ligne').onclick = plus;
|
||||||
|
|
||||||
a = document.querySelectorAll('[name="remove_line"]');
|
a = document.querySelectorAll('[name="remove_line"]');
|
||||||
l = a.length;
|
l = a.length;
|
||||||
for(i = 0; i < l; i++) {
|
for(i = 0; i < l; i++) {
|
||||||
a[i].onclick = function(){
|
a[i].onclick = function(){
|
||||||
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
|
this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
|
||||||
updateSum();
|
updateSum();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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;
|
const form = document.querySelector('#f_numero_facture').form;
|
||||||
changeTypeSaisie(form.base_receveur.value);
|
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');
|
||||||
|
});
|
||||||
|
|
||||||
} ());
|
} ());
|
||||||
|
|
||||||
|
|
||||||
@ -99,4 +116,4 @@
|
|||||||
hideAllTypes();
|
hideAllTypes();
|
||||||
{/literal}
|
{/literal}
|
||||||
selectType({$radio.type});
|
selectType({$radio.type});
|
||||||
</script>
|
</script>
|
||||||
|
@ -48,6 +48,24 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</dd>
|
</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>
|
<dt>Date d'ajout</dt>
|
||||||
<dd>{$client.date_creation|date:'d/m/Y'}</dd>
|
<dd>{$client.date_creation|date:'d/m/Y'}</dd>
|
||||||
|
|
||||||
@ -94,4 +112,4 @@
|
|||||||
<p class="alert block">Ce client n'a pas de document associé.</p>
|
<p class="alert block">Ce client n'a pas de document associé.</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file="_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
{input type="text" name="siret" label="SIREN/SIRET" 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="tel" name="telephone" label="Téléphone" source=$client}
|
||||||
{input type="email" name="email" label="Adresse e-mail" 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>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
@ -24,4 +26,4 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
{include file="_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<?php continue; ?>
|
<?php continue; ?>
|
||||||
{/if}
|
{/if}
|
||||||
{if $key == 'siret'}
|
{if $key == 'siret'}
|
||||||
<?php
|
<?php
|
||||||
if (null === $value) { $value = ""; }
|
if (null === $value) { $value = ""; }
|
||||||
$value = implode(' ', str_split($value, 3));
|
$value = implode(' ', str_split($value, 3));
|
||||||
?>
|
?>
|
||||||
@ -61,6 +61,8 @@
|
|||||||
{input type="text" name="siret" label="SIREN/SIRET"}
|
{input type="text" name="siret" label="SIREN/SIRET"}
|
||||||
{input type="tel" name="telephone" label="Téléphone"}
|
{input type="tel" name="telephone" label="Téléphone"}
|
||||||
{input type="email" name="email" label="Adresse e-mail"}
|
{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>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
</dl>
|
</dl>
|
||||||
<br>
|
<br>
|
||||||
<fieldset>
|
<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>
|
<dl>
|
||||||
{input type="text" name="numero_rue_asso" source=$conf label="Numéro de rue" maxlength=5}
|
{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"}
|
{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"}
|
{input type="text" name="ville_asso" source=$conf label="Ville"}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</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>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Factures</legend>
|
<legend>Factures et devis</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{input type="checkbox" name="logo" value="1" source=$conf label="Imprimer le logo de l'association"}
|
{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}
|
{input type="textarea" class="full-width" rows="5" name="footer" source=$conf label="Pied de document — informations légales" required=true}
|
||||||
</dl>
|
</dl>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<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>
|
</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{input type="select" name="adresse_client" label="Adresse" required=true options=$champsPaheko source=$conf}
|
{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="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}
|
{input type="select" name="pattern" label="Format de numéro de document" required=false options=$patterns source=$conf}
|
||||||
<dd class="help">
|
<dd class="help">
|
||||||
F = Facture, D = Devis, RF = Reçu fiscal, RC = Reçu cotisation
|
F = Facture, D = Devis
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</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>
|
<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>
|
||||||
@ -86,4 +69,4 @@
|
|||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{include file="_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
|
115
upgrade.php
115
upgrade.php
@ -6,13 +6,13 @@ use Paheko\Entities\Files\File;
|
|||||||
|
|
||||||
$db = DB::getInstance();
|
$db = DB::getInstance();
|
||||||
$old_version = $plugin->oldVersion();
|
$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
|
// 0.2.0 - Stock le contenu en json plutôt qu'en serialized
|
||||||
if (version_compare($old_version, '0.2.0', '<'))
|
if (version_compare($old_version, '0.2.0', '<'))
|
||||||
{
|
{
|
||||||
$r = (array) DB::getInstance()->get('SELECT * FROM plugin_facturation_factures');
|
$r = (array) DB::getInstance()->get('SELECT * FROM plugin_facturation_factures');
|
||||||
|
|
||||||
foreach ($r as $e) {
|
foreach ($r as $e) {
|
||||||
$e->contenu =json_encode(unserialize((string) $e->contenu));
|
$e->contenu =json_encode(unserialize((string) $e->contenu));
|
||||||
$db->update('plugin_facturation_factures', $e, $db->where('id', (int)$e->id));
|
$db->update('plugin_facturation_factures', $e, $db->where('id', (int)$e->id));
|
||||||
@ -33,7 +33,7 @@ if (version_compare($old_version, '0.3.0', '<'))
|
|||||||
$db->exec('DROP TABLE `plugin_facturation_config`;');
|
$db->exec('DROP TABLE `plugin_facturation_config`;');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.4.0 -
|
// 0.4.0 -
|
||||||
if (version_compare($old_version, '0.4.0', '<'))
|
if (version_compare($old_version, '0.4.0', '<'))
|
||||||
{
|
{
|
||||||
$db->exec(<<<EOT
|
$db->exec(<<<EOT
|
||||||
@ -52,7 +52,7 @@ if (version_compare($old_version, '0.4.0', '<'))
|
|||||||
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('VI', 'Virement');
|
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('VI', 'Virement');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
|
INSERT OR IGNORE INTO plugin_facturation_paiement (code, nom) VALUES ('AU', 'Autre');
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS plugin_facturation_factures_tmp
|
CREATE TABLE IF NOT EXISTS plugin_facturation_factures_tmp
|
||||||
(
|
(
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
@ -74,11 +74,11 @@ if (version_compare($old_version, '0.4.0', '<'))
|
|||||||
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.6.0 -
|
// 0.6.0 -
|
||||||
if (version_compare($old_version, '0.6.0', '<'))
|
if (version_compare($old_version, '0.6.0', '<'))
|
||||||
{
|
{
|
||||||
define('DEVIS', 0);
|
define('DEVIS', 0);
|
||||||
@ -106,12 +106,12 @@ if (version_compare($old_version, '0.6.0', '<'))
|
|||||||
contenu TEXT NOT NULL,
|
contenu TEXT NOT NULL,
|
||||||
total INTEGER DEFAULT 0
|
total INTEGER DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO plugin_facturation_factures_tmp SELECT * FROM plugin_facturation_factures;
|
INSERT INTO plugin_facturation_factures_tmp SELECT * FROM plugin_facturation_factures;
|
||||||
DROP TABLE plugin_facturation_factures;
|
DROP TABLE plugin_facturation_factures;
|
||||||
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
ALTER TABLE plugin_facturation_factures_tmp RENAME TO plugin_facturation_factures;
|
||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
|
|
||||||
$factures = $facture->listAll();
|
$factures = $facture->listAll();
|
||||||
foreach($factures as $k=>$f)
|
foreach($factures as $k=>$f)
|
||||||
@ -119,13 +119,13 @@ EOT
|
|||||||
foreach($f->contenu as $line => $content)
|
foreach($f->contenu as $line => $content)
|
||||||
{
|
{
|
||||||
// Petit bug qui peut arriver avec des contenus mal enregistrés en db
|
// Petit bug qui peut arriver avec des contenus mal enregistrés en db
|
||||||
if (is_int($content))
|
if (is_int($content))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contenu[] = ['designation' => $content['designation'],
|
$contenu[] = ['designation' => $content['designation'],
|
||||||
'prix' => (int) ($content['prix'] * 100) ];
|
'prix' => (int) ($content['prix'] * 100) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
$f->contenu = $contenu;
|
$f->contenu = $contenu;
|
||||||
@ -143,7 +143,7 @@ EOT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.6.2 -
|
// 0.6.2 -
|
||||||
if (version_compare($old_version, '0.6.2', '<'))
|
if (version_compare($old_version, '0.6.2', '<'))
|
||||||
{
|
{
|
||||||
define('DEVIS', 0);
|
define('DEVIS', 0);
|
||||||
@ -168,14 +168,14 @@ if (version_compare($old_version, '0.6.2', '<'))
|
|||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte") VALUES ('0','Aucun','');
|
("id","menu","texte") VALUES ('0','Aucun','');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte")
|
("id","menu","texte")
|
||||||
VALUES ('1','HelloAsso','Don via HelloAsso');
|
VALUES ('1','HelloAsso','Don via HelloAsso');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte")
|
("id","menu","texte")
|
||||||
VALUES ('2','Frais de déplacement',
|
VALUES ('2','Frais de déplacement',
|
||||||
'Renonciation aux remboursements de frais de déplacement');
|
'Renonciation aux remboursements de frais de déplacement');
|
||||||
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
INSERT OR IGNORE INTO plugin_facturation_txt_cerfa
|
||||||
("id","menu","texte")
|
("id","menu","texte")
|
||||||
VALUES ('3','Don en nature','Don en nature');
|
VALUES ('3','Don en nature','Don en nature');
|
||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
@ -211,7 +211,6 @@ if (version_compare($old_version, '0.8.1', '<'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 0.8.5 Ajout champs SIREN/SIRET à la table clients
|
// 0.8.5 Ajout champs SIREN/SIRET à la table clients
|
||||||
|
|
||||||
if (version_compare($old_version, '0.8.5', '<'))
|
if (version_compare($old_version, '0.8.5', '<'))
|
||||||
{
|
{
|
||||||
$db->exec(<<<EOT
|
$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