diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 23dcacf4f1d..f234be227ea 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -47,14 +47,14 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE)) $conf->global->MAIN_MOTD_SETUPPAGE=preg_replace('//i','
',$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\n"; print '
'; diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 133dd247459..29e4c96b6c3 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -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'])) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 77d2b9ecd66..a9b5204abc7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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(); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index abf1bb51db3..66c5b077fb4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cce0b9277eb..fac9bdfd764 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 56bdb1207c7..9c878615a19 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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].'
'."\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; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 204b43f97e0..d0dce2d236d 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -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'].'&leftmenu='; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7db79024c62..459d2dfd1fb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -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'].'&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:''); diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index ba6b0b02061..6bf258cbb89 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -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(); diff --git a/htdocs/index.php b/htdocs/index.php index 44aa2c6005c..6108985a0b6 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -61,14 +61,14 @@ if (! empty($conf->global->MAIN_MOTD)) $conf->global->MAIN_MOTD=preg_replace('//i','
',$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\n"; print '
'; diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 83dd849d9a0..36b26fd7953 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -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); diff --git a/htdocs/langs/ca_ES/paybox.lang b/htdocs/langs/ca_ES/paybox.lang index 147743058d3..4d8f8c160bf 100644 --- a/htdocs/langs/ca_ES/paybox.lang +++ b/htdocs/langs/ca_ES/paybox.lang @@ -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 Paybox 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 &tag=value 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 %s 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 Paybox 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 &tag=value 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 %s 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) diff --git a/test/phpunit/FactureTestRounding.php b/test/phpunit/FactureTestRounding.php index 1c38fe17bad..449d33eafdf 100644 --- a/test/phpunit/FactureTestRounding.php +++ b/test/phpunit/FactureTestRounding.php @@ -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); } } diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index 57a95b0b40a..101fd670ac3 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -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);