Merge remote-tracking branch 'origin/3.3' into develop

Conflicts:
	htdocs/core/boxes/box_activity.php
This commit is contained in:
Laurent Destailleur
2013-01-19 16:29:16 +01:00
32 changed files with 255 additions and 230 deletions

View File

@@ -767,7 +767,7 @@ if ($id)
// Line to type new values // Line to type new values
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
$obj = (object) array(); $obj = new stdClass();
// If data was already input, we define them in obj to populate input fields. // If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd')) if (GETPOST('actionadd'))
{ {
@@ -1292,4 +1292,4 @@ function fieldList($fieldlist,$obj='',$tabname='')
} }
} }
?> ?>

View File

@@ -89,12 +89,12 @@ class ActionComm extends CommonObject
{ {
$this->db = $db; $this->db = $db;
$this->author = (object) array(); $this->author = new stdClass();
$this->usermod = (object) array(); $this->usermod = new stdClass();
$this->usertodo = (object) array(); $this->usertodo = new stdClass();
$this->userdone = (object) array(); $this->userdone = new stdClass();
$this->societe = (object) array(); $this->societe = new stdClass();
$this->contact = (object) array(); $this->contact = new stdClass();
} }
/** /**

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@@ -736,6 +736,17 @@ else if ($action == "addline" && $user->rights->propal->creer)
} }
$desc=dol_concatdesc($desc,$product_desc); $desc=dol_concatdesc($desc,$product_desc);
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
$tmptxt='(';
if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - ';
if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0);
$tmptxt.=')';
$desc.= dol_concatdesc($desc, $tmptxt);
}
} }
$type = $prod->type; $type = $prod->type;

View File

@@ -2405,7 +2405,7 @@ class Propal extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->lines[$i] = (object) array(); $this->lines[$i] = new stdClass();
$this->lines[$i]->id = $obj->rowid; // for backward compatibility $this->lines[$i]->id = $obj->rowid; // for backward compatibility
$this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->label = $obj->custom_label; $this->lines[$i]->label = $obj->custom_label;

View File

@@ -212,7 +212,7 @@ $head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear'; $head[$h][2] = 'byyear';
$h++; $h++;
$object=(object) array(); // TODO $object not defined ? $object=new stdClass(); // TODO $object not defined ?
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats'); complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats');
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); dol_fiche_head($head,'byyear',$langs->trans("Statistics"));

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@@ -651,6 +651,17 @@ else if ($action == 'addline' && $user->rights->commande->creer)
} }
$desc=dol_concatdesc($desc,$product_desc); $desc=dol_concatdesc($desc,$product_desc);
// Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{
$tmptxt='(';
if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - ';
if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0);
$tmptxt.=')';
$desc.= dol_concatdesc($desc, $tmptxt);
}
} }
$type = $prod->type; $type = $prod->type;

View File

@@ -233,7 +233,7 @@ $h++;
if ($mode == 'customer') $type='order_stats'; if ($mode == 'customer') $type='order_stats';
if ($mode == 'supplier') $type='supplier_order_stats'; if ($mode == 'supplier') $type='supplier_order_stats';
$object=(object) array(); // TODO $object not defined ? $object=new stdClass(); // TODO $object not defined ?
complete_head_from_modules($conf,$langs,$object,$head,$h,$type); complete_head_from_modules($conf,$langs,$object,$head,$h,$type);
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); dol_fiche_head($head,'byyear',$langs->trans("Statistics"));

View File

@@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@@ -1041,7 +1041,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$desc = $product_desc; $desc = $product_desc;
} }
else else
{ {
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id); $tva_tx = get_default_tva($mysoc,$object->client,$prod->id);
$tva_npr = get_default_npr($mysoc,$object->client,$prod->id); $tva_npr = get_default_npr($mysoc,$object->client,$prod->id);
@@ -1098,16 +1098,17 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
} }
$desc=dol_concatdesc($desc,$product_desc); $desc=dol_concatdesc($desc,$product_desc);
}
if (! empty($prod->customcode) || ! empty($prod->country_code)) // Add custom code and origin country into description
{ if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
$tmptxt='('; {
if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; $tmptxt='(';
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - '; if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0); if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - ';
$tmptxt.=')'; if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0);
$desc.= (dol_textishtml($desc)?"<br>\n":"\n").$tmptxt; $tmptxt.=')';
$desc.= dol_concatdesc($desc, $tmptxt);
}
} }
$type = $prod->type; $type = $prod->type;

View File

@@ -513,7 +513,7 @@ class RemiseCheque extends CommonObject
$i = 0; $i = 0;
while ($objp = $this->db->fetch_object($result)) while ($objp = $this->db->fetch_object($result))
{ {
$docmodel->lines[$i] = (object) array(); $docmodel->lines[$i] = new stdClass();
$docmodel->lines[$i]->bank_chq = $objp->banque; $docmodel->lines[$i]->bank_chq = $objp->banque;
$docmodel->lines[$i]->emetteur_chq = $objp->emetteur; $docmodel->lines[$i]->emetteur_chq = $objp->emetteur;
$docmodel->lines[$i]->amount_chq = $objp->amount; $docmodel->lines[$i]->amount_chq = $objp->amount;

View File

@@ -74,32 +74,32 @@ class Conf
function __construct() function __construct()
{ {
// Avoid warnings when filling this->xxx // Avoid warnings when filling this->xxx
$this->file = (object) array(); $this->file = new stdClass();
$this->db = (object) array(); $this->db = new stdClass();
$this->global = (object) array(); $this->global = new stdClass();
$this->mycompany = (object) array(); $this->mycompany = new stdClass();
$this->admin = (object) array(); $this->admin = new stdClass();
$this->user = (object) array(); $this->user = new stdClass();
$this->syslog = (object) array(); $this->syslog = new stdClass();
$this->browser = (object) array(); $this->browser = new stdClass();
$this->multicompany = (object) array(); $this->multicompany = new stdClass();
// First level object // First level object
$this->expedition_bon = (object) array(); $this->expedition_bon = new stdClass();
$this->livraison_bon = (object) array(); $this->livraison_bon = new stdClass();
$this->fournisseur = (object) array(); $this->fournisseur = new stdClass();
$this->product = (object) array(); $this->product = new stdClass();
$this->service = (object) array(); $this->service = new stdClass();
$this->contrat = (object) array(); $this->contrat = new stdClass();
$this->actions = (object) array(); $this->actions = new stdClass();
$this->commande = (object) array(); $this->commande = new stdClass();
$this->propal = (object) array(); $this->propal = new stdClass();
$this->facture = (object) array(); $this->facture = new stdClass();
$this->contrat = (object) array(); $this->contrat = new stdClass();
$this->adherent = (object) array(); $this->adherent = new stdClass();
$this->bank = (object) array(); $this->bank = new stdClass();
$this->notification = (object) array(); $this->notification = new stdClass();
$this->mailing = (object) array(); $this->mailing = new stdClass();
//! Charset for HTML output and for storing data in memory //! Charset for HTML output and for storing data in memory
$this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1 $this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1
@@ -179,7 +179,7 @@ class Conf
{ {
$modulename=strtolower($reg[1]); $modulename=strtolower($reg[1]);
if ($modulename == 'propale') $modulename='propal'; if ($modulename == 'propale') $modulename='propal';
if (! isset($this->$modulename) || ! is_object($this->$modulename)) $this->$modulename=(object) array(); if (! isset($this->$modulename) || ! is_object($this->$modulename)) $this->$modulename=new stdClass();
$this->$modulename->enabled=true; $this->$modulename->enabled=true;
$this->modules[]=$modulename; // Add this module in list of enabled modules $this->modules[]=$modulename; // Add this module in list of enabled modules
} }
@@ -202,20 +202,20 @@ class Conf
} }
// Second or others levels object // Second or others levels object
$this->propal->cloture = (object) array(); $this->propal->cloture = new stdClass();
$this->propal->facturation = (object) array(); $this->propal->facturation = new stdClass();
$this->commande->client = (object) array(); $this->commande->client = new stdClass();
$this->commande->fournisseur = (object) array(); $this->commande->fournisseur = new stdClass();
$this->facture->client = (object) array(); $this->facture->client = new stdClass();
$this->facture->fournisseur = (object) array(); $this->facture->fournisseur = new stdClass();
$this->fournisseur->commande = (object) array(); $this->fournisseur->commande = new stdClass();
$this->fournisseur->facture = (object) array(); $this->fournisseur->facture = new stdClass();
$this->contrat->services = (object) array(); $this->contrat->services = new stdClass();
$this->contrat->services->inactifs = (object) array(); $this->contrat->services->inactifs = new stdClass();
$this->contrat->services->expires = (object) array(); $this->contrat->services->expires = new stdClass();
$this->adherent->cotisation = (object) array(); $this->adherent->cotisation = new stdClass();
$this->bank->rappro = (object) array(); $this->bank->rappro = new stdClass();
$this->bank->cheque = (object) array(); $this->bank->cheque = new stdClass();
// Clean some variables // Clean some variables
if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php"; if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php";

View File

@@ -596,8 +596,8 @@ class Menubase
$title = $langs->trans($menu['titre']); $title = $langs->trans($menu['titre']);
} }
} }
//$tmp4=dol_microtime_float(); //$tmp4=dol_microtime_float();
//print '>>> 3 '.($tmp4 - $tmp3).'<br>'; //print '>>> 3 '.($tmp4 - $tmp3).'<br>';
// We complete tabMenu // We complete tabMenu
$tabMenu[$b]['rowid'] = $menu['rowid']; $tabMenu[$b]['rowid'] = $menu['rowid'];

View File

@@ -40,7 +40,7 @@ class Translate
private $_tab_loaded=array(); // Array to store result after loading each language file private $_tab_loaded=array(); // Array to store result after loading each language file
var $cache_labels=array(); // Cache for labels return by getLabelFromKey method var $cache_labels=array(); // Cache for labels return by getLabelFromKey method
var $cache_currencies=array(); // Cache to store currency symbols var $cache_currencies=array(); // Cache to store currency symbols
@@ -705,80 +705,80 @@ class Translate
else return $amount.$symbol; else return $amount.$symbol;
} }
/** /**
* Return a currency code into its symbol * Return a currency code into its symbol
* *
* @param string $currency_code Currency code * @param string $currency_code Currency code
* @param string $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency. * @param string $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency.
* @return string Currency symbol encoded into UTF8 * @return string Currency symbol encoded into UTF8
*/ */
function getCurrencySymbol($currency_code, $forceloadall=0) function getCurrencySymbol($currency_code, $forceloadall=0)
{ {
$currency_sign = ''; // By default return iso code $currency_sign = ''; // By default return iso code
if (function_exists("mb_convert_encoding")) if (function_exists("mb_convert_encoding"))
{ {
$this->load_cache_currencies($forceloadall?'':$currency_code); $this->load_cache_currencies($forceloadall?'':$currency_code);
if (isset($this->cache_currencies[$currency_code]) && ! empty($this->cache_currencies[$currency_code]['unicode']) && is_array($this->cache_currencies[$currency_code]['unicode'])) if (isset($this->cache_currencies[$currency_code]) && ! empty($this->cache_currencies[$currency_code]['unicode']) && is_array($this->cache_currencies[$currency_code]['unicode']))
{ {
foreach($this->cache_currencies[$currency_code]['unicode'] as $unicode) foreach($this->cache_currencies[$currency_code]['unicode'] as $unicode)
{ {
$currency_sign .= mb_convert_encoding("&#{$unicode};", "UTF-8", 'HTML-ENTITIES'); $currency_sign .= mb_convert_encoding("&#{$unicode};", "UTF-8", 'HTML-ENTITIES');
} }
} }
} }
return ($currency_sign?$currency_sign:$currency_code); return ($currency_sign?$currency_sign:$currency_code);
} }
/** /**
* Load into the cache, all currencies * Load into the cache, all currencies
* *
* @param string $currency_code Get only currency. Get all if ''. * @param string $currency_code Get only currency. Get all if ''.
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO * @return int Nb of loaded lines, 0 if already loaded, <0 if KO
*/ */
function load_cache_currencies($currency_code) function load_cache_currencies($currency_code)
{ {
global $db; global $db;
if (! empty($currency_code) && isset($this->cache_currencies[$currency_code])) return 0; // Value already into cache if (! empty($currency_code) && isset($this->cache_currencies[$currency_code])) return 0; // Value already into cache
$sql = "SELECT code_iso, label, unicode"; $sql = "SELECT code_iso, label, unicode";
$sql.= " FROM ".MAIN_DB_PREFIX."c_currencies"; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies";
$sql.= " WHERE active = 1"; $sql.= " WHERE active = 1";
if (! empty($currency_code)) $sql.=" AND code_iso = '".$currency_code."'"; if (! empty($currency_code)) $sql.=" AND code_iso = '".$currency_code."'";
//$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later //$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later
dol_syslog(get_class($this).'::load_cache_currencies sql='.$sql, LOG_DEBUG); dol_syslog(get_class($this).'::load_cache_currencies sql='.$sql, LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$this->load("dict"); $this->load("dict");
$label=array(); $label=array();
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$this->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
$this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode($obj->unicode, true);
$label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
$i++;
}
array_multisort($label, SORT_ASC, $this->cache_currencies);
return $num; // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
} $this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$this->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
else $this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode($obj->unicode, true);
{ $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
dol_print_error($db); $i++;
return -1; }
}
array_multisort($label, SORT_ASC, $this->cache_currencies);
return $num;
}
else
{
dol_print_error($db);
return -1;
}
} }
} }

View File

@@ -385,7 +385,7 @@ function agenda_prepare_head()
$h++; $h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin'); complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin');
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
@@ -455,7 +455,7 @@ function calendars_prepare_head($param)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
$object=(object) array(); $object=new stdClass();
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line

View File

@@ -708,20 +708,20 @@ function dol_format_address($object)
/** /**
* Format a string. * Format a string.
* *
* @param string $fmt Format of strftime function (http://php.net/manual/fr/function.strftime.php) * @param string $fmt Format of strftime function (http://php.net/manual/fr/function.strftime.php)
* @param int $ts Timesamp (If is_gmt is true, timestamp is already includes timezone and daylight saving offset, if is_gmt is false, timestamp is a GMT timestamp and we must compensate with server PHP TZ) * @param int $ts Timesamp (If is_gmt is true, timestamp is already includes timezone and daylight saving offset, if is_gmt is false, timestamp is a GMT timestamp and we must compensate with server PHP TZ)
* @param int $is_gmt See comment of timestamp parameter * @param int $is_gmt See comment of timestamp parameter
* @return string A formatted string * @return string A formatted string
*/ */
function dol_strftime($fmt, $ts=false, $is_gmt=false) function dol_strftime($fmt, $ts=false, $is_gmt=false)
{ {
if ((abs($ts) <= 0x7FFFFFFF)) { // check if number in 32-bit signed range if ((abs($ts) <= 0x7FFFFFFF)) { // check if number in 32-bit signed range
return ($is_gmt)? @gmstrftime($fmt,$ts): @strftime($fmt,$ts); return ($is_gmt)? @gmstrftime($fmt,$ts): @strftime($fmt,$ts);
} }
else return 'Error date into a not supported range'; else return 'Error date into a not supported range';
} }
/** /**
@@ -2938,18 +2938,18 @@ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
dol_syslog("get_default_tva: seller use vat=".$thirdparty_seller->tva_assuj.", seller country=".$thirdparty_seller->country_code.", seller in cee=".$thirdparty_seller->isInEEC().", buyer country=".$thirdparty_buyer->country_code.", buyer in cee=".$thirdparty_buyer->isInEEC().", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(! empty($conf->global->SERVICES_ARE_ECOMMERCE_200238EC)?$conf->global->SERVICES_ARE_ECOMMERCE_200238EC:'')); dol_syslog("get_default_tva: seller use vat=".$thirdparty_seller->tva_assuj.", seller country=".$thirdparty_seller->country_code.", seller in cee=".$thirdparty_seller->isInEEC().", buyer country=".$thirdparty_buyer->country_code.", buyer in cee=".$thirdparty_buyer->isInEEC().", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(! empty($conf->global->SERVICES_ARE_ECOMMERCE_200238EC)?$conf->global->SERVICES_ARE_ECOMMERCE_200238EC:''));
// If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm)
// we use the buyer VAT. // we use the buyer VAT.
if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC))
{ {
//print "eee".$thirdparty_buyer->isACompany();exit; //print "eee".$thirdparty_buyer->isACompany();exit;
if (! $thirdparty_seller->isInEEC() && $thirdparty_buyer->isInEEC() && ! $thirdparty_buyer->isACompany()) if (! $thirdparty_seller->isInEEC() && $thirdparty_buyer->isInEEC() && ! $thirdparty_buyer->isACompany())
{ {
//print 'VATRULE 6'; //print 'VATRULE 6';
return get_product_vat_for_country($idprod,$thirdparty_buyer,$idprodfournprice); return get_product_vat_for_country($idprod,$thirdparty_buyer,$idprodfournprice);
} }
} }
// Si vendeur non assujeti a TVA (tva_assuj vaut 0/1 ou franchise/reel) // Si vendeur non assujeti a TVA (tva_assuj vaut 0/1 ou franchise/reel)
if (is_numeric($thirdparty_seller->tva_assuj) && ! $thirdparty_seller->tva_assuj) if (is_numeric($thirdparty_seller->tva_assuj) && ! $thirdparty_seller->tva_assuj)
{ {

View File

@@ -191,7 +191,7 @@ if (! empty($dolibarr_main_url_root_alt))
define('DOL_URL_ROOT_ALT', $suburi); // URL relative root ('', '/dolibarr/custom', ...) define('DOL_URL_ROOT_ALT', $suburi); // URL relative root ('', '/dolibarr/custom', ...)
} }
//print DOL_URL_ROOT.'-'.DOL_URL_ROOT_ALT; //print DOL_URL_ROOT.'-'.DOL_URL_ROOT_ALT;
// Define prefix MAIN_DB_PREFIX // Define prefix MAIN_DB_PREFIX
define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix); define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);

View File

@@ -406,7 +406,7 @@ class FactureFournisseur extends CommonInvoice
{ {
$obj = $this->db->fetch_object($resql_rows); $obj = $this->db->fetch_object($resql_rows);
$this->lines[$i] = (object) array(); $this->lines[$i] = new stdClass();
$this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description; $this->lines[$i]->description = $obj->description;
$this->lines[$i]->ref = $obj->product_ref; // TODO deprecated $this->lines[$i]->ref = $obj->product_ref; // TODO deprecated

View File

@@ -57,7 +57,7 @@ $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="fac.datef"; if (! $sortfield) $sortfield="fac.datef,fac.rowid";
$month = GETPOST('month','int'); $month = GETPOST('month','int');
$year = GETPOST('year','int'); $year = GETPOST('year','int');
@@ -193,7 +193,7 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"facnumber","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"facnumber","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fac.datef,fac.rowid","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"fac.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"fac.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"fac.libelle","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"fac.libelle","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);

View File

@@ -252,7 +252,7 @@ if ($user->societe_id == 0)
} }
} }
$object=(object) array(); $object=new stdClass();
$parameters=array(); $parameters=array();
$action=''; $action='';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks

View File

@@ -48,10 +48,10 @@ require_once ADODB_PATH.'adodb-time.inc.php';
// Avoid warnings with strict mode E_STRICT // Avoid warnings with strict mode E_STRICT
$conf = new stdClass(); // instantiate $conf explicitely $conf = new stdClass(); // instantiate $conf explicitely
$conf->global = (object) array(); $conf->global = new stdClass();
$conf->file = (object) array(); $conf->file = new stdClass();
$conf->db = (object) array(); $conf->db = new stdClass();
$conf->syslog = (object) array(); $conf->syslog = new stdClass();
// Force $_REQUEST["logtohtml"] // Force $_REQUEST["logtohtml"]
$_REQUEST["logtohtml"]=1; $_REQUEST["logtohtml"]=1;

View File

@@ -5,7 +5,7 @@
-- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be> -- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> -- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> -- Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
-- Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> -- Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de> -- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
-- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl> -- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl>
-- --
@@ -284,7 +284,7 @@ insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,no
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'NL','',1,'','Newfoundland and Labrador'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'NL','',1,'','Newfoundland and Labrador');
-- Provinces Spain (id country=4) -- Provinces Spain (id country=4)
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('01', 419, '', 19, 'PAIS VASCO', 'País Vasco', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('01', 419, '', 19, 'ALAVA, 'Álava', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('02', 404, '', 4, 'ALBACETE', 'Albacete', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('02', 404, '', 4, 'ALBACETE', 'Albacete', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('03', 411, '', 11, 'ALICANTE', 'Alicante', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('03', 411, '', 11, 'ALICANTE', 'Alicante', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('04', 401, '', 1, 'ALMERIA', 'Almería', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('04', 401, '', 1, 'ALMERIA', 'Almería', 1);
@@ -294,7 +294,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('08', 406, '', 6, 'BARCELONA', 'Barcelona', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('08', 406, '', 6, 'BARCELONA', 'Barcelona', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('09', 403, '', 8, 'BURGOS', 'Burgos', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('09', 403, '', 8, 'BURGOS', 'Burgos', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('10', 412, '', 12, 'CACERES', 'Cáceres', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('10', 412, '', 12, 'CACERES', 'Cáceres', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('11', 401, '', 1, 'CADIz', 'Cádiz', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('11', 401, '', 1, 'CADIZ', 'Cádiz', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('12', 411, '', 11, 'CASTELLON', 'Castellón', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('12', 411, '', 11, 'CASTELLON', 'Castellón', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('13', 404, '', 4, 'CIUDAD REAL', 'Ciudad Real', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('13', 404, '', 4, 'CIUDAD REAL', 'Ciudad Real', 1);
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('14', 401, '', 1, 'CORDOBA', 'Córdoba', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('14', 401, '', 1, 'CORDOBA', 'Córdoba', 1);

View File

@@ -913,3 +913,5 @@ ALTER TABLE llx_element_lock DROP COLUMN status;
DELETE FROM llx_c_action_trigger WHERE elementtype='withdraw'; DELETE FROM llx_c_action_trigger WHERE elementtype='withdraw';
UPDATE llx_c_action_trigger SET code='FICHINTER_VALIDATE' WHERE code='FICHEINTER_VALIDATE'; UPDATE llx_c_action_trigger SET code='FICHINTER_VALIDATE' WHERE code='FICHEINTER_VALIDATE';
UPDATE llx_c_departements SET ncc='ALAVA', nom='Álava' WHERE code_departement='01' AND fk_region=419;

View File

@@ -775,41 +775,41 @@ if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity'
//print 'eee'.$conf->standard_menu; //print 'eee'.$conf->standard_menu;
// Init menu manager // Init menu manager
if (empty($user->societe_id)) // If internal user or not defined if (empty($user->societe_id)) // If internal user or not defined
{ {
$conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED); $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED); $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
} }
else // If external user else // If external user
{ {
$conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
} }
// For backward compatibility // For backward compatibility
if (empty($conf->standard_menu)) $conf->standard_menu ='eldy_backoffice.php'; if (empty($conf->standard_menu)) $conf->standard_menu ='eldy_backoffice.php';
elseif ($conf->standard_menu == 'eldy.php') $conf->standard_menu='eldy_backoffice.php'; elseif ($conf->standard_menu == 'eldy.php') $conf->standard_menu='eldy_backoffice.php';
// Load the menu manager (only if not already done)
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // menu=eldy_backoffice.php
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
{
$file_menu='eldy_backoffice.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
$menumanager = new MenuManager($db);
// Load the menu manager (only if not already done)
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // menu=eldy_backoffice.php
if (! class_exists('MenuManager'))
{
$menufound=0;
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
foreach($dirmenus as $dirmenu)
{
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
if ($menufound) break;
}
if (! $menufound) // If failed to include, we try with standard
{
$file_menu='eldy_backoffice.php';
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
}
}
$menumanager = new MenuManager($db);

View File

@@ -177,7 +177,7 @@ function paypaladmin_prepare_head()
$head[$h][2] = 'paypalaccount'; $head[$h][2] = 'paypalaccount';
$h++; $h++;
$object=(object) array(); $object=new stdClass();
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line

View File

@@ -2571,7 +2571,7 @@ class Product extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$row = $this->db->fetch_object($result); $row = $this->db->fetch_object($result);
$this->stock_warehouse[$row->fk_entrepot] = (object) array(); $this->stock_warehouse[$row->fk_entrepot] = new stdClass();
$this->stock_warehouse[$row->fk_entrepot]->real = $row->reel; $this->stock_warehouse[$row->fk_entrepot]->real = $row->reel;
$this->stock_warehouse[$row->fk_entrepot]->pmp = $row->pmp; $this->stock_warehouse[$row->fk_entrepot]->pmp = $row->pmp;
$this->stock_reel+=$row->reel; $this->stock_reel+=$row->reel;

View File

@@ -551,7 +551,7 @@ class Task extends CommonObject
if (! $error) if (! $error)
{ {
$tasks[$i] = (object) array(); $tasks[$i] = new stdClass();
$tasks[$i]->id = $obj->taskid; $tasks[$i]->id = $obj->taskid;
$tasks[$i]->ref = $obj->taskid; $tasks[$i]->ref = $obj->taskid;
$tasks[$i]->fk_project = $obj->projectid; $tasks[$i]->fk_project = $obj->projectid;

View File

@@ -66,7 +66,7 @@ $demoprofiles=array(
$tmpaction = 'view'; $tmpaction = 'view';
$parameters=array(); $parameters=array();
$object=(object) 'nothing'; $object=new stdClass();
$reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('addDemoProfile', $parameters, $object, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;

View File

@@ -136,7 +136,7 @@ if ($PAYPALTOKEN)
$ack = strtoupper($resArray["ACK"]); $ack = strtoupper($resArray["ACK"]);
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING")
{ {
$object = (object) 'paypal'; $object = new stdClass();
$object->source = $source; $object->source = $source;
$object->ref = $ref; $object->ref = $ref;

View File

@@ -45,10 +45,10 @@ require_once ADODB_PATH.'adodb-time.inc.php';
// Avoid warnings with strict mode E_STRICT // Avoid warnings with strict mode E_STRICT
$conf = new stdClass(); // instantiate $conf explicitely $conf = new stdClass(); // instantiate $conf explicitely
$conf->global = (object) array(); $conf->global = new stdClass();
$conf->file = (object) array(); $conf->file = new stdClass();
$conf->db = (object) array(); $conf->db = new stdClass();
$conf->syslog = (object) array(); $conf->syslog = new stdClass();
// Force $_REQUEST["logtohtml"] // Force $_REQUEST["logtohtml"]
$_REQUEST["logtohtml"]=1; $_REQUEST["logtohtml"]=1;

View File

@@ -112,11 +112,11 @@ class User extends CommonObject
$this->all_permissions_are_loaded = 0; $this->all_permissions_are_loaded = 0;
$this->admin=0; $this->admin=0;
$this->conf = (object) array(); $this->conf = new stdClass();
$this->rights = (object) array(); $this->rights = new stdClass();
$this->rights->user = (object) array(); $this->rights->user = new stdClass();
$this->rights->user->user = (object) array(); $this->rights->user->user = new stdClass();
$this->rights->user->self = (object) array(); $this->rights->user->self = new stdClass();
} }
/** /**
@@ -538,11 +538,11 @@ class User extends CommonObject
if ($perms) if ($perms)
{ {
if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = (object) array(); // For avoid error if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = new stdClass(); // For avoid error
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = new stdClass();
if ($subperms) if ($subperms)
{ {
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
$this->rights->$module->$perms->$subperms = 1; $this->rights->$module->$perms->$subperms = 1;
} }
else else
@@ -588,11 +588,11 @@ class User extends CommonObject
if ($perms) if ($perms)
{ {
if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = (object) array(); // For avoid error if (! isset($this->rights) || ! is_object($this->rights)) $this->rights = new stdClass(); // For avoid error
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = new stdClass();
if ($subperms) if ($subperms)
{ {
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
$this->rights->$module->$perms->$subperms = 1; $this->rights->$module->$perms->$subperms = 1;
} }
else else

View File

@@ -470,11 +470,11 @@ class UserGroup extends CommonObject
if ($perms) if ($perms)
{ {
if (! isset($this->rights)) $this->rights = (object) array(); // For avoid error if (! isset($this->rights)) $this->rights = new stdClass(); // For avoid error
if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = (object) array(); if (! isset($this->rights->$module) || ! is_object($this->rights->$module)) $this->rights->$module = new stdClass();
if ($subperms) if ($subperms)
{ {
if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = (object) array(); if (! isset($this->rights->$module->$perms) || ! is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = new stdClass();
$this->rights->$module->$perms->$subperms = 1; $this->rights->$module->$perms->$subperms = 1;
} }
else else

View File

@@ -217,16 +217,16 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('1970-01-01 00:00:00',$result); $this->assertEquals('1970-01-01 00:00:00',$result);
// Check %Y-%m-%d %H:%M:%S format // Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true); // http://www.epochconverter.com/ $result=dol_print_date(16725225600,'%Y-%m-%d %H:%M:%S',true); // http://www.epochconverter.com/
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('2500-01-01 00:00:00',$result); $this->assertEquals('2500-01-01 00:00:00',$result);
// Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true); // http://www.epochconverter.com/
print __METHOD__." result=".$result."\n";
$this->assertEquals('1912-01-01 00:00:00',$result); // dol_print_date use TZ (good) but epoch converter does not use it.
// Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date(-1830384000,'%Y-%m-%d %H:%M:%S',true); // http://www.epochconverter.com/
print __METHOD__." result=".$result."\n";
$this->assertEquals('1912-01-01 00:00:00',$result); // dol_print_date use TZ (good) but epoch converter does not use it.
// Check %Y-%m-%d %H:%M:%S format // Check %Y-%m-%d %H:%M:%S format
$result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true); // http://www.epochconverter.com/ $result=dol_print_date(-11676096000,'%Y-%m-%d %H:%M:%S',true); // http://www.epochconverter.com/
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";

View File

@@ -77,9 +77,9 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
if (getServerTimeZoneString() != 'Europe/Paris') { if (getServerTimeZoneString() != 'Europe/Paris') {
print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
} }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
@@ -152,10 +152,10 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
// Specific cas during war // Specific cas during war
// 1940, no timezone // 1940, no timezone
$result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false); // http://www.epochconverter.com/ $result=dol_print_date(-946771200,'%Y-%m-%d %H:%M:%S',false); // http://www.epochconverter.com/
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('1940-01-01 01:00:00',$result); // dol_print_date use a modern timezone, not epoch converter as it did not exists this year $this->assertEquals('1940-01-01 01:00:00',$result); // dol_print_date use a modern timezone, not epoch converter as it did not exists this year
// 1941, timezone is added by germany to +2 (same for 1942) // 1941, timezone is added by germany to +2 (same for 1942)
$result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false); // http://www.epochconverter.com/ $result=dol_print_date(-915148800,'%Y-%m-%d %H:%M:%S',false); // http://www.epochconverter.com/