Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retained warranty value not propagated on next situation invoice when equal to 0 #29411

Open
didi31 opened this issue Apr 19, 2024 · 0 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@didi31
Copy link

didi31 commented Apr 19, 2024

Bug

When retained warranty is 0 on the first situation invoice, the next is equal to the default value set into $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT.
The controls inside the code use "empty" function whilst it should use " != '' test.

File compta/facture/card.php starting at line 3868

Old code
if (empty($retained_warranty)) {
if (!empty($objectsrc->retained_warranty)) { // use previous situation value
$retained_warranty = $objectsrc->retained_warranty;
}
}
$retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;

New code

		if ($retained_warranty == '') {
			if ($objectsrc->retained_warranty != '') { // use previous situation value
				$retained_warranty = $objectsrc->retained_warranty;
			}
		}
		$retained_warranty_js_default = $retained_warranty != '' ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;

Dolibarr Version

18.0, 19.0

Environment PHP

No response

Environment Database

No response

Steps to reproduce the behavior and expected behavior

Use Situation invoice and retained warranty, with a default value to 5%, options
Create the first situation invoice with a retained warranty set to 0
Create the second situation invoice

Attached files

No response

@didi31 didi31 added the Bug This is a bug (something does not work as expected) label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant