Overview
Comment:correction numérotage automatique des comptes fix [26b1f1a224dcd294542c56bbb057f0ab1a5aeb7d]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 39e72e63335f4622631413825cc30a84538006c9
User & Date: bohwaz on 2015-03-11 00:11:28
Other Links: manifest | tags
Context
2015-03-28
16:33
comptage du nombre d'écritures liées et avertissement avant suppression, et ne pas supprimer les liaisons membre <-> écriture, simplement indiquer qu'elles ne sont plus liées à une cotisation check-in: fea5d3bdbe user: bohwaz tags: trunk
2015-03-11
00:11
correction numérotage automatique des comptes fix [26b1f1a224dcd294542c56bbb057f0ab1a5aeb7d] check-in: 39e72e6333 user: bohwaz tags: trunk
2015-03-10
05:17
Callback pour insertion de fichier dans page wiki check-in: 619af651ca user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Compta/Comptes.php from [0cb2bda52e] to [ef24ced8a2].

60
61
62
63
64
65
66



67

68






69

70
71
72
73
74
75
76
77
78
79
80
81
82
        $this->_checkFields($data, true);

        $db = DB::getInstance();

        if (empty($data['id']))
        {
            $new_id = $data['parent'];



            $nb_sous_comptes = $db->simpleQuerySingle('SELECT COUNT(*) FROM compta_comptes WHERE parent = ?;', false, $new_id);








            // Pas plus de 26 sous-comptes par compte, parce que l'alphabet s'arrête à 26 lettres

            if ($nb_sous_comptes >= 26)
            {
                throw new UserException('Nombre de sous-comptes maximal atteint pour ce compte parent-ci.');
            }

            $new_id .= chr(65+(int)$nb_sous_comptes);
        }
        else
        {
            $new_id = $data['id'];
        }

        if (isset($data['position']))







>
>
>
|
>
|
>
>
>
>
>
>
|
>
|



<
<







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84


85
86
87
88
89
90
91
        $this->_checkFields($data, true);

        $db = DB::getInstance();

        if (empty($data['id']))
        {
            $new_id = $data['parent'];
            $letters = range('A', 'Z');
            $sub_accounts = $db->simpleStatementFetchAssoc('SELECT id, id FROM compta_comptes 
                WHERE parent = ? ORDER BY id COLLATE NOCASE ASC;', $data['parent']);

            foreach ($letters as $letter)
            {
                if (!in_array($new_id . $letter, $sub_accounts))
                {
                    $new_id .= $letter;
                    break;
                }
            }

            // On a exaucé le nombre de sous-comptes possibles
            if ($new_id == $data['parent'])
            {
                throw new UserException('Nombre de sous-comptes maximal atteint pour ce compte parent-ci.');
            }


        }
        else
        {
            $new_id = $data['id'];
        }

        if (isset($data['position']))

Modified src/www/admin/compta/banques/index.php from [14fbe20721] to [15595f811b].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
            $id = $banques->add([
                'libelle'       =>  Utils::post('libelle'),
                'banque'        =>  Utils::post('banque'),
                'iban'          =>  Utils::post('iban'),
                'bic'           =>  Utils::post('bic'),
            ]);

            if (Utils::post('solde'))
            {
            	$exercices = new Compta\Exercices;
            	$exercice = $exercices->getCurrent();
            	$solde = Utils::post('solde');

            	$journal->add([
                    'libelle'       =>  'Solde initial',







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
            $id = $banques->add([
                'libelle'       =>  Utils::post('libelle'),
                'banque'        =>  Utils::post('banque'),
                'iban'          =>  Utils::post('iban'),
                'bic'           =>  Utils::post('bic'),
            ]);

            if (Utils::post('solde') > 0)
            {
            	$exercices = new Compta\Exercices;
            	$exercice = $exercices->getCurrent();
            	$solde = Utils::post('solde');

            	$journal->add([
                    'libelle'       =>  'Solde initial',