Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 3:12 pm
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Automated Cron Job Bugs
PostPosted: Mon Dec 01, 2008 9:06 pm 
Offline

Joined: Wed Nov 05, 2008 8:26 pm
Posts: 13
Here's a bug I confirmed and fixed regarding cron job files.

Problem: a2billing_batch_process.php cron jobs does not read dbtype from config file properly causing postgres db installs to fail during execution.

Description: There is a variable called UNIX_TIMESTAMP that differs from mysql to postgres (see lines 30-40 area). The call to check for "postgres" is made BEFORE loading the configuration settings from a2billing.conf. This is a problem because the determination of dbtype is made before the code/process has the information and thus, postgres dbtype is NEVER evaluated as such.

Affected Files:
- a2billing_batch_process.php (UNIX_TIMESTAMP is used currently, needs be be fixed)
- a2billing_bill_diduse.php (UNIX_TIMESTAMP not currently used in code, should be fixed)
- a2billing_subscription_fee.php (UNIX_TIMESTAMP not currently used in code, should be fixed)

Fix: There is a simple fix to move the "if" statement after loading the configuration (basically move it down few lines of code). Here's how it should be after fix:
$A2B = new A2Billing();
$A2B -> load_conf($agi, NULL, 0, $idconfig);

if ($A2B->config["database"]['dbtype'] == "postgres"){
$UNIX_TIMESTAMP = "date_part('epoch',";
}else{
$UNIX_TIMESTAMP = "UNIX_TIMESTAMP(";
}

:D

a2billing: branch/1.3 (1.3.4+)
db: postgres 8.3


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2008 9:57 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
Thanks. I can't believe I had never noticed this, as I'm one of the few here running A2B on Postgres.
Committed with other related fixes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 
Auto Dialer Software


All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group