I'm trying to do something before my invoice saves. In my invoice module I have:
function invoice_node_presave($node) {
var_dump($node); die;
if ($node->type == 'invoice') {
// If true we are creating a new invoice
if (intval($node->invoice_number) == 0) {
// Get new invoice number
if (intval($node->user_defined_invoice_number) > 0) {
$node->invoice_number = $node->user_defined_invoice_number;
}
else {
$node->invoice_number = _invoice_get_new_invoice_number();
}
}
}
......
}
As you see I have a var_dump($node)
& a die;
. This works perfect. But then when I want to add the following in my template.php
:
function xmed_node_presave($node){
dump($node); die;
if (($node->type == 'invoice')) { //node has not been saved
dpr($node); die;
}
}
He doesn't die. He just runs... Also the rest of functions in my template.php
like function xmed_preprocess_page(&$vars)
work.