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;
$sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")";
$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 .= $this->join;

View File

@ -95,8 +95,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
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->facture->lire)
{
if ($user->rights->facture->lire) {
$mesg = '';
$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.'/compta/facture/class/facturestats.class.php';
$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');
$showtot = GETPOST($param_showtot, 'alpha');
} else {
@ -119,7 +117,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
if (empty($endyear)) $endyear = $nowarray['year'];
$numberyears = (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 5 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH);
$startyear = $endyear - $numberyears;
$endyear =
$endyear =
$mode = 'customer';
$WIDTH = (($showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
@ -137,18 +135,15 @@ class box_graph_invoices_peryear extends ModeleBoxes
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (!$mesg)
{
if (!$mesg) {
$langs->load("bills");
$px2->SetData($data2);
unset($data2);
$i = $startyear;
$legend = array();
while ($i <= $endyear)
{
if ($startmonth != 1)
{
while ($i <= $endyear) {
if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
} else {
$legend[] = $i;
@ -169,14 +164,12 @@ class box_graph_invoices_peryear extends ModeleBoxes
$px2->draw($filenamenb, $fileurlnb);
}
if (empty($conf->use_javascript_ajax))
{
if (empty($conf->use_javascript_ajax)) {
$langs->load("errors");
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
}
if (!$mesg)
{
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {

View File

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