Email Queue - List: Add Resend option.

This commit is contained in:
fusionate
2025-09-10 12:47:08 -06:00
parent e4bae0ad32
commit 6fbcaab062
3 changed files with 181 additions and 29 deletions

View File

@@ -81,6 +81,57 @@
}
}
/**
* resend emails in the queue
*/
public function resend($records) {
if (permission_exists($this->name.'_edit')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
}
//resend multiple emails
if (is_array($records) && @sizeof($records) != 0) {
//build the message array
$x = 0;
foreach ($records as $record) {
//add to the array
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
$array[$this->table][$x]['email_status'] = 'waiting';
$array[$this->table][$x]['email_retry_count'] = null;
}
//increment the id
$x++;
}
//save the changes
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//set message
message::add($text['message-resending_messages']);
}
unset($records, $states);
}
}
}
/**
* toggle a field between two values
*/