TVA par défaut à 10 %, corrige le Montant TTC illisible

- TVA par défaut passe de 0 % à 10 % (taux intermédiaire) pour une
  nouvelle ligne -- la plupart des lignes saisies portent effectivement
  de la TVA.
- Montant TTC (désactivé) était illisible : Chromium affiche le texte
  d'un champ disabled via -webkit-text-fill-color plutôt que color,
  qui restait sur son gris par défaut du navigateur -- quasi invisible
  sur le fond gris de --flform-bg-subtle en mode sombre. Fixé
  explicitement sur les deux thèmes.
This commit is contained in:
2026-09-07 12:01:33 +02:00
parent 5aa00b2ffd
commit f0927bac88
4 changed files with 18 additions and 8 deletions
@@ -15,7 +15,7 @@ required: false
translatable: true
default_value:
-
value: 0.0
value: 10.0
default_value_callback: ''
settings:
min: null
@@ -148,10 +148,16 @@ html.gin--dark-mode .figli-ledger-form {
figli_compta_ledger_node_presave()) -- a faint fill and full opacity
(overriding the browser's default half-transparent disabled look,
which would make the computed number harder to read) instead of the
plain white/transparent of an editable field. */
plain white/transparent of an editable field. -webkit-text-fill-color
specifically: Chromium renders disabled/autofilled input text through
this property instead of `color` -- left alone, it defaults to a
fixed grey that's illegible against either theme's --flform-bg-subtle
(near-invisible dark-grey-on-dark-grey in dark mode, the actual bug
reported; same risk in light mode against a light fill). */
.figli-ledger-form input:disabled.form-element {
background: var(--flform-bg-subtle);
color: var(--flform-text);
-webkit-text-fill-color: var(--flform-text);
opacity: 1;
cursor: default;
}
@@ -388,13 +388,13 @@ function figli_compta_ledger_update_8003() {
function figli_compta_ledger_update_8004() {
_figli_field('node', 'ligne_comptable', 'field_tva', 'TVA (%)', 'decimal', ['precision' => 8, 'scale' => 4, 'min' => 0]);
// New lines default to 0% rather than blank -- the common case (every
// type other than charge/entrée/achat/hébergement with a real invoice)
// has no VAT at all, so this is one less field associates need to
// touch for most lines.
// New lines default to 10% (taux intermédiaire) rather than blank --
// most new lines associates enter do carry VAT, so this saves a click
// on the common case instead of silently defaulting to "no VAT" for
// every line unless someone remembers to change it.
$field_tva = FieldConfig::loadByName('node', 'ligne_comptable', 'field_tva');
if ($field_tva && $field_tva->getDefaultValueLiteral() === []) {
$field_tva->setDefaultValue(0)->save();
$field_tva->setDefaultValue(10)->save();
}
// Weights are plain integers -- entity_display component config
@@ -141,7 +141,11 @@ function figli_compta_ledger_form_alter(&$form, FormStateInterface $form_state,
$current = $tva_field['#default_value'] ?? NULL;
$rate_default = 'autre';
if ($current === NULL || $current === '') {
$rate_default = '0';
// 10 % (taux intermédiaire), not 0 -- most new lines associates
// enter do carry VAT, so this saves a click on the common case
// instead of silently defaulting to "no VAT" for every line
// unless someone remembers to change it.
$rate_default = '10';
}
else {
foreach (array_keys($taux_officiels) as $rate) {