Options. \Utility\Debug::errorLog('options', $contract->options); $jobRecord = !is_null($jobRecord) ? $jobRecord : $record; $profileId = 0; if ('Sending' == $jobRecord->jobState) { return; } if ($contract->options->SaveDraft) { $jobRecord->jobState = 'Draft'; $this->em->flush($jobRecord); } elseif ($contract->options->TestDraft) { $jobRecord->jobState = 'Draft'; $this->em->flush($jobRecord); $profileId = \Utility\Registry::getAuthParam('id'); exec("php /var/www/namibia/public/index.php newsletter send " . $jobRecord->id . " 1 $profileId > /dev/null &"); } elseif ($contract->options->Send) { $jobRecord->jobState = 'Sending'; $this->em->flush($jobRecord); exec("php /var/www/namibia/public/index.php newsletter send " . $jobRecord->id . " 0 $profileId > /dev/null &"); } } /** * Cron: newsletter send * Send newsletter. * @param integer $jobId * @param integer $test * @param integer $profileId */ public function send($jobId, $test, $profileId) { #-> Options. $jobRecord = $this->em ->getRepository('\Newsletter\Entity\Newsletter') ->find($jobId); if (is_null($jobRecord)) { return; } if (1 == $test) { $oNotify = new \Utility\Comms\Notification(); $sentTo = $oNotify->sendNewsletter($jobRecord->id, true, $profileId); $jobRecord->jobState = 'Draft'; $jobRecord->sentTo = is_numeric($sentTo) ? $sentTo : 0; } elseif (0 == $test) { $oNotify = new \Utility\Comms\Notification(); $sentTo = $oNotify->sendNewsletter($jobRecord->id, false); $jobRecord->jobState = 'Sent'; $jobRecord->sentTo = is_numeric($sentTo) ? $sentTo : 0; } $this->em->flush($jobRecord); } }