Edit in Place Collection for Enquiry Status Working OK
This commit is contained in:
parent
8b6312ad47
commit
92d0284b7f
|
|
@ -5,16 +5,23 @@ class EnquiriesController extends AppController {
|
|||
|
||||
var $name = 'Enquiries';
|
||||
var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax', 'Number', 'Text');
|
||||
|
||||
|
||||
var $paginate = array(
|
||||
'limit' => 250,
|
||||
'order'=>array('Enquiry.id' => 'desc'));
|
||||
|
||||
var $components = array('Email');
|
||||
var $components = array('RequestHandler', 'Email');
|
||||
|
||||
function index() {
|
||||
$this->Enquiry->recursive = 0;
|
||||
$this->set('enquiries', $this->paginate());
|
||||
$statuses = $this->Enquiry->Status->find('all');
|
||||
$status_list = array();
|
||||
foreach ($statuses as $status) {
|
||||
$status_list[] = array($status['Status']['id'], $status['Status']['name']);
|
||||
}
|
||||
$this->set('status_list', $status_list);
|
||||
}
|
||||
|
||||
function view($id = null) {
|
||||
|
|
@ -258,7 +265,7 @@ class EnquiriesController extends AppController {
|
|||
'timeout' => '15',
|
||||
'host' => '192.168.0.6');
|
||||
$this->Email->delivery = 'smtp';
|
||||
$this->Email->charset = 'iso-8859-15';
|
||||
|
||||
$enquiry = $this->Enquiry->read(null, $id);
|
||||
$this->Email->to = $enquiry['Contact']['email'];
|
||||
$this->Email->cc = array($enquiry['User']['email']);
|
||||
|
|
@ -269,7 +276,7 @@ class EnquiriesController extends AppController {
|
|||
$this->Email->from = 'CMC Technologies - Sales <sales@cmctechnologies.com.au>';
|
||||
$this->Email->template = 'enquiry_added';
|
||||
$this->Email->sendAs = 'both';
|
||||
|
||||
$this->Email->charset = 'iso-8859-1';
|
||||
$this->set('enquiry', $enquiry);
|
||||
if($this->Email->send()) {
|
||||
$this->Session->setFlash(__('The Enquiry has been added and the Contact has been emailed', true));
|
||||
|
|
@ -336,8 +343,13 @@ class EnquiriesController extends AppController {
|
|||
}
|
||||
|
||||
function update_status($enquiryid) {
|
||||
if(!empty($this->data)) {
|
||||
$this->Enquiry->save($this->data);
|
||||
$newid = $this->params['form']['value'];
|
||||
if($newid) {
|
||||
$this->Enquiry->id = $enquiryid;
|
||||
$this->Enquiry->saveField('status_id', $newid);
|
||||
$this->set('enquiry', $this->Enquiry->findById($enquiryid));
|
||||
$this->layout='ajax';
|
||||
$this->render();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
7
vendors/shells/vault.php
vendored
7
vendors/shells/vault.php
vendored
|
|
@ -25,7 +25,7 @@ class VaultShell extends Shell {
|
|||
$number_of_messages = $MC->Nmsgs;
|
||||
|
||||
/* Loop through the messages and sort them into ones to be processed or discarded */
|
||||
for ($i=1; $i <= $number_of_messages; $i++) {
|
||||
for ($i=1; $i < $number_of_messages; $i++) {
|
||||
$this_header = imap_headerinfo($mbox, $i);
|
||||
$message = $this->getMessage($mbox, $i, $this_header);
|
||||
$enquiry = $this->checkIfValidEnquiry($message['subject'], $testing);
|
||||
|
|
@ -155,7 +155,7 @@ function fetchBodyAttachments($mailbox, $msg_number, $filename, $email_dir) {
|
|||
$name = explode('=', $words[2]);
|
||||
$attachments[$j]['type'] = $type[1];
|
||||
$attachments[$j]['name'] = $name[1];
|
||||
|
||||
echo "in message number $msg_number: found attachment ".$attachments[$j]['name'].' '.$attachments[$j]['type']."\n";
|
||||
}
|
||||
return $attachments;
|
||||
}
|
||||
|
|
@ -251,7 +251,8 @@ function checkIfValidEnquiry($subject, $testing) {
|
|||
return $enquiry;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
//$i = 0;
|
||||
$i = 0;
|
||||
foreach ($enquiries as $enquiry):
|
||||
$class = null;
|
||||
//if ($i++ % 2 == 0) {
|
||||
|
|
@ -58,8 +58,7 @@ foreach ($enquiries as $enquiry):
|
|||
|
||||
|
||||
?>
|
||||
<tr<?php echo $class;?>>
|
||||
|
||||
<tr<?php echo $class;?> id="<?php echo $i; ?>">
|
||||
<?php $nameclass = null;
|
||||
if($enquiry['Enquiry']['posted'] == 1) {
|
||||
$nameclass = ' class="posted"';
|
||||
|
|
@ -107,8 +106,10 @@ foreach ($enquiries as $enquiry):
|
|||
<?php echo $html->link($enquiry['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $enquiry['Country']['id'])); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $html->link($enquiry['Status']['name'], array('controller'=> 'statuses', 'action'=>'view', $enquiry['Status']['id'])); ?>
|
||||
<td><div id="statusupdate_<?php echo $i;?>"><?php echo $enquiry['Status']['name']; ?></div>
|
||||
<?php
|
||||
echo $ajax->editor("statusupdate_$i", array('controller'=>'Enquiries', 'action'=>'update_status', $enquiry['Enquiry']['id']), array('update' => "statusupdate_$i", 'collection' => $status_list, 'okText'=>'Change Status', 'savingText' => 'Saving..', 'formId' => 'EnquiryStatusId'));
|
||||
?>
|
||||
</td>
|
||||
<td class = "comments">
|
||||
<?php
|
||||
|
|
@ -126,6 +127,7 @@ foreach ($enquiries as $enquiry):
|
|||
|
||||
</td>
|
||||
</tr>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -136,3 +138,4 @@ foreach ($enquiries as $enquiry):
|
|||
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
|
||||
</div>
|
||||
|
||||
<?php print_r($status_list); ?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="enquiries index">
|
||||
<h2><?php __('Master Enquiry Register');?></h2>
|
||||
<? echo $this->element('enquiry_table', $enquiries); ?>
|
||||
<? echo $this->element('enquiry_table', $enquiries, $status_list); ?>
|
||||
</div>
|
||||
|
|
|
|||
1
views/enquiries/update_status.ctp
Normal file
1
views/enquiries/update_status.ctp
Normal file
|
|
@ -0,0 +1 @@
|
|||
<?php echo $enquiry['Status']['name']; ?>
|
||||
Loading…
Reference in a new issue