function commerce_billy_mail_pdf_prepare in Commerce Billy Mail 7
Helper function to prepare the order mail. Returns its components as array.
Parameters
stdClass $order:
Return value
array
1 call to commerce_billy_mail_pdf_prepare()
- _commerce_billy_mail_get_attachments in ./
commerce_billy_mail.module - Returns the mail attachment(s).
File
- ./
commerce_billy_mail.module, line 245
Code
function commerce_billy_mail_pdf_prepare($order) {
// Currently a copy of the first part of
// See: https://drupal.org/node/2099283
if (module_exists('commerce_billy_pdf')) {
module_load_include('module', 'commerce_billy_pdf');
}
else {
drupal_set_message('PDF email attachment could not be createt, because commerce_billy_pdf is disabled.', 'error');
}
$html = commerce_billy_pdf_html($order);
// TODO: Better use $filename = commerce_billy_pdf_gen_filename($order); when issue #2093643 is resolved in commerce_billy.
$filename = preg_replace('/[^a-z0-9]/', '_', drupal_strtolower('invoice_' . $order->order_number)) . '.pdf';
if (module_exists('transliteration')) {
$filename = transliteration_clean_filename($filename);
}
return array(
$html,
$filename,
);
}