fix: [internal] RestSearchExport: fetch published and unpublished events

pull/8452/head
Jakub Onderka 2022-06-16 16:35:40 +02:00
parent 3dc6281676
commit 1885e972d9
2 changed files with 5 additions and 5 deletions

View File

@ -3348,7 +3348,7 @@ class EventsController extends AppController
$this->set('exportFormats', $exportFormats);
$this->render('ajax/eventRestSearchExportConfirmationForm');
} else {
$returnFormat = empty($this->Event->validFormats[$returnFormat]) ? 'json' : $returnFormat;
$returnFormat = !isset($this->Event->validFormats[$returnFormat]) ? 'json' : $returnFormat;
$idList = $id;
if (!is_array($idList)) {
if (is_numeric($idList) || Validation::uuid($idList)) {
@ -3361,13 +3361,13 @@ class EventsController extends AppController
throw new NotFoundException(__('Invalid input.'));
}
$filters = [
'eventid' => $idList
'eventid' => $idList,
'published' => [true, false], // fetch published and unpublished events
];
$elementCounter = 0;
$renderView = false;
$validFormat = $this->Event->validFormats[$returnFormat];
$responseType = $validFormat[0];
$responseType = $this->Event->validFormats[$returnFormat][0];
$final = $this->Event->restSearch($this->Auth->user(), $returnFormat, $filters, false, false, $elementCounter, $renderView);
if ($renderView) {
$final = json_decode($final->intoString(), true);

View File

@ -2753,7 +2753,7 @@ class Event extends AppModel
public function set_filter_published(&$params, $conditions, $options)
{
if (isset($params['published'])) {
if (isset($params['published']) && $params['published'] !== [true, false]) {
$conditions['AND']['Event.published'] = $params['published'];
}
return $conditions;