Fix indent ++
This commit is contained in:
parent
d45f81a515
commit
541c5820bc
16 changed files with 415 additions and 417 deletions
|
|
@ -26,78 +26,78 @@ $tpl->assign('moyen_paiement', f('moyen_paiement') ?: $f->moyen_paiement);
|
|||
if(f('save'))
|
||||
{
|
||||
$form->check('modifier_facture', [
|
||||
'type' => 'required|in:facture,devis',
|
||||
'numero_facture' => 'required|string',
|
||||
'date_emission' => 'required|date',
|
||||
'date_echeance' => 'required|date',
|
||||
// 'reglee' => '',
|
||||
// 'archivee' => '',
|
||||
'base_receveur' => 'required|in:membre,client',
|
||||
// 'client' => '',
|
||||
// 'membre' => '',
|
||||
'moyen_paiement' => 'required|in:' . implode(',', array_keys($cats->listMoyensPaiement())),
|
||||
'designation' => 'array|required',
|
||||
'prix' => 'array|required'
|
||||
'type' => 'required|in:facture,devis',
|
||||
'numero_facture' => 'required|string',
|
||||
'date_emission' => 'required|date',
|
||||
'date_echeance' => 'required|date',
|
||||
// 'reglee' => '',
|
||||
// 'archivee' => '',
|
||||
'base_receveur' => 'required|in:membre,client',
|
||||
// 'client' => '',
|
||||
// 'membre' => '',
|
||||
'moyen_paiement' => 'required|in:' . implode(',', array_keys($cats->listMoyensPaiement())),
|
||||
'designation' => 'array|required',
|
||||
'prix' => 'array|required'
|
||||
]);
|
||||
|
||||
|
||||
if (!$form->hasErrors())
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if ( count(f('designation')) !== count(f('prix')) )
|
||||
{
|
||||
throw new UserException('Nombre de désignations et de prix reçus différent.');
|
||||
}
|
||||
|
||||
$truc = [
|
||||
'numero' => f('numero_facture'),
|
||||
'date_emission' => f('date_emission'),
|
||||
'date_echeance' => f('date_echeance'),
|
||||
'reglee' => f('reglee') == 'on'?1:0,
|
||||
'archivee' => f('archivee') == 'on'?1:0,
|
||||
'moyen_paiement' => f('moyen_paiement'),
|
||||
'toto' => 0
|
||||
];
|
||||
|
||||
if (f('type') == 'facture')
|
||||
{
|
||||
$truc['type_facture'] = 1;
|
||||
}
|
||||
elseif (f('type') == 'devis')
|
||||
{
|
||||
$truc['type_facture'] = 0;
|
||||
}
|
||||
|
||||
foreach(f('designation') as $k=>$value)
|
||||
{
|
||||
$truc['contenu'][$k]['designation'] = $value;
|
||||
$truc['contenu'][$k]['prix'] = f('prix')[$k];
|
||||
$truc['toto'] += f('prix')[$k];
|
||||
}
|
||||
$truc['total'] = $truc['toto'];
|
||||
unset($truc['toto']);
|
||||
|
||||
if (f('base_receveur') == 'client')
|
||||
{
|
||||
$truc['receveur_membre'] = 0;
|
||||
$truc['receveur_id'] = f('client');
|
||||
}
|
||||
elseif (f('base_receveur') == 'membre')
|
||||
{
|
||||
$truc['receveur_membre'] = 1;
|
||||
$truc['receveur_id'] = f('membre');
|
||||
}
|
||||
try
|
||||
{
|
||||
if ( count(f('designation')) !== count(f('prix')) )
|
||||
{
|
||||
throw new UserException('Nombre de désignations et de prix reçus différent.');
|
||||
}
|
||||
|
||||
$r = $facture->edit($id, $truc);
|
||||
$truc = [
|
||||
'numero' => f('numero_facture'),
|
||||
'date_emission' => f('date_emission'),
|
||||
'date_echeance' => f('date_echeance'),
|
||||
'reglee' => f('reglee') == 'on'?1:0,
|
||||
'archivee' => f('archivee') == 'on'?1:0,
|
||||
'moyen_paiement' => f('moyen_paiement'),
|
||||
'toto' => 0
|
||||
];
|
||||
|
||||
Utils::redirect(PLUGIN_URL . 'facture.php?id='.(int)$id);
|
||||
if (f('type') == 'facture')
|
||||
{
|
||||
$truc['type_facture'] = 1;
|
||||
}
|
||||
elseif (f('type') == 'devis')
|
||||
{
|
||||
$truc['type_facture'] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
catch(UserException $e)
|
||||
{
|
||||
$form->addError($e->getMessage());
|
||||
}
|
||||
foreach(f('designation') as $k=>$value)
|
||||
{
|
||||
$truc['contenu'][$k]['designation'] = $value;
|
||||
$truc['contenu'][$k]['prix'] = f('prix')[$k];
|
||||
$truc['toto'] += f('prix')[$k];
|
||||
}
|
||||
$truc['total'] = $truc['toto'];
|
||||
unset($truc['toto']);
|
||||
|
||||
if (f('base_receveur') == 'client')
|
||||
{
|
||||
$truc['receveur_membre'] = 0;
|
||||
$truc['receveur_id'] = f('client');
|
||||
}
|
||||
elseif (f('base_receveur') == 'membre')
|
||||
{
|
||||
$truc['receveur_membre'] = 1;
|
||||
$truc['receveur_id'] = f('membre');
|
||||
}
|
||||
|
||||
$r = $facture->edit($id, $truc);
|
||||
|
||||
Utils::redirect(PLUGIN_URL . 'facture.php?id='.(int)$id);
|
||||
|
||||
}
|
||||
catch(UserException $e)
|
||||
{
|
||||
$form->addError($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue