Modified src/include/lib/Garradin/Compta/Comptes.php
from [25f947e684]
to [aaa9c6fdc2].
︙ | | | ︙ | |
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
/**
* Renvoie si un compte existe et n'est pas désactivé
* @param string $id Numéro de compte
* @return boolean TRUE si le compte existe et n'est pas désactivé
*/
public function isActive($id)
{
return DB::getInstance()->test('compta_comptes', $db->where('id', trim($id)) . ' AND ' . $db->where('desactive', '!=', 1));
}
public function get($id)
{
$db = DB::getInstance();
return $db->first('SELECT * FROM compta_comptes WHERE id = ?;', trim($id));
}
|
>
|
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
/**
* Renvoie si un compte existe et n'est pas désactivé
* @param string $id Numéro de compte
* @return boolean TRUE si le compte existe et n'est pas désactivé
*/
public function isActive($id)
{
$db = DB::getInstance();
return $db->test('compta_comptes', $db->where('id', trim($id)) . ' AND ' . $db->where('desactive', '!=', 1));
}
public function get($id)
{
$db = DB::getInstance();
return $db->first('SELECT * FROM compta_comptes WHERE id = ?;', trim($id));
}
|
︙ | | | ︙ | |
Modified src/include/lib/Garradin/Template.php
from [1501151da1]
to [469e9b3bcb].
︙ | | | ︙ | |
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
$this->assign('self_url_no_qs', Utils::getSelfUrl(true));
$this->assign('is_logged', false);
$this->register_function('form_errors', [$this, 'formErrors']);
$this->register_function('show_error', [$this, 'showError']);
$this->register_function('custom_colors', [$this, 'customColors']);
}
protected function formErrors($params)
{
$form = $this->getTemplateVars('form');
if (!$form->hasErrors())
|
>
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
$this->assign('self_url_no_qs', Utils::getSelfUrl(true));
$this->assign('is_logged', false);
$this->register_function('form_errors', [$this, 'formErrors']);
$this->register_function('show_error', [$this, 'showError']);
$this->register_function('custom_colors', [$this, 'customColors']);
$this->register_modifier('strlen', 'strlen');
}
protected function formErrors($params)
{
$form = $this->getTemplateVars('form');
if (!$form->hasErrors())
|
︙ | | | ︙ | |
Modified src/www/_inc.php
from [64c1a92193]
to [68654f2da9].
1
2
3
4
5
6
|
<?php
namespace Garradin;
require_once __DIR__ . '/../include/init.php';
?>
|
>
<
<
|
1
2
3
4
5
|
<?php
namespace Garradin;
require_once __DIR__ . '/../include/init.php';
|
Modified src/www/admin/compta/banques/index.php
from [15595f811b]
to [ebe60d3b59].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$banques = new Compta\Comptes_Bancaires;
$journal = new Compta\Journal;
$error = false;
if (Utils::post('add'))
{
if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
{
throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
if (!Utils::CSRF_check('compta_ajout_banque'))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
else
{
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$banques = new Compta\Comptes_Bancaires;
$journal = new Compta\Journal;
$error = false;
if (Utils::post('add'))
{
$session->requireAccess('compta', Membres::DROIT_ADMIN);
if (!Utils::CSRF_check('compta_ajout_banque'))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
else
{
|
︙ | | | ︙ | |
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
74
75
76
77
|
$exercices = new Compta\Exercices;
$exercice = $exercices->getCurrent();
$solde = Utils::post('solde');
$journal->add([
'libelle' => 'Solde initial',
'montant' => abs($solde),
'date' => gmdate('Y-m-d', $exercice['debut']),
'compte_credit' => $solde > 0 ? null : $id,
'compte_debit' => $solde < 0 ? null : $id,
'numero_piece' => null,
'remarques' => 'Opération automatique à l\'ajout du compte dans la liste des comptes bancaires',
'id_auteur' => $user['id'],
]);
}
Utils::redirect('/admin/compta/banques/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
}
$liste = $banques->getList();
foreach ($liste as &$banque)
{
$banque['solde'] = $journal->getSolde($banque['id']);
}
$tpl->assign('liste', $liste);
function tpl_format_iban($iban)
{
return implode(' ', str_split($iban, 4));
}
$tpl->register_modifier('format_iban', 'Garradin\tpl_format_iban');
$tpl->assign('error', $error);
$tpl->display('admin/compta/banques/index.tpl');
|
|
|
|
|
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
74
|
$exercices = new Compta\Exercices;
$exercice = $exercices->getCurrent();
$solde = Utils::post('solde');
$journal->add([
'libelle' => 'Solde initial',
'montant' => abs($solde),
'date' => gmdate('Y-m-d', $exercice->debut),
'compte_credit' => $solde > 0 ? null : $id,
'compte_debit' => $solde < 0 ? null : $id,
'numero_piece' => null,
'remarques' => 'Opération automatique à l\'ajout du compte dans la liste des comptes bancaires',
'id_auteur' => $user->id,
]);
}
Utils::redirect('/admin/compta/banques/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
}
$liste = $banques->getList();
foreach ($liste as &$banque)
{
$banque->solde = $journal->getSolde($banque->id);
}
$tpl->assign('liste', $liste);
function tpl_format_iban($iban)
{
return implode(' ', str_split($iban, 4));
}
$tpl->register_modifier('format_iban', 'Garradin\tpl_format_iban');
$tpl->assign('error', $error);
$tpl->display('admin/compta/banques/index.tpl');
|
Modified src/www/admin/compta/banques/modifier.php
from [4cf6c6d28b]
to [b80a5da1e9].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$banque = new Compta\Comptes_Bancaires;
$compte = $banque->get(qg('id'));
if (!$compte)
{
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$banque = new Compta\Comptes_Bancaires;
$compte = $banque->get(qg('id'));
if (!$compte)
{
|
︙ | | | ︙ | |
46
47
48
49
50
51
52
53
54
|
}
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/banques/modifier.tpl');
?>
|
<
<
|
43
44
45
46
47
48
49
|
}
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/banques/modifier.tpl');
|
Modified src/www/admin/compta/banques/rapprocher.php
from [4d947870a5]
to [697914e32f].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
if ($user['droits']['compta'] < Membres::DROIT_ECRITURE)
{
throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$banques = new Compta\Comptes_Bancaires;
$rapprochement = new Compta\Rapprochement;
$exercices = new Compta\Exercices;
$exercice = $exercices->getCurrent();
$compte = $banques->get(qg('id'));
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ECRITURE);
$banques = new Compta\Comptes_Bancaires;
$rapprochement = new Compta\Rapprochement;
$exercices = new Compta\Exercices;
$exercice = $exercices->getCurrent();
$compte = $banques->get(qg('id'));
|
︙ | | | ︙ | |
Modified src/www/admin/compta/banques/supprimer.php
from [2ce8ab68ad]
to [7a7915257e].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$banque = new Compta\Comptes_Bancaires;
$compte = $banque->get(qg('id'));
if (!$compte)
{
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$banque = new Compta\Comptes_Bancaires;
$compte = $banque->get(qg('id'));
if (!$compte)
{
|
︙ | | | ︙ | |
40
41
42
43
44
45
46
47
48
|
}
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/banques/supprimer.tpl');
?>
|
<
<
|
37
38
39
40
41
42
43
|
}
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/banques/supprimer.tpl');
|
Modified src/www/admin/compta/categories/ajouter.php
from [75ac6668be]
to [6e722cc3e8].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$cats = new Compta\Categories;
$error = false;
if (!empty($_POST['add']))
{
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$cats = new Compta\Categories;
$error = false;
if (!empty($_POST['add']))
{
|
︙ | | | ︙ | |
Modified src/www/admin/compta/categories/modifier.php
from [7b001b4932]
to [b91c181e44].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$cats = new Compta\Categories;
$id = (int)qg('id');
$cat = $cats->get($id);
if (!$cat)
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$cats = new Compta\Categories;
$id = (int)qg('id');
$cat = $cats->get($id);
if (!$cat)
|
︙ | | | ︙ | |
51
52
53
54
55
56
57
58
59
|
}
}
$tpl->assign('error', $error);
$tpl->assign('cat', $cat);
$tpl->display('admin/compta/categories/modifier.tpl');
?>
|
<
<
|
48
49
50
51
52
53
54
|
}
}
$tpl->assign('error', $error);
$tpl->assign('cat', $cat);
$tpl->display('admin/compta/categories/modifier.tpl');
|
Modified src/www/admin/compta/categories/supprimer.php
from [9fe2dc2696]
to [57188aaeb9].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$cats = new Compta\Categories;
$id = (int)qg('id');
$cat = $cats->get($id);
if (!$cat)
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$cats = new Compta\Categories;
$id = (int)qg('id');
$cat = $cats->get($id);
if (!$cat)
|
︙ | | | ︙ | |
40
41
42
43
44
45
46
47
48
|
}
}
$tpl->assign('error', $error);
$tpl->assign('cat', $cat);
$tpl->display('admin/compta/categories/supprimer.tpl');
?>
|
<
<
|
37
38
39
40
41
42
43
|
}
}
$tpl->assign('error', $error);
$tpl->assign('cat', $cat);
$tpl->display('admin/compta/categories/supprimer.tpl');
|
Modified src/www/admin/compta/comptes/ajouter.php
from [bf33114fea]
to [df1d8630ca].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$classe = (int) qg('classe');
if (!$classe || $classe < 1 || $classe > 9)
{
throw new UserException("Cette classe de compte n'existe pas.");
}
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$classe = (int) qg('classe');
if (!$classe || $classe < 1 || $classe > 9)
{
throw new UserException("Cette classe de compte n'existe pas.");
}
|
︙ | | | ︙ | |
48
49
50
51
52
53
54
55
56
|
$parent = $comptes->get(Utils::post('parent') ?: $classe);
$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', Utils::post('position') ?: $parent['position']);
$tpl->assign('comptes', $comptes->listTree($classe));
$tpl->display('admin/compta/comptes/ajouter.tpl');
?>
|
<
<
|
45
46
47
48
49
50
51
|
$parent = $comptes->get(Utils::post('parent') ?: $classe);
$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', Utils::post('position') ?: $parent['position']);
$tpl->assign('comptes', $comptes->listTree($classe));
$tpl->display('admin/compta/comptes/ajouter.tpl');
|
Modified src/www/admin/compta/comptes/index.php
from [fa3fc772b1]
to [8422c33bbc].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$classe = (int) qg('classe');
$tpl->assign('classe', $classe);
if (!$classe)
{
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$classe = (int) qg('classe');
$tpl->assign('classe', $classe);
if (!$classe)
{
|
︙ | | | ︙ | |
29
30
31
32
33
34
35
36
37
|
global $positions;
return $positions[$pos];
}
$tpl->register_modifier('get_position', 'Garradin\tpl_get_position');
$tpl->display('admin/compta/comptes/index.tpl');
?>
|
<
<
|
26
27
28
29
30
31
32
|
global $positions;
return $positions[$pos];
}
$tpl->register_modifier('get_position', 'Garradin\tpl_get_position');
$tpl->display('admin/compta/comptes/index.tpl');
|
Modified src/www/admin/compta/comptes/modifier.php
from [ef5895a765]
to [acafab3508].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$id = qg('id');
$compte = $comptes->get($id);
if (!$compte)
{
throw new UserException('Le compte demandé n\'existe pas.');
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$id = qg('id');
$compte = $comptes->get($id);
if (!$compte)
{
throw new UserException('Le compte demandé n\'existe pas.');
|
︙ | | | ︙ | |
45
46
47
48
49
50
51
52
53
|
$tpl->assign('error', $error);
$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', Utils::post('position') ?: $compte['position']);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/comptes/modifier.tpl');
?>
|
<
<
|
42
43
44
45
46
47
48
|
$tpl->assign('error', $error);
$tpl->assign('positions', $comptes->getPositions());
$tpl->assign('position', Utils::post('position') ?: $compte['position']);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/comptes/modifier.tpl');
|
Modified src/www/admin/compta/comptes/supprimer.php
from [87319b8fc7]
to [0e50aca974].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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.");
}
$id = qg('id');
$compte = $comptes->get($id);
if (!$compte)
{
throw new UserException('Le compte demandé n\'existe pas.');
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$id = qg('id');
$compte = $comptes->get($id);
if (!$compte)
{
throw new UserException('Le compte demandé n\'existe pas.');
|
︙ | | | ︙ | |
61
62
63
64
65
66
67
68
69
|
$tpl->assign('can_disable', $comptes->canDisable($compte['id']));
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/comptes/supprimer.tpl');
?>
|
<
<
|
58
59
60
61
62
63
64
|
$tpl->assign('can_disable', $comptes->canDisable($compte['id']));
$tpl->assign('error', $error);
$tpl->assign('compte', $compte);
$tpl->display('admin/compta/comptes/supprimer.tpl');
|
Modified src/www/admin/compta/exercices/ajouter.php
from [ed57d48ab3]
to [e0a18a0e20].
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);
$e = new Compta\Exercices;
if (f('add'))
{
fc('compta_ajout_exercice', [
'libelle' => 'required',
'fin' => 'required|date',
'debut' => 'required|date',
], $form_errors);
if (count($form_errors) == 0)
{
try
{
$id = $e->add([
'libelle' => f('libelle'),
'debut' => f('debut'),
'fin' => f('fin'),
]);
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$form_errors[] = $e->getMessage();
}
}
}
$tpl->display('admin/compta/exercices/ajouter.tpl');
|
|
|
|
|
|
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);
$e = new Compta\Exercices;
if (f('add'))
{
$form->check('compta_ajout_exercice', [
'libelle' => 'required',
'fin' => 'required|date',
'debut' => 'required|date',
]);
if (!$form->hasErrors())
{
try
{
$id = $e->add([
'libelle' => f('libelle'),
'debut' => f('debut'),
'fin' => f('fin'),
]);
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
$tpl->display('admin/compta/exercices/ajouter.tpl');
|
Modified src/www/admin/compta/exercices/cloturer.php
from [8abfc96cf3]
to [15ebcb6b96].
︙ | | | ︙ | |
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
41
42
43
44
45
46
|
if (!$exercice)
{
throw new UserException('Exercice inconnu.');
}
if (f('close'))
{
fc('compta_cloturer_exercice_' . $exercice->id, [
'fin' => 'date|required',
'reports' => 'boolean',
], $form_errors);
if (count($form_errors) == 0)
{
try
{
$id = $e->close($exercice->id, f('fin'));
if ($id && f('reports'))
{
$e->doReports($exercice->id, Utils::modifyDate(f('fin'), '+1 day'));
}
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$form_errors[] = $e->getMessage();
}
}
}
$tpl->assign('exercice', $exercice);
$tpl->display('admin/compta/exercices/cloturer.tpl');
|
|
|
|
|
|
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
41
42
43
44
45
46
|
if (!$exercice)
{
throw new UserException('Exercice inconnu.');
}
if (f('close'))
{
$form->check('compta_cloturer_exercice_' . $exercice->id, [
'fin' => 'date|required',
'reports' => 'boolean',
]);
if (!$form->hasErrors())
{
try
{
$id = $e->close($exercice->id, f('fin'));
if ($id && f('reports'))
{
$e->doReports($exercice->id, Utils::modifyDate(f('fin'), '+1 day'));
}
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
$tpl->assign('exercice', $exercice);
$tpl->display('admin/compta/exercices/cloturer.tpl');
|
Modified src/www/admin/compta/exercices/index.php
from [89c863a8b2]
to [b850cf88e1].
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$e = new Compta\Exercices;
$tpl->assign('liste', $e->getList());
$tpl->assign('current', $e->getCurrent());
$tpl->display('admin/compta/exercices/index.tpl');
?>
|
<
<
|
1
2
3
4
5
6
7
8
9
10
11
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$e = new Compta\Exercices;
$tpl->assign('liste', $e->getList());
$tpl->assign('current', $e->getCurrent());
$tpl->display('admin/compta/exercices/index.tpl');
|
Modified src/www/admin/compta/exercices/supprimer.php
from [1c0f44070c]
to [90312d8c29].
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
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?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.");
}
$e = new Compta\Exercices;
$exercice = $e->get((int)qg('id'));
if (!$exercice)
{
throw new UserException('Exercice inconnu.');
}
if ($exercice['cloture'])
{
throw new UserException('Impossible de supprimer un exercice clôturé.');
}
$error = false;
if (!empty($_POST['delete']))
{
if (!Utils::CSRF_check('compta_supprimer_exercice_'.$exercice['id']))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
else
{
try
{
$id = $e->delete($exercice['id']);
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
}
$tpl->assign('error', $error);
$tpl->assign('exercice', $exercice);
$tpl->display('admin/compta/exercices/supprimer.tpl');
?>
|
|
<
<
<
|
|
<
<
|
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
41
42
43
44
45
46
47
48
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$e = new Compta\Exercices;
$exercice = $e->get((int)qg('id'));
if (!$exercice)
{
throw new UserException('Exercice inconnu.');
}
if ($exercice['cloture'])
{
throw new UserException('Impossible de supprimer un exercice clôturé.');
}
$error = false;
if (f('delete'))
{
if (!Utils::CSRF_check('compta_supprimer_exercice_'.$exercice['id']))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
else
{
try
{
$id = $e->delete($exercice->id);
Utils::redirect('/admin/compta/exercices/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
}
$tpl->assign('error', $error);
$tpl->assign('exercice', $exercice);
$tpl->display('admin/compta/exercices/supprimer.tpl');
|
Modified src/www/admin/compta/import.php
from [029d24a386]
to [bd5c2b226a].
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$e = new Compta\Exercices;
$import = new Compta\Import;
$form_errors = [];
if (qg('export') !== null)
{
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename="Export comptabilité - ' . $config->get('nom_asso') . ' - ' . date('Y-m-d') . '.csv"');
$import->toCSV($e->getCurrentId());
exit;
}
$error = false;
if (f('import'))
{
fc('compta_import', [
'upload' => 'file|required',
'type' => 'required|in:citizen,garradin',
], $form_errors);
if (count($form_errors) === 0)
{
try
{
if (f('type') == 'citizen')
{
$import->fromCitizen($_FILES['upload']['tmp_name']);
}
elseif (f('type') == 'garradin')
{
$import->fromCSV($_FILES['upload']['tmp_name']);
}
else
{
throw new UserException('Import inconnu.');
}
Utils::redirect('/admin/compta/import.php?ok');
}
catch (UserException $e)
{
$form_errors[] = $e->getMessage();
}
}
}
$tpl->assign('form_errors', $form_errors);
$tpl->assign('ok', qg('ok'));
$tpl->display('admin/compta/import.tpl');
|
<
<
|
|
|
|
<
|
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$e = new Compta\Exercices;
$import = new Compta\Import;
if (qg('export') !== null)
{
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename="Export comptabilité - ' . $config->get('nom_asso') . ' - ' . date('Y-m-d') . '.csv"');
$import->toCSV($e->getCurrentId());
exit;
}
$error = false;
if (f('import'))
{
$form->check('compta_import', [
'upload' => 'file|required',
'type' => 'required|in:citizen,garradin',
]);
if (!$form->hasErrors())
{
try
{
if (f('type') == 'citizen')
{
$import->fromCitizen($_FILES['upload']['tmp_name']);
}
elseif (f('type') == 'garradin')
{
$import->fromCSV($_FILES['upload']['tmp_name']);
}
else
{
throw new UserException('Import inconnu.');
}
Utils::redirect('/admin/compta/import.php?ok');
}
catch (UserException $e)
{
$form->addError($e->getMessage());
}
}
}
$tpl->assign('ok', qg('ok'));
$tpl->display('admin/compta/import.tpl');
|
Modified src/www/admin/compta/operations/cotisation.php
from [92b0f6ecfd]
to [9326164d95].
︙ | | | ︙ | |
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
41
42
43
44
45
46
47
48
49
|
$mco = $m_cotisations->get($id);
if (!$mco)
{
throw new UserException("La cotisation demandée n'existe pas.");
}
$co = $cotisations->get($mco['id_cotisation']);
$membre = $membres->get($mco['id_membre']);
if (!$membre)
{
throw new UserException("Le membre demandé n'existe pas.");
}
$liste_comptes = $comptes->getListAll();
function get_nom_compte($compte)
{
if (is_null($compte))
return '';
global $liste_comptes;
return $liste_comptes[$compte];
}
$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('journal', $m_cotisations->listOperationsCompta($mco['id']));
$tpl->assign('cotisation_membre', $mco);
$tpl->assign('cotisation', $co);
$tpl->assign('membre', $membre);
$tpl->display('admin/compta/operations/cotisation.tpl');
|
|
|
|
|
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
41
42
43
44
45
46
47
48
49
|
$mco = $m_cotisations->get($id);
if (!$mco)
{
throw new UserException("La cotisation demandée n'existe pas.");
}
$co = $cotisations->get($mco->id_cotisation);
$membre = $membres->get($mco->id_membre);
if (!$membre)
{
throw new UserException("Le membre demandé n'existe pas.");
}
$liste_comptes = $comptes->getListAll();
function get_nom_compte($compte)
{
if (is_null($compte))
return '';
global $liste_comptes;
return $liste_comptes[$compte];
}
$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('journal', $m_cotisations->listOperationsCompta($mco->id));
$tpl->assign('cotisation_membre', $mco);
$tpl->assign('cotisation', $co);
$tpl->assign('membre', $membre);
$tpl->display('admin/compta/operations/cotisation.tpl');
|
Modified src/www/admin/compta/operations/index.php
from [ef889a1c1a]
to [b00c4bb240].
︙ | | | ︙ | |
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
41
42
43
44
45
46
47
48
49
50
51
52
|
$cat = $cats->get(qg('cat'));
if (!$cat)
{
throw new UserException("La catégorie demandée n'existe pas.");
}
$type = $cat['type'];
}
else
{
if (null !== qg('autres'))
$type = Compta\Categories::AUTRES;
elseif (null !== qg('depenses'))
$type = Compta\Categories::DEPENSES;
else
$type = Compta\Categories::RECETTES;
}
$journal = new Compta\Journal;
$list = $journal->getListForCategory($type === Compta\Categories::AUTRES ? null : $type, $cat ? $cat['id'] : null);
$tpl->assign('categorie', $cat);
$tpl->assign('journal', $list);
$tpl->assign('type', $type);
if ($type !== Compta\Categories::AUTRES)
{
$tpl->assign('liste_cats', $cats->getList($type));
}
$total = 0.0;
foreach ($list as $row)
{
$total += (float) $row['montant'];
}
$tpl->assign('total', $total);
$tpl->display('admin/compta/operations/index.tpl');
|
|
|
|
|
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
41
42
43
44
45
46
47
48
49
50
51
52
|
$cat = $cats->get(qg('cat'));
if (!$cat)
{
throw new UserException("La catégorie demandée n'existe pas.");
}
$type = $cat->type;
}
else
{
if (null !== qg('autres'))
$type = Compta\Categories::AUTRES;
elseif (null !== qg('depenses'))
$type = Compta\Categories::DEPENSES;
else
$type = Compta\Categories::RECETTES;
}
$journal = new Compta\Journal;
$list = $journal->getListForCategory($type === Compta\Categories::AUTRES ? null : $type, $cat ? $cat->id : null);
$tpl->assign('categorie', $cat);
$tpl->assign('journal', $list);
$tpl->assign('type', $type);
if ($type !== Compta\Categories::AUTRES)
{
$tpl->assign('liste_cats', $cats->getList($type));
}
$total = 0.0;
foreach ($list as $row)
{
$total += (float) $row->montant;
}
$tpl->assign('total', $total);
$tpl->display('admin/compta/operations/index.tpl');
|
Modified src/www/admin/compta/operations/membre.php
from [da8d2a3389]
to [2edb571c2f].
︙ | | | ︙ | |
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
global $liste_comptes;
return $liste_comptes[$compte];
}
$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('journal', $journal->listForMember($membre['id'], $exercice));
$tpl->assign('exercices', $exercices->getList());
$tpl->assign('exercice', $exercice);
$tpl->assign('membre', $membre);
$tpl->display('admin/compta/operations/membre.tpl');
|
|
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
global $liste_comptes;
return $liste_comptes[$compte];
}
$tpl->register_modifier('get_nom_compte', 'Garradin\get_nom_compte');
$tpl->assign('journal', $journal->listForMember($membre->id, $exercice));
$tpl->assign('exercices', $exercices->getList());
$tpl->assign('exercice', $exercice);
$tpl->assign('membre', $membre);
$tpl->display('admin/compta/operations/membre.tpl');
|
Modified src/www/admin/compta/operations/modifier.php
from [a00ae8b874]
to [5caac0bd9a].
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;
}
|
︙ | | | ︙ | |
Modified src/www/admin/compta/operations/recherche_sql.php
from [2c30e18af2]
to [bece8f5704].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?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;
$query = trim(qg('query'));
$tpl->assign('schema', $journal->schemaSQL());
$tpl->assign('query', $query);
|
|
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$journal = new Compta\Journal;
$query = trim(qg('query'));
$tpl->assign('schema', $journal->schemaSQL());
$tpl->assign('query', $query);
|
︙ | | | ︙ | |
Modified src/www/admin/compta/operations/supprimer.php
from [af94791960]
to [dd52dcb16d].
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
|
<?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;
$operation = $journal->get(qg('id'));
if (!$operation)
{
throw new UserException("L'opération demandée n'existe pas.");
}
$error = false;
if (!empty($_POST['delete']))
{
if (!Utils::CSRF_check('compta_supprimer_'.$operation['id']))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
else
{
try
{
$journal->delete($operation['id']);
Utils::redirect('/admin/compta/operations/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
|
|
<
<
<
|
|
|
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
|
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$session->requireAccess('compta', Membres::DROIT_ADMIN);
$journal = new Compta\Journal;
$operation = $journal->get(qg('id'));
if (!$operation)
{
throw new UserException("L'opération demandée n'existe pas.");
}
$error = false;
if (f('delete'))
{
if (!Utils::CSRF_check('compta_supprimer_'.$operation['id']))
{
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
}
else
{
try
{
$journal->delete($operation->id);
Utils::redirect('/admin/compta/operations/');
}
catch (UserException $e)
{
$error = $e->getMessage();
}
}
|
︙ | | | ︙ | |
Modified src/www/admin/compta/operations/voir.php
from [458ff3e2ef]
to [4b9f17ce08].
︙ | | | ︙ | |
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
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{
throw new UserException("L'opération demandée n'existe pas.");
}
$exercices = new Compta\Exercices;
$tpl->assign('operation', $operation);
$credit = $comptes->get($operation['compte_credit']);
$tpl->assign('nom_compte_credit', $credit['libelle']);
$debit = $comptes->get($operation['compte_debit']);
$tpl->assign('nom_compte_debit', $debit['libelle']);
$tpl->assign('exercice', $exercices->get($operation['id_exercice']));
if ($operation['id_categorie'])
{
$cats = new Compta\Categories;
$categorie = $cats->get($operation['id_categorie']);
$tpl->assign('categorie', $categorie);
if ($categorie['type'] == Compta\Categories::RECETTES)
{
$tpl->assign('compte', $debit['libelle']);
}
else
{
$tpl->assign('compte', $credit['libelle']);
}
$tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation['moyen_paiement']));
}
if ($operation['id_auteur'])
{
$auteur = $membres->get($operation['id_auteur']);
$tpl->assign('nom_auteur', $auteur['identite']);
}
$tpl->assign('related_members', $journal->listRelatedMembers($operation['id']));
$tpl->display('admin/compta/operations/voir.tpl');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{
throw new UserException("L'opération demandée n'existe pas.");
}
$exercices = new Compta\Exercices;
$tpl->assign('operation', $operation);
$credit = $comptes->get($operation->compte_credit);
$tpl->assign('nom_compte_credit', $credit->libelle);
$debit = $comptes->get($operation->compte_debit);
$tpl->assign('nom_compte_debit', $debit->libelle);
$tpl->assign('exercice', $exercices->get($operation->id_exercice));
if ($operation->id_categorie)
{
$cats = new Compta\Categories;
$categorie = $cats->get($operation->id_categorie);
$tpl->assign('categorie', $categorie);
if ($categorie->type == Compta\Categories::RECETTES)
{
$tpl->assign('compte', $debit->libelle);
}
else
{
$tpl->assign('compte', $credit->libelle);
}
$tpl->assign('moyen_paiement', $cats->getMoyenPaiement($operation->moyen_paiement));
}
if ($operation->id_auteur)
{
$auteur = $membres->get($operation->id_auteur);
$tpl->assign('nom_auteur', $auteur->identite);
}
$tpl->assign('related_members', $journal->listRelatedMembers($operation->id));
$tpl->display('admin/compta/operations/voir.tpl');
|
Modified src/www/admin/password.php
from [1b8d4026c7]
to [cc263171b2].
︙ | | | ︙ | |
48
49
50
51
52
53
54
55
56
|
$champ = $champs->get($config->get('champ_identifiant'));
$tpl->assign('champ', $champ);
$tpl->assign('error', $error);
$tpl->display('admin/password.tpl');
?>
|
<
<
|
48
49
50
51
52
53
54
|
$champ = $champs->get($config->get('champ_identifiant'));
$tpl->assign('champ', $champ);
$tpl->assign('error', $error);
$tpl->display('admin/password.tpl');
|
Modified src/www/admin/wiki/_preview.php
from [0e6ea2fd1d]
to [d803765203].
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
if ($user['droits']['wiki'] < Membres::DROIT_ECRITURE)
{
throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}
$tpl->assign('contenu', Utils::post('contenu'));
$tpl->display('admin/wiki/_preview.tpl');
|
>
|
|
<
<
<
|
|
1
2
3
4
5
6
7
8
9
10
11
|
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$session->requireAccess('wiki', Membres::DROIT_ECRITURE);
$tpl->assign('contenu', f('contenu'));
$tpl->display('admin/wiki/_preview.tpl');
|