Improved service display

This commit is contained in:
Deon George
2011-07-14 19:09:03 +10:00
parent 46c3b9a075
commit 27cdab1fe4
37 changed files with 1319 additions and 1042 deletions

View File

@@ -9,6 +9,7 @@
* @author Deon George
* @copyright (c) 2010 Open Source Billing
* @license http://dev.osbill.net/license.html
* @todo Replace View::factory files to use $this->viewpath()
*/
class Controller_Admin_Service extends Controller_TemplateDefault {
protected $control = array('Services'=>'services');
@@ -17,6 +18,7 @@ class Controller_Admin_Service extends Controller_TemplateDefault {
'listbycheckout'=>TRUE,
'listadslservices'=>TRUE,
'listhspaservices'=>TRUE,
'update'=>TRUE,
);
/**
@@ -355,7 +357,7 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
Block::add(array(
'title'=>_('ADSL Services'),
'body'=>$output,
));
));
if ($summary)
Block::add(array(
@@ -411,5 +413,28 @@ GROUP BY DATE_FORMAT(DATE,"%%Y-%%m"),SID
return $return;
}
public function action_update($id) {
$so = ORM::factory('service',$id);
if (! $so->loaded())
Request::current()->redirect('welcome/index');
if ($_POST) {
if (isset($_POST['plugin']) AND $_POST['plugin'])
if (! $so->plugin()->values($_POST['plugin'])->update()->saved())
throw new Kohana_Exception('Failed to save updates to plugin data for record :record',array(':record'=>$so->id()));
if (! $so->values($_POST)->update()->saved())
throw new Kohana_Exception('Failed to save updates to plugin data for record :record',array(':record'=>$so->id()));
}
Block::add(array(
'title'=>sprintf('%s %s:%s',_('Update Service'),$so->id(),$so->name()),
'body'=>View::factory($so->viewpath())
->set('so',$so)
->set('plugin_form',$so->admin_update()),
));
}
}
?>