Merge remote-tracking branch 'Dolibarr/develop' into develop

This commit is contained in:
Nicolas ZABOURI 2019-05-16 09:52:59 +02:00
commit 304e403d88
10 changed files with 85 additions and 26 deletions

View File

@ -0,0 +1,15 @@
<?php
// Example to use PHPStan
// cd git/dolibarr
// /usr/bin/php7.2 ../phpstan.phar -l1 analyze htdocs/societe/website.php --memory-limit 2G
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
define('DOL_URL_ROOT', '/');
// Load the main.inc.php file to have finctions llx_Header and llx_Footer defined
if (! defined("NOLOGIN")) define("NOLOGIN",'1');
global $conf, $langs, $user, $db;
include_once __DIR__ . '/../../htdocs/main.inc.php';

View File

@ -660,16 +660,19 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
if (empty($type)) // For a filesystem path
{
$res = DOL_DOCUMENT_ROOT.'/'.$path; // Standard default path
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
if (is_array($conf->file->dol_document_root))
{
if ($key == 'main')
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array("main"=>"/home/main/htdocs", "alt0"=>"/home/dirmod/htdocs", ...)
{
continue;
}
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
return $res;
if ($key == 'main')
{
continue;
}
if (file_exists($dirroot.'/'.$path))
{
$res=$dirroot.'/'.$path;
return $res;
}
}
}
if ($returnemptyifnotfound) // Not found into alternate dir

View File

@ -1152,7 +1152,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
$contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
if (! is_object($hookmanager)) $hookmanager = new HookManager($db);
$hookmanager->initHooks("main");
$hookmanager->initHooks(array("main"));
$parameters=array('contentsecuritypolicy'=>$contentsecuritypolicy);
$result=$hookmanager->executeHooks('setContentSecurityPolicy', $parameters); // Note that $action and $object may have been modified by some hooks
@ -1212,7 +1212,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
if (empty($disablehead))
{
if (! is_object($hookmanager)) $hookmanager = new HookManager($db);
$hookmanager->initHooks("main");
$hookmanager->initHooks(array("main"));
$ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);

View File

@ -346,7 +346,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<table class="border centpercent">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswithonsecondcolumn';
//$keyforbreak='fieldkeytoswitchonsecondcolumn';
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
// Other attributes

View File

@ -778,7 +778,7 @@ SCRIPT;
$num = count($product_fourn_list);
if (($num + ($offset * $limit)) < $nbtotalofrecords) $num++;
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVEUR ['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1);
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVER ['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1);
// Suppliers list title
print '<div class="div-table-responsive">';

View File

@ -1851,7 +1851,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$backbutton='<a class="justalink" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Back") . '</a>';
print_barre_liste($title, $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, $backbutton, count($prodcustprice->lines), $nbtotalofrecords, 'title_accountancy.png');
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $option, $sortfield, $sortorder, $backbutton, count($prodcustprice->lines), $nbtotalofrecords, 'title_accountancy.png');
if (count($prodcustprice->lines) > 0)
{
@ -1973,7 +1973,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$option = '&search_soc=' . $search_soc . '&id=' . $object->id;
print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, 'title_accountancy.png');
print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVER ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, 'title_accountancy.png');
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
print '<input type="hidden" name="id" value="' . $object->id . '">';

View File

@ -20,7 +20,7 @@
*/
/**
* \file class/societeaccount.class.php
* \file societe/class/societeaccount.class.php
* \ingroup societe
* \brief This file is a CRUD class file for SocieteAccount (Create/Read/Update/Delete)
*/

View File

@ -428,7 +428,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$option = '&socid=' . GETPOST('socid', 'int') . '&prodid=' . GETPOST('prodid', 'int');
print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords);
print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVER ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords);
if (count($prodcustprice->lines) > 0) {
@ -519,7 +519,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<!-- view specific price for each product -->'."\n";
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
print_barre_liste($langs->trans('PriceForEachProduct'), $page, $_SERVER['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, '');
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
@ -603,7 +603,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
{
$colspan=9;
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1;
print '<tr ' . $bc[false] . '><td colspan="'.$colspan.'">' . $langs->trans('None') . '</td></tr>';
print '<tr class="oddeven"><td colspan="'.$colspan.'">' . $langs->trans('None') . '</td></tr>';
}
print "</table>";

View File

@ -37,6 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->loadLangs(array("companies","website"));
$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$show_files = GETPOST('show_files', 'int');
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_status=GETPOST('search_status');
// Security check
@ -340,14 +346,14 @@ $objecttmp=new SocieteAccount($db);
$trackid='thi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
/*if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
}
}*/
/*$moreforfilter = '';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter = '';
/*$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';*/

View File

@ -1,8 +1,35 @@
parameters:
bootstrap: null
bootstrap: %currentWorkingDirectory%/build/phpstan/bootstrap.php
excludes_analyse:
- %rootDir%/htdocs/includes/*
autoload_directories: []
- %currentWorkingDirectory%/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php
- %currentWorkingDirectory%/htdocs/includes/*
- %currentWorkingDirectory%/htdocs/*/class/api_*
autoload_directories:
- %currentWorkingDirectory%/htdocs/accountancy/class
- %currentWorkingDirectory%/htdocs/adherents/class
- %currentWorkingDirectory%/htdocs/api/class
- %currentWorkingDirectory%/htdocs/asset/class
- %currentWorkingDirectory%/htdocs/blockedlog/class
- %currentWorkingDirectory%/htdocs/bom/class
- %currentWorkingDirectory%/htdocs/bookmarks/class
- %currentWorkingDirectory%/htdocs/cashdesk/class
- %currentWorkingDirectory%/htdocs/categories/class
- %currentWorkingDirectory%/htdocs/comm/action/class
- %currentWorkingDirectory%/htdocs/comm/propal/class
- %currentWorkingDirectory%/htdocs/commande/class
- %currentWorkingDirectory%/htdocs/compta/bank/class
- %currentWorkingDirectory%/htdocs/compta/cashcontrol/class
- %currentWorkingDirectory%/htdocs/compta/deplacement/class
- %currentWorkingDirectory%/htdocs/compta/facture/class
- %currentWorkingDirectory%/htdocs/compta/localtax/class
- %currentWorkingDirectory%/htdocs/compta/paiement/class
- %currentWorkingDirectory%/htdocs/conf
- %currentWorkingDirectory%/htdocs/contact/class
- %currentWorkingDirectory%/htdocs/contrat/class
- %currentWorkingDirectory%/htdocs/core/class
- %currentWorkingDirectory%/htdocs/product/class
- %currentWorkingDirectory%/htdocs/societe/class
- %currentWorkingDirectory%/htdocs/user/class
autoload_files: []
featureToggles:
subtractableTypes: false
@ -30,7 +57,15 @@ parameters:
polluteCatchScopeWithTryAssignments: false
reportMagicMethods: false
reportMagicProperties: false
ignoreErrors: []
ignoreErrors:
-
message: '#Call to an undefined method abcdef#'
path: %currentWorkingDirectory%/dirtoignoreerror/*
- '#Undefined variable: \$langs#'
- '#Undefined variable: \$user#'
- '#Undefined variable: \$db#'
- '#Undefined variable: \$conf#'
- '#Undefined variable: \$hookmanager#'
internalErrorsCountLimit: 50
cache:
nodesByFileCountMax: 512