From b2bf24913f4ee2cd72b038e96369b38371ed4d6d Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Thu, 16 Jul 2009 15:51:40 +1000 Subject: [PATCH] Various little changes. some SQL differences too which arent tracked. stupidly --- controllers/customers_controller.php | 1 + controllers/enquiries_controller.php | 1 + controllers/industries_controller.php | 21 ++++++++++++-- models/industry.php | 10 +++++-- views/contacts/add.ctp | 1 + views/contacts/add_one.ctp | 1 + views/contacts/add_to_customer.ctp | 4 ++- views/contacts/edit.ctp | 1 + views/contacts/view.ctp | 8 ++++++ views/customers/index.ctp | 2 ++ views/customers/view.ctp | 18 ++++++++++++ views/elements/payment_terms_box.ctp | 2 +- views/industries/.add.ctp.swp | Bin 12288 -> 12288 bytes views/industries/add.ctp | 1 + views/industries/view.ctp | 40 +++++++++++++++++++++++++- views/layouts/default.ctp | 13 --------- views/principles/add.ctp | 1 + views/principles/edit.ctp | 1 + views/principles/view.ctp | 8 ++++++ views/products/add.ctp | 5 +++- 20 files changed, 116 insertions(+), 23 deletions(-) diff --git a/controllers/customers_controller.php b/controllers/customers_controller.php index e136dfbd..ec8b1add 100755 --- a/controllers/customers_controller.php +++ b/controllers/customers_controller.php @@ -39,6 +39,7 @@ class CustomersController extends AppController { $status_list[] = array($status['Status']['id'], $status['Status']['name']); } $this->set('status_list', $status_list); + $this->set('parent_industry_list', $this->Customer->Industry->find('list', array('conditions' => array('parent_id' => null)))); } function add() { diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index fb8237a1..5d828e11 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -46,6 +46,7 @@ class EnquiriesController extends AppController { if($enquiry['Enquiry']['shipping_address_id'] != 0) { $this->set('shippingaddress', $this->Enquiry->ShippingAddress->findById($enquiry['Enquiry']['shipping_address_id'])); } + } diff --git a/controllers/industries_controller.php b/controllers/industries_controller.php index 86cf321f..c03319ff 100644 --- a/controllers/industries_controller.php +++ b/controllers/industries_controller.php @@ -32,21 +32,36 @@ class IndustriesController extends AppController { $this->redirect(array('action'=>'index')); } $this->set('industry', $this->Industry->read(null, $id)); + $subCustomers = $this->Industry->findAllByParentId($id); + $this->set('sub_customers', $subCustomers); + + $catCust = ""; + foreach ($subCustomers as $indust) { + foreach ($indust['Customer'] as $subcust) { + $myid = $subcust['id']; + $catCust[$myid] = $subcust; + } + + } + $this->set('category_customers', $catCust); + + } function add() { if (!empty($this->data)) { if ($this->Industry->save($this->data)) { - + $newid = $this->Industry->id; $new_industry = $this->Industry->findById($newid); if($new_industry['Industry']['parent_id'] == 0) { - + + $newsub = $this->data['Industry']['sub_category']; $this->Industry->create(); $this->data['Industry']['parent_id'] = $newid; - $this->data['Industry']['name'] = $new_industry['Industry']['name']." - General"; + $this->data['Industry']['name'] = $newsub; $this->Industry->save($this->data); } $this->Session->setFlash(__('The Industry has been saved', true)); diff --git a/models/industry.php b/models/industry.php index 8a9a44de..0838e991 100644 --- a/models/industry.php +++ b/models/industry.php @@ -8,9 +8,10 @@ class Industry extends AppModel { var $hasAndBelongsToMany = array ( 'Customer' => array( 'className' => 'Customer', - 'joinTable' => 'industries_customers', - 'unique' => false - ) + 'joinTable' => 'industries_customers' + // 'foreignKey' => 'industry_id', + // 'associationForeignKey' => 'customer_id' + ) ); @@ -30,6 +31,9 @@ class Industry extends AppModel { ) ); + + + } ?> diff --git a/views/contacts/add.ctp b/views/contacts/add.ctp index 1994dc5b..4c5e8161 100755 --- a/views/contacts/add.ctp +++ b/views/contacts/add.ctp @@ -13,6 +13,7 @@ echo $form->input('mobile'); echo $form->input('fax'); echo $form->input('contact_category_id'); + echo $form->input('job_title'); echo $form->input('notes'); ?> diff --git a/views/contacts/add_one.ctp b/views/contacts/add_one.ctp index 0a295a35..e1b368a7 100644 --- a/views/contacts/add_one.ctp +++ b/views/contacts/add_one.ctp @@ -15,6 +15,7 @@ echo $form->input("Contact.mobile"); echo $form->input("Contact.fax"); echo $form->input("Contact.contact_category_id", array('options' => $contact_categories, 'label' => 'Contact Department')); + echo $form->input("Contact.job_title"); echo $form->input("Contact.notes"); echo $form->input("Contact.customer_id", array('type'=>'hidden', 'value' => $customerid)); ?> diff --git a/views/contacts/add_to_customer.ctp b/views/contacts/add_to_customer.ctp index 65ed1635..79716bdc 100755 --- a/views/contacts/add_to_customer.ctp +++ b/views/contacts/add_to_customer.ctp @@ -13,8 +13,10 @@ echo $form->input('mobile'); echo $form->input('fax'); echo $form->input('contact_category_id', array('label'=>'Contact Department', 'empty' => 'Please Choose a Department')); + echo $form->input('job_title'); echo $form->input('notes'); - ?> + +?> end('Submit');?> diff --git a/views/contacts/edit.ctp b/views/contacts/edit.ctp index e70a29f1..ce396ca2 100755 --- a/views/contacts/edit.ctp +++ b/views/contacts/edit.ctp @@ -14,6 +14,7 @@ echo $form->input('mobile'); echo $form->input('fax'); echo $form->input('contact_category_id', array('label' => 'Department', 'empty' => 'Please Choose a Department')); + echo $form->input('job_title'); echo $form->input('notes'); ?> diff --git a/views/contacts/view.ctp b/views/contacts/view.ctp index 5de16f18..eb2e187a 100755 --- a/views/contacts/view.ctp +++ b/views/contacts/view.ctp @@ -42,11 +42,19 @@   + > >   + + > + > + +   + + > > diff --git a/views/customers/index.ctp b/views/customers/index.ctp index 44ff785a..dd1dd7bc 100755 --- a/views/customers/index.ctp +++ b/views/customers/index.ctp @@ -85,3 +85,5 @@ foreach ($customers as $customer):
  • link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?>
  • + + diff --git a/views/customers/view.ctp b/views/customers/view.ctp index 81cf10d2..9468c638 100755 --- a/views/customers/view.ctp +++ b/views/customers/view.ctp @@ -57,6 +57,22 @@ + + + +
    input('name'); echo $form->input('short_name'); echo $form->input('code'); + echo $form->input('url'); echo $form->input('address'); echo $form->input('city'); echo $form->input('state'); diff --git a/views/principles/edit.ctp b/views/principles/edit.ctp index 6462d139..09bb0228 100755 --- a/views/principles/edit.ctp +++ b/views/principles/edit.ctp @@ -7,6 +7,7 @@ echo $form->input('name'); echo $form->input('short_name'); echo $form->input('code'); + echo $form->input('url'); echo $form->input('address'); echo $form->input('city'); echo $form->input('state'); diff --git a/views/principles/view.ctp b/views/principles/view.ctp index 296c619b..908aff1b 100755 --- a/views/principles/view.ctp +++ b/views/principles/view.ctp @@ -11,12 +11,20 @@   + > >   + > + > + link($principle['Principle']['url'], $principle['Principle']['url']); ?> +   + + + > > link($principle['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $principle['Country']['id'])); ?> diff --git a/views/products/add.ctp b/views/products/add.ctp index f69c532c..3ed686d7 100755 --- a/views/products/add.ctp +++ b/views/products/add.ctp @@ -7,7 +7,10 @@ input('principle_id'); echo $form->input('title'); - echo $fck->fckeditor(array('Product', 'description'), ''); + echo "
    "; + echo ""; + echo $fck->fckeditor(array('Product', 'description'), ''); + echo "
    "; //echo $form->input('description'); echo $form->input('part_number'); echo $form->input('product_category_id');