28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
$m_cotisations = new Membres\Cotisations;
$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;
$error = false;
if (f('add') && $membre)
{
$form->check('add_cotisation', [
'date' => 'date_format:Y-m-d|required',
'id_cotisation' => 'numeric|required|in_table:cotisations,id',
'id_membre' => 'numeric|required|in_table:membres,id',
]);
if (!$form->hasErrors())
{
try {
$data = [
'date' => f('date'),
'id_cotisation' => f('id_cotisation'),
'id_membre' => f('id_membre'),
'id_auteur' => $user->id,
'montant' => f('montant'),
'moyen_paiement' => f('moyen_paiement'),
'numero_cheque' => f('numero_cheque'),
'banque' => f('banque'),
];
$m_cotisations->add($data);
Utils::redirect('/admin/membres/cotisations.php?id=' . (int)f('id_membre'));
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
|
|
>
>
>
>
>
>
>
|
|
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
$m_cotisations = new Membres\Cotisations;
$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;
$error = false;
if (f('add'))
{
$form->check('add_cotisation', [
'date' => 'date_format:Y-m-d|required',
'id_cotisation' => 'numeric|required|in_table:cotisations,id',
'id_membre' => 'numeric|required|in_table:membres,id',
]);
if (!$form->hasErrors())
{
try {
$id_membre = f('id_membre');
if (!$id_membre && f('numero_membre'))
{
$id_membre = (new Membres)->getIDWithNumero(f('numero_membre'));
}
$data = [
'date' => f('date'),
'id_cotisation' => f('id_cotisation'),
'id_membre' => $id_membre,
'id_auteur' => $user->id,
'montant' => f('montant'),
'moyen_paiement' => f('moyen_paiement'),
'numero_cheque' => f('numero_cheque'),
'banque' => f('banque'),
];
$m_cotisations->add($data);
Utils::redirect('/admin/membres/cotisations.php?id=' . $id_membre);
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
|