Skip to content

Commit

Permalink
implemented ILIAS-eLearning#1735 (check online status of course on mo…
Browse files Browse the repository at this point in the history
…ment of event, not on moment where mail is send)
  • Loading branch information
klees committed Oct 22, 2015
1 parent d40215f commit aeb2786
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
19 changes: 10 additions & 9 deletions Services/GEV/Mailing/classes/class.gevCrsAutoMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class gevCrsAutoMail extends ilAutoMail {

private static $template_type = "CrsMail";

public function __construct($a_crs_id, $a_id) {
public function __construct($a_crs_id, $a_id, $a_check_offline_status = true) {
global $ilDB, $lng, $ilCtrl, $ilias, $ilSetting, $ilUser;

$this->db = &$ilDB;
Expand All @@ -48,6 +48,8 @@ public function __construct($a_crs_id, $a_id) {
$this->gev_crs_mail_template_type = self::$template_type;
$this->global_bcc = null;

$this->check_offline_status = $a_check_offline_status;

parent::__construct($a_id);
}

Expand Down Expand Up @@ -430,18 +432,14 @@ protected function getMessageFromTemplate($a_templ_id, $a_user_id, $a_email, $a_


public function send($a_recipients = null, $a_occasion = null) {
//TODO: this maybe needs to be adjusted
// Do not send mails for online-trainings.
/* if ($this->getCourse()->getVfSettings()->isTypeOnline()) {
return;
}*/

// Do not send mails for courses that are offline.
// except for trainer mail when training is cancelled.
// This is a hack and really no good design.
global $ilLog;

if ($this->getCourse()->getOfflineStatus() && $this->getId() != "trainer_training_cancelled") {
if ($this->check_offline_status
&& $this->getCourse()->getOfflineStatus()
&& $this->getId() != "trainer_training_cancelled") {
$ilLog->write("gevCrsAutoMail::send: course is offline, won't send mail. crs_id=".$this->getCourse()->getId().", mail_id=".$this->getId());
return;
}
Expand All @@ -460,7 +458,10 @@ public function send($a_recipients = null, $a_occasion = null) {
public function sendDeferred($a_recipients = null, $a_occasion = null) {
global $ilLog;
$ilLog->write("gevCrsAutoMail::sendDeferred");
if ($this->getCourse()->getOfflineStatus() && $this->getId() != "bill_mail") {

if ($this->check_offline_status
&& $this->getCourse()->getOfflineStatus()
&& $this->getId() != "bill_mail") {
$ilLog->write("....courseOffline and not a bill");
return;
}
Expand Down
4 changes: 3 additions & 1 deletion Services/GEV/Mailing/classes/class.gevCrsAutoMails.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

class gevCrsAutoMails extends ilAutoMails {
public function __construct($a_obj_id) {
public function __construct($a_obj_id, $a_check_offline_status = true) {
$this->mail_data = array(
"self_booking_to_booked" => "gevSelfBookingToBooked"
, "self_booking_to_waiting" => "gevSelfBookingToWaiting"
Expand Down Expand Up @@ -44,6 +44,8 @@ public function __construct($a_obj_id) {

parent::__construct($a_obj_id);

$this->check_offline_status = $a_check_offline_status;

global $lng;
$this->lng = &$lng;

Expand Down
2 changes: 1 addition & 1 deletion Services/GEV/Mailing/classes/class.gevDeferredMails.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function sendDeferredMails($a_crs_ids = null, $a_mail_ids = null, $a_reci
foreach ($mails as $mail) {
if ($cur_crs_id != $mail["crs_id"]) {
$cur_crs_id = $mail["crs_id"];
$automails = new gevCrsAutoMails($cur_crs_id);
$automails = new gevCrsAutoMails($cur_crs_id, false);
}

try {
Expand Down

0 comments on commit aeb2786

Please sign in to comment.