Fix signature of getNbByMonth

This commit is contained in:
Laurent Destailleur 2022-06-17 15:06:24 +02:00
parent ffbd057ef3
commit 7ce47ce786
2 changed files with 12 additions and 10 deletions

View File

@ -82,12 +82,13 @@ class ReceptionStats extends Stats
} }
/** /**
* Return reception number by month for a year * Return reception number by month for a year
* *
* @param int $year Year to scan * @param int $year Year to scan
* @return array Array with number by month * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array with number by month
*/ */
public function getNbByMonth($year) public function getNbByMonth($year, $format = 0)
{ {
global $user; global $user;
@ -101,7 +102,7 @@ class ReceptionStats extends Stats
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
$res = $this->_getNbByMonth($year, $sql); $res = $this->_getNbByMonth($year, $sql, $format);
return $res; return $res;
} }

View File

@ -89,12 +89,13 @@ class TicketStats extends Stats
} }
/** /**
* Renvoie le nombre de facture par mois pour une annee donnee * Return the number of tickets per month for a given year
* *
* @param string $year Year to scan * @param string $year Year to scan
* @return array Array of values * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array of values
*/ */
public function getNbByMonth($year) public function getNbByMonth($year, $format = 0)
{ {
$sql = "SELECT MONTH(datec) as dm, count(*)"; $sql = "SELECT MONTH(datec) as dm, count(*)";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
@ -103,7 +104,7 @@ class TicketStats extends Stats
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
$res = $this->_getNbByMonth($year, $sql); $res = $this->_getNbByMonth($year, $sql, $format);
//var_dump($res);print '<br>'; //var_dump($res);print '<br>';
return $res; return $res;
} }