Skip to content

Commit

Permalink
FIX : Default values feature is broken on units field on product crea…
Browse files Browse the repository at this point in the history
…te (#31873)

* FIX : Default values feature is broken on units field on product create

* FIX: use getDolGlobalString, removed useless ternary
  • Loading branch information
jyhere authored Nov 16, 2024
1 parent aff3a20 commit 15d8257
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions htdocs/product/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"');
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT')), 0, 2);
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (GETPOST('weight_units', 'alpha') ?: getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 0)), 0, 2);
print '</td></tr>';
}

Expand All @@ -1662,29 +1662,29 @@
print '<input name="size" class="width50" value="'.GETPOST('size').'"> x ';
print '<input name="sizewidth" class="width50" value="'.GETPOST('sizewidth').'"> x ';
print '<input name="sizeheight" class="width50" value="'.GETPOST('sizeheight').'">';
print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : '0', 0, 2);
print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : (GETPOST('size_units', 'alpha') ?: '0'), 0, 2);
print '</td></tr>';
}
if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) {
// Brut Surface
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
print '<input name="surface" size="4" value="'.GETPOST('surface').'">';
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : '0', 0, 2);
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : (GETPOST('surface_units', 'alpha') ?: '0'), 0, 2);
print '</td></tr>';
}
if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) {
// Brut Volume
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : '0', 0, 2);
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : (GETPOST('volume_units', 'alpha') ?: '0'), 0, 2);
print '</td></tr>';
}

if (getDolGlobalString('PRODUCT_ADD_NET_MEASURE')) {
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td>';
print '<input name="net_measure" size="4" value="'.GETPOST('net_measure').'">';
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT')), 0, 0);
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (GETPOST('net_measure_units', 'alpha') ?: getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 0)), 0, 0);
print '</td></tr>';
}
}
Expand Down

0 comments on commit 15d8257

Please sign in to comment.