Skip to content
Snippets Groups Projects
Commit ca29e702 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #79510 fix errors

parent c8e79275
Branches
Tags
3 merge requests!2869Master,!2852Hotline,!2844hotline #79510 fix calender category selector
Pipeline #5077 passed with stage
in 43 minutes and 50 seconds
......@@ -153,20 +153,14 @@ class Class_Calendar {
protected function _loadArticles($extra_prefs) {
$id_cat = ('all' == $this->select_id_cat)
? $this->id_categorie
: $this->select_id_cat;
$time = $this->getTimeSource()->time();
$prefs = array_merge(['display_order' => 'EventDebut',
'id_categorie' => $id_cat,
'id_categorie' => $this->_getCategoriesIds(),
'events_only' => true,
'event_date' => $this->date,
'id_bib' => $this->id_bib,
'id_lieu' => $this->getPlaceParam(),
'custom_fields' => $this->getCustomFields(),
'published' => $this->date >= strftime('%Y-%m',$time)],
'published' => $this->date >= strftime('%Y-%m', $this->getTimeSource()->time())],
$extra_prefs);
$articles = Class_Article::getArticlesByPreferences($prefs);
......@@ -175,6 +169,22 @@ class Class_Calendar {
}
protected function _getCategoriesIds() {
$ids = ('all' == $this->select_id_cat)
? $this->id_categorie
: $this->select_id_cat;
return $this->_areCategoriesIdsValid($ids)
? $ids
: '';
}
protected function _areCategoriesIdsValid($ids) {
return preg_match('/^\d-?/', $ids);
}
protected function getPlaceParam() {
return isset($this->place) ? $this->place : '';
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment