diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index 218bd734..a5136848 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -22,6 +22,7 @@ class EnquiriesController extends AppController { $status_list[] = array($status['Status']['id'], $status['Status']['name']); } $this->set('status_list', $status_list); + } function view($id = null) { diff --git a/controllers/product_categories_controller.php b/controllers/product_categories_controller.php new file mode 100644 index 00000000..ed484830 --- /dev/null +++ b/controllers/product_categories_controller.php @@ -0,0 +1,63 @@ +ProductCategory->recursive = 0; + $this->set('productCategories', $this->paginate()); + } + + function view($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid ProductCategory.', true)); + $this->redirect(array('action'=>'index')); + } + $this->set('productCategory', $this->ProductCategory->read(null, $id)); + $this->set('products', $this->ProductCategory->Product->findAllByProductCategoryId($id)); + } + + function add() { + if (!empty($this->data)) { + $this->ProductCategory->create(); + if ($this->ProductCategory->save($this->data)) { + $this->Session->setFlash(__('The ProductCategory has been saved', true)); + $this->redirect(array('action'=>'index')); + } else { + $this->Session->setFlash(__('The ProductCategory could not be saved. Please, try again.', true)); + } + } + } + + function edit($id = null) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(__('Invalid ProductCategory', true)); + $this->redirect(array('action'=>'index')); + } + if (!empty($this->data)) { + if ($this->ProductCategory->save($this->data)) { + $this->Session->setFlash(__('The ProductCategory has been saved', true)); + $this->redirect(array('action'=>'index')); + } else { + $this->Session->setFlash(__('The ProductCategory could not be saved. Please, try again.', true)); + } + } + if (empty($this->data)) { + $this->data = $this->ProductCategory->read(null, $id); + } + } + + function delete($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid id for ProductCategory', true)); + $this->redirect(array('action'=>'index')); + } + if ($this->ProductCategory->del($id)) { + $this->Session->setFlash(__('ProductCategory deleted', true)); + $this->redirect(array('action'=>'index')); + } + } + +} +?> diff --git a/controllers/products_controller.php b/controllers/products_controller.php index 9d7643a1..f69102bb 100755 --- a/controllers/products_controller.php +++ b/controllers/products_controller.php @@ -3,7 +3,7 @@ class ProductsController extends AppController { var $name = 'Products'; var $components = array('RequestHandler'); - var $helpers = array('Html', 'Form', 'Ajax', 'Number'); + var $helpers = array('Html', 'Form', 'Ajax', 'Number', 'Fck'); function index() { $this->Product->recursive = 0; diff --git a/models/enquiry.php b/models/enquiry.php index 538401b8..518f3182 100755 --- a/models/enquiry.php +++ b/models/enquiry.php @@ -73,6 +73,7 @@ class Enquiry extends AppModel { /*Custom Validation Rule to Check that Enquiries with Australian States are assigned to Australia. * and that Overseas enquiries are NOT assigned to Australia. * Not Portable at all. This code is only for CMC usage + * Should probably change this to use RegExes. */ function checkStates($data) { @@ -93,10 +94,8 @@ class Enquiry extends AppModel { } } } - - - - + + //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'User' => array('className' => 'User', diff --git a/views/elements/enquiry_table.ctp b/views/elements/enquiry_table.ctp index 039cf7ed..ce4aaeeb 100644 --- a/views/elements/enquiry_table.ctp +++ b/views/elements/enquiry_table.ctp @@ -82,7 +82,14 @@ foreach ($enquiries as $enquiry): echo date('j M Y',$time->toUnix($enquiry['Enquiry']['created'])); ?>
| Title | ++ | +
|---|