Skip to content

Commit

Permalink
Manage update for INVOICE_USE_RETAINED_WARRANTY
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-Ngr committed Oct 11, 2024
1 parent 4c8ce23 commit 1e47266
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
21 changes: 16 additions & 5 deletions htdocs/admin/invoice_situation.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,26 @@
$item->nameText = $langs->trans('AllowedInvoiceForRetainedWarranty');

$arrayAvailableType = array(
0 => "", // don't use $showempty in selectArray since it sets a value of -1
Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"),
Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"),
);

if ($action == 'edit') {
$item->fieldInputOverride = $form->selectarray('INVOICE_USE_RETAINED_WARRANTY', $arrayAvailableType, $conf->global->INVOICE_USE_RETAINED_WARRANTY, 0);
} else {
$item->fieldOutputOverride= isset($arrayAvailableType[getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')]) ? $arrayAvailableType[getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')] : '';
switch ($action) {
case 'edit':
$item->fieldInputOverride = $form->selectarray('INVOICE_USE_RETAINED_WARRANTY', $arrayAvailableType, $conf->global->INVOICE_USE_RETAINED_WARRANTY, 1);
break;
case 'update':
$ret_warranty_val = GETPOST('INVOICE_USE_RETAINED_WARRANTY');
if ($ret_warranty_val == -1) {
$conf->global->INVOICE_USE_RETAINED_WARRANTY = '';
$_POST['INVOICE_USE_RETAINED_WARRANTY'] = '';
} else {
$conf->global->INVOICE_USE_RETAINED_WARRANTY = $ret_warranty_val;
}
$item->fieldOutputOverride = $arrayAvailableType[$ret_warranty_val] ?? '';
break;
default:
$item->fieldOutputOverride = $arrayAvailableType[getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')] ?? '';
}

//$item = $formSetup->newItem('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION')->setAsYesNo();
Expand Down
3 changes: 1 addition & 2 deletions htdocs/langs/en_US/stocks.lang
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,4 @@ ExternalWarehouse=External warehouse
LatestModifiedWarehouses=Latest %s modified warehouses
LatestStockMovements=Latest %s stock movements
QtyCurrentlyKnownInStock=System estimated quantity you have in stock. As long as the inventory is not closed, this is a realtime value and it may change if you continue to make stock movement during the inventory (not recommended).
QtyInStockWhenInventoryWasValidated=System estimated quantity you had in stock when the inventory was validated (before the stock correction)
StockTransferProFormat=Proforma stocks transfer
QtyInStockWhenInventoryWasValidated=System estimated quantity you had in stock when the inventory was validated (before the stock correction)

0 comments on commit 1e47266

Please sign in to comment.