Various little changes. some SQL differences too which arent tracked. stupidly

This commit is contained in:
Karl Cordes 2009-07-16 15:51:40 +10:00
parent a6aedb0198
commit b2bf24913f
20 changed files with 116 additions and 23 deletions

View file

@ -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() {

View file

@ -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']));
}
}

View file

@ -32,6 +32,20 @@ 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() {
@ -44,9 +58,10 @@ class IndustriesController extends AppController {
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));

View file

@ -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 {
)
);
}
?>

View file

@ -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');
?>
</fieldset>

View file

@ -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));
?>

View file

@ -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');
?>
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>

View file

@ -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');
?>
</fieldset>

View file

@ -42,11 +42,19 @@
<?php echo $contact['Contact']['direct_phone']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Fax'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $contact['Contact']['fax']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Job Title'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $contact['Contact']['job_title']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Notes'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $contact['Contact']['notes']; ?>

View file

@ -85,3 +85,5 @@ foreach ($customers as $customer):
<li><?php echo $html->link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?> </li>
</ul>
</div>

View file

@ -57,6 +57,22 @@
</ul>
</div>
<div class="related">
<h3><?php __('Industries that this Customer has been tagged in'); ?></h3>
<?php if(!empty($customer['Industry'])): ?>
<ul id="industrytaglist">
<?php foreach ($customer['Industry'] as $industry) {
echo "<li>".$html->link(__($industry['name'],true), array('action'=>'view', 'controller'=>'industries', $industry['id']))."</li>";
}
echo "</ul>";
endif;
echo "<br>";
echo "<div class=\"actions\">".$html->link("Tag Industries for this Customer", array('action'=>'tagindustries',$customer['Customer']['id']))."</div>";
?>
</div>
<div class="related">
<h3><?php __('Contacts');?><?php echo $html->image('system-users.png'); ?></h3>
<div class="actions">
@ -148,3 +164,5 @@
<? debug($customer, true); ?>
<?php debug($parent_industry_list); ?>

View file

@ -1,5 +1,5 @@
<?
echo $form->input('payment_terms', array('options' => array(
echo $form->input('payment_terms', array('empty'=>'Select the Terms of Payment', 'options' => array(
'100% Payment with Order' => '100% Payment with Order',
'Net 7 Days for Approved Accounts' => 'Net 7 Days for Approved Accounts',
'Net 14 Days for Approved Accounts' => 'Net 14 Days for Approved Accounts',

Binary file not shown.

View file

@ -16,6 +16,7 @@ else {
if(!isset($parent)) {
echo $form->input('parent_id', array('type'=>'hidden', 'value' => 0));
echo $form->input('sub_category', array('label'=>'Name of the first Sub-Industry to this new Industry'));
}
else {
echo $form->input('parent_id', array('type'=>'hidden', 'value' => $parent['Industry']['id']));

View file

@ -64,7 +64,9 @@
<div class="related">
<h3><?php __('Customers in this Industry');?></h3>
<?php if (!empty($industry['Customer'])):?>
<?php if (!empty($industry['Customer'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Name'); ?></th>
@ -91,6 +93,42 @@
</tr>
<?php endforeach; ?>
</table>
<?php
elseif (!empty($category_customers)): ?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Name'); ?></th>
<th><?php __('Notes'); ?></th>
<th><?php __('Payment Terms'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($category_customers as $customer):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $customer['name'];?></td>
<td><?php echo $customer['notes'];?></td>
<td><?php echo $customer['payment_terms'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'customers', 'action'=>'view', $customer['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'customers', 'action'=>'edit', $customer['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
<?php debug($industry); ?>

View file

@ -111,7 +111,6 @@ if (window.attachEvent) window.attachEvent("onload", sfHover);
<li><h3><?php echo $html->link('Quotes', '/quotes/index'); ?></h3>
<ul>
<li><?php echo $html->link('Quote Index', '/quotes/index'); ?></li>
<li><?php echo $html->link('New Quote', '/quotes/add'); ?></li>
<li><?php echo $html->link('Find Quote', '/quotes/find'); ?></li>
</ul>
</li>
@ -140,18 +139,6 @@ if (window.attachEvent) window.attachEvent("onload", sfHover);
</div>
<div id="searchbox-appear">
<?php echo $form->create('Enquiry', array('id'=>'searchbox', 'action'=>'search'));
echo $form->input('Enquiry No', array('label'=>false, 'id'=>'searchbox', 'div'=>false));
echo $form->submit('Quick Lookup', array('div'=>false));
echo $form->end();
?>
</div>
</div>
<div id="content">
<?php

View file

@ -6,6 +6,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');

View file

@ -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');

View file

@ -11,12 +11,20 @@
<?php echo $principle['Principle']['short_name']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Code'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $principle['Principle']['code']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('URL'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($principle['Principle']['url'], $principle['Principle']['url']); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Country'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($principle['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $principle['Country']['id'])); ?>

View file

@ -7,7 +7,10 @@
<?php
echo $form->input('principle_id');
echo $form->input('title');
echo $fck->fckeditor(array('Product', 'description'), '');
echo "<div class=\"input text\">";
echo "<label for=\"data[Product][description\">Description</label>";
echo $fck->fckeditor(array('Product', 'description'), '');
echo "</div>";
//echo $form->input('description');
echo $form->input('part_number');
echo $form->input('product_category_id');