_data['id_member']) { $memberId = $this->_data['id_member']; } elseif ($this->_data['id_location']) { $memberId = $this->db->queryOne("SELECT id_pay_member FROM {$this->db->tblLocation} WHERE id = " . $this->_data['id_location']); } if ($memberId) { $this->_data['customer'] = $this->db->queryRow("SELECT * FROM {$this->db->tblMember} WHERE id = {$memberId}"); } if (!count($this->_data['customer'])) { sendDeveloperEmail('Member not found for invoice', $this->_data); return false; } else { return true; } } public function getInvoices4Send() { $invoiceIds = $this->db->queryCol("SELECT id FROM {$this->db->tblInvoice} WHERE sent = 'n' AND senderror = 'n'"); return $invoiceIds; } public function prepareEmail($data, &$Doc) { require_once('lib/htmlMimeMail/htmlMimeMail.php'); $mail = new htmlMimeMail(); //$data['body'] = str_replace(BASE_URL.'/broadcastEmailFiles/', '', $data['body']); $Doc->smartyInit(); $Doc->Smarty->assign('item', $data); $html = $Doc->Smarty->fetch('Invoice/invoiceMail.tpl'); $mail->setHtml($html); if ($data['attachment']) { $mail->addAttachment(file_get_contents(WWW_PATH . '/userfile/' . $data['attachment']), 'invoice.pdf', $c_type='application/pdf'); } //vdie($mail); //$mail->_findHtmlImages(WWW_PATH.'/broadcastEmailFiles/'); $mail->setFrom(Settings::get('admin_email_from')); $mail->setSubject('New Invoice from mncar.org'); $mail->setHeader('X-Mailer', 'HTML Mime mail class'); return $mail; } } ?>