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

Bugfix for #32206 and #32207 #32209

Open
wants to merge 2 commits into
base: 20.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,13 @@
$facligne->multicurrency_total_tva = -$remise->multicurrency_amount_tva;
$facligne->multicurrency_total_ttc = -$remise->multicurrency_amount_ttc;

//Bugfix#32206 - Incorrect Discounts or Credit is applied in a multicurrency Invoice

Check failure on line 2641 in htdocs/compta/facture/class/facture.class.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Whitespace found at end of line
if ($this->multicurrency_tx > 0) {
Copy link
Member

@eldy eldy Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When multicurrency_tx is set, all other fields multicurrency should already contains a value include the rate. So bug shoul be at a higher place.
May be they are not saved correctly into the remise table ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, I have created a pull request for this.
#32872

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we have to migrate the previous data as well.

$facligne->multicurrency_subprice = round(-$remise->multicurrency_subprice * $this->multicurrency_tx,2);

Check failure on line 2643 in htdocs/compta/facture/class/facture.class.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

No space found after comma in argument list
$facligne->multicurrency_total_ht = round(-$remise->multicurrency_amount_ht * $this->multicurrency_tx,2);

Check failure on line 2644 in htdocs/compta/facture/class/facture.class.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

No space found after comma in argument list
$facligne->multicurrency_total_tva = round(-$remise->multicurrency_amount_tva * $this->multicurrency_tx,2);

Check failure on line 2645 in htdocs/compta/facture/class/facture.class.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

No space found after comma in argument list
$facligne->multicurrency_total_ttc = round(-$remise->multicurrency_amount_ttc * $this->multicurrency_tx,2);

Check failure on line 2646 in htdocs/compta/facture/class/facture.class.php

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

No space found after comma in argument list
}
$lineid = $facligne->insert();
if ($lineid > 0) {
$result = $this->update_price(1);
Expand Down
5 changes: 3 additions & 2 deletions htdocs/core/tpl/objectline_create.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,9 @@ function(data) {
var multicurrency_code = $('option:selected', this).attr('data-multicurrency-code'); // When select is done from HTML select
if (multicurrency_code == undefined) { multicurrency_code = jQuery('#idprodfournprice').attr('data-multicurrency-code'); } // When select is done from HTML input with ajax autocomplete

var multicurrency_up = parseFloat($('option:selected', this).attr('data-multicurrency-unitprice')); // When select is done from HTML select
if (isNaN(multicurrency_up)) { multicurrency_up = parseFloat(jQuery('#idprodfournprice').attr('data-multicurrency-unitprice')); } // When select is done from HTML input with ajax autocomplete
//Bugfix #32207 - In Multi currency Supplier Order Multi currency buying price is coming as NaN
var multicurrency_up = parseFloat($('option:selected', this).attr('data-multicurrency-up')); // When select is done from HTML select
if (isNaN(multicurrency_up)) { multicurrency_up = parseFloat(jQuery('#idprodfournprice').attr('data-multicurrency-up')); } // When select is done from HTML input with ajax autocomplete

if (multicurrency_code == object_multicurrency_code) {
has_multicurrency_up = true;
Expand Down
Loading