';
@@ -347,7 +347,7 @@ function show_array_last_actions_done($max=5)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
-
+
print '
';
@@ -458,7 +458,7 @@ function actions_prepare_head($object)
{
include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
$resource=new DolResource($db);
-
+
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
$listofresourcelinked = $resource->getElementResources($object->element, $object->id);
$nbResources=count($listofresourcelinked);
@@ -506,6 +506,11 @@ function calendars_prepare_head($param)
$h = 0;
$head = array();
+ $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
+ $head[$h][1] = $langs->trans("ViewList");
+ $head[$h][2] = 'cardlist';
+ $h++;
+
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
$head[$h][1] = $langs->trans("ViewDay");
$head[$h][2] = 'cardday';
@@ -529,16 +534,12 @@ function calendars_prepare_head($param)
$head[$h][2] = 'cardpertype';
$h++;
}
-
+
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewPerUser");
$head[$h][2] = 'cardperuser';
$h++;
- $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
- $head[$h][1] = $langs->trans("ViewList");
- $head[$h][2] = 'cardlist';
- $h++;
$object=new stdClass();
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index d1e0b9020b7..c0e5e896872 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -434,6 +434,8 @@ function currency_name($code_iso, $withcode='', $outputlangs=null)
if (empty($outputlangs)) $outputlangs=$langs;
+ $outputlangs->load("dict");
+
// If there is a translation, we can send immediatly the label
if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso)
{
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 3c771220c70..dedb169dc38 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1068,10 +1068,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
{
- $pdf->SetXY(-20,-$posy);
+ $pdf->SetXY($dims['wk']-$dims['rm']-15, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
- if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
- else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
+ if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
+ else $pdf->MultiCell(15, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
}
return $marginwithfooter;
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 7b7adc76901..6b42e7ad500 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -81,10 +81,10 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:'');
- // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined.
+ // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url']))
{
- $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu=';
+ $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
}
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url']))
{
@@ -94,6 +94,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$url = dol_buildpath($url,1).($param?'?'.$param:'');
//$shorturl = $shorturl.($param?'?'.$param:'');
$shorturl = $url;
+
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
}
@@ -126,7 +127,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
// Output menu entries
foreach($menu->liste as $menkey => $menuval)
{
- if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
+ if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']);
}
@@ -300,6 +301,16 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print "\n";
}
+ if (is_array($moredata) && ! empty($moredata['bookmarks']))
+ {
+ print "\n";
+ print "\n";
+ print '
'."\n";
+ print $moredata['bookmarks'];
+ print '
'."\n";
+ print "\n";
+ }
+
// We update newmenu with entries found into database
$menuArbo = new Menubase($db,'auguria');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
@@ -563,16 +574,6 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
if ($altok) print ''; // End menu block
}
- if (is_array($moredata) && ! empty($moredata['bookmarks']))
- {
- print "\n";
- print "\n";
- print '
'."\n";
- print $moredata['bookmarks'];
- print '
'."\n";
- print "\n";
- }
-
return count($menu_array);
}
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index ad0bce68f86..b479f02619c 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -1583,7 +1583,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
- // Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined.
+ // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
{
$param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index de7b42ef1a6..dc8b16fecc8 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -235,7 +235,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
- 'position'=>102,
+ 'position'=>140,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
@@ -247,7 +247,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
'langs'=>'agenda',
- 'position'=>103,
+ 'position'=>141,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
@@ -259,7 +259,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
'langs'=>'agenda',
- 'position'=>104,
+ 'position'=>142,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
@@ -271,7 +271,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
'langs'=>'agenda',
- 'position'=>105,
+ 'position'=>143,
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
@@ -283,7 +283,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
'langs'=>'agenda',
- 'position'=>106,
+ 'position'=>144,
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
@@ -296,7 +296,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
- 'position'=>112,
+ 'position'=>110,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
@@ -308,7 +308,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
'langs'=>'agenda',
- 'position'=>113,
+ 'position'=>111,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
@@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
'langs'=>'agenda',
- 'position'=>114,
+ 'position'=>112,
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
@@ -332,7 +332,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
'langs'=>'agenda',
- 'position'=>115,
+ 'position'=>113,
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
@@ -344,7 +344,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
'langs'=>'agenda',
- 'position'=>116,
+ 'position'=>114,
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
@@ -357,7 +357,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda',
'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda',
'langs'=>'agenda',
- 'position'=>120,
+ 'position'=>160,
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
index 95bcc21740b..be358744d07 100644
--- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
+++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql
@@ -271,3 +271,8 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10
ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);
+
+
+UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur';
+UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client';
+
diff --git a/test/phpunit/CompanyLibTest.php b/test/phpunit/CompanyLibTest.php
new file mode 100644
index 00000000000..330eb914308
--- /dev/null
+++ b/test/phpunit/CompanyLibTest.php
@@ -0,0 +1,143 @@
+
+ *
+ * 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/CompanyLibTest.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/core/lib/company.lib.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 CompanyLibTest extends PHPUnit_Framework_TestCase
+{
+ protected $savconf;
+ protected $savuser;
+ protected $savlangs;
+ protected $savdb;
+
+ /**
+ * Constructor
+ * We save global variables into local variables
+ *
+ * @return AdminLibTest
+ */
+ function __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";
+ }
+ /**
+ * End phpunit tests
+ *
+ * @return void
+ */
+ protected function tearDown()
+ {
+ print __METHOD__."\n";
+ }
+
+ /**
+ * testNameCurrency
+ *
+ * @return void
+ */
+ public function testNameCurrency()
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $result=currency_name('USD');
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals('US Dollars',$result,'Test to get currency name USD in default language '.$langs->defaultlang);
+
+ $outputlangs=new Translate('', $conf);
+ $outputlangs->setDefaultLang('fr_FR');
+
+ $result=currency_name('USD', 1, $outputlangs);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals('USD - Dollars US',$result,'Test to get currency name USD in default language '.$outputlangs->getDefaultLang());
+
+ return $result;
+ }
+}