20Mar09 Dev starting again
This commit is contained in:
parent
55a8d8cc79
commit
5021f77c69
|
|
@ -67,7 +67,9 @@ class ContactsController extends AppController {
|
||||||
$this->set('increment', $increment);
|
$this->set('increment', $increment);
|
||||||
}
|
}
|
||||||
function add_one($customerid) {
|
function add_one($customerid) {
|
||||||
|
$contact_categories = $this->Contact->ContactCategory->find('list');
|
||||||
$this->set('customerid', $customerid);
|
$this->set('customerid', $customerid);
|
||||||
|
$this->set('contact_categories', $contact_categories);
|
||||||
}
|
}
|
||||||
function remove_one($customerid) {
|
function remove_one($customerid) {
|
||||||
$contacts = $this->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customerid)));
|
$contacts = $this->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customerid)));
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class EnquiriesController extends AppController {
|
||||||
if ($this->Enquiry->save($this->data)) {
|
if ($this->Enquiry->save($this->data)) {
|
||||||
$id = $this->Enquiry->id;
|
$id = $this->Enquiry->id;
|
||||||
if($this->data['Enquiry']['send_enquiry_email'] == 1) {
|
if($this->data['Enquiry']['send_enquiry_email'] == 1) {
|
||||||
$this->__sendNewEnquiryEmail($id);
|
$this->__addToQueue($id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->Session->setFlash(__('The Enquiry has been saved but the Contact has NOT been emailed, as you requested.', true));
|
$this->Session->setFlash(__('The Enquiry has been saved but the Contact has NOT been emailed, as you requested.', true));
|
||||||
|
|
@ -154,6 +154,24 @@ class EnquiriesController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Add enquiry_id to the Email Queue */
|
||||||
|
|
||||||
|
function __addToQueue($id) {
|
||||||
|
$enquiry = $this->Enquiry->read(null, $id);
|
||||||
|
$this->Enquiry->EnquiryEmailQueue->create();
|
||||||
|
$this->data['EnquiryEmailQueue']['enquiry_id'] = $enquiry['Enquiry']['id'];
|
||||||
|
if ($this->Enquiry->EnquiryEmailQueue->save($this->data)) {
|
||||||
|
$this->Session->setFlash(__('The Enquiry has been saved and the Enquiry notification email has been added to the Queue', true));
|
||||||
|
$this->redirect(array('action'=>'view/'.$enquiry['Enquiry']['id']), null, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->Session->setFlash(__('The Enquiry has been saved but the notification email could not be added to the Queue.', true));
|
||||||
|
$this->redirect(array('action'=>'view/'.$enquiry['Enquiry']['id']), null, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Generate Enquiry number and return it as a string */
|
/* Generate Enquiry number and return it as a string */
|
||||||
|
|
||||||
function __generateEnquiryNumber($data) {
|
function __generateEnquiryNumber($data) {
|
||||||
|
|
@ -256,7 +274,7 @@ class EnquiriesController extends AppController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Moving this to the new Enquiry email sender. */
|
||||||
function __sendNewEnquiryEmail($id) {
|
function __sendNewEnquiryEmail($id) {
|
||||||
|
|
||||||
//Setup the SMTP Options
|
//Setup the SMTP Options
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ class PrincipleContactsController extends AppController {
|
||||||
if (!empty($this->data)) {
|
if (!empty($this->data)) {
|
||||||
$this->PrincipleContact->create();
|
$this->PrincipleContact->create();
|
||||||
if ($this->PrincipleContact->save($this->data)) {
|
if ($this->PrincipleContact->save($this->data)) {
|
||||||
$this->Session->setFlash(__('The PrincipleContact has been saved', true));
|
$this->Session->setFlash(__('The Contact has been added to the Principle', true));
|
||||||
$principleid = $this->data['PrincipleContact']['principle_id'];
|
$principleid = $this->data['PrincipleContact']['principle_id'];
|
||||||
$this->redirect(array('controller'=>'Principles', 'action'=>'index'));
|
$this->redirect(array('controller'=>'Principles', 'action'=>'view/'.$principleid));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The PrincipleContact could not be saved. Please, try again.', true));
|
$this->Session->setFlash(__('The PrincipleContact could not be saved. Please, try again.', true));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ class PrinciplesController extends AppController {
|
||||||
var $helpers = array('Html', 'Form');
|
var $helpers = array('Html', 'Form');
|
||||||
|
|
||||||
var $paginate = array(
|
var $paginate = array(
|
||||||
'Principle' => array('order' => array('Principle.id' => 'asc')),
|
'Principle' => array('limit' => 50, 'order' => array('Principle.name' => 'asc')),
|
||||||
'Enquiry' => array('limit' => 200, 'order' => array('Enquiry.id' => 'desc'))
|
'Enquiry' => array('limit' => 200, 'order' => array('Enquiry.id' => 'desc'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,9 @@ class Enquiry extends AppModel {
|
||||||
'foreignKey' => 'enquiry_id',
|
'foreignKey' => 'enquiry_id',
|
||||||
'dependent' => false
|
'dependent' => false
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var $hasOne = array('EnquiryEmailQueue');
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
7
models/enquiry_email_queue.php
Normal file
7
models/enquiry_email_queue.php
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
class EnquiryEmailQueue extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'EnquiryEmailQueue';
|
||||||
|
var $belongsTo = array('Enquiry');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -13,7 +13,11 @@ class Product extends AppModel {
|
||||||
'conditions' => '',
|
'conditions' => '',
|
||||||
'fields' => '',
|
'fields' => '',
|
||||||
'order' => ''
|
'order' => ''
|
||||||
)
|
),
|
||||||
|
|
||||||
|
'ProductCategory' => array('className'=>'ProductCategory',
|
||||||
|
'foreignKey' => 'product_category_id'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
models/product_category.php
Normal file
13
models/product_category.php
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
class ProductCategory extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'ProductCategory';
|
||||||
|
|
||||||
|
var $hasMany = array('Product'=>array('className'=>'Product',
|
||||||
|
'foreignKey'=>'product_category_id'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
echo $form->input("Contact.phone");
|
echo $form->input("Contact.phone");
|
||||||
echo $form->input("Contact.mobile");
|
echo $form->input("Contact.mobile");
|
||||||
echo $form->input("Contact.fax");
|
echo $form->input("Contact.fax");
|
||||||
echo $form->input("Contact.contact_category_id");
|
echo $form->input("Contact.contact_category_id", array('options' => $contact_categories, 'label' => 'Contact Department'));
|
||||||
echo $form->input("Contact.notes");
|
echo $form->input("Contact.notes");
|
||||||
echo $form->input("Contact.customer_id", array('type'=>'hidden', 'value' => $customerid));
|
echo $form->input("Contact.customer_id", array('type'=>'hidden', 'value' => $customerid));
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,9 @@
|
||||||
</dd>
|
</dd>
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Comments'); ?></dt>
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Comments'); ?></dt>
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||||
|
<span class="enquiry-view-comments">
|
||||||
<?php echo $enquiry['Enquiry']['comments']; ?>
|
<?php echo $enquiry['Enquiry']['comments']; ?>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ foreach ($principles as $principle):
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<?php echo $html->link(__('View', true), array('action'=>'view', $principle['Principle']['id'])); ?>
|
<?php echo $html->link(__('View', true), array('action'=>'view', $principle['Principle']['id'])); ?>
|
||||||
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $principle['Principle']['id'])); ?>
|
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $principle['Principle']['id'])); ?>
|
||||||
<?php echo $html->link(__('Delete', true), array('action'=>'delete', $principle['Principle']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $principle['Principle']['id'])); ?>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
|
||||||
|
|
@ -127,4 +127,3 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?pr($principle); ?>
|
|
||||||
|
|
|
||||||
|
|
@ -795,7 +795,7 @@ div.code-coverage-results span.result-good {
|
||||||
|
|
||||||
div.principle-emails {
|
div.principle-emails {
|
||||||
float: right;
|
float: right;
|
||||||
background: #E5E5E5;
|
background: #ECF2F2;
|
||||||
border: 1px black dashed;
|
border: 1px black dashed;
|
||||||
width: auto;
|
width: auto;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
@ -850,6 +850,13 @@ span.principle-emails {
|
||||||
color: #000000;
|
color: #000000;
|
||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.enquiry-view-comments {
|
||||||
|
color: #000000;
|
||||||
|
font-size: 100%;
|
||||||
|
text-align: left;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
span.tip {
|
span.tip {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue