From 5b1f72489bb990bab7569afc6a8f90540529f17a Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Mon, 6 Jul 2009 11:25:53 +1000 Subject: [PATCH] Rah --- controllers/industries_controller.php | 3 +-- models/industry.php | 36 ++++++++++++++++++++++++++ views/industries/.add.ctp.swp | Bin 12288 -> 12288 bytes views/industries/.view.ctp.swp | Bin 16384 -> 16384 bytes views/industries/add.ctp | 1 - views/industries/view.ctp | 27 +++++-------------- 6 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 models/industry.php diff --git a/controllers/industries_controller.php b/controllers/industries_controller.php index 1098423b..98b8430b 100644 --- a/controllers/industries_controller.php +++ b/controllers/industries_controller.php @@ -27,10 +27,9 @@ class IndustriesController extends AppController { $this->Session->setFlash(__('The Industry could not be saved. Please, try again.', true)); } } - $customers = $this->Industry->Customer->find('list'); $parents = $this->Industry->find('list', array('conditions' => array( 'Industry.parent_id' => null))); - $this->set(compact('customers', 'parents')); + $this->set(compact('parents')); } function edit($id = null) { diff --git a/models/industry.php b/models/industry.php new file mode 100644 index 00000000..fed8c8ab --- /dev/null +++ b/models/industry.php @@ -0,0 +1,36 @@ + array( + 'className' => 'Customer', + 'joinTable' => 'industries_customers' + // 'foreignKey' => 'industry_id', + // 'associationForeignKey' => 'customer_id' + ) + ); + + + var $belongsTo = array ( + 'ParentIndustry' => array( + 'className' => 'Industries', + 'foreignKey' => 'parent_id' + + ) + ); + + var $hasMany = array ( + 'subIndustry' => array( + 'className' => 'Industries', + 'foreignKey' => 'parent_id', + 'dependent' => true + ) + ); + +} + +?> diff --git a/views/industries/.add.ctp.swp b/views/industries/.add.ctp.swp index 6d0f748e9bd9b3d31a91f69c00913a9138fe77e5..394622af52a446a82a58854288c16ed47105f508 100644 GIT binary patch delta 144 zcmZojXh={vI28Jc8eZ5?di8FL7GcaT)7UfJ_sIt*zDKl$nNt&+3 z=6B3;Jd7fnc?G`n^Xl?2FiZqukS>wQf(r76Cj1Nx>Ojl_#DDo17@h<1Lm+MiVlE)= evI1_s|~A1~Kq;tbu&3=G+cML81}s%&&w$~@74b@MxB zIUYvQ&AbBN`FS~b7#IqG7^FpXvY>*zp*TMSgD?=Y0r6u#28KI8d<=*W0C5TszvN|L t$N}QdKwWh}T)sI`!GLG-0$riaM|3)wxSdOjOY(D5i_|r(C!6b^1OVaSB%1&L diff --git a/views/industries/.view.ctp.swp b/views/industries/.view.ctp.swp index 09b1902eed78b7f38b61faff8ee6b38601efc789..e05017808d2a82890de1a461e103ab63233e8bf7 100644 GIT binary patch delta 641 zcmYk)O-K}R7{~Evc6D`j+uRXkJs8fox}t~OO(IDL53vSnn=eFo5Wx~tS}@ne1vOky z=tWBGUwP>g1ci_kLlj1r4&lj5hal`)NH36`>Y#mxb)kU||7V_O{xidGCZE^xdCk0- zxX_g{TVuzCBP3!Cr@BwS56f~yiaU+XCp{j~o%z@eEohRx`(4~0q(&KuNy9yRhSI j?)Ta8(TSOkyX`Yog-Up`+c{j76}_qU?Xc5jzw-VA`4fWT delta 910 zcmciBO=uHA6bJCPHEpuBX|sYf+KQ8pW)ssiTPZ}`%?3rNl}0KQi;!BYX%?7o?Kyq#$@ghoSP zv&!YMEK3ay6CNMY(<|8vXFv4PYKUkdUn{Ra55GG1u}7N1XJO9)v;q5=?`My97w<~W z7*nUX#8UO~ZX!2)^Af#;XRraIa0HgSh)h@j1EygV&cLUGL_3{C4F0yblDK(?FqOE_U_m6Ew&CEpQiF~b4vDjF}xNcgtn{v$ASWAWs zYo82TQ=Pr})r7xZ$zLnT)Bh{mi_UI)DK;}aq@k3pl)@#3vZ#!|Khf8g(e2wq_XKYV thf}}-cCJEzOUk132%|OdgAY9Rx^lM@e=)*y>M7oxcJp8~X>X~MuD|kG!2AFJ diff --git a/views/industries/add.ctp b/views/industries/add.ctp index fc9b4618..4823a24b 100644 --- a/views/industries/add.ctp +++ b/views/industries/add.ctp @@ -5,7 +5,6 @@ input('name'); echo $form->input('parent_id'); - echo $form->input('Customer'); ?> end('Submit');?> diff --git a/views/industries/view.ctp b/views/industries/view.ctp index 1a7194f6..864bfbae 100644 --- a/views/industries/view.ctp +++ b/views/industries/view.ctp @@ -11,19 +11,8 @@ } ?> -
- > - > - -   - - > - > - link($industry['ParentIndustry']['name'], array('controller'=> 'industries', 'action'=>'view', $industry['ParentIndustry']['id'])); ?> -   - -
- + +
  • link(__('Edit Industry', true), array('action'=>'edit', $industry['Industry']['id'])); ?>
  • @@ -34,9 +23,9 @@
+ @@ -112,9 +104,4 @@ -
-
    -
  • link(__('New Customer', true), array('controller'=> 'customers', 'action'=>'add'));?>
  • -
-