Jump to content

action hook doesn't work


Recommended Posts

InvoicePaymentReminder Action Hook doesn't work and I don't know why. When I use ContactEdit the script works, but when I use the InvoicePaymentReminder it doesn't. How is that possible?

 

Today the cronjob sent a reminder mail but the activitylog doesn't show anything.

Is it possible to have more action hooks in one file or is that the reason why it doesn't work?

Link to comment
Share on other sites

function send_reminder($vars)
{

require("includes/class.mollie.php");

$invoiceid = $vars['invoiceid'];
$type = $vars['type'];

logActivity('sendReminder:'.$invoiceid.' '.$type);	

if($type=="reminder"){
	$title="Betalingsherinnering:";	
}
elseif($type=="firstoverdue"){
	$title="2e Betalingsherinnering:";
}
elseif($type=="secondoverdue"){
	$title="3e Betalingsherinnering:";
}
elseif($type=="thirdoverdue"){
	$title="Laatste herinnering!";
}
else{
	$title="Betalingsherinnering:";
}

   $_query = "	SELECT i.total, c.value  AS number
			FROM tblinvoices i,  tblcustomfieldsvalues c
			WHERE i.id=$invoiceid AND fieldid=11 AND relid=i.userid
			AND  (SELECT value FROM tblcustomfieldsvalues WHERE fieldid=12 AND relid=i.userid) ='Ja'";

   $data = full_query($_query);
   $result = mysql_fetch_array($data);

if(is_numeric(str_replace(".","",$result[0])) && is_numeric($result[1]))
{
    $bedrag = $result[0];
	$nummer = $result[1];

$txt = $title."
Factuur: #" . $invoiceid . "
Bedrag: " . $bedrag . " EUR";


 $sms = new mollie();

 // Choose SMS gateway
 $sms->setGateway(2);

 // Set Mollie.nl username and password
 $sms->setLogin('........', '........');
 // Set originator
 $sms->setOriginator('......');
 // Add recipient(s)
 $sms->addRecipients($nummer);


 // Send the SMS Message
 $sms->sendSMS($txt);
 if ($sms->getSuccess()) {
   logActivity('<b>SMS bericht verzonden naar: '. $nummer .'</b><br />SMS text:<br/>'.$txt);
 }
 else {
   logActivity('<b>SMS verzenden is mislukt!</b><br>
       Errorcode: ' . $sms->getResultCode() . '<br>
       Error: ' . $sms->getResultMessage());
 }

}
}


add_hook("InvoicePaymentReminder",1,"send_reminder");
?>

 

Thanks for your help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated