fix card when action=create (#39336)

some default values are not set
This commit is contained in:
Sylvain Legrand 2026-07-30 18:37:46 +03:00 committed by GitHub
parent c7d2a661bf
commit 19c5b8f825
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -2307,6 +2307,9 @@ if ($action == 'create') {
if (GETPOSTISSET('fk_account')) {
$fk_account = GETPOSTINT('fk_account');
}
if (GETPOSTISSET('shipping_method_id')) {
$shipping_method_id = GETPOSTINT('shipping_method_id');
}
}
// Warehouse default if null
if ($soc->fk_warehouse > 0) {
@ -2448,7 +2451,7 @@ if ($action == 'create') {
}
print '<tr class="field_shipping_method_id"><td class="titlefieldcreate">'.$langs->trans('SendingMethod').'</td><td class="valuefieldcreate">';
print img_picto('', 'dolly', 'class="pictofixedwidth"');
$form->selectShippingMethod((string) (GETPOSTISSET('shipping_method_id') ? GETPOSTINT('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
$form->selectShippingMethod((string) $shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
}

View file

@ -2245,7 +2245,7 @@ if ($action == 'create' && $usercancreate) {
$mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id;
$fk_account = empty($soc->mode_reglement_id) ? $fk_account : $soc->fk_account;
$availability_id = 0;
$shipping_method_id = $soc->shipping_method_id;
$shipping_method_id = empty($soc->shipping_method_id) ? $shipping_method_id : $soc->shipping_method_id;
$warehouse_id = $soc->fk_warehouse;
$demand_reason_id = $soc->demand_reason_id;
//$remise_percent = $soc->remise_percent;
@ -2423,7 +2423,7 @@ if ($action == 'create' && $usercancreate) {
if (isModEnabled('shipping')) {
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
$form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOSTINT('shipping_method_id') != 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
$form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOSTINT('shipping_method_id') > 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); // -1 is the "no value" placeholder for this select, not 0, so it must not override the fresh thirdparty default after a company change
print '</td></tr>';
}