function uc_order_load_invoice in Ubercart 5
4 calls to uc_order_load_invoice()
- uc_notify_checkout in uc_notify/
uc_notify.module - Send new order confirmation e-mail to customer and/or administrator.
- uc_order_invoice in uc_order/
uc_order.module - Display an invoice in the browser, convert it to PDF, or e-mail it as HTML.
- uc_order_mail_invoice_form_submit in uc_order/
uc_order.module - uc_order_view in uc_order/
uc_order.module - Display the order view screen, constructed via hook_order_pane().
File
- uc_order/
uc_order.module, line 2893
Code
function uc_order_load_invoice($order, $op = 'view', $template = 'customer') {
static $invoice;
if (isset($invoice[$order->order_id][$template])) {
return $invoice[$order->order_id][$template];
}
$file = drupal_get_path('module', 'uc_order') . '/templates/' . $template . '.itpl.php';
if (file_exists($file)) {
switch ($op) {
case 'checkout-mail':
$thank_you_message = TRUE;
case 'admin-mail':
$help_text = TRUE;
$email_text = TRUE;
$store_footer = TRUE;
case 'view':
case 'print':
$business_header = TRUE;
$thank_you_message = $thank_you_message === TRUE ? TRUE : FALSE;
$shipping_method = TRUE;
break;
}
$products = $order->products;
if (!is_array($products)) {
$products = array();
}
$line_items = $order->line_items;
$items = _line_item_list();
foreach ($items as $item) {
if (isset($item['display_only']) && $item['display_only'] == TRUE) {
$result = $item['callback']('display', $order);
if (is_array($result)) {
foreach ($result as $line) {
$line_items[] = array(
'line_item_id' => $line['id'],
'title' => $line['title'],
'amount' => $line['amount'],
'weight' => $item['weight'],
'data' => $line['data'],
);
}
}
}
}
if (!is_array($line_items)) {
$line_items = array();
}
usort($line_items, 'uc_weight_sort');
ob_start();
require $file;
$output = ob_get_contents();
ob_end_clean();
}
$output = token_replace($output, 'global');
$output = token_replace($output, 'order', $order);
$invoice[$order->order_id][$template] = $output;
return $output;
}