Finished sending of Preordernotifications

This commit is contained in:
Frank Schubert
2023-01-26 22:01:09 +01:00
parent b8d7bd3956
commit fe26e8f2bc
9 changed files with 288 additions and 81 deletions
@@ -1,14 +1,19 @@
<?php
class PreordernotificationModel {
public $sender_email;
public $sender_name;
public $sender_replyto;
public $subject;
public $body_text;
public $body_html;
public $tosend_date;
public $sent_date;
public $send_start;
public $send_finish;
public $recipient_count;
public $preordercampaign_id;
public $preorder_filter;
public $send_lock;
public $note = null;
public $create_by = null;
@@ -145,78 +150,26 @@ class PreordernotificationModel {
}
}
if(array_key_exists("productgroup_id", $filter)) {
$productgroup_id = $filter['productgroup_id'];
if(is_numeric($productgroup_id)) {
$where .= " AND productgroup_id=$productgroup_id";
} elseif(is_array($productgroup_id) && count($productgroup_id)) {
$where .= " AND Preordernotification.productgroup_id IN (". implode(",", $productgroup_id).")";
if(array_key_exists("preordercampaign_id", $filter)) {
$preordercampaign_id = $filter['preordercampaign_id'];
if(is_numeric($preordercampaign_id)) {
$where .= " AND preordercampaign_id=$preordercampaign_id";
} elseif(is_array($preordercampaign_id) && count($preordercampaign_id)) {
$where .= " AND Preordernotification.preordercampaign_id IN (". implode(",", $preordercampaign_id).")";
}
}
if(array_key_exists("producttech_id", $filter)) {
$producttech_id = $filter['producttech_id'];
if(is_numeric($producttech_id)) {
$where .= " AND Preordernotification.producttech_id=$producttech_id";
} elseif(is_array($producttech_id) && count($producttech_id)) {
$where .= " AND Preordernotification.producttech_id IN (". implode(",", $producttech_id).")";
if(array_key_exists("send_finish", $filter)) {
$send_finish = $db->escape($filter['send_finish']);
if($send_finish === null) {
$where .= " AND Preordernotification.send_finish = NULL";
}
}
if(array_key_exists("sla_id", $filter)) {
$sla_id = $filter['sla_id'];
if(is_numeric($sla_id)) {
$where .= " AND sla_id=$sla_id";
} elseif(is_array($sla_id) && count($sla_id)) {
$where .= " AND Preordernotification.sla_id IN (". implode(",", $sla_id).")";
}
}
if(array_key_exists("name", $filter)) {
$name = $db->escape($filter['name']);
if($name) {
$where .= " AND Preordernotification.`name` like '$name'";
}
}
if(array_key_exists("name%", $filter)) {
$name = $db->escape($filter['name%']);
if($name) {
$where .= " AND Preordernotification.`name` like '%$name%'";
}
}
if(array_key_exists("external", $filter)) {
$external = $filter['external'];
if(is_numeric($external)) {
if($external) {
$where .= " AND Preordernotification.external=1";
} else {
$where .= " AND Preordernotification.external=0";
}
}
}
if(array_key_exists("customer_type", $filter)) {
$customer_type = $db->escape($filter['customer_type']);
if($customer_type) {
$where .= " AND Preordernotificationtech.`customer_type` = '$customer_type'";
}
}
if(array_key_exists("attributename", $filter)) {
$attributename = $db->escape($filter['attributename']);
if($attributename) {
$where .= " AND PreordernotificationtechAttribute.name = '$attributename'";
}
}
if(array_key_exists("attributevalue", $filter)) {
$attributevalue = $db->escape($filter['attributevalue']);
if($attributevalue) {
$where .= " AND PreordernotificationAttribute.value = '$attributevalue'";
if(array_key_exists("send_lock", $filter)) {
$send_lock = $db->escape($filter['send_lock']);
if($send_lock === null) {
$where .= " AND Preordernotification.send_lock = NULL";
}
}