Ejemplo n.º 1
0
 protected function displaySentEmails()
 {
     $EmailForm = new common_email();
     $EmailForm->setCacheable(false);
     $email = pg_escape_string($_SESSION['client']['customer']['email']);
     $emails = $EmailForm->listing("email_from = '{$email}' AND template = 'referral_invite'", "created DESC");
     if (is_array($emails) && count($emails) > 0) {
         foreach ($emails as $email) {
             $this->tpl->assign("ITEM", $email);
             $this->tpl->parse("content.email_list.email");
         }
         $this->tpl->parse("content.email_list");
     }
 }
Ejemplo n.º 2
0
 /**
  * showPreviouslySentEmails
  */
 public function showPreviouslySentEmails($email_address)
 {
     if (!$email_address) {
         return false;
     }
     require_once 'models/common/common_email.php';
     $Email = new common_email();
     $list = $Email->listing("email_recipient = '{$email_address}'");
     foreach ($list as $item) {
         $this->tpl->assign('ITEM', $item);
         $this->tpl->parse('content.outbox.item');
     }
     if (count($list) > 0) {
         $this->tpl->parse('content.outbox');
     }
 }
Ejemplo n.º 3
0
 public function getDataForReport($date_from, $date_to)
 {
     require_once 'models/common/common_email.php';
     $Email = new common_email();
     $date_from = date("Y-m-d", strtotime($date_from));
     $date_to = date("Y-m-d", strtotime($date_to));
     $where = "created > '{$date_from}' AND created < '{$date_to}' ";
     $where .= "AND template IN ('notification_back_in_stock_admin', 'notification_out_of_stock_admin', 'notification_back_in_stock_customer')";
     $list = $Email->listing($where, "id DESC");
     $result = array();
     foreach ($list as $item) {
         $params = unserialize($item['content']);
         $variety_id = $params['product']['variety']['id'];
         if ($variety_id > 0) {
             $day = date("Y-m-d", strtotime($item['created']));
             $is_back_in_stock = strpos($item['template'], "back_in_stock") !== false;
             $is_customer = strpos($item['template'], "customer") !== false;
             $key = $variety_id . "-" . $day . "-" . (int) $is_back_in_stock;
             if (isset($result[$key])) {
                 if ($is_customer) {
                     $result[$key]["Customer Notification Sent"]++;
                     if (!empty($result[$key]["Customer Receipent Addresses"])) {
                         $result[$key]["Customer Receipent Addresses"] .= ", ";
                     }
                     $result[$key]["Customer Receipent Addresses"] .= $item['email_recipient'];
                 } else {
                     $result[$key]["Admin Notification Sent"]++;
                     if (!empty($result[$key]["Admin Receipent Addresses"])) {
                         $result[$key]["Admin Receipent Addresses"] .= ", ";
                     }
                     $result[$key]["Admin Receipent Addresses"] .= $item['email_recipient'];
                 }
             } else {
                 $product = $this->getProductInfo($variety_id);
                 $row = array("Type" => $is_back_in_stock ? "Back in Stock" : "Out of Stock", "SKU" => $product['variety']['sku'], "Product Id" => $params['product']['id'], "Variety Id" => $variety_id, "Product Name" => $product['name'], "Variety Name" => $product['variety']['name'], "Date and Time" => date("d/m/Y H:i:s", strtotime($item['created'])));
                 if ($is_customer) {
                     $row["Admin Notification Sent"] = 0;
                     $row["Customer Notification Sent"] = 1;
                     $row["Admin Receipent Addresses"] = "";
                     $row["Customer Receipent Addresses"] = $item['email_recipient'];
                 } else {
                     $row["Admin Notification Sent"] = 1;
                     $row["Customer Notification Sent"] = 0;
                     $row["Admin Receipent Addresses"] = $item['email_recipient'];
                     $row["Customer Receipent Addresses"] = "";
                 }
                 $result[$key] = $row;
             }
         }
     }
     return $result;
 }