1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$journal = new Compta\Journal;
$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;
$operation = $journal->get(qg('id'));
if (!$operation)
{
throw new UserException("L'opération demandée n'existe pas.");
}
if ($operation['id_categorie'])
{
$categorie = $cats->get($operation['id_categorie']);
}
else
{
$categorie = false;
}
if ($categorie && $categorie['type'] != Compta\Categories::AUTRES)
{
$type = $categorie['type'];
}
else
{
$type = null;
}
$error = false;
|
|
<
<
<
|
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$journal = new Compta\Journal;
$cats = new Compta\Categories;
$banques = new Compta\Comptes_Bancaires;
$operation = $journal->get(qg('id'));
if (!$operation)
{
throw new UserException("L'opération demandée n'existe pas.");
}
if ($operation->id_categorie)
{
$categorie = $cats->get($operation->id_categorie);
}
else
{
$categorie = false;
}
if ($categorie && $categorie->type != Compta\Categories::AUTRES)
{
$type = $categorie->type;
}
else
{
$type = null;
}
$error = false;
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{
throw new UserException('Moyen de paiement invalide.');
}
if (Utils::post('moyen_paiement') == 'ES')
{
$a = Compta\Comptes::CAISSE;
$b = $cat['compte'];
}
else
{
if (!trim(Utils::post('banque')))
{
throw new UserException('Le compte bancaire choisi est invalide.');
}
if (!array_key_exists(Utils::post('banque'), $banques->getList()))
{
throw new UserException('Le compte bancaire choisi n\'existe pas.');
}
$a = Utils::post('banque');
$b = $cat['compte'];
}
if ($type == Compta\Categories::DEPENSES)
{
$debit = $b;
$credit = $a;
}
|
|
|
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
{
throw new UserException('Moyen de paiement invalide.');
}
if (Utils::post('moyen_paiement') == 'ES')
{
$a = Compta\Comptes::CAISSE;
$b = $cat->compte;
}
else
{
if (!trim(Utils::post('banque')))
{
throw new UserException('Le compte bancaire choisi est invalide.');
}
if (!array_key_exists(Utils::post('banque'), $banques->getList()))
{
throw new UserException('Le compte bancaire choisi n\'existe pas.');
}
$a = Utils::post('banque');
$b = $cat->compte;
}
if ($type == Compta\Categories::DEPENSES)
{
$debit = $b;
$credit = $a;
}
|