Fix: Running fixdosfile onto all project

This commit is contained in:
Laurent Destailleur 2013-07-07 13:17:48 +02:00
parent 2bc650bf61
commit 7c163f7be3
14 changed files with 238 additions and 238 deletions

View File

@ -47,14 +47,14 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
$conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$conf->global->MAIN_MOTD_SETUPPAGE);
if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
{
$i=0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD_SETUPPAGE,$reg) && $i < 100)
{
$tmp=explode('|',$reg[1]);
$i=0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD_SETUPPAGE,$reg) && $i < 100)
{
$tmp=explode('|',$reg[1]);
if (! empty($tmp[1])) $langs->load($tmp[1]);
$conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD_SETUPPAGE);
$i++;
}
$conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD_SETUPPAGE);
$i++;
}
print "\n<!-- Start of welcome text for setup page -->\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td>';

View File

@ -75,7 +75,7 @@ if (GETPOST('action','alpha')=='install')
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
if ($result > 0)
{
$documentrootalt=DOL_DOCUMENT_ROOT.'/extensions';
$documentrootalt=DOL_DOCUMENT_ROOT.'/extensions';
$result=dol_uncompress($newfile,$documentrootalt);
if (! empty($result['error']))
{

View File

@ -2475,18 +2475,18 @@ class Propal extends CommonObject
$file = $conf->global->PROPALE_ADDON.".php";
$classname = $conf->global->PROPALE_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/propale/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/propale/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
}
$obj = new $classname();

View File

@ -136,18 +136,18 @@ class Commande extends CommonOrder
$file = $conf->global->COMMANDE_ADDON.".php";
$classname = $conf->global->COMMANDE_ADDON;
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/commande/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
// Include file with class
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/commande/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
}
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
if (! $mybool)
{
dol_print_error('',"Failed to include file ".$file);
return '';
}
$obj = new $classname();

View File

@ -1511,8 +1511,8 @@ abstract class CommonObject
$this->total_localtax2 = 0;
$this->total_ttc = 0;
$total_ht_by_vats = array();
$total_tva_by_vats = array();
$total_ttc_by_vats = array();
$total_tva_by_vats = array();
$total_ttc_by_vats = array();
$num = $this->db->num_rows($resql);
$i = 0;
@ -1543,9 +1543,9 @@ abstract class CommonObject
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db,'Failed to update line');
$this->total_tva -= $diff;
$this->total_ttc -= $diff;
$total_tva_by_vats[$obj->vatrate] -= $diff;
$total_ttc_by_vats[$obj->vatrate] -= $diff;
$this->total_ttc -= $diff;
$total_tva_by_vats[$obj->vatrate] -= $diff;
$total_ttc_by_vats[$obj->vatrate] -= $diff;
}
}

View File

@ -259,15 +259,15 @@ function dol_buildpath($path, $type=0)
if (empty($type)) // For a filesystem path
{
$res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard value
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{
if ($key == 'main') continue;
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
break;
}
}
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
break;
}
}
}
else // For an url path
{
@ -278,20 +278,20 @@ function dol_buildpath($path, $type=0)
$res='';
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{
if ($key == 'main') continue;
if ($key == 'main') continue;
preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?'
if (! empty($regs[1]))
{
//print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n";
if (file_exists($dirroot.'/'.$path))
{
if (file_exists($dirroot.'/'.$path))
{
if ($type == 1) $res=DOL_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path;
if ($type == 2) $res=DOL_MAIN_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path;
break;
if ($type == 2) $res=DOL_MAIN_URL_ROOT.$conf->file->dol_url_root[$key].'/'.$path;
break;
}
}
}
}
}
@ -1718,15 +1718,15 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false, $srcon
// Clean parameters
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
// If alt path are defined, define url where img file is, according to physical path
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir/htdocs", ...)
foreach ($conf->file->dol_document_root as $type => $dirroot) // ex: array(["main"]=>"/home/maindir/htdocs", ["alt0"]=>"/home/moddir/htdocs", ...)
{
if ($type == 'main') continue;
if (file_exists($dirroot.'/'.$path.'/img/'.$picto))
{
$url=$conf->file->dol_url_root[$type];
break;
}
}
if ($type == 'main') continue;
if (file_exists($dirroot.'/'.$path.'/img/'.$picto))
{
$url=$conf->file->dol_url_root[$type];
break;
}
}
// $url is '' or '/custom', $path is current theme or
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;

View File

@ -63,8 +63,8 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
$url = $shorturl = $newTabMenu[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
{
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0];
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&amp;leftmenu=';

View File

@ -289,8 +289,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
$url = $shorturl = $newTabMenu[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
{
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0];
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&amp;leftmenu=';
@ -1300,8 +1300,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
// For external modules
$tmp=explode('?',$menu_array[$i]['url'],2);
$url = $tmp[0];
$tmp=explode('?',$menu_array[$i]['url'],2);
$url = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');
$url = dol_buildpath($url,1).($param?'?'.$param:'');

View File

@ -47,8 +47,8 @@ if (!empty($conf->projet->enabled)) {
$langs->load('bills');
$langs->load('suppliers');
$langs->load('companies');
$langs->load('products');
$langs->load('companies');
$langs->load('products');
$mesg='';
$errors=array();

View File

@ -61,14 +61,14 @@ if (! empty($conf->global->MAIN_MOTD))
$conf->global->MAIN_MOTD=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$conf->global->MAIN_MOTD);
if (! empty($conf->global->MAIN_MOTD))
{
$i=0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD,$reg) && $i < 100)
{
$tmp=explode('|',$reg[1]);
if (! empty($tmp[1])) $langs->load($tmp[1]);
$conf->global->MAIN_MOTD=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD);
$i++;
}
$i=0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i',$conf->global->MAIN_MOTD,$reg) && $i < 100)
{
$tmp=explode('|',$reg[1]);
if (! empty($tmp[1])) $langs->load($tmp[1]);
$conf->global->MAIN_MOTD=preg_replace('/__\('.preg_quote($reg[1]).'\)__/i',$langs->trans($tmp[0]),$conf->global->MAIN_MOTD);
$i++;
}
print "\n<!-- Start of welcome text -->\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td>';

View File

@ -359,7 +359,7 @@ if (! $error && $db->connected && $action == "set")
$dir[5] = $main_data_dir."/ficheinter";
$dir[6] = $main_data_dir."/produit";
$dir[7] = $main_data_dir."/doctemplates";
$dir[7] = $main_data_dir."/extensions";
$dir[7] = $main_data_dir."/extensions";
// Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas
$num=count($dir);

View File

@ -1,38 +1,38 @@
# Dolibarr language file - ca_ES - paybox
CHARSET=UTF-8
PayBoxSetup=Configuració mòdul PayBox
PayBoxDesc=Aquest mòdul ofereix una pàgina de pagament a través del proveïdor <a href="http://www.paybox.com" target="_blank">Paybox</a> per realitzar qualsevol pagament o un pagament en relació amb un objecte Dolibarr (factures, comandes ...)
PaymentForm=Formulari de pagament
FollowingUrlAreAvailableToMakePayments=Les següents URL estan disponibles per a permetre a un client fer un pagament
WelcomeOnPaymentPage=Benvingut als nostres serveis de pagament en línia
ThisScreenAllowsYouToPay=Aquesta pantalla li permet fer el seu pagament en línia destinat a %s.
ThisIsInformationOnPayment=Aquí està la informació sobre el pagament a realitzar
ToComplete=A completar
YourEMail=E-mail de confirmació de pagament
Creditor=Beneficiari
PaymentCode=Codi de pagament
PayBoxDoPayment=Continua el pagament amb targeta
YouWillBeRedirectedOnPayBox=Serà redirigit a la pàgina segura de PayBox per indicar la seva targeta de crèdit
PleaseBePatient=Espereu uns segons
Continue=Continuar
ToOfferALinkForOnlinePayment=URL de pagament %s
ToOfferALinkForOnlinePaymentOnOrder=URL que ofereix una interfície de pagament en línia %s basada en l'import d'una comanda de client
ToOfferALinkForOnlinePaymentOnInvoice=URL que ofereix una interfície de pagament en línia %s basada en l'import d'una factura a client
ToOfferALinkForOnlinePaymentOnContractLine=URL que ofereix una interfície de pagament en línia %s basada en l'import d'una línia de contracte
ToOfferALinkForOnlinePaymentOnFreeAmount=URL que ofereix una interfície de pagament en línia %s basada en un impport llíure
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL que ofereix una interfície de pagament en línia %s basada en la cotització d'un membre
YouCanAddTagOnUrl=També pot afegir el paràmetre url <b>&tag=<i>value</i></b> per a qualsevol d'aquestes adreces (obligatori només per al pagament lliure) per veure el seu propi codi de comentari de pagament.
SetupPayBoxToHavePaymentCreatedAutomatically=Configureu la vostra url Paybox <b>%s</b> per tal que el pagament es creu automàticament al validar.
YourPaymentHasBeenRecorded=Aquesta pàgina confirma que el pagament s'ha registrat correctament. Gràcies.
YourPaymentHasNotBeenRecorded=El seu pagament no ha estat registrat i la transacció ha estat anul.lada. Gràcies.
AccountParameter=Paràmetres del compte
UsageParameter=Paràmetres d'ús
InformationToFindParameters=Informació per trobar la seva configuració de compte %s
PAYBOX_CGI_URL_V2=Url del mòdul CGI Paybox de pagament
VendorName=Nom del venedor
CSSUrlForPaymentForm=Url del full d'estil CSS per al formulari de pagament
MessageOK=Missatge a la pàgina de retorn de pagament confirmat
MessageKO=Missatge a la pàgina de retorn de pagament cancel·lat
NewPayboxPaymentReceived=Nou pagament Paybox rebut
NewPayboxPaymentFailed=Nou intent de pagament Paybox sense èxit
# Dolibarr language file - ca_ES - paybox
CHARSET=UTF-8
PayBoxSetup=Configuració mòdul PayBox
PayBoxDesc=Aquest mòdul ofereix una pàgina de pagament a través del proveïdor <a href="http://www.paybox.com" target="_blank">Paybox</a> per realitzar qualsevol pagament o un pagament en relació amb un objecte Dolibarr (factures, comandes ...)
PaymentForm=Formulari de pagament
FollowingUrlAreAvailableToMakePayments=Les següents URL estan disponibles per a permetre a un client fer un pagament
WelcomeOnPaymentPage=Benvingut als nostres serveis de pagament en línia
ThisScreenAllowsYouToPay=Aquesta pantalla li permet fer el seu pagament en línia destinat a %s.
ThisIsInformationOnPayment=Aquí està la informació sobre el pagament a realitzar
ToComplete=A completar
YourEMail=E-mail de confirmació de pagament
Creditor=Beneficiari
PaymentCode=Codi de pagament
PayBoxDoPayment=Continua el pagament amb targeta
YouWillBeRedirectedOnPayBox=Serà redirigit a la pàgina segura de PayBox per indicar la seva targeta de crèdit
PleaseBePatient=Espereu uns segons
Continue=Continuar
ToOfferALinkForOnlinePayment=URL de pagament %s
ToOfferALinkForOnlinePaymentOnOrder=URL que ofereix una interfície de pagament en línia %s basada en l'import d'una comanda de client
ToOfferALinkForOnlinePaymentOnInvoice=URL que ofereix una interfície de pagament en línia %s basada en l'import d'una factura a client
ToOfferALinkForOnlinePaymentOnContractLine=URL que ofereix una interfície de pagament en línia %s basada en l'import d'una línia de contracte
ToOfferALinkForOnlinePaymentOnFreeAmount=URL que ofereix una interfície de pagament en línia %s basada en un impport llíure
ToOfferALinkForOnlinePaymentOnMemberSubscription=URL que ofereix una interfície de pagament en línia %s basada en la cotització d'un membre
YouCanAddTagOnUrl=També pot afegir el paràmetre url <b>&tag=<i>value</i></b> per a qualsevol d'aquestes adreces (obligatori només per al pagament lliure) per veure el seu propi codi de comentari de pagament.
SetupPayBoxToHavePaymentCreatedAutomatically=Configureu la vostra url Paybox <b>%s</b> per tal que el pagament es creu automàticament al validar.
YourPaymentHasBeenRecorded=Aquesta pàgina confirma que el pagament s'ha registrat correctament. Gràcies.
YourPaymentHasNotBeenRecorded=El seu pagament no ha estat registrat i la transacció ha estat anul.lada. Gràcies.
AccountParameter=Paràmetres del compte
UsageParameter=Paràmetres d'ús
InformationToFindParameters=Informació per trobar la seva configuració de compte %s
PAYBOX_CGI_URL_V2=Url del mòdul CGI Paybox de pagament
VendorName=Nom del venedor
CSSUrlForPaymentForm=Url del full d'estil CSS per al formulari de pagament
MessageOK=Missatge a la pàgina de retorn de pagament confirmat
MessageKO=Missatge a la pàgina de retorn de pagament cancel·lat
NewPayboxPaymentReceived=Nou pagament Paybox rebut
NewPayboxPaymentFailed=Nou intent de pagament Paybox sense èxit
PAYBOX_PAYONLINE_SENDEMAIL=E-Mail a avisar en cas de pagament (amb èxit o no)

View File

@ -173,7 +173,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
@ -200,136 +200,136 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
}
/**
* testFactureAddLine1
*
* @return void
*/
public function testFactureAddLine1()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
/**
* testFactureAddLine1
*
* @return void
*/
public function testFactureAddLine1()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
$localobject1a=new Facture($this->savdb);
$localobject1a->initAsSpecimen('nolines');
$facid=$localobject1a->create($user);
$localobject1a->addline($facid, 'Line 1', 6.36, 15, 21); // This include update_price
print __METHOD__." id=".$facid." total_ttc=".$localobject1a->total_ttc."\n";
$this->assertEquals(95.40, $localobject1a->total_ht);
$this->assertEquals(20.03, $localobject1a->total_tva);
$this->assertEquals(115.43, $localobject1a->total_ttc);
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
$localobject1a=new Facture($this->savdb);
$localobject1a->initAsSpecimen('nolines');
$facid=$localobject1a->create($user);
$localobject1a->addline($facid, 'Line 1', 6.36, 15, 21); // This include update_price
print __METHOD__." id=".$facid." total_ttc=".$localobject1a->total_ttc."\n";
$this->assertEquals(95.40, $localobject1a->total_ht);
$this->assertEquals(20.03, $localobject1a->total_tva);
$this->assertEquals(115.43, $localobject1a->total_ttc);
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
$localobject1b=new Facture($this->savdb);
$localobject1b->initAsSpecimen('nolines');
$facid=$localobject1b->create($user);
$localobject1b->addline($facid, 'Line 1', 6.36, 15, 21); // This include update_price
print __METHOD__." id=".$facid." total_ttc=".$localobject1b->total_ttc."\n";
$this->assertEquals(95.40, $localobject1b->total_ht, 'testFactureAddLine1 total_ht');
$this->assertEquals(20.03, $localobject1b->total_tva, 'testFactureAddLine1 total_tva');
$this->assertEquals(115.43, $localobject1b->total_ttc, 'testFactureAddLine1 total_ttc');
}
/**
* testFactureAddLine2
*
* @return void
*
* @depends testFactureAddLine1
* The depends says test is run only if previous is ok
*/
public function testFactureAddLine2()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
$localobject1b=new Facture($this->savdb);
$localobject1b->initAsSpecimen('nolines');
$facid=$localobject1b->create($user);
$localobject1b->addline($facid, 'Line 1', 6.36, 15, 21); // This include update_price
print __METHOD__." id=".$facid." total_ttc=".$localobject1b->total_ttc."\n";
$this->assertEquals(95.40, $localobject1b->total_ht, 'testFactureAddLine1 total_ht');
$this->assertEquals(20.03, $localobject1b->total_tva, 'testFactureAddLine1 total_tva');
$this->assertEquals(115.43, $localobject1b->total_ttc, 'testFactureAddLine1 total_ttc');
}
/**
* testFactureAddLine2
*
* @return void
*
* @depends testFactureAddLine1
* The depends says test is run only if previous is ok
*/
public function testFactureAddLine2()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
$localobject2=new Facture($this->savdb);
$localobject2->initAsSpecimen('nolines');
$facid=$localobject2->create($user);
$localobject2->addline($facid, 'Line 1', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 2', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 3', 6.36, 5, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject2->total_ttc."\n";
$this->assertEquals(95.40, $localobject2->total_ht);
$this->assertEquals(20.04, $localobject2->total_tva);
$this->assertEquals(115.44, $localobject2->total_ttc);
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
$localobject2=new Facture($this->savdb);
$localobject2->initAsSpecimen('nolines');
$facid=$localobject2->create($user);
$localobject2->addline($facid, 'Line 1', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 2', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 3', 6.36, 5, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject2->total_ttc."\n";
$this->assertEquals(95.40, $localobject2->total_ht);
$this->assertEquals(20.04, $localobject2->total_tva);
$this->assertEquals(115.44, $localobject2->total_ttc);
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
$localobject2=new Facture($this->savdb);
$localobject2->initAsSpecimen('nolines');
$facid=$localobject2->create($user);
$localobject2->addline($facid, 'Line 1', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 2', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 3', 6.36, 5, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject2->total_ttc."\n";
$this->assertEquals(95.40, $localobject2->total_ht);
$this->assertEquals(20.03, $localobject2->total_tva);
$this->assertEquals(115.43, $localobject2->total_ttc);
}
/**
* testFactureAddLine3
*
* @return void
*
* @depends testFactureAddLine2
* The depends says test is run only if previous is ok
*/
public function testFactureAddLine3()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
$localobject2=new Facture($this->savdb);
$localobject2->initAsSpecimen('nolines');
$facid=$localobject2->create($user);
$localobject2->addline($facid, 'Line 1', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 2', 6.36, 5, 21);
$localobject2->addline($facid, 'Line 3', 6.36, 5, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject2->total_ttc."\n";
$this->assertEquals(95.40, $localobject2->total_ht);
$this->assertEquals(20.03, $localobject2->total_tva);
$this->assertEquals(115.43, $localobject2->total_ttc);
}
/**
* testFactureAddLine3
*
* @return void
*
* @depends testFactureAddLine2
* The depends says test is run only if previous is ok
*/
public function testFactureAddLine3()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 0
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
$localobject3=new Facture($this->savdb);
$localobject3->initAsSpecimen('nolines');
$facid=$localobject3->create($user);
$localobject3->addline($facid, 'Line 1', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 2', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 3', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 4', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 5', 6.36, 3, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject3->total_ttc."\n";
$this->assertEquals(95.40, $localobject3->total_ht);
$this->assertEquals(20.05, $localobject3->total_tva);
$this->assertEquals(115.45, $localobject3->total_ttc);
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
$localobject3=new Facture($this->savdb);
$localobject3->initAsSpecimen('nolines');
$facid=$localobject3->create($user);
$localobject3->addline($facid, 'Line 1', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 2', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 3', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 4', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 5', 6.36, 3, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject3->total_ttc."\n";
$this->assertEquals(95.40, $localobject3->total_ht);
$this->assertEquals(20.05, $localobject3->total_tva);
$this->assertEquals(115.45, $localobject3->total_ttc);
// With option MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND = 1
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1;
$localobject3=new Facture($this->savdb);
$localobject3->initAsSpecimen('nolines');
$facid=$localobject3->create($user);
$localobject3->addline($facid, 'Line 1', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 2', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 3', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 4', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 5', 6.36, 3, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject3->total_ttc."\n";
$this->assertEquals(95.40, $localobject3->total_ht);
$this->assertEquals(20.03, $localobject3->total_tva);
$this->assertEquals(115.43, $localobject3->total_ttc);
$localobject3=new Facture($this->savdb);
$localobject3->initAsSpecimen('nolines');
$facid=$localobject3->create($user);
$localobject3->addline($facid, 'Line 1', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 2', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 3', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 4', 6.36, 3, 21);
$localobject3->addline($facid, 'Line 5', 6.36, 3, 21);
print __METHOD__." id=".$facid." total_ttc=".$localobject3->total_ttc."\n";
$this->assertEquals(95.40, $localobject3->total_ht);
$this->assertEquals(20.03, $localobject3->total_tva);
$this->assertEquals(115.43, $localobject3->total_ttc);
}
}

View File

@ -200,7 +200,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$this->savlangs=$langs;
$this->savdb=$db;
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=0;
// Two lines of 1.24 give 2.48 HT and 2.72 TTC with standard vat rounding mode
$localobject=new Facture($this->savdb);