Skip to content

Commit 57c19cc

Browse files
MyvTsvRom1-B
andauthored
fix(reference): prevent empty string in ecotax_price by setting a default value (#451)
* fix(reference): prevent empty string in ecotax_price by setting a default value * CHANGELOG.md * Update inc/reference.class.php Co-authored-by: Romain B. <[email protected]> * Update inc/reference.class.php Co-authored-by: Romain B. <[email protected]> --------- Co-authored-by: Romain B. <[email protected]>
1 parent 775c076 commit 57c19cc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
## [Unreleased]
99

1010
- Fix icon for `transfer` action
11+
- Fix reference form error when ecotax_price field is not set
1112

1213
## [2.11.1] - 2025-07-11
1314

inc/reference.class.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ public function prepareInputForAdd($input)
325325
return false;
326326
}
327327

328+
if (empty($input["ecotax_price"])) {
329+
$input["ecotax_price"] = 0;
330+
}
331+
328332
return $input;
329333
}
330334

@@ -740,7 +744,7 @@ public function showForm($id, $options = [])
740744
'type' => 'number',
741745
'step' => PLUGIN_ORDER_NUMBER_STEP,
742746
'min' => 0,
743-
'value' => $this->fields['ecotax_price'],
747+
'value' => Html::formatNumber($this->fields["ecotax_price"], true),
744748
]
745749
);
746750
echo "</td>";

0 commit comments

Comments
 (0)