Utiliser des entiers au lieu de float tel Garradin
This commit is contained in:
parent
11974482f2
commit
ede7c789d7
13 changed files with 189 additions and 139 deletions
|
|
@ -17,3 +17,38 @@ $facture = new Facture;
|
|||
$tpl->assign('f_obj', $facture);
|
||||
|
||||
$identite = (string) Config::getInstance()->get('champ_identite');
|
||||
|
||||
$tpl->register_function('money_fac', function (array $params)
|
||||
{
|
||||
static $params_list = ['value', 'name', 'user'];
|
||||
|
||||
// Extract params and keep attributes separated
|
||||
$attributes = array_diff_key($params, array_flip($params_list));
|
||||
$params = array_intersect_key($params, array_flip($params_list));
|
||||
extract($params, \EXTR_SKIP);
|
||||
|
||||
$current_value = null;
|
||||
|
||||
if (isset($value)) {
|
||||
$current_value = $value;
|
||||
}
|
||||
|
||||
if (!isset($user)) {
|
||||
$user = false;
|
||||
}
|
||||
|
||||
if (!isset($name))
|
||||
{
|
||||
$name = 'prix[]';
|
||||
}
|
||||
|
||||
if (null !== $current_value && !$user) {
|
||||
$current_value = Utils::money_format($current_value, ',', '');
|
||||
}
|
||||
|
||||
$current_value = htmlspecialchars($current_value, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$currency = Config::getInstance()->get('monnaie');
|
||||
return sprintf('<td><nobr><input type="text" pattern="[0-9]*([.,][0-9]{1,2})?" inputmode="decimal" size="8" class="money" style="width: 60%%" onchange="updateSum();" name="%s" value="%s" /><b>%s</b></nobr></td>', $name, $current_value, $currency);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue