Fixes to OSB to work with KH 3.3
This commit is contained in:
48
modules/service/classes/Controller/Task/Service.php
Normal file
48
modules/service/classes/Controller/Task/Service.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides OSB service task capabilities.
|
||||
*
|
||||
* @package OSB
|
||||
* @subpackage Service
|
||||
* @category Controllers/Task
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Task_Service extends Controller_Task {
|
||||
private function _traffic_suppliers($active=FALSE) {
|
||||
$suppliers = ORM::factory('Adsl_Supplier');
|
||||
|
||||
return $active ? $suppliers->list_active() : $suppliers->find_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* List all services by their default checkout method
|
||||
*/
|
||||
public function action_gettraffic() {
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso) {
|
||||
if (Minion_CLI::options('verbose'))
|
||||
echo $aso->name."\n";
|
||||
|
||||
$traffic = Service_Traffic_ADSL::instance($aso->name)->update_traffic();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Charges for excess traffic usage
|
||||
*/
|
||||
public function action_chargetraffic() {
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso)
|
||||
$traffic = Service_Traffic_ADSL::instance($aso->name)->charge_excess_traffic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send alerts to users when they exceed their traffic allowance
|
||||
*/
|
||||
public function action_alerttraffic() {
|
||||
foreach ($this->_traffic_suppliers(TRUE) as $aso)
|
||||
$traffic = Service_Traffic_ADSL::instance($aso->name)->alert_traffic();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user