mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Fix: Backward compatibility with spain.
This commit is contained in:
@@ -124,7 +124,13 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testCalculPriceTotal()
|
||||
{
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT'
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT'
|
||||
$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0);
|
||||
print __METHOD__." result1=".join(', ',$result1)."\n";
|
||||
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
|
||||
@@ -135,6 +141,14 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__." result2=".join(', ',$result2)."\n";
|
||||
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result2);
|
||||
|
||||
// Old function for spain countries. To check backward compatibility.
|
||||
global $mysoc;
|
||||
$mysoc=new Societe($db);
|
||||
$mysoc->country_code='ES';
|
||||
$result3=calcul_price_total(10, 10, 0, 10, 1.4, 0, 0, 'HT', 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
|
||||
print __METHOD__." result3=".join(', ',$result3)."\n";
|
||||
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0),$result3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user