Skip to content
Snippets Groups Projects
Verified Commit 0122f147 authored by Manuel Herrmann's avatar Manuel Herrmann
Browse files

email filter by nights

parent 121b4405
No related branches found
No related tags found
No related merge requests found
......@@ -37,10 +37,13 @@ class AdminMailPage extends AdminPage {
foreach ($this->environment->oconfig['essen'] as $key => $typ) {
$essen .= '<option value="' . $key . '">' . $typ . '</option>';
}
$maxtage = $this->fahrt->getLenTage();
$fahrt_bereich = $this->environment->database->select('fahrten', ['von', 'bis'], ['fahrt_id' => $this->fahrt->getID()]);
$von = strtotime($fahrt_bereich[0]['von']);
$bis = strtotime($fahrt_bereich[0]['bis']);
$tage = '';
for ($cnt = $maxtage; $cnt >= 0; $cnt--)
$tage .= '<option value="' . $cnt . '">' . $cnt . '</option>';
for ($tag = $von; $tag < $bis; $tag += 24*60*60)
$tage .= '<option value="' . date('Y-m-d', $tag) . '">' . date('d.m.Y', $tag) . '</option>';
return '
<script type="text/javascript">
......@@ -138,7 +141,7 @@ class AdminMailPage extends AdminPage {
}
private function buildQueryWhere() {
$where = ['fahrt_id' => $this->fahrt->getID(), 'OR' => ['on_waitlist' => 0,
$where = ['fahrt_id' => $this->fahrt->getID(), 'OR #waitlist' => ['on_waitlist' => 0,
'AND' => [
'transferred[!]' => null,
'on_waitlist' => 1
......@@ -154,7 +157,12 @@ class AdminMailPage extends AdminPage {
$where['abtyp'] = $_REQUEST['val_abtyp'];
}
if (isset($_REQUEST['check_nights'])) {
// TODO
$nights = $_REQUEST['val_nights'];
$conditions = [];
foreach ($nights as $night)
$conditions['AND #'.$night] = ['anday[<=]' => $night, 'abday[>]' => $night];
if (sizeof($conditions) > 0)
$where['OR #nights'] = $conditions;
}
if (isset($_REQUEST['check_essen'])) {
$where['essen'] = $_REQUEST['val_essen'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment