New: Monaco is like France for default vat calculation
Qual: More phpunit tests
This commit is contained in:
parent
96a90e2e7a
commit
5499c91712
@ -7,8 +7,12 @@ English Dolibarr ChangeLog
|
|||||||
For users:
|
For users:
|
||||||
- New: Add supplier ref on supplier orders.
|
- New: Add supplier ref on supplier orders.
|
||||||
- New: Can export supplier orders.
|
- New: Can export supplier orders.
|
||||||
|
- New: First feature to install external plugins from gui.
|
||||||
|
- New: Monaco is like France for default vat calculation
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
|
- A module can overwrite templates parts.
|
||||||
|
- Can add a link on title field of added dictionnary.
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.2 compared to 3.1 *****
|
***** ChangeLog for 3.2 compared to 3.1 *****
|
||||||
|
|||||||
@ -2833,7 +2833,8 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
|||||||
// Le test ci-dessus ne devrait pas etre necessaire. Me signaler l'exemple du cas juridique concerne si le test suivant n'est pas suffisant.
|
// Le test ci-dessus ne devrait pas etre necessaire. Me signaler l'exemple du cas juridique concerne si le test suivant n'est pas suffisant.
|
||||||
|
|
||||||
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
||||||
if ($societe_vendeuse->country_code == $societe_acheteuse->country_code) // Warning ->country_code not always defined
|
if (($societe_vendeuse->country_code == $societe_acheteuse->country_code)
|
||||||
|
|| (in_array($societe_vendeuse->country_code,array('FR,MC')) && in_array($societe_acheteuse->country_code,array('FR','MC')))) // Warning ->country_code not always defined
|
||||||
{
|
{
|
||||||
//print 'VATRULE 3';
|
//print 'VATRULE 3';
|
||||||
return get_product_vat_for_country($idprod,$societe_vendeuse->country_code);
|
return get_product_vat_for_country($idprod,$societe_vendeuse->country_code);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -394,5 +394,74 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
|
|||||||
//var_dump($decoded);
|
//var_dump($decoded);
|
||||||
$this->assertEquals($arraytotest,$decoded);
|
$this->assertEquals($arraytotest,$decoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testGetDefaultTva
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetDefaultTva()
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs,$db;
|
||||||
|
$this->savconf=$conf;
|
||||||
|
$this->savuser=$user;
|
||||||
|
$this->savlangs=$langs;
|
||||||
|
$this->savdb=$db;
|
||||||
|
|
||||||
|
$companyfrnovat=new Societe($db);
|
||||||
|
$companyfrnovat->country_code='FR';
|
||||||
|
$companyfrnovat->tva_assuj=0;
|
||||||
|
|
||||||
|
$companyfr=new Societe($db);
|
||||||
|
$companyfr->country_code='FR';
|
||||||
|
$companyfr->tva_assuj=1;
|
||||||
|
|
||||||
|
$companymo=new Societe($db);
|
||||||
|
$companymo->country_code='MC';
|
||||||
|
$companymo->tva_assuj=1;
|
||||||
|
|
||||||
|
$companyit=new Societe($db);
|
||||||
|
$companyit->country_code='IT';
|
||||||
|
$companyit->tva_assuj=1;
|
||||||
|
$companyit->tva_intra='IT99999';
|
||||||
|
|
||||||
|
$notcompanyit=new Societe($db);
|
||||||
|
$notcompanyit->country_code='IT';
|
||||||
|
$notcompanyit->tva_assuj=1;
|
||||||
|
$notcompanyit->tva_intra='';
|
||||||
|
$notcompanyit->typent_code='TE_PRIVATE';
|
||||||
|
|
||||||
|
$companyus=new Societe($db);
|
||||||
|
$companyus->country_code='US';
|
||||||
|
$companyus->tva_assuj=1;
|
||||||
|
$companyus->tva_intra='';
|
||||||
|
|
||||||
|
// Test RULE 1-2
|
||||||
|
$vat=get_default_tva($companyfrnovat,$companymo,0);
|
||||||
|
$this->assertEquals(0,$vat);
|
||||||
|
|
||||||
|
// Test RULE 3 (FR-FR)
|
||||||
|
$vat=get_default_tva($companyfr,$companyfr,0);
|
||||||
|
$this->assertEquals(19.6,$vat);
|
||||||
|
|
||||||
|
// Test RULE 3 (FR-MC)
|
||||||
|
$vat=get_default_tva($companyfr,$companymo,0);
|
||||||
|
$this->assertEquals(19.6,$vat);
|
||||||
|
|
||||||
|
// Test RULE 4 (FR-IT)
|
||||||
|
$vat=get_default_tva($companyfr,$companyit,0);
|
||||||
|
$this->assertEquals(0,$vat);
|
||||||
|
|
||||||
|
// Test RULE 5 (FR-IT)
|
||||||
|
$vat=get_default_tva($companyfr,$notcompanyit,0);
|
||||||
|
$this->assertEquals(19.6,$vat);
|
||||||
|
|
||||||
|
// Test RULE 6 (FR-IT)
|
||||||
|
// Not tested
|
||||||
|
|
||||||
|
// Test RULE 7 (FR-US)
|
||||||
|
$vat=get_default_tva($companyfr,$companyus,0);
|
||||||
|
$this->assertEquals(0,$vat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user