Overview
SHA1:21645d32faf4cfb20382ea68aea042fd188bc7bb
Date: 2017-10-12 10:40:11
User: bohwaz
Comment:Projets: corrige sélecteur de projet dans la saisie d'opération
Timelines: family | ancestors | descendants | both | dev
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2017-10-12
10:58
[cda68df623] Ajout modif projet à la modif d'écriture (user: bohwaz, tags: dev)
10:40
[21645d32fa] Projets: corrige sélecteur de projet dans la saisie d'opération (user: bohwaz, tags: dev)
10:32
[2ccae440ce] Corrections pour mise à jour depuis vieilles versions (user: bohwaz, tags: dev)
Changes

Modified src/include/lib/Garradin/Template.php from [da9abe523b] to [855aa2d829].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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
			{
				return 'continue;';
			}
		});

		$this->register_function('form_errors', [$this, 'formErrors']);
		$this->register_function('show_error', [$this, 'showError']);
		$this->register_function('form_select', [$this, 'formSelect']);
		$this->register_function('form_field', [$this, 'formField']);
		$this->register_function('select_compte', [$this, 'formSelectCompte']);
		$this->register_function('html_champ_membre', [$this, 'formChampMembre']);

		$this->register_function('custom_colors', [$this, 'customColors']);
		$this->register_function('plugin_url', ['Garradin\Utils', 'plugin_url']);
		$this->register_function('diff', [$this, 'diff']);
................................................................................
		{
			return '';
		}

		return '<p class="error">' . $this->escape($params['message']) . '</p>';
	}

	protected function formSelect(array $params)
	{
		if (empty($params['name']))
		{
			throw new \BadFunctionCallException("Paramètre name manquant pour select");
		}

		$name = $params['name'];
		$value = '';

		if (f($name) !== null)
		{
			$value = f($name);
		}
		elseif (isset($params['data']) && is_array($params['data']) && isset($params['data'][$name]))
		{
			$value = $params['data'][$name];
		}
		elseif (isset($params['data']) && is_object($params['data']) && isset($params['data']->$name))
		{
			$value = $params['data']->$name;
		}
		elseif (isset($params['default']))
		{
			$value = $params['default'];
		}

		$out = sprintf('<select name="%s" id="f_%1$s">', $params['name']);

		if (!empty($params['values']))
		{
			foreach ($params['values'] as $v)
			{
				$out .= '<option value="'.htmlspecialchars($v, ENT_QUOTES, 'UTF-8').'"';

				if ($v == $value)
					$out .= ' selected="selected"';

				$out .= '>'.htmlspecialchars($v, ENT_QUOTES, 'UTF-8').'</option>';
			}
		}

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

	protected function formField(array $params)
	{
		if (!isset($params['name']))
		{
			throw new \BadFunctionCallException('name argument is mandatory');
		}








<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







35
36
37
38
39
40
41

42
43
44
45
46
47
48
...
121
122
123
124
125
126
127














































128
129
130
131
132
133
134
			{
				return 'continue;';
			}
		});

		$this->register_function('form_errors', [$this, 'formErrors']);
		$this->register_function('show_error', [$this, 'showError']);

		$this->register_function('form_field', [$this, 'formField']);
		$this->register_function('select_compte', [$this, 'formSelectCompte']);
		$this->register_function('html_champ_membre', [$this, 'formChampMembre']);

		$this->register_function('custom_colors', [$this, 'customColors']);
		$this->register_function('plugin_url', ['Garradin\Utils', 'plugin_url']);
		$this->register_function('diff', [$this, 'diff']);
................................................................................
		{
			return '';
		}

		return '<p class="error">' . $this->escape($params['message']) . '</p>';
	}















































	protected function formField(array $params)
	{
		if (!isset($params['name']))
		{
			throw new \BadFunctionCallException('name argument is mandatory');
		}

Modified src/templates/admin/compta/operations/saisir.tpl from [42b0215ddd] to [64bc7f11d5].

27
28
29
30
31
32
33
34
35

36






37
38
39
40
41
42
43
            <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle}" required="required" /></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" step="0.01" required="required" /> {$config.monnaie}</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>
            {if count($projets) > 1}
            <dt><label for="f_projet">Projet</label></dt>

            <dd>{form_select name="projet" values=$projets}</dd>






            {/if}
        </dl>
        <dl class="type_recette type_depense">
            <dt><label for="f_moyen_paiement">Moyen de paiement</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                <select name="moyen_paiement" id="f_moyen_paiement" required="required">
                {foreach from=$moyens_paiement item="moyen"}







|

>
|
>
>
>
>
>
>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
            <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle}" required="required" /></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" step="0.01" required="required" /> {$config.monnaie}</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>
            {if count($projets) > 0}
            <dt><label for="f_projet">Projet</label></dt>
            <dd>
                <select name="projet" id="f_projet">
                    <option value="0">-- Aucun</option>
                    {foreach from=$projets key="id" item="libelle"}
                    <option name="{$id}"{form_field name="projet" selected=$id}>{$libelle}</option>
                    {/foreach}
                </select>
            </dd>
            {/if}
        </dl>
        <dl class="type_recette type_depense">
            <dt><label for="f_moyen_paiement">Moyen de paiement</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
            <dd>
                <select name="moyen_paiement" id="f_moyen_paiement" required="required">
                {foreach from=$moyens_paiement item="moyen"}

Modified src/www/admin/compta/operations/saisir.php from [84e11944f3] to [723edaa903].

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
$tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES');
$tpl->assign('categories_depenses', $cats->getList(Compta\Categories::DEPENSES));
$tpl->assign('categories_recettes', $cats->getList(Compta\Categories::RECETTES));
$tpl->assign('comptes_bancaires', $banques->getList());
$tpl->assign('banque', f('banque'));
$tpl->assign('compte_cheque_e_encaisser', Compta\Comptes::CHEQUE_A_ENCAISSER);
$tpl->assign('compte_carte_e_encaisser', Compta\Comptes::CARTE_A_ENCAISSER);
$tpl->assign('projets', [0 => '-- Aucun'] + (new Compta\Projets)->getAssocList());

if (!$session->get('context_compta_date'))
{
    $exercices = new Compta\Exercices;
    $exercice = $exercices->getCurrent();

    if ($exercice->debut > time() || $exercice->fin < time())







|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
$tpl->assign('moyen_paiement', f('moyen_paiement') ?: 'ES');
$tpl->assign('categories_depenses', $cats->getList(Compta\Categories::DEPENSES));
$tpl->assign('categories_recettes', $cats->getList(Compta\Categories::RECETTES));
$tpl->assign('comptes_bancaires', $banques->getList());
$tpl->assign('banque', f('banque'));
$tpl->assign('compte_cheque_e_encaisser', Compta\Comptes::CHEQUE_A_ENCAISSER);
$tpl->assign('compte_carte_e_encaisser', Compta\Comptes::CARTE_A_ENCAISSER);
$tpl->assign('projets', (new Compta\Projets)->getAssocList());

if (!$session->get('context_compta_date'))
{
    $exercices = new Compta\Exercices;
    $exercice = $exercices->getCurrent();

    if ($exercice->debut > time() || $exercice->fin < time())