';
- if ($picto) $return.= '| '.img_picto('',$picto, 'class="valignmiddle widthpictotitle" id="pictotitle"', $pictoisfullpath).' | ';
+ if ($picto) $return.= ''.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).' | ';
$return.= '';
$return.= ' '.$titre.' ';
$return.= ' | ';
@@ -6110,7 +6110,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$paymenturl=$url;
}
- $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$outputlangs->trans("PredefinedMailContentLink", $paymenturl):'');
+ $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):'');
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
}
}
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 1bae075142f..12b755fa220 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -7,6 +7,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017-2018 Ferran Marcet
+ * Copyright (C) 2018 Frédéric France
*
* 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
@@ -887,7 +888,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
- $total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
+ $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 701eee5bc17..417ee6249b3 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -8,6 +8,7 @@
* Copyright (C) 2012-2014 Raphaël Doursenaud
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017-2018 Ferran Marcet
+ * Copyright (C) 2018 Frédéric France
*
* 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
@@ -1117,7 +1118,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
- $total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
+ $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php
index 4b79261a8da..727b410cacb 100644
--- a/htdocs/core/modules/modSalaries.class.php
+++ b/htdocs/core/modules/modSalaries.class.php
@@ -50,7 +50,9 @@ class modSalaries extends DolibarrModules
$this->db = $db;
$this->numero = 510; // Perms from 501..519
- $this->family = "compta";
+ // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
+ // It is used to group modules by family in module setup page
+ $this->family = "financial";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 50af3db805e..54009821fff 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -7,6 +7,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017-2018 Ferran Marcet
+ * Copyright (C) 2018 Frédéric France
*
* 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
@@ -1064,7 +1065,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
- $total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
+ $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index 2a317a4c7a2..243a692eed8 100644
--- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2010-2014 Laurent Destailleur
* Copyright (C) 2015 Marcos García
+ * Copyright (C) 2018 Frédéric France
*
* 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
@@ -648,7 +649,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
- $total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
+ $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1);
diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 53636898fb9..1be46ee2eca 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -5,6 +5,7 @@
* Copyright (C) 2010-2014 Juanjo Menent
* Copyright (C) 2015 Marcos García
* Copyright (C) 2017 Ferran Marcet
+ * Copyright (C) 2018 Frédéric France
*
* 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
@@ -821,7 +822,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
- $total_ht = (($conf->multicurrency->enabled && isset($object->mylticurrency_tx) && $object->mylticurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
+ $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang
index 96c23413955..4ae24fd2abe 100644
--- a/htdocs/langs/en_US/boxes.lang
+++ b/htdocs/langs/en_US/boxes.lang
@@ -73,10 +73,10 @@ BoxProposalsPerMonth=Proposals per month
NoTooLowStockProducts=No products are under the low stock limit
BoxProductDistribution=Products/Services Distribution
BoxProductDistributionFor=Distribution of %s by %s
-BoxTitleLastModifiedSupplierBills=Supplier Invoices: last %s modified
-BoxTitleLatestModifiedSupplierOrders=Supplier Orders: last %s modified
-BoxTitleLastModifiedCustomerBills=Customer Invoices: last %s modified
-BoxTitleLastModifiedCustomerOrders=Customer Orders: last %s modified
+BoxTitleLastModifiedSupplierBills=Latest %s modified vendors invoices
+BoxTitleLatestModifiedSupplierOrders=Last %s modified purchase orders
+BoxTitleLastModifiedCustomerBills=Latest %s modified customers invoices
+BoxTitleLastModifiedCustomerOrders=Latest %s modified customer orders
BoxTitleLastModifiedPropals=Latest %s modified proposals
ForCustomersInvoices=Customers invoices
ForCustomersOrders=Customers orders
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index a3cc816f7fa..7bbd173be30 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -328,7 +328,7 @@ Copy=Copy
Paste=Paste
Default=Default
DefaultValue=Default value
-DefaultValues=Default values
+DefaultValues=Default values/filters/sorting
Price=Price
PriceCurrency=Price (currency)
UnitPrice=Unit price
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index 6fba0af2b64..b68102ef90d 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -327,7 +327,7 @@ Copy=Copier
Paste=Coller
Default=Défaut
DefaultValue=Valeur par défaut
-DefaultValues=Valeurs par défaut
+DefaultValues=Valeurs/Filtres/Tri par défaut
Price=Prix
PriceCurrency=Prix (devise)
UnitPrice=Prix unitaire
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index cbd78a763dc..e0e4b590c1a 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -454,6 +454,36 @@ class Loan extends CommonObject
return $result;
}
+
+ /**
+ * Initialise an instance with random values.
+ * Used to build previews or test instances.
+ * id must be 0 if object instance is a specimen.
+ *
+ * @return void
+ */
+ function initAsSpecimen()
+ {
+ global $user, $langs, $conf;
+
+ $now=dol_now();
+
+ // Initialise parameters
+ $this->id = 0;
+ $this->fk_bank = 1;
+ $this->label = 'SPECIMEN';
+ $this->specimen = 1;
+ $this->socid = 1;
+ $this->account_capital = 16;
+ $this->account_insurance = 616;
+ $this->account_interest = 518;
+ $this->datestart = $now;
+ $this->dateend = $now + (3600 * 24 * 365);
+ $this->note_public = 'SPECIMEN';
+ $this->capital = 20000;
+ $this->nbterm = 48;
+ $this->rate = 4.3;
+ }
/**
* Return amount of payments already done
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 83ebdc47507..3303d63ef81 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -712,6 +712,9 @@ foreach ($listofreferent as $key => $value)
$testnew=$value['testnew'];
$project_field=$value['project_field'];
+ $exclude_select_element = array('payment_various');
+ if (!empty($value['exclude_select_element'])) $exclude_select_element[] = $value['exclude_select_element'];
+
if ($qualified)
{
// If we want the project task array to have details of users
@@ -731,7 +734,7 @@ foreach ($listofreferent as $key => $value)
if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS;
}
- if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, array('payment_various')))
+ if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename,$exclude_select_element))
{
$selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300',-2,!empty($project_field)?$project_field:'fk_projet');
if (! $selectList || ($selectList<0))
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index d6595554dab..430bb2f121c 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -1378,7 +1378,7 @@ div.nopadding {
margin : 0px auto;
}
-#pictotitle {
+.pictotitle {
margin-: 8px;
margin-bottom: 4px;
}
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 6862825d2ed..d88a84c5090 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1372,7 +1372,7 @@ table.noborder tr.liste_titre td {
margin : 0px auto;
}
-#pictotitle {
+.pictotitle {
margin-: 8px;
margin-bottom: 4px;
}
diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php
index 15c3ee3f429..008014fbcb5 100644
--- a/test/phpunit/AllTests.php
+++ b/test/phpunit/AllTests.php
@@ -195,6 +195,8 @@ class AllTests
$suite->addTestSuite('HolidayTest');
require_once dirname(__FILE__).'/ExpenseReportTest.php';
$suite->addTestSuite('ExpenseReportTest');
+ require_once dirname(__FILE__).'/LoanTest.php';
+ $suite->addTestSuite('LoanTest');
require_once dirname(__FILE__).'/EntrepotTest.php';
$suite->addTestSuite('EntrepotTest');
diff --git a/test/phpunit/LoanTest.php b/test/phpunit/LoanTest.php
new file mode 100644
index 00000000000..8341f788ede
--- /dev/null
+++ b/test/phpunit/LoanTest.php
@@ -0,0 +1,218 @@
+
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file test/phpunit/LoanTest.php
+ * \ingroup test
+ * \brief PHPUnit test
+ * \remarks To run this script as CLI: phpunit filename.php
+ */
+
+global $conf,$user,$langs,$db;
+//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
+//require_once 'PHPUnit/Autoload.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/loan/class/loan.class.php';
+
+if (empty($user->id))
+{
+ print "Load permissions for admin user nb 1\n";
+ $user->fetch(1);
+ $user->getrights();
+}
+$conf->global->MAIN_DISABLE_ALL_MAILS=1;
+
+
+/**
+ * Class for PHPUnit tests
+ *
+ * @backupGlobals disabled
+ * @backupStaticAttributes enabled
+ * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
+ */
+class LoanTest extends PHPUnit_Framework_TestCase
+{
+ protected $savconf;
+ protected $savuser;
+ protected $savlangs;
+ protected $savdb;
+
+ /**
+ * Constructor
+ * We save global variables into local variables
+ *
+ * @return LoanTest
+ */
+ function __construct()
+ {
+ parent::__construct();
+
+ //$this->sharedFixture
+ global $conf,$user,$langs,$db;
+ $this->savconf=$conf;
+ $this->savuser=$user;
+ $this->savlangs=$langs;
+ $this->savdb=$db;
+
+ print __METHOD__." db->type=".$db->type." user->id=".$user->id;
+ //print " - db ".$db->db;
+ print "\n";
+ }
+
+ // Static methods
+ public static function setUpBeforeClass()
+ {
+ global $conf,$user,$langs,$db;
+ $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
+
+ print __METHOD__."\n";
+ }
+
+ // tear down after class
+ public static function tearDownAfterClass()
+ {
+ global $conf,$user,$langs,$db;
+ $db->rollback();
+
+ print __METHOD__."\n";
+ }
+
+ /**
+ * Init phpunit tests
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ print __METHOD__."\n";
+ //print $db->getVersion()."\n";
+ }
+ /**
+ * End phpunit tests
+ *
+ * @return void
+ */
+ protected function tearDown()
+ {
+ print __METHOD__."\n";
+ }
+
+ /**
+ * testLoanCreate
+ *
+ * @return void
+ */
+ public function testLoanCreate()
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $localobject=new Loan($this->savdb);
+ $localobject->initAsSpecimen();
+ $result=$localobject->create($user);
+
+ $this->assertLessThan($result, 0);
+ print __METHOD__." result=".$result."\n";
+ return $result;
+ }
+
+ /**
+ * testLoanFetch
+ *
+ * @param int $id Id of object
+ * @return void
+ *
+ * @depends testLoanCreate
+ * The depends says test is run only if previous is ok
+ */
+ public function testLoanFetch($id)
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $localobject=new Loan($this->savdb);
+ $result=$localobject->fetch($id);
+
+ $this->assertLessThan($result, 0);
+ print __METHOD__." id=".$id." result=".$result."\n";
+ return $localobject;
+ }
+
+ /**
+ * testLoanOther
+ *
+ * @param Loan $localobject Loan
+ * @return int
+ *
+ * @depends testLoanFetch
+ * The depends says test is run only if previous is ok
+ */
+ public function testLoanOther($localobject)
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $result=$localobject->set_paid($user);
+
+ print __METHOD__." id=".$localobject->id." result=".$result."\n";
+ $this->assertLessThan($result, 0);
+ return $localobject->id;
+ }
+
+ /**
+ * testLoanDelete
+ *
+ * @param int $id Id of loan
+ * @return void
+ *
+ * @depends testLoanCreate
+ * The depends says test is run only if previous is ok
+ */
+ public function testLoanDelete($id)
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $localobject=new Loan($this->savdb);
+ $result=$localobject->fetch($id);
+ $result=$localobject->delete($user);
+
+ print __METHOD__." id=".$id." result=".$result."\n";
+ $this->assertLessThan($result, 0);
+ return $result;
+ }
+
+}