Migration de Facturation\Config à la gestion de conf intégrée à Garradin

This commit is contained in:
Noizette 2020-10-24 01:00:48 +02:00
parent 4b3fa030d8
commit 33b9f05062
11 changed files with 91 additions and 82 deletions

View file

@ -48,56 +48,56 @@ if(f('save'))
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
];
$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;
}
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']);
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');
}
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);
$r = $facture->edit($id, $truc);
Utils::redirect(PLUGIN_URL . 'facture.php?id='.(int)$id);
Utils::redirect(PLUGIN_URL . 'facture.php?id='.(int)$id);
}
catch(UserException $e)
{
$form->addError($e->getMessage());
}
}
catch(UserException $e)
{
$form->addError($e->getMessage());
}
}
}