Added Service Add, some internal consistency updates
This commit is contained in:
@@ -35,6 +35,8 @@ class Model_Product extends ORM_OSB {
|
||||
),
|
||||
);
|
||||
|
||||
protected $_form = array('id'=>'id','value'=>'description()');
|
||||
|
||||
protected $_nullifempty = array(
|
||||
'price_group',
|
||||
);
|
||||
@@ -107,6 +109,13 @@ class Model_Product extends ORM_OSB {
|
||||
return ORM::factory(Kohana::classname(sprintf('Product_Plugin_%s',$this->prod_plugin_file)),$this->prod_plugin_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the plugin to store data during an update
|
||||
*/
|
||||
public function plugin_edit() {
|
||||
return (is_null($x = $this->plugin())) ? NULL : $x->render_edit();
|
||||
}
|
||||
|
||||
public function save(Validation $validation=NULL) {
|
||||
parent::save($validation);
|
||||
|
||||
@@ -187,16 +196,6 @@ class Model_Product extends ORM_OSB {
|
||||
return $price ? $price : array('0'=>array('price_base'=>0,'price_setup'=>0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the plugin to store data
|
||||
*/
|
||||
public function admin_update() {
|
||||
if (is_null($plugin = $this->plugin()))
|
||||
return NULL;
|
||||
else
|
||||
return $plugin->admin_update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the configured price groups for this product
|
||||
*/
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* This class supports Product Plugins.
|
||||
*
|
||||
* @package Product
|
||||
* @package Product/Plugin
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
@@ -13,12 +13,6 @@ abstract class Model_Product_Plugin extends ORM_OSB {
|
||||
// Reset any sorting that may be defined in our parent
|
||||
protected $_sorting = array();
|
||||
|
||||
/**
|
||||
* The admin_update should be implemented in plugins.
|
||||
* It is used to update the plugin specific product information
|
||||
*/
|
||||
abstract public function admin_update();
|
||||
|
||||
/**
|
||||
* The cost of this service
|
||||
*/
|
||||
@@ -30,13 +24,20 @@ abstract class Model_Product_Plugin extends ORM_OSB {
|
||||
*/
|
||||
abstract public function feature_summary();
|
||||
|
||||
abstract public function supplier();
|
||||
|
||||
/**
|
||||
* Return the name of the plugin
|
||||
*/
|
||||
protected function plugin() {
|
||||
return strtolower(preg_replace('/(.*)_([a-zA-Z]+)$/',"$2",get_class($this)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Form info for admins to update with plugin data
|
||||
*/
|
||||
abstract public function render_edit();
|
||||
|
||||
abstract public function render_order();
|
||||
|
||||
abstract public function supplier();
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user