Skip to content

Commit

Permalink
Fix const INVOICE_USE_RETAINED_WARRANTY (#30533)
Browse files Browse the repository at this point in the history
* Fix const INVOICE_USE_RETAINED_WARRANTY being set as -1 when it should be empty

* fix missing translation

* fix missing translation

* Manage update for INVOICE_USE_RETAINED_WARRANTY

* use native setAsSelect() form function
  • Loading branch information
thomas-Ngr authored Nov 7, 2024
1 parent 434697e commit 9374a31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 1 addition & 7 deletions htdocs/admin/invoice_situation.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,11 @@

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

$arrayAvailableType = array(
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, 1);
} else {
$item->fieldOutputOverride= isset($arrayAvailableType[getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')]) ? $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
3 changes: 3 additions & 0 deletions htdocs/install/mysql/migration/repair.sql
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,6 @@ alter table llx_product_attribute_combination_price_level drop index fk_product_
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_62;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_63;
ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE INDEX uk_prod_att_comb_price_level(fk_product_attribute_combination, fk_price_level);

-- delete a constant that should not be set
DELETE FROM llx_const WHERE name = 'INVOICE_USE_RETAINED_WARRANTY' AND value = -1;

0 comments on commit 9374a31

Please sign in to comment.