Improve printing options for invoices reducing global styles

This commit is contained in:
Manuel Cillero 2017-09-03 18:15:21 +02:00
parent 42355f66e6
commit 8809632f15
19 changed files with 19 additions and 72 deletions

View file

@ -175,8 +175,8 @@ function theme_storminvoice_list($header, $invoices, $itemsperpage, $totals_topa
* The node object that contains the invoice.
*/
function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
// Add generic SuiteDesk node CSS
drupal_add_css(drupal_get_path('module', 'storm') . '/storm-node.css', 'module');
global $language;
// Adds CSS for SuiteDesk Invoice node view
drupal_add_css(drupal_get_path('module', 'storminvoice') . '/storminvoice-nodeview.css');
@ -191,13 +191,13 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
// Bodge fix to keep html and pdf invoices working. Without language, menu items default to /storm
if (!$node->language) {
$node->language = 'en';
$node->language = $language->language;
}
$node->content['links']['print']['html'] = array(
'#prefix' => '<dt class="stormcomponent print_html">',
'#suffix' => '</dt>',
'#value' => l(t('Print HTML'), 'invoice/report/'. $node->nid .'/html/'. $node->language),
'#value' => l(t('Print HTML'), 'invoice/report/'. $node->nid .'/html/'. $node->language, array('attributes' => array('onclick' => 'window.open(this.href); return false', 'rel' => 'nofollow'))),
'#weight' => $l_pos++,
);
@ -207,7 +207,7 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['links']['print']['pdf'] = array(
'#prefix' => '<dt class="stormcomponent print_pdf">',
'#suffix' => '</dt>',
'#value' => l(t('Print PDF'), 'invoice/report/'. $node->nid .'/pdf/'. $node->language),
'#value' => l(t('Print PDF'), 'invoice/report/'. $node->nid .'/pdf/'. $node->language, array('attributes' => array('onclick' => 'window.open(this.href); return false', 'rel' => 'nofollow'))),
'#weight' => $l_pos++,
);
$node->content['links']['print']['email'] = array(
@ -415,6 +415,7 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
$organization = node_load($node->organization_nid);
$myorg = node_load(variable_get('storm_organization_nid', 0));
/*
if (isset($myorg->orglanguage)) {
if ($myorg->orglanguage != $organization->orglanguage) {
$language = $organization->orglanguage .','. $myorg->orglanguage;
@ -423,7 +424,7 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
$language = $myorg->orglanguage;
}
}
*/
if (isset($myorg->currency)) {
$currencies = storm_attributes_bydomain('Currency');
$node->content['group5']['currency'] = array(
@ -481,7 +482,7 @@ function theme_storminvoice_report_pdf($node, $language, $output = 'screen') {
drupal_goto('node/'. $node->nid);
}
require_once($tcpdf_dir .'/config/lang/eng.php');
# require_once($tcpdf_dir .'/config/lang/eng.php');
require_once($tcpdf_dir .'/tcpdf.php');
$languages = explode(',', $language);
$language = $languages[0];