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

Bug: DiscountAbsolute class does not handle correctly multi currency #10848

Closed
McCoy78 opened this issue Mar 15, 2019 · 1 comment
Closed

Bug: DiscountAbsolute class does not handle correctly multi currency #10848

McCoy78 opened this issue Mar 15, 2019 · 1 comment

Comments

@McCoy78
Copy link

McCoy78 commented Mar 15, 2019

Bug

DiscountAbsolute class does not handle correctly Multi-Currency fields

Environment

  • Version: 7.0.3

Expected and actual behavior

  1. Multicurrency fields are not available as data member of the class
  2. Therefore the create method does not fill the database with umlticurrency values

Steps to reproduce the behavior

With multicurrency enabled:

  • create a deposit invoice
  • transform the deposit invoice as a discount using the dedicated button
    At this step, the record in the table 'xxx_societe_remise_except' has the multicurrency fields set to 0
  • As a concequency: use the discount on a new invoice and the 'Total without VAT' is wrong.

Suggested implementation

As a short-term patch, modify the SQL statement of the DiscountAbsolute::create method as following:
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except";
$sql.= " (entity, datec, fk_soc, fk_user, description,";
$sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,";
$sql.= " fk_facture_source,multicurrency_amount_ht,multicurrency_amount_tva,multicurrency_amount_ttc";
$sql.= ")";
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',";
$sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.",";
$sql.= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'":"null").",'".$this->amount_ht."','".$this->amount_tva."','".$this->amount_ttc."'";
$sql.= ")";

As a long term patch: review the DiscountAbsolute in order to handle correctly multicurrency

@eldy
Copy link
Member

eldy commented Jul 15, 2019

This bug or the feature request seems to be fixed or included into last recent stable version, so I close the issue.

@eldy eldy closed this as completed Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants