Changed month selection behaviour.
This commit is contained in:
@ -129,21 +129,17 @@ class EntryAPI extends RestAPI {
|
||||
|
||||
|
||||
protected function get_months() {
|
||||
$year=$this->_request['year'];
|
||||
$account=$this->_request['account'];
|
||||
|
||||
$connection=$this->get_db_connection();
|
||||
|
||||
$statement=$connection->prepare("select distinct extract(month from value_date) as month from entry where value_date between date (:year || '-01-01') and date(:year || '-01-01') + interval '1 year' - interval '1 day' order by month desc");
|
||||
$statement->bindParam("year", $year);
|
||||
$statement=$connection->prepare("select distinct extract(year from value_date) as year, extract(month from value_date) as month from entry where account_id = :account order by year, month");
|
||||
$statement->bindParam("account", $account);
|
||||
|
||||
$return=$statement->execute();
|
||||
|
||||
if($return) {
|
||||
$result=[];
|
||||
foreach($statement->fetchAll(PDO::FETCH_NUM) as $value) {
|
||||
array_push($result, $value[0]);
|
||||
}
|
||||
$this->response($result);
|
||||
$this->response($statement->fetchAll(PDO::FETCH_ASSOC));
|
||||
} else {
|
||||
$this->response($statement->errorInfo()[2], 500);
|
||||
}
|
||||
|
Reference in New Issue
Block a user