Cron Job Usage
For example we may need to automatically update exchange rates and revalue foreign accounts on daily basis. We use a cron job to do this using native FrontAccounting functions and classes.
Session values and global variables $page_security and $path_to_root need to be available in the cron script to simulate a login and execution thereafter.
public function __construct() { global $_SESSION; // if _CJ is defined, login user non interactively if (@$cron_request) { $_SESSION['wa_current_user']->login($comp, $usr, $pwd); } }
The above code when included inside hooks.php within Class as constructor enables the script to work when outside the webroot as a cron job.