Skip to content

Commit

Permalink
use native setAsSelect() form function
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-Ngr committed Oct 11, 2024
1 parent 3159eb8 commit 19f7f28
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions htdocs/admin/invoice_situation.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,12 @@

$item = $formSetup->newItem('INVOICE_USE_RETAINED_WARRANTY');
$item->nameText = $langs->trans('AllowedInvoiceForRetainedWarranty');

$arrayAvailableType = array(
0 => '',
Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation"),
Facture::TYPE_STANDARD.'+'.Facture::TYPE_SITUATION => $langs->trans("InvoiceSituation").' + '.$langs->trans("InvoiceStandard"),
);

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->setAsSelect($arrayAvailableType);

//$item = $formSetup->newItem('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION')->setAsYesNo();
//$item->nameText = $langs->trans('RetainedWarrantyOnlyForSituation');
Expand Down

0 comments on commit 19f7f28

Please sign in to comment.