dolibarr-tasktrack
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-tasktrack] [Task #1060] Register fields localtax(1|2)_type int


From: Doliforge
Subject: [Dolibarr-tasktrack] [Task #1060] Register fields localtax(1|2)_type into details tables
Date: Tue, 10 Sep 2013 11:43:19 +0200

Doliforge
Is this email not displaying correctly?
update email preferences.

Register fields localtax(1|2)_type into details tables

Latest modifications

2013-09-10 11:43 (Europe/Paris)
I think you suggest this because inside the function calcul_total_price, there is a select to get localtaxt type.
But this is wrong. localtax_type should be a parameter of calcul_total_price. So i prefer this:

Before calling to calcul_total_price (for example into method that add a line) you do must call
getLocalTaxesFromRate with "0" as second parameter so you get into an array localtaxes values and types. Then your provide this array as a new parameter of calcul_total_price.
Into calcul_total_price, we keep code that read vat table to be compatible with caller that does not provide this new array, but when array is provided, reading table lx_c_tva into calul_price_total is no more required. (this function should only contains calculation rules and not database access).

The calcul_total_price then does not need to return an array (and should not because it is an input data not an output data), because you already have this array defined before calling calcul_price_total.

Answer now

Snapshot

 Details
Submitted on:  2013-09-10 09:27 Submitted by:  Juanjo Menent (simnandez)
Last Modified On:  2013-09-10 09:28 
Summary:  Register fields localtax(1|2)_type into details tables
Description:  Register fields localtax(1|2)_type into details tables
Priority:  5 - Medium Open to Any Developer:  No
Subproject:  Module Tax Assigned to (multiple):  Juanjo Menent (simnandez),Laurent Destailleur (eldy)
 Status
Start Date:  - End Date:  -
Completion (0-100%):  0 Status:  Open

Comments

Laurent Destailleur 2013-09-10 11:43
I think you suggest this because inside the function calcul_total_price, there is a select to get localtaxt type.
But this is wrong. localtax_type should be a parameter of calcul_total_price. So i prefer this:

Before calling to calcul_total_price (for example into method that add a line) you do must call
getLocalTaxesFromRate with "0" as second parameter so you get into an array localtaxes values and types. Then your provide this array as a new parameter of calcul_total_price.
Into calcul_total_price, we keep code that read vat table to be compatible with caller that does not provide this new array, but when array is provided, reading table lx_c_tva into calul_price_total is no more required. (this function should only contains calculation rules and not database access).

The calcul_total_price then does not need to return an array (and should not because it is an input data not an output data), because you already have this array defined before calling calcul_price_total.

Juanjo Menent 2013-09-10 09:28
I think the best way is return this data into array returned by calcul_price_total


reply via email to

[Prev in Thread] Current Thread [Next in Thread]