Merge remote-tracking branch 'upstream/develop' into camelCaps

This commit is contained in:
Frédéric FRANCE 2018-09-01 14:06:23 +02:00
commit 10200374ef
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
56 changed files with 461 additions and 192 deletions

View File

@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/8.0.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).

View File

@ -238,9 +238,9 @@
<!--<rule ref="PEAR.Commenting.FunctionComment.MissingReturn"> <!--<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity> <severity>0</severity>
</rule>--> </rule>-->
<rule ref="PEAR.Commenting.FunctionComment.Missing"> <!--<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity> <severity>0</severity>
</rule> </rule>-->
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType" /> <rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />

View File

@ -5,7 +5,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -50,11 +50,11 @@ $main_option = array (
$configuration = AccountancyExport::getTypeConfig(); $configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration[param]; $listparam = $configuration['param'];
$listformat = $configuration[format]; $listformat = $configuration['format'];
$listcr = $configuration[cr]; $listcr = $configuration['cr'];
$model_option = array ( $model_option = array (
@ -117,7 +117,7 @@ if ($action == 'update') {
if (! $error) { if (! $error) {
// reload // reload
$configuration = AccountancyExport::getTypeConfig(); $configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration[param]; $listparam = $configuration['param'];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -142,27 +142,27 @@ print ' {'."\n";
foreach ($listparam as $key => $param) { foreach ($listparam as $key => $param) {
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n"; print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
print ' {'."\n"; print ' {'."\n";
print ' //console.log("'.$param[label].'");'."\n"; print ' //console.log("'.$param['label'].'");'."\n";
if (empty($param[ACCOUNTING_EXPORT_FORMAT])) { if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[ACCOUNTING_EXPORT_FORMAT].'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
} }
if (empty($param[ACCOUNTING_EXPORT_SEPARATORCSV])) { if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
} }
if (empty($param[ACCOUNTING_EXPORT_ENDLINE])) { if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
} }
if (empty($param[ACCOUNTING_EXPORT_DATE])) { if (empty($param['ACCOUNTING_EXPORT_DATE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
} else { } else {
@ -257,15 +257,15 @@ if ($num2) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $key[label]; $label = $key['label'];
print '<td width="50%">' . $langs->trans($label) . '</td>'; print '<td width="50%">' . $langs->trans($label) . '</td>';
// Value // Value
print '<td>'; print '<td>';
if (is_array($key[param])) { if (is_array($key['param'])) {
print $form->selectarray($label, $key[param], $conf->global->$label, 0); print $form->selectarray($label, $key['param'], $conf->global->$label, 0);
} else { } else {
print '<input type="text" size="20" id="'. $label .'" name="' . $key[label] . '" value="' . $conf->global->$label . '">'; print '<input type="text" size="20" id="'. $label .'" name="' . $key['label'] . '" value="' . $conf->global->$label . '">';
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -147,6 +147,7 @@ $paymentsalstatic = new PaymentSalary($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db); $paymentexpensereportstatic = new PaymentExpenseReport($db);
$paymentvariousstatic = new PaymentVarious($db); $paymentvariousstatic = new PaymentVarious($db);
$paymentloanstatic = new PaymentLoan($db); $paymentloanstatic = new PaymentLoan($db);
$accountLinestatic=new AccountLine($db);
// Get code of finance journal // Get code of finance journal
$accountingjournalstatic = new AccountingJournal($db); $accountingjournalstatic = new AccountingJournal($db);
@ -370,7 +371,8 @@ if ($result) {
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount; //$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
} else if ($links[$key]['type'] == 'banktransfert') { } else if ($links[$key]['type'] == 'banktransfert') {
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer"); $accountLinestatic->fetch($links[$key]['url_id']);
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- ' .$accountLinestatic ->getNomUrl(1);
$tabtp[$obj->rowid][$account_transfer] += $obj->amount; $tabtp[$obj->rowid][$account_transfer] += $obj->amount;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']); $bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2); $tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);

View File

@ -19,7 +19,7 @@
*/ */
/** /**
* \file htdocs/adherents/admin/public.php * \file htdocs/adherents/admin/website.php
* \ingroup member * \ingroup member
* \brief File of main public page for member module * \brief File of main public page for member module
* \author Laurent Destailleur * \author Laurent Destailleur

View File

@ -20,9 +20,9 @@ if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
/** /**
* \file htdocs/admin/dolistore/ajax.php * \file htdocs/admin/dolistore/ajax/image.php
* \ingroup admin * \ingroup admin
* \brief Page des informations dolistore * \brief Page des informations dolistore
*/ */
require "../../../main.inc.php"; require "../../../main.inc.php";
@ -56,4 +56,3 @@ try {
else if ($trace[0]['args'][0] == 401) die('Bad auth key'); else if ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
} }

View File

@ -25,9 +25,18 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class
*/ */
class Dolistore class Dolistore
{ {
// params /**
public $start; // beginning of pagination * beginning of pagination
public $end; // end of pagination * @var int
*/
public $start;
/**
* end of pagination
* @var int
*/
public $end;
public $per_page; // pagination: display per page public $per_page; // pagination: display per page
public $categorie; // the current categorie public $categorie; // the current categorie
public $search; // the search keywords public $search; // the search keywords
@ -284,20 +293,37 @@ class Dolistore
return $html; return $html;
} }
/**
* get previous link
*
* @param string $text symbol previous
* @return string html previous link
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_previous_link($text = '<<') function get_previous_link($text = '<<')
{ {
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
} }
/**
* get next link
*
* @param string $text symbol next
* @return string html next link
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_next_link($text = '>>') function get_next_link($text = '>>')
{ {
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
} }
/**
* get previous url
*
* @return string previous url
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_previous_url() function get_previous_url()
{ {
$param_array = array(); $param_array = array();
if ($this->start < $this->per_page) { if ($this->start < $this->per_page) {
@ -314,6 +340,11 @@ class Dolistore
return $this->url."&".$param; return $this->url."&".$param;
} }
/**
* get next url
*
* @return string next url
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_next_url() function get_next_url()
{ {
@ -332,6 +363,13 @@ class Dolistore
return $this->url."&".$param; return $this->url."&".$param;
} }
/**
* version compare
*
* @param string $v1 version 1
* @param string $v2 version 2
* @return int result of compare
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function version_compare($v1, $v2) function version_compare($v1, $v2)
{ {

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/admin/oauthlogintoken.php * \file htdocs/admin/oauthlogintokens.php
* \ingroup oauth * \ingroup oauth
* \brief Setup page to configure oauth access to login information * \brief Setup page to configure oauth access to login information
*/ */

View File

@ -52,6 +52,12 @@ if (!$mode) $mode='config';
// used in library escpos maybe useful if php doesn't support gzdecode // used in library escpos maybe useful if php doesn't support gzdecode
if (!function_exists('gzdecode')) { if (!function_exists('gzdecode')) {
/**
* Gzdecode
*
* @param string $data data to deflate
* @return string data deflated
*/
function gzdecode($data) function gzdecode($data)
{ {
return gzinflate(substr($data,10,-8)); return gzinflate(substr($data,10,-8));
@ -450,4 +456,3 @@ if ($mode == 'template' && $user->admin)
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -16,9 +16,9 @@
*/ */
/** /**
* \file ticket/admin/ticket_extrafields.php * \file admin/ticket_extrafields.php
* \ingroup ticket * \ingroup ticket
* \brief Page to setup extra fields of ticket * \brief Page to setup extra fields of ticket
*/ */
require '../main.inc.php'; require '../main.inc.php';

View File

@ -26,6 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
class Login class Login
{ {
/**
* Constructor of the class
*/
function __construct() function __construct()
{ {
global $db; global $db;

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file card.php * \file htdocs/asset/card.php
* \ingroup asset * \ingroup asset
* \brief Page to create/edit/view asset * \brief Page to create/edit/view asset
*/ */

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file document.php * \file htdocs/asset/document.php
* \ingroup asset * \ingroup asset
* \brief Tab for documents linked to Assets * \brief Tab for documents linked to Assets
*/ */

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* \file info.php * \file htdocs/asset/info.php
* \ingroup asset * \ingroup asset
* \brief Page to show an asset information * \brief Page to show an asset information
*/ */

View File

@ -18,7 +18,7 @@
*/ */
/** /**
* \file list.php * \file htdocs/asset/list.php
* \ingroup asset * \ingroup asset
* \brief List page for asset * \brief List page for asset
*/ */

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file note.php * \file htdocs/asset/note.php
* \ingroup asset * \ingroup asset
* \brief Card with notes on Asset * \brief Card with notes on Asset
*/ */

View File

@ -805,7 +805,7 @@ class Categorie extends CommonObject
* *
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @param int $onlyids Return only ids of objects (consume less memory) * @param int $onlyids Return only ids of objects (consume less memory)
* @return mixed -1 if KO, array of instance of object if OK * @return array|int -1 if KO, array of instance of object if OK
* @see containsObject * @see containsObject
*/ */
function getObjectsInCateg($type, $onlyids=0) function getObjectsInCateg($type, $onlyids=0)

View File

@ -1578,7 +1578,7 @@ class Propal extends CommonObject
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; $sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
$sql.= ' d.fk_unit,'; $sql.= ' d.fk_unit,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobach as product_batch,'; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_batch,';
$sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,'; $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,';
$sql.= ' d.date_start, d.date_end,'; $sql.= ' d.date_start, d.date_end,';
$sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* \file htdocs/core/class/fiscalyear.php * \file htdocs/core/class/fiscalyear.class.php
* \ingroup fiscal year * \ingroup fiscal year
* \brief File of class to manage fiscal years * \brief File of class to manage fiscal years
*/ */

View File

@ -34,10 +34,16 @@ class Ldap
*/ */
public $error=''; public $error='';
/**
* @var string[] Array of error strings
*/
public $errors = array();
/** /**
* Tableau des serveurs (IP addresses ou nom d'hotes) * Tableau des serveurs (IP addresses ou nom d'hotes)
*/ */
var $server=array(); var $server=array();
/** /**
* Base DN (e.g. "dc=foo,dc=com") * Base DN (e.g. "dc=foo,dc=com")
*/ */

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* \file core/lib/assets.lib.php * \file htdocs/core/lib/asset.lib.php
* \ingroup asset * \ingroup asset
* \brief Library files with common functions for Assets * \brief Library files with common functions for Assets
*/ */
@ -24,7 +24,7 @@
/** /**
* Prepare admin pages header * Prepare admin pages header
* *
* @return array * @return array head array with tabs
*/ */
function AssetsAdminPrepareHead() function AssetsAdminPrepareHead()
{ {
@ -65,6 +65,11 @@ function AssetsAdminPrepareHead()
return $head; return $head;
} }
/**
* Prepare admin pages header
*
* @return array head array with tabs
*/
function AssetsPrepareHead() function AssetsPrepareHead()
{ {
global $langs, $conf; global $langs, $conf;

View File

@ -163,6 +163,12 @@ function fichinter_admin_prepare_head()
return $head; return $head;
} }
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function fichinter_rec_prepare_head($object) function fichinter_rec_prepare_head($object)
{ {
global $langs, $conf; //, $user; global $langs, $conf; //, $user;

View File

@ -607,19 +607,19 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
} }
/**
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* This prefix is valid in a web context only and is unique for instance and avoid conflict
* between multi-instances, even when having two instances with one root dir or two instances
* in virtual servers.
*
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix
*/
if (! function_exists('dol_getprefix')) if (! function_exists('dol_getprefix'))
{ {
function dol_getprefix($mode='') /**
{ * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
* This prefix is valid in a web context only and is unique for instance and avoid conflict
* between multi-instances, even when having two instances with one root dir or two instances
* in virtual servers.
*
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
* @return string A calculated prefix
*/
function dol_getprefix($mode='')
{
global $conf; global $conf;
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email // If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email

View File

@ -1167,6 +1167,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
return $numFinal; return $numFinal;
} }
/**
* Get string between
*
* @param string $string String to test
* @param int $start Value for start
* @param int $end Value for end
* @return string Return part of string
*/
function get_string_between($string, $start, $end) function get_string_between($string, $start, $end)
{ {
$string = " ".$string; $string = " ".$string;

View File

@ -169,6 +169,12 @@ function invoice_admin_prepare_head()
} }
/**
* Return array head with list of tabs to view object informations.
*
* @param Facture $object Invoice object
* @return array head array with tabs
*/
function invoice_rec_prepare_head($object) function invoice_rec_prepare_head($object)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;

View File

@ -87,6 +87,11 @@ function resource_prepare_head($object)
return $head; return $head;
} }
/**
* Prepare head for admin tabs
*
* @return array Array of head entries
*/
function resource_admin_prepare_head() function resource_admin_prepare_head()
{ {

View File

@ -103,12 +103,12 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
} }
else else
{ {
dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR); dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
sleep(1); sleep(1);
$langs->load('main'); $langs->load('main');
$langs->load('other'); $langs->load('other');
$langs->load('errors'); $langs->load('errors');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
} }
} }
} }
@ -118,18 +118,18 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
} }
/**
* Show Dolibarr default login page.
* Part of this code is also duplicated into main.inc.php::top_htmlhead
*
* @param Translate $langs Lang object (must be initialized by a new).
* @param Conf $conf Conf object
* @param Societe $mysoc Company object
* @return void
*/
if (! function_exists('dol_loginfunction')) if (! function_exists('dol_loginfunction'))
{ {
function dol_loginfunction($langs,$conf,$mysoc) /**
* Show Dolibarr default login page.
* Part of this code is also duplicated into main.inc.php::top_htmlhead
*
* @param Translate $langs Lang object (must be initialized by a new).
* @param Conf $conf Conf object
* @param Societe $mysoc Company object
* @return void
*/
function dol_loginfunction($langs,$conf,$mysoc)
{ {
global $dolibarr_main_demo,$db; global $dolibarr_main_demo,$db;
global $smartphone,$hookmanager; global $smartphone,$hookmanager;
@ -510,4 +510,3 @@ function getRandomPassword($generic=false)
return $generated_password; return $generated_password;
} }

View File

@ -160,9 +160,9 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png'; $urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=' . urlencode('thumbs/' . $mysoc->logo_small); $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode('thumbs/' . $mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) { } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&amp;modulepart=companylogo&amp;file=' . urlencode($mysoc->logo); $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file=' . urlencode($mysoc->logo);
$width = 128; $width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) { } elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png'; $urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
@ -175,20 +175,3 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '<div style="margin-left: 50px; margin-right: 50px;">'; print '<div style="margin-left: 50px; margin-right: 50px;">';
} }
/**
* Show footer for new member
*
* @return void
*/
function llxFooterTicket()
{
print '</div>';
printCommonFooter('public');
dol_htmloutput_events();
print "</body>\n";
print "</html>\n";
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1332,7 +1333,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// Search if cron entry already present // Search if cron entry already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'"; if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'";
if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'"; if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'"; if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'";
@ -1358,7 +1359,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if(is_int($status)){ $sql.= ' status,'; } if(is_int($status)){ $sql.= ' status,'; }
$sql.= " entity, test)"; $sql.= " entity, test)";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= "'".$this->db->escape($this->rights_class)."', "; $sql.= "'".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."', ";
$sql.= "'".$this->db->idate($now)."', "; $sql.= "'".$this->db->idate($now)."', ";
$sql.= ($datestart ? "'".$this->db->idate($datestart)."'" : "NULL").", "; $sql.= ($datestart ? "'".$this->db->idate($datestart)."'" : "NULL").", ";
$sql.= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", "; $sql.= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", ";
@ -1422,7 +1423,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if (is_array($this->cronjobs)) if (is_array($this->cronjobs))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG); dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG);
@ -1806,7 +1807,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$err=0; $err=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def";
$sql.= " WHERE module = '".$this->db->escape($this->rights_class)."'"; $sql.= " WHERE module = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG); dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG);
if (! $this->db->query($sql)) if (! $this->db->query($sql))
@ -1845,7 +1846,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$menu->menu_handler='all'; $menu->menu_handler='all';
//$menu->module=strtolower($this->name); TODO When right_class will be same than module name //$menu->module=strtolower($this->name); TODO When right_class will be same than module name
$menu->module=$this->rights_class; $menu->module=empty($this->rights_class)?strtolower($this->name):$this->rights_class;
if (! $this->menu[$key]['fk_menu']) if (! $this->menu[$key]['fk_menu'])
{ {
@ -1942,7 +1943,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$err=0; $err=0;
//$module=strtolower($this->name); TODO When right_class will be same than module name //$module=strtolower($this->name); TODO When right_class will be same than module name
$module=$this->rights_class; $module=empty($this->rights_class)?strtolower($this->name):$this->rights_class;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
$sql.= " WHERE module = '".$this->db->escape($module)."'"; $sql.= " WHERE module = '".$this->db->escape($module)."'";

View File

@ -38,7 +38,7 @@ class html_cerfafr extends ModeleDon
/** /**
* Constructor * Constructor
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {
@ -168,7 +168,7 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form); $form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form);
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist //$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
$form = str_replace('__AMOUNT__', price($don->amount), $form); $form = str_replace('__AMOUNT__', price($don->amount), $form);
$form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form); $form = str_replace('__AMOUNTLETTERS__',amountToLetters($don->amount),$form);
$form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form); $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form);
$form = str_replace('__CURRENCYCODE__',$conf->currency,$form); $form = str_replace('__CURRENCYCODE__',$conf->currency,$form);
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form); $form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form);
@ -279,8 +279,15 @@ class html_cerfafr extends ModeleDon
} }
} }
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /**
function chiffre_en_lettre($montant, $devise1='', $devise2='') * numbers to letters
*
* @param mixed $montant amount
* @param mixed $devise1 devise 1 ex: euro
* @param mixed $devise2 devise 2 ex: centimes
* @return string amount in letters
*/
function amountToLetters($montant, $devise1='', $devise2='')
{ {
if(empty($devise1)) $dev1='euros'; if(empty($devise1)) $dev1='euros';
else $dev1=$devise1; else $dev1=$devise1;

View File

@ -22,9 +22,8 @@
/** /**
* \defgroup produit Module product variants * \defgroup produit Module product variants
* \brief Module to manage product combinations based on product attributes * \brief Module to manage product combinations based on product attributes
* \file htdocs/core/modules/modAttributes.class.php * \file htdocs/core/modules/modVariants.class.php
* \ingroup produit * \ingroup produit
* \brief File to describe module to manage catalog of predefined products
*/ */
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -110,4 +109,3 @@ class modVariants extends DolibarrModules
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
} }
} }

View File

@ -423,10 +423,18 @@ class doc_generic_user_odt extends ModelePDFUser
return -1; return -1;
} }
/**
* get substitution array for object
*
* @param User $object user
* @param Translation $outputlangs translation object
* @param string $array_key key for array
* @return array array of substitutions
*/
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function get_substitutionarray_object($object,$outputlangs,$array_key='object') function get_substitutionarray_object($object,$outputlangs,$array_key='object')
{ {
$array_other=array(); $array_other = array();
foreach($object as $key => $value) { foreach($object as $key => $value) {
if (!is_array($value) && !is_object($value)) { if (!is_array($value) && !is_object($value)) {
$array_other[$array_key.'_'.$key] = $value; $array_other[$array_key.'_'.$key] = $value;

View File

@ -34,11 +34,18 @@ class CdavLib
private $langs; private $langs;
/**
* Constructor
*
* @param User $user user
* @param DoliDB $db Database handler
* @param Translation $langs translation
*/
function __construct($user, $db, $langs) function __construct($user, $db, $langs)
{ {
$this->user = $user; $this->user = $user;
$this->db = $db; $this->db = $db;
$this->langs = $langs; $this->langs = $langs;
} }
/** /**

View File

@ -478,10 +478,12 @@ class Expedition extends CommonObject
$sql.= ", e.note_private, e.note_public"; $sql.= ", e.note_private, e.note_public";
$sql.= ', e.fk_incoterms, e.location_incoterms'; $sql.= ', e.fk_incoterms, e.location_incoterms';
$sql.= ', i.libelle as libelle_incoterms'; $sql.= ', i.libelle as libelle_incoterms';
$sql.= ', s.libelle as shipping_method';
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as s ON e.fk_shipping_method = s.rowid';
$sql.= " WHERE e.entity IN (".getEntity('expedition').")"; $sql.= " WHERE e.entity IN (".getEntity('expedition').")";
if ($id) $sql.= " AND e.rowid=".$id; if ($id) $sql.= " AND e.rowid=".$id;
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
@ -499,9 +501,9 @@ class Expedition extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->socid = $obj->socid; $this->socid = $obj->socid;
$this->ref_customer = $obj->ref_customer; $this->ref_customer = $obj->ref_customer;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int; $this->ref_int = $obj->ref_int;
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author; $this->user_author_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
@ -511,12 +513,13 @@ class Expedition extends CommonObject
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->fk_delivery_address = $obj->fk_address; $this->fk_delivery_address = $obj->fk_address;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->shipping_method_id = $obj->fk_shipping_method; $this->shipping_method_id = $obj->fk_shipping_method;
$this->shipping_method = $obj->shipping_method;
$this->tracking_number = $obj->tracking_number; $this->tracking_number = $obj->tracking_number;
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
$this->origin_id = $obj->origin_id; $this->origin_id = $obj->origin_id;
$this->billed = $obj->billed; $this->billed = $obj->billed;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_projet;
$this->trueWeight = $obj->weight; $this->trueWeight = $obj->weight;
$this->weight_units = $obj->weight_units; $this->weight_units = $obj->weight_units;
@ -532,13 +535,13 @@ class Expedition extends CommonObject
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
// A denormalized value // A denormalized value
$this->trueSize = $obj->size."x".$obj->width."x".$obj->height; $this->trueSize = $obj->size."x".$obj->width."x".$obj->height;
$this->size_units = $obj->size_units; $this->size_units = $obj->size_units;
//Incoterms //Incoterms
$this->fk_incoterms = $obj->fk_incoterms; $this->fk_incoterms = $obj->fk_incoterms;
$this->location_incoterms = $obj->location_incoterms; $this->location_incoterms = $obj->location_incoterms;
$this->libelle_incoterms = $obj->libelle_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms;
$this->db->free($result); $this->db->free($result);

View File

@ -128,8 +128,15 @@ class ExpenseReportIk extends CoreObject
return $categories; return $categories;
} }
public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat) /**
{ * Return an array of ranges for a user
*
* @param User $userauthor user author id
* @param int $fk_c_exp_tax_cat category
* @return boolean|array
*/
public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat)
{
$default_range = (int) $userauthor->default_range; // if not defined, then 0 $default_range = (int) $userauthor->default_range; // if not defined, then 0
$ranges = self::getRangesByCategory($fk_c_exp_tax_cat); $ranges = self::getRangesByCategory($fk_c_exp_tax_cat);

View File

@ -190,37 +190,35 @@ class LoanSchedule extends CommonObject
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql) {
{ if ($this->db->num_rows($resql)) {
if ($this->db->num_rows($resql)) $obj = $this->db->fetch_object($resql);
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->fk_loan = $obj->fk_loan; $this->fk_loan = $obj->fk_loan;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->tms = $this->db->jdate($obj->tms); $this->tms = $this->db->jdate($obj->tms);
$this->datep = $this->db->jdate($obj->datep); $this->datep = $this->db->jdate($obj->datep);
$this->amount_capital = $obj->amount_capital; $this->amount_capital = $obj->amount_capital;
$this->amount_insurance = $obj->amount_insurance; $this->amount_insurance = $obj->amount_insurance;
$this->amount_interest = $obj->amount_interest; $this->amount_interest = $obj->amount_interest;
$this->fk_typepayment = $obj->fk_typepayment; $this->fk_typepayment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment; $this->num_payment = $obj->num_payment;
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
$this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif; $this->fk_user_modif = $obj->fk_user_modif;
$this->type_code = $obj->type_code; $this->type_code = $obj->type_code;
$this->type_libelle = $obj->type_libelle; $this->type_libelle = $obj->type_libelle;
$this->bank_account = $obj->fk_account; $this->bank_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank; $this->bank_line = $obj->fk_bank;
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
} }
@ -374,14 +372,25 @@ class LoanSchedule extends CommonObject
} }
} }
<<<<<<< HEAD
// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
function calc_mens($capital,$rate,$nbterm) function calc_mens($capital,$rate,$nbterm)
=======
/**
* Calculate mensuality
*
* @param double $capital Capital
* @param double $rate rate
* @param int $nbterm nb term
* @return double mensuality
*/
function calc_mens($capital, $rate, $nbterm)
>>>>>>> upstream/develop
{ {
$result=''; $result='';
if (!empty($capital)&&!empty($rate)&&!empty($nbterm)) if (!empty($capital) && !empty($rate) && !empty($nbterm)) {
{ $result = ($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1)));
$result=($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1)));
} }
return $result; return $result;

View File

@ -1067,11 +1067,14 @@ else
print $formproduct->select_measuring_units("surface_units","surface"); print $formproduct->select_measuring_units("surface_units","surface");
print '</td></tr>'; print '</td></tr>';
} }
// Volume if (empty($conf->global->PRODUCT_DISABLE_VOLUME))
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">'; {
print '<input name="volume" size="4" value="'.GETPOST('volume').'">'; // Volume
print $formproduct->select_measuring_units("volume_units","volume"); print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">';
print '</td></tr>'; print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
print $formproduct->select_measuring_units("volume_units","volume");
print '</td></tr>';
}
} }
// Units // Units

View File

@ -654,6 +654,9 @@ class PropalmergepdfproductLine
var $tms=''; var $tms='';
var $import_key; var $import_key;
/**
* Constructor
*/
function __construct() function __construct()
{ {
return 1; return 1;

View File

@ -25,7 +25,7 @@
/** /**
* Define head array for tabs of inventory tools setup pages * Define head array for tabs of inventory tools setup pages
* *
* @return Array of head * @return array Array of head
*/ */
function inventoryAdminPrepareHead() function inventoryAdminPrepareHead()
{ {
@ -55,6 +55,15 @@ function inventoryAdminPrepareHead()
return $head; return $head;
} }
/**
* Define head array for tabs of inventory tools setup pages
*
* @param Inventory $inventory Object inventory
* @param string $title parameter
* @param string $get parameter
*
* @return array Array of head
*/
function inventoryPrepareHead(&$inventory, $title='Inventory', $get='') function inventoryPrepareHead(&$inventory, $title='Inventory', $get='')
{ {
global $langs; global $langs;
@ -66,6 +75,13 @@ function inventoryPrepareHead(&$inventory, $title='Inventory', $get='')
/**
* Define head array for tabs of inventory tools setup pages
*
* @param Inventory $inventory Object inventory
*
* @return string html of products
*/
function inventorySelectProducts(&$inventory) function inventorySelectProducts(&$inventory)
{ {
global $conf,$db,$langs; global $conf,$db,$langs;
@ -101,4 +117,3 @@ function inventorySelectProducts(&$inventory)
return $select_html; return $select_html;
} }

View File

@ -29,7 +29,12 @@ class ProjectStats extends Stats
public $socid; public $socid;
public $year; public $year;
function __construct($db) /**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{ {
global $conf, $user; global $conf, $user;

View File

@ -29,6 +29,11 @@ class TaskStats extends Stats
public $socid; public $socid;
public $year; public $year;
/**
* Constructor of the class
*
* @param DoliDb $db Database handler
*/
function __construct($db) function __construct($db)
{ {
global $conf, $user; global $conf, $user;

View File

@ -180,11 +180,11 @@ else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONL
$urllogo=''; $urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{ {
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('thumbs/'.$logosmall); $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('thumbs/'.$logosmall);
} }
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{ {
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode($logo); $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode($logo);
$width=96; $width=96;
} }
// Output html code for logo // Output html code for logo

View File

@ -682,12 +682,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global->
$urllogo=''; $urllogo='';
if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall))
{ {
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('thumbs/'.$logosmall); $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('thumbs/'.$logosmall);
$width=150; $width=150;
} }
elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo))
{ {
$urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode($logo); $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode($logo);
$width=150; $width=150;
} }
// Output html code for logo // Output html code for logo

View File

@ -0,0 +1 @@

View File

@ -1025,7 +1025,12 @@ class Ticket extends CommonObject
$this->tms = ''; $this->tms = '';
} }
/**
* print selected status
*
* @param string $selected selected status
* @return void
*/
public function printSelectStatus($selected = "") public function printSelectStatus($selected = "")
{ {
print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '');

View File

@ -146,14 +146,14 @@ class User extends CommonObject
public $default_c_exp_tax_cat; public $default_c_exp_tax_cat;
public $default_range; public $default_range;
public $fields=array( public $fields = array(
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'), 'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
); );
/** /**
* Constructor de la classe * Constructor of the class
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */

View File

@ -53,6 +53,11 @@ class ProductAttribute
*/ */
public $rang; public $rang;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db) public function __construct(DoliDB $db)
{ {
global $conf; global $conf;

View File

@ -52,8 +52,13 @@ class ProductAttributeValue
*/ */
public $value; public $value;
public function __construct(DoliDB $db) /**
{ * Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
global $conf; global $conf;
$this->db = $db; $this->db = $db;

View File

@ -70,7 +70,12 @@ class ProductCombination
*/ */
public $entity; public $entity;
public function __construct(DoliDB $db) /**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{ {
global $conf; global $conf;

View File

@ -52,10 +52,15 @@ class ProductCombination2ValuePair
*/ */
public $fk_prod_attr_val; public $fk_prod_attr_val;
public function __construct(DoliDB $db) /**
{ * Constructor
$this->db = $db; *
} * @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
}
/** /**
* Translates this class to a human-readable string * Translates this class to a human-readable string

View File

@ -56,11 +56,12 @@ if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
if (! defined("NOLOGIN")) define("NOLOGIN",1); if (! defined("NOLOGIN")) define("NOLOGIN",1);
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site. if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
if (! defined("NOIPCHECK")) define("NOIPCHECK",1); // Do not check IP defined into conf $dolibarr_main_restrict_ip if (! defined("NOIPCHECK")) define("NOIPCHECK",1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
// For multicompany
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
} }
// For multicompany
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
/** /**
* Header empty * Header empty
* *

View File

@ -239,6 +239,13 @@ exit(0);
/**
* script cron usage
*
* @param string $path path
* @param string $script_file filename
* @return void
*/
function usage($path,$script_file) function usage($path,$script_file)
{ {
global $conf; global $conf;
@ -252,4 +259,3 @@ function usage($path,$script_file)
print "For example, to run pending tasks every 5mn, you can add this line:\n"; print "For example, to run pending tasks every 5mn, you can add this line:\n";
print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n"; print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n";
} }

View File

@ -74,14 +74,24 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase
print "\n"; print "\n";
} }
// Static methods /**
public static function setUpBeforeClass() * setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$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.
print __METHOD__."\n"; print __METHOD__."\n";
} }
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@ -173,6 +173,11 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $object['statut']); $this->assertEquals(1, $object['statut']);
} }
/**
* testRestCreateUser
*
* @return void
*/
public function testRestCreateUser() public function testRestCreateUser()
{ {

View File

@ -91,6 +91,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print "\n"; print "\n";
} }
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@ -131,6 +136,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@ -42,6 +42,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
) )
); );
/**
* setUpBeforeClass
*
* @return void
*/
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
// Make sure we backup and remove the configuration file to force new install. // Make sure we backup and remove the configuration file to force new install.
@ -54,12 +59,22 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
self::shareSession(true); self::shareSession(true);
} }
/**
* dropTestDatabase
*
* @return void
*/
protected static function dropTestDatabase() protected static function dropTestDatabase()
{ {
$mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass); $mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass);
$mysqli->query("DROP DATABASE " . self::$db_name); $mysqli->query("DROP DATABASE " . self::$db_name);
} }
/**
* tearDownAfterClass
*
* @return void
*/
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
// Remove the generated configuration and restore the backed up file. // Remove the generated configuration and restore the backed up file.
@ -70,6 +85,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
self::dropTestDatabase(); self::dropTestDatabase();
} }
/**
* setUp
*
* @return void
*/
public function setUp() public function setUp()
{ {
// Populating the database can take quite long. // Populating the database can take quite long.
@ -77,17 +97,32 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->setBrowserUrl(self::$url); $this->setBrowserUrl(self::$url);
} }
/**
* testInstallRedirect
*
* @return void
*/
public function testInstallRedirect() public function testInstallRedirect()
{ {
$this->url('/'); $this->url('/');
$this->assertContains('/install/index.php', $this->url()); $this->assertContains('/install/index.php', $this->url());
} }
/**
* testInstallPageTitle
*
* @return void
*/
public function testInstallPageTitle() public function testInstallPageTitle()
{ {
$this->assertContains('Dolibarr', $this->title()); $this->assertContains('Dolibarr', $this->title());
} }
/**
* testInstallProcess
*
* @return void
*/
public function testInstallProcess() public function testInstallProcess()
{ {
// FIXME: the button itself should have an ID // FIXME: the button itself should have an ID
@ -95,6 +130,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/check.php', $this->url()); $this->assertContains('/install/check.php', $this->url());
} }
/**
* testCheckPage
*
* @return void
*/
public function testCheckPage() public function testCheckPage()
{ {
$unavailable_choices = $this->byId('navail_choices'); $unavailable_choices = $this->byId('navail_choices');
@ -109,6 +149,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/fileconf.php', $this->url()); $this->assertContains('/install/fileconf.php', $this->url());
} }
/**
* testForm
*
* @return void
*/
public function testForm() public function testForm()
{ {
$this->assertFalse($this->byClassName('hideroot')->displayed()); $this->assertFalse($this->byClassName('hideroot')->displayed());
@ -153,12 +198,22 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->byId('db_pass_root')->value(''); $this->byId('db_pass_root')->value('');
} }
/**
* testFormSubmit
*
* @return void
*/
public function testFormSubmit() public function testFormSubmit()
{ {
$this->byName('forminstall')->submit(); $this->byName('forminstall')->submit();
$this->assertContains('/install/step1.php', $this->url()); $this->assertContains('/install/step1.php', $this->url());
} }
/**
* testStep1
*
* @return void
*/
public function testStep1() public function testStep1()
{ {
$this->assertFalse($this->byId('pleasewait')->displayed()); $this->assertFalse($this->byId('pleasewait')->displayed());
@ -170,6 +225,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/step2.php', $this->url()); $this->assertContains('/install/step2.php', $this->url());
} }
/**
* testStep2
*
* @return void
*/
public function testStep2() public function testStep2()
{ {
$this->byName('forminstall')->submit(); $this->byName('forminstall')->submit();
@ -178,6 +238,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
// There is no step 3 // There is no step 3
/**
* testStep4
*
* @return void
*/
public function testStep4() public function testStep4()
{ {
// FIXME: should have an ID // FIXME: should have an ID
@ -191,6 +256,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/install/step5.php', $this->url()); $this->assertContains('/install/step5.php', $this->url());
} }
/**
* testStep5
*
* @return void
*/
public function testStep5() public function testStep5()
{ {
// FIXME: this button should have an ID // FIXME: this button should have an ID
@ -198,6 +268,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
$this->assertContains('/admin/index.php', $this->url()); $this->assertContains('/admin/index.php', $this->url());
} }
/**
* testFirstLogin
*
* @return void
*/
public function testFirstLogin() public function testFirstLogin()
{ {
$this->assertEquals('login', $this->byTag('form')->attribute('id')); $this->assertEquals('login', $this->byTag('form')->attribute('id'));