Overview
Comment:Liste des comptes dans la saisie
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 94036d70d9cf2e051e6bf6b0504f4a9b9c036e0e
User & Date: bohwaz on 2012-07-08 00:11:43
Other Links: manifest | tags
Context
2012-07-08
01:34
Réduction du plan comptable check-in: 486d2a4fd1 user: bohwaz tags: trunk
00:11
Liste des comptes dans la saisie check-in: 94036d70d9 user: bohwaz tags: trunk
2012-07-07
23:20
Fallback du input type date si le navigateur ne le gère pas (genre... Firefox, comme toujours) check-in: 1f418f143d user: bohwaz tags: trunk
Changes

Modified DB_SCHEMA from [1b0caa210d] to [2c3d236bfd].

233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
    FOREIGN KEY(compte_debit) REFERENCES compta_comptes(id),
    FOREIGN KEY(compte_credit) REFERENCES compta_comptes(id),
    FOREIGN KEY(id_exercice) REFERENCES compta_exercices(id),
    FOREIGN KEY(id_auteur) REFERENCES membres(id),
    FOREIGN KEY(id_categorie) REFERENCES compta_categories(id)
);

CREATE INDEX compta_operations_exercice ON compta_operations (id_exercice);
CREATE INDEX compta_operations_date ON compta_operations (date);
CREATE INDEX compta_operations_comptes ON compta_operations (compte_debit, compte_credit);
CREATE INDEX compta_operations_auteur ON compta_operations (id_auteur);

CREATE TABLE compta_moyens_paiement
-- Moyens de paiement
(
    code TEXT PRIMARY KEY,
    nom TEXT
);







|
|
|
|







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
    FOREIGN KEY(compte_debit) REFERENCES compta_comptes(id),
    FOREIGN KEY(compte_credit) REFERENCES compta_comptes(id),
    FOREIGN KEY(id_exercice) REFERENCES compta_exercices(id),
    FOREIGN KEY(id_auteur) REFERENCES membres(id),
    FOREIGN KEY(id_categorie) REFERENCES compta_categories(id)
);

CREATE INDEX compta_operations_exercice ON compta_journal (id_exercice);
CREATE INDEX compta_operations_date ON compta_journal (date);
CREATE INDEX compta_operations_comptes ON compta_journal (compte_debit, compte_credit);
CREATE INDEX compta_operations_auteur ON compta_journal (id_auteur);

CREATE TABLE compta_moyens_paiement
-- Moyens de paiement
(
    code TEXT PRIMARY KEY,
    nom TEXT
);

Modified include/class.compta_comptes.php from [53556ebca4] to [9f242de960].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

class Garradin_Compta_Comptes
{
    public function importPlan()
    {
        $plan = json_decode(file_get_contents(GARRADIN_ROOT . '/include/plan_comptable.json'));

        $db = Garradin_DB::getInstance();
        $db->exec('BEGIN;');
        $db->exec('DELETE FROM compta_comptes WHERE plan_comptable = 1;'); // Nettoyage avant insertion

        foreach ($plan as $id=>$compte)
        {






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

class Garradin_Compta_Comptes
{
    public function importPlan()
    {
        $plan = json_decode(file_get_contents(GARRADIN_ROOT . '/include/plan_comptable.json'), true);

        $db = Garradin_DB::getInstance();
        $db->exec('BEGIN;');
        $db->exec('DELETE FROM compta_comptes WHERE plan_comptable = 1;'); // Nettoyage avant insertion

        foreach ($plan as $id=>$compte)
        {
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
        $db = Garradin_DB::getInstance();
        return $db->simpleStatementFetch('SELECT * FROM compta_comptes WHERE parent = ? ORDER BY id;', $parent);
    }

    public function listTree($parent = 0)
    {
        $db = Garradin_DB::getInstance();

        return $db->simpleStatementFetch('SELECT * FROM compta_comptes WHERE parent LIKE \''.$db->escapeString($parent).'%\' ORDER BY id;');
    }

    protected function _checkFields(&$data, $force_parent_check = false)
    {
        $db = Garradin_DB::getInstance();

        if (empty($data['libelle']) || !trim($data['libelle']))







>
|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
        $db = Garradin_DB::getInstance();
        return $db->simpleStatementFetch('SELECT * FROM compta_comptes WHERE parent = ? ORDER BY id;', $parent);
    }

    public function listTree($parent = 0)
    {
        $db = Garradin_DB::getInstance();
        $parent = $parent ? 'WHERE parent LIKE \''.$db->escapeString($parent).'%\' ' : '';
        return $db->simpleStatementFetch('SELECT * FROM compta_comptes '.$parent.' ORDER BY id;');
    }

    protected function _checkFields(&$data, $force_parent_check = false)
    {
        $db = Garradin_DB::getInstance();

        if (empty($data['libelle']) || !trim($data['libelle']))

Modified include/template.php from [5d81b7bb84] to [fb7e6cb51a].

305
306
307
308
309
310
311
312


































313
314

315
316
317
318
319
320
321

        $prev = $i;
    }

    $out .= '</table>';
    return $out;
}



































$tpl->register_function('csrf_field', 'tpl_csrf_field');
$tpl->register_function('form_field', 'tpl_form_field');


$tpl->register_function('format_droits', 'tpl_format_droits');

$tpl->register_function('pagination', 'tpl_pagination');

$tpl->register_function('diff', 'tpl_diff');









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>







305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

        $prev = $i;
    }

    $out .= '</table>';
    return $out;
}

function tpl_select_compte($params)
{
    $name = $params['name'];
    $comptes = $params['comptes'];

    $out = '<select name="'.$name.'" id="f_'.$name.'" class="large">';

    foreach ($comptes as $compte)
    {
        if (!isset($compte['id'][1]))
        {
            $out.= '<optgroup label="'.htmlspecialchars($compte['libelle'], ENT_QUOTES, 'UTF-8', false).'" class="niveau_1"></optgroup>';
        }
        elseif (!isset($compte['id'][2]))
        {
            if ($compte['id'] > 10)
                $out.= '</optgroup>';

            $out.= '<optgroup label="'.htmlspecialchars($compte['id'] . ' - ' . $compte['libelle'], ENT_QUOTES, 'UTF-8', false).'" class="niveau_2">';
        }
        else
        {
            $out .= '<option value="'.htmlspecialchars($compte['id'], ENT_QUOTES, 'UTF-8', false).'" class="niveau_'.strlen($compte['id']).'">';
            $out .= htmlspecialchars($compte['id'] . ' - ' . $compte['libelle'], ENT_QUOTES, 'UTF-8', false);
            $out .= '</option>';
        }
    }

    $out .= '</optgroup>';
    $out .= '</select>';

    return $out;
}

$tpl->register_function('csrf_field', 'tpl_csrf_field');
$tpl->register_function('form_field', 'tpl_form_field');
$tpl->register_function('select_compte', 'tpl_select_compte');

$tpl->register_function('format_droits', 'tpl_format_droits');

$tpl->register_function('pagination', 'tpl_pagination');

$tpl->register_function('diff', 'tpl_diff');

Modified templates/admin/compta/saisie.tpl from [016afa7ec3] to [94a3e6e944].

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

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Informations sur l'opération</legend>
        <dl>
            <dt><label for="f_date">Date</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="date" name="date" id="f_date" value="{form_field name=date}" /></dd>
            <dt><label for="f_libelle">Libellé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle}" /></dd>
            <dt><label for="f_montant">Montant</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="number" size="5" name="montant" id="f_montant" value="{form_field name=montant default=0.00}" min="0.00" /> €</dd>
            <dt><label for="f_compte_debit">Compte débité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                <select name="compte_debit" id="f_compte_debit">
                </select>
            </dd>
            <dt><label for="f_compte_credit">Compte crédité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                <select name="compte_credit" id="f_compte_credit">
                </select>
            </dd>
            <dt><label for="f_numero_piece">Numéro de pièce comptable</label></dt>
            <dd><input type="text" name="numero_piece" id="f_numero_piece" value="{form_field name=numero_piece}" /></dd>
            <dt><label for="f_remarques">Remarques</label></dt>
            <dd><textarea name="remarques" id="f_remarques" rows="4" cols="30">{form_field name=remarques}</textarea></dd>
        </dl>
    </fieldset>







|






|
<



|
<







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

<form method="post" action="{$self_url|escape}">

    <fieldset>
        <legend>Informations sur l'opération</legend>
        <dl>
            <dt><label for="f_date">Date</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="date" name="date" id="f_date" value="{form_field name=date}" size="10" /></dd>
            <dt><label for="f_libelle">Libellé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle}" /></dd>
            <dt><label for="f_montant">Montant</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd><input type="number" size="5" name="montant" id="f_montant" value="{form_field name=montant default=0.00}" min="0.00" /> €</dd>
            <dt><label for="f_compte_debit">Compte débité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                {select_compte comptes=$comptes name="compte_debit"}

            </dd>
            <dt><label for="f_compte_credit">Compte crédité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                {select_compte comptes=$comptes name="compte_credit"}

            </dd>
            <dt><label for="f_numero_piece">Numéro de pièce comptable</label></dt>
            <dd><input type="text" name="numero_piece" id="f_numero_piece" value="{form_field name=numero_piece}" /></dd>
            <dt><label for="f_remarques">Remarques</label></dt>
            <dd><textarea name="remarques" id="f_remarques" rows="4" cols="30">{form_field name=remarques}</textarea></dd>
        </dl>
    </fieldset>

Modified www/admin/compta/saisie.php from [cca4bab2b0] to [82827e3cf8].

44
45
46
47
48
49
50


51
52
53
54
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('error', $error);



$tpl->display('admin/compta/saisie.tpl');

?>







>
>




44
45
46
47
48
49
50
51
52
53
54
55
56
        {
            $error = $e->getMessage();
        }
    }
}

$tpl->assign('error', $error);

$tpl->assign('comptes', $comptes->listTree());

$tpl->display('admin/compta/saisie.tpl');

?>

Modified www/admin/static/admin.css from [55c91ae55e] to [293a511793].

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165




























166
167
168
169
170
171
172
}

fieldset dl dd {
    padding: 0.2em 0.5em 0.2em 1em;
}

input[type=text], textarea, input[type=password], input[type=email],
input[type=url], input[type=tel], input[type=date], select {
    padding: 0.2em 0.4em;
    font-family: Sans-serif;
    min-width: 20em;
}

input[type=number] {
    padding: 0.2em 0.4em;
    font-family: Sans-serif;
    min-width: 8em;
}

input[type=submit], input[type=button] {
    padding: 0.3em;
    cursor: pointer;
}





























p.submit {
    margin: 1em;
}

.submit input[type=submit] {
    font-size: 1.2em;
}







|





|


|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
}

fieldset dl dd {
    padding: 0.2em 0.5em 0.2em 1em;
}

input[type=text], textarea, input[type=password], input[type=email],
input[type=url], input[type=tel], select {
    padding: 0.2em 0.4em;
    font-family: Sans-serif;
    min-width: 20em;
}

input[type=number], input[type=date] {
    padding: 0.2em 0.4em;
    font-family: Sans-serif;
    min-width: 2em;
}

input[type=submit], input[type=button] {
    padding: 0.3em;
    cursor: pointer;
}

select.large {
    width: 95%;
}

select.large optgroup.niveau_1 {
    background: #333;
    color: #fff;
    font-style: normal;
    font-size: 1.2em;
}

select.large optgroup.niveau_2 {
    background: #666;
    color: #fff;
    font-style: normal;
    padding-left: 1em;
}

select.large option {
    background: #fff;
    color: #000;
}

select.large .niveau_3 { padding-left: 1em; font-weight: bold; }
select.large .niveau_4 { padding-left: 2em; }
select.large .niveau_5 { padding-left: 3em; }
select.large .niveau_6 { padding-left: 4em; }

p.submit {
    margin: 1em;
}

.submit input[type=submit] {
    font-size: 1.2em;
}