Exemplo n.º 1
0
//Converting Text
$parts = explode('$aos_products_quotes_name', $text);
$text = $parts[0];
$parts = explode('$aos_products_quotes_product_total_price', $parts[1]);
$linePart = '$aos_products_quotes_name' . $parts[0] . '$aos_products_quotes_product_total_price';
//Converting Line Items
$obb = array();
$sep = '';
foreach ($lineItems as $id => $productId) {
    $obb['AOS_Products_Quotes'] = $id;
    $obb['AOS_Products'] = $productId;
    $text .= $sep . TemplateParser::parse_template($linePart, $obb);
    $sep = '</td></tr><tr><td>';
}
$text .= $parts[1];
$converted = TemplateParser::parse_template($text, $object_arr);
$printable = str_replace("\$", "", $converted);
require_once 'modules/Emails/Email.php';
//First Create e-mail draft
$email = new Email();
// set the id for relationships
$email->id = create_guid();
$email->new_with_id = true;
//subject
$email->name = "Quote For " . $quote->name . "";
//body
$email->description_html = $printable;
//type is draft
$email->type = "draft";
$email->status = "draft";
if (!empty($quote->billing_contact_id) && $quote->billing_contact_id != "") {