Fixing style errors.

This commit is contained in:
stickler-ci 2021-09-20 17:57:10 +00:00
parent c40b22facd
commit d919ef9c4c
3 changed files with 12 additions and 23 deletions

View File

@ -281,8 +281,7 @@ class FactureStats extends Stats
$startYear = $endYear - $numberYears; $startYear = $endYear - $numberYears;
$sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")"; $sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) if (!$user->rights->societe->client->voir && !$this->socid) {
{
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
$sql .= $this->join; $sql .= $this->join;

View File

@ -95,8 +95,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
if ($user->socid) $socid = $user->socid; if ($user->socid) $socid = $user->socid;
if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->facture->lire) if ($user->rights->facture->lire) {
{
$mesg = ''; $mesg = '';
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
@ -105,8 +104,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE')); $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) {
{
$endyear = GETPOST($param_year, 'int'); $endyear = GETPOST($param_year, 'int');
$showtot = GETPOST($param_showtot, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha');
} else { } else {
@ -137,18 +135,15 @@ class box_graph_invoices_peryear extends ModeleBoxes
$px2 = new DolGraph(); $px2 = new DolGraph();
$mesg = $px2->isGraphKo(); $mesg = $px2->isGraphKo();
if (!$mesg) if (!$mesg) {
{
$langs->load("bills"); $langs->load("bills");
$px2->SetData($data2); $px2->SetData($data2);
unset($data2); unset($data2);
$i = $startyear; $i = $startyear;
$legend = array(); $legend = array();
while ($i <= $endyear) while ($i <= $endyear) {
{ if ($startmonth != 1) {
if ($startmonth != 1)
{
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
} else { } else {
$legend[] = $i; $legend[] = $i;
@ -169,14 +164,12 @@ class box_graph_invoices_peryear extends ModeleBoxes
$px2->draw($filenamenb, $fileurlnb); $px2->draw($filenamenb, $fileurlnb);
} }
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax)) {
{
$langs->load("errors"); $langs->load("errors");
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs"); $mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
} }
if (!$mesg) if (!$mesg) {
{
$stringtoshow = ''; $stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript"> $stringtoshow .= '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {

View File

@ -619,7 +619,7 @@ abstract class Stats
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Returns the summed amounts per year for a given number of past years ending now * Returns the summed amounts per year for a given number of past years ending now
* @param string $sql SQL * @param string $sql SQL
* @return array * @return array
@ -628,12 +628,10 @@ abstract class Stats
{ {
$result = array(); $result = array();
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$j = (int) $row[0]; $j = (int) $row[0];
$result[] = [ $result[] = [
@ -646,5 +644,4 @@ abstract class Stats
} }
return $result; return $result;
} }
} }