Integration contrib @DDgallo sur CERFA
This commit is contained in:
parent
637c493671
commit
61f40e100d
8 changed files with 218 additions and 42 deletions
|
|
@ -18,6 +18,15 @@ $moyens_paiement = $facture->listMoyensPaiement(true);
|
|||
$tpl->assign('moyens_paiement', $moyens_paiement);
|
||||
$tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES');
|
||||
|
||||
$tpl->assign('formes_don', array('1' => 'Acte authentique',
|
||||
'2' => 'Acte sous seing privé',
|
||||
'3' => 'Don manuel',
|
||||
'4' => 'Autres'));
|
||||
$tpl->assign('natures_don', array('1' => 'Numéraire',
|
||||
'2' => 'Chèque',
|
||||
'3' => 'Virement, CB; ...'));
|
||||
$tpl->assign('textes_don', $facture->listTextesCerfa());
|
||||
|
||||
qv(['id' => 'required|numeric']);
|
||||
$id = (int) qg('id');
|
||||
|
||||
|
|
@ -66,21 +75,30 @@ if(f('save'))
|
|||
'moyen_paiement' => f('moyen_paiement'),
|
||||
'toto' => 0
|
||||
];
|
||||
$truc['type_facture'] = f('type');
|
||||
|
||||
if (in_array(f('type'), [DEVIS, FACT, CERFA]))
|
||||
if (in_array(f('type'), [DEVIS, FACT]))
|
||||
{
|
||||
$truc['type_facture'] = f('type');
|
||||
foreach(f('designation') as $k=>$value)
|
||||
{
|
||||
$truc['contenu'][$k]['designation'] = $value;
|
||||
$truc['contenu'][$k]['prix'] = Utils::moneyToInteger(f('prix')[$k]);
|
||||
$truc['toto'] += Utils::moneyToInteger(f('prix')[$k]);
|
||||
|
||||
}
|
||||
$truc['total'] = $truc['toto'];
|
||||
unset($truc['toto']);
|
||||
}
|
||||
elseif ( f('type') == CERFA )
|
||||
{
|
||||
$truc['contenu'] = [
|
||||
'forme' => f('forme_don'),
|
||||
'nature' => f('nature_don'),
|
||||
'texte' => f('texte_don')];
|
||||
$truc['total'] = Utils::moneyToInteger(f('total'));
|
||||
unset($truc['toto']);
|
||||
}
|
||||
|
||||
foreach(f('designation') as $k=>$value)
|
||||
{
|
||||
$truc['contenu'][$k]['designation'] = $value;
|
||||
$truc['contenu'][$k]['prix'] = Utils::moneyToInteger(f('prix')[$k]);
|
||||
$truc['toto'] += Utils::moneyToInteger(f('prix')[$k]);
|
||||
|
||||
}
|
||||
$truc['total'] = $truc['toto'];
|
||||
unset($truc['toto']);
|
||||
|
||||
if (f('base_receveur') == 'client')
|
||||
{
|
||||
|
|
@ -206,7 +224,13 @@ $doc['membre'] = $f->receveur_id;
|
|||
|
||||
$doc['date_emission'] = strtotime(f('date_emission')) ?: $f->date_emission;
|
||||
$doc['date_echeance'] = strtotime(f('date_echeance')) ?: $f->date_echeance; // Smarty m'a saoulé pour utiliser form_field|date_fr:---
|
||||
|
||||
/* modif DD -- CERFA -------------------------------------- */
|
||||
if ( $f->type_facture == CERFA ) {
|
||||
$doc['total'] = $f->total;
|
||||
$doc['forme_don'] = $f->contenu['forme'];
|
||||
$doc['nature_don'] = $f->contenu['nature'];
|
||||
$doc['texte_don'] = $f->contenu['texte'];
|
||||
}
|
||||
$tpl->assign('doc', $doc);
|
||||
|
||||
$radio['type'] = f('type')??$doc['type'];
|
||||
|
|
@ -223,7 +247,7 @@ $prix = [];
|
|||
// C'est un peu l'équivalent de form_field, mais j'avais écrit ça avant
|
||||
// et oulala, c'est un peu complexe, faudrait réfléchir keskivomieux
|
||||
$from_user = false;
|
||||
if ($f->type_facture != COTIS)
|
||||
if (in_array($f->type_facture, [DEVIS, FACT]))
|
||||
{
|
||||
if (($d = f('designation')) && ($p = f('prix')))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue