diff --git a/modules/commerce_billy_pdf/commerce_billy_pdf.module b/modules/commerce_billy_pdf/commerce_billy_pdf.module index fec9d31..59d967c 100644 --- a/modules/commerce_billy_pdf/commerce_billy_pdf.module +++ b/modules/commerce_billy_pdf/commerce_billy_pdf.module @@ -140,6 +140,7 @@ function commerce_billy_pdf_preprocess_entity(&$variables) { * Page callback for invoice PDF. */ function commerce_billy_pdf($order) { + $order->pdf_download = TRUE; $html = commerce_billy_pdf_html($order); $filename = preg_replace('/[^a-z0-9]/', '_', drupal_strtolower('invoice_' . $order->order_number)) . '.pdf'; @@ -228,6 +229,13 @@ function commerce_billy_pdf_commerce_order_view($order, $view_mode) { $order->content['invoice_logo'] = array( '#value' => variable_get('commerce_billy_pdf_logo', 'misc/druplicon.png'), ); + if (empty($order->pdf_download)) { + $css_files = variable_get('commerce_billy_pdf_css_files', array(drupal_get_path('module', 'commerce_billy_pdf') . '/css/pdf.css')); + foreach ($css_files as $file) { + $order->content['#attached']['css'][] = $file; + } + $order->content['invoice_logo']['#value'] = '/' . $order->content['invoice_logo']['#value']; + } } }