Index: branches/5.2.x/units/orders/orders_tag_processor.php =================================================================== diff -u -N -r15598 -r15605 --- branches/5.2.x/units/orders/orders_tag_processor.php (.../orders_tag_processor.php) (revision 15598) +++ branches/5.2.x/units/orders/orders_tag_processor.php (.../orders_tag_processor.php) (revision 15605) @@ -1,6 +1,6 @@ Application->recallObject('ord'); - $orditems = $this->Application->recallObject('orditems'); - - $sql = 'SELECT ResourceId - FROM '.TABLE_PREFIX.'Products - WHERE ProductId = '.$orditems->GetDBField('ProductId'); - $resource_id = $this->Conn->GetOne($sql); - - $ml_formatter = $this->Application->recallObject('kMultiLanguage'); - $custom_fields = $this->Application->getUnitOption('p', 'CustomFields'); - $custom_name = $ml_formatter->LangFieldName('cust_'.array_search($params['msg_custom_field'], $custom_fields)); - - $sql = 'SELECT '.$custom_name.' - FROM '.$this->Application->getUnitOption('p-cdata', 'TableName').' - WHERE ResourceId = '.$resource_id; - $message_template = $this->Conn->GetOne($sql); - - if (!$message_template || trim($message_template) == '') { - // message template missing - return ; - } - - $from_name = strip_tags($this->Application->ConfigValue('Site_Name')); - $from_email = $this->Application->ConfigValue('DefaultEmailSender'); - - $to_name = $order->GetDBField('BillingTo'); - $to_email = $order->GetDBField('BillingEmail'); - if (!$to_email) { - // billing email is empty, then use user's email - $sql = 'SELECT Email - FROM '.$this->Application->getUnitOption('u', 'TableName').' - WHERE PortalUserId = '.$order->GetDBField('PortalUserId'); - $to_email = $this->Conn->GetOne($sql); - } - - $esender = $application->recallObject('EmailSender.-product'); - /* @var $esender kEmailSendingHelper */ - - $esender->SetFrom($from_email, $from_name); - $esender->AddTo($to_email, $to_name); - - $email_events_eh = $this->Application->recallObject('emailevents_EventHandler'); - /* @var $email_events_eh EmailEventsEventsHandler */ - - list ($message_headers, $message_body) = $email_events_eh->ParseMessageBody($message_template, Array()); - if (!trim($message_body)) { - // message body missing - return false; - } - - foreach ($message_headers as $header_name => $header_value) { - $esender->SetEncodedHeader($header_name, $header_value); - } - - $esender->SetHTML($message_body); - $esender->Deliver(); - } - /** * Prints order totals *