Ensure compatibility with PHP 5.6

This commit is contained in:
Manuel Cillero 2017-09-03 18:41:09 +02:00
parent 8809632f15
commit d256810e19

View file

@ -859,22 +859,23 @@ function theme_storminvoice_report_html($node, $language) {
'style' => 'text-align: right;', 'style' => 'text-align: right;',
), ),
); );
$rows_keys = array_keys($rows);
if ($node->tax1) { if ($node->tax1) {
$rows[end(array_keys($rows))][] = array( $rows[end($rows_keys)][] = array(
'data' => sprintf('%.2f', $i->tax1), 'data' => sprintf('%.2f', $i->tax1),
'style' => 'text-align: right;', 'style' => 'text-align: right;',
); );
} }
if ($node->tax2) { if ($node->tax2) {
$rows[end(array_keys($rows))][] = array( $rows[end($rows_keys)][] = array(
'data' => sprintf('%.2f', $i->tax2), 'data' => sprintf('%.2f', $i->tax2),
'style' => 'text-align: right;', 'style' => 'text-align: right;',
); );
} }
$rows[end(array_keys($rows))][] = array( $rows[end($rows_keys)][] = array(
'data' => sprintf('%.2f', $i->total), 'data' => sprintf('%.2f', $i->total),
'style' => 'text-align: right;', 'style' => 'text-align: right;',
); );
} }
$total = t('Total', array(), $language); $total = t('Total', array(), $language);
@ -890,23 +891,23 @@ function theme_storminvoice_report_html($node, $language) {
'style' => 'text-align: right;', 'style' => 'text-align: right;',
), ),
); );
$rows_keys = array_keys($rows);
if ($node->tax1) { if ($node->tax1) {
$rows[end(array_keys($rows))][] = array( $rows[end($rows_keys)][] = array(
'data' => sprintf('%.2f', $node->tax1), 'data' => sprintf('%.2f', $node->tax1),
'style' => 'text-align: right;', 'style' => 'text-align: right;',
); );
} }
if ($node->tax2) { if ($node->tax2) {
$rows[end(array_keys($rows))][] = array( $rows[end($rows_keys)][] = array(
'data' => sprintf('%.2f', $node->tax2), 'data' => sprintf('%.2f', $node->tax2),
'style' => 'text-align: right;', 'style' => 'text-align: right;',
); );
} }
$rows[end(array_keys($rows))][] = array( $rows[end($rows_keys)][] = array(
'data' => sprintf('%.2f', $node->total), 'data' => sprintf('%.2f', $node->total),
'style' => 'text-align: right;', 'style' => 'text-align: right;',
); );
$o .= '<div id="storminvoice_items">'. theme('table', $header, $rows) .'</div>'; $o .= '<div id="storminvoice_items">'. theme('table', $header, $rows) .'</div>';