Skip to content

Commit e4a8b50

Browse files
committed
hotfix - Quickmail exclude fix when multiselect is being used.
1 parent 611acfd commit e4a8b50

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

blocks/quickmail/classes/persistents/message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function populate_recip_course_msg()
270270
// are added to the time of it being sent is within 1000s (plenty of time to send)
271271
// This msg recips can also be generated by viewing scheduled emails.
272272
$diffy = time() - $msgexists[0]->timemodified;
273-
error_log("\n\nWhat is diffy: ". $diffy);
273+
// error_log("\n\nWhat is diffy: ". $diffy);
274274
// This can get stale! Delete all recipients belonging to this
275275
// message and update with most current list.
276276
if ($diffy > 1000 && count($recipientuserids) > 0) {

blocks/quickmail/classes/requests/transformers/compose_transformer.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,20 @@ public function get_transformed_excluded_entity_ids() {
7979
*/
8080
public function get_transformed_excluded() {
8181
$excludes = "";
82-
$counter = count($this->form_data->excluded_entity_ids) ?? 0;
83-
for($c = 0; $c < $counter; $c++) {
84-
$excludes .= $this->form_data->excluded_entity_ids[$c];
85-
if ($c+1 < $counter) {
86-
$excludes .= ',';
82+
// In the config/settings on the course level the instructor can use multiselect
83+
// instead of autocomplete which removes the excluded option in the form.
84+
// This check stops it from breaking.
85+
if (property_exists($this->form_data, "excluded_entity_ids")) {
86+
87+
$counter = count($this->form_data->excluded_entity_ids) ?? 0;
88+
for($c = 0; $c < $counter; $c++) {
89+
$excludes .= $this->form_data->excluded_entity_ids[$c];
90+
if ($c+1 < $counter) {
91+
$excludes .= ',';
92+
}
8793
}
8894
}
95+
8996
return $excludes;
9097
}
9198

0 commit comments

Comments
 (0)