notify(); return $this; } /** * @return void */ private function notify() { $dayMarks = App_Settings_Obj::get('taxationDueDateNotification'); $dayMarks = preg_split('/[,\ ]+/', $dayMarks); $dayMarks = array_filter($dayMarks, function ($value) { return $value !== '';}); if (empty($dayMarks)) { return; } $dayMarks = array_unique($dayMarks); sort($dayMarks); $dateMap = []; foreach ($dayMarks as $dayMark) { $day = date('Y-m-d', strtotime('+' . $dayMark . ' days')); $dateMap[$day] = (int) $dayMark; } $this->_getDataObj()->setFilter('dueDate', array_keys($dateMap)); foreach ($this->_getDataObj()->getListStatement() as $taxation) { $dayMark = $dateMap[$taxation['dueDate']]; $template = $dayMark == 0 ? 'taxationDueDateUserNotification' : 'taxationNDaysBeforeDueDateUserNotification'; Mail::sendTaxationDueDateNotification($taxation['id'], $dayMark, $template); } } }