Implement PLESK, SSL Services

This commit is contained in:
Deon George
2011-12-17 10:31:35 +11:00
parent cb18209369
commit c8fd44f844
29 changed files with 1038 additions and 438 deletions

View File

@@ -9,10 +9,14 @@
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
*
* Fields:
* + queue: PROVISION (to be provisioned)
*/
class Model_Service extends ORMOSB {
// Relationships
protected $_has_one = array(
'affiliate'=>array('far_key'=>'affiliate_id','foreign_key'=>'id'),
'service_billing'=>array('far_key'=>'account_billing_id','foreign_key'=>'id'),
);
protected $_has_many = array(
@@ -104,17 +108,24 @@ class Model_Service extends ORMOSB {
}
}
/**
* Enable the plugin to store data
*/
public function admin_update() {
if (is_null($plugin = $this->plugin()))
return NULL;
else
return $plugin->_admin_update();
return $plugin->admin_update();
}
/** LIST FUNCTIONS **/
private function _list_active() {
return $this->where('active','=',1);
}
public function list_active() {
return $this->where('active','=','1')->find_all();
return $this->_list_active()->find_all();
}
public function list_bylistgroup($cat) {
@@ -138,14 +149,20 @@ class Model_Service extends ORMOSB {
* List services that need to be billed.
*/
public function list_invoicesoon() {
$result = array();
// @todo This needs to be configurable
$days = 35;
foreach ($this->list_active() as $so)
// @todo This should be configurable (days)
if (! $so->suspend_billing AND $so->date_next_invoice < time()+35*86400)
array_push($result,$so);
return $this->_list_active()
->where_open()->where('suspend_billing','IS',NULL)->or_where('suspend_billing','=','0')->where_close()
->where('date_next_invoice','<',time()+$days*86400)
->find_all();
}
return $result;
/**
* List services that need to be provisioned
*/
public function list_provision() {
return $this->_list_active()->where('queue','=','PROVISION');
}
}
?>