Fixed bugs in AJAX search
This commit is contained in:
parent
60bcdf1f2d
commit
cde0312586
|
|
@ -49,8 +49,6 @@ class EnquiriesController extends AppController {
|
||||||
foreach($enquiry['Email'] as $email) {
|
foreach($enquiry['Email'] as $email) {
|
||||||
$emailIDs[] = $email['id'];
|
$emailIDs[] = $email['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$emails = $this->Enquiry->Email->find('all', array('conditions'=>array('Email.id'=>$emailIDs)));
|
$emails = $this->Enquiry->Email->find('all', array('conditions'=>array('Email.id'=>$emailIDs)));
|
||||||
|
|
||||||
$this->set('emails', $emails);
|
$this->set('emails', $emails);
|
||||||
|
|
@ -489,7 +487,7 @@ class EnquiriesController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$customerFields = array('Customer.id', 'Customer.name');
|
$customerFields = array('Customer.id', 'Customer.name');
|
||||||
$enquiryFields = array('Enquiry.id', 'Enquiry.title', 'Customer.name', 'Customer.id');
|
$enquiryFields = array('Enquiry.id', 'Enquiry.title','Enquiry.created','Principle.short_name', 'Principle.name', 'Customer.name', 'Customer.id', 'Contact.first_name','Contact.last_name', 'Contact.id');
|
||||||
$contactFields = array('Contact.id', 'Contact.type','Contact.customer_id', 'Contact.first_name','Contact.last_name', 'Customer.name');
|
$contactFields = array('Contact.id', 'Contact.type','Contact.customer_id', 'Contact.first_name','Contact.last_name', 'Customer.name');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
class UsersController extends AppController {
|
class UsersController extends AppController {
|
||||||
|
|
||||||
var $name = 'Users';
|
var $name = 'Users';
|
||||||
var $helpers = array('Html', 'Form');
|
var $helpers = array('Html', 'Form', 'Javascript', 'Text');
|
||||||
var $components = array('Acl','Auth', 'Cookie');
|
var $components = array('Acl','Auth', 'Cookie');
|
||||||
var $paginate = array(
|
var $paginate = array(
|
||||||
'Users' => array('order' => array('User.id' => 'desc'),
|
'Users' => array('order' => array('User.id' => 'desc'),
|
||||||
|
|
@ -79,6 +79,15 @@ class UsersController extends AppController {
|
||||||
$user = $this->User->read(null, $id);
|
$user = $this->User->read(null, $id);
|
||||||
$this->set('user', $user);
|
$this->set('user', $user);
|
||||||
|
|
||||||
|
$emailIDs = array();
|
||||||
|
foreach($user['Email'] as $email) {
|
||||||
|
$emailIDs[] = $email['id'];
|
||||||
|
}
|
||||||
|
$emails = $this->User->Email->find('all', array('conditions'=>array('Email.id'=>$emailIDs)));
|
||||||
|
$this->set('emails', $emails);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch($user['User']['type']) {
|
switch($user['User']['type']) {
|
||||||
case 'contact':
|
case 'contact':
|
||||||
$this->render('viewContact');
|
$this->render('viewContact');
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,12 @@
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $html->link($enquiryRes['Enquiry']['title'], array('controller'=>'enquiries', 'action'=>'view', $enquiryRes['Enquiry']['id'])); ?></td>
|
<td><?php echo $html->link($enquiryRes['Enquiry']['title'], array('controller'=>'enquiries', 'action'=>'view', $enquiryRes['Enquiry']['id'])); ?></td>
|
||||||
<td> <?php echo $html->link($enquiryRes['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiryRes['Customer']['id'])); ?></td>
|
<td> <?php echo $html->link($enquiryRes['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiryRes['Customer']['id'])); ?></td>
|
||||||
<td> <?php echo $html->link($enquiryRes['Contact']['first_name'].' '.$enquiryRes['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiryRes['Contact']['id'])); ?></td>
|
<td> <?php echo $html->link($enquiryRes['Contact']['first_name'].' '.$enquiryRes['Contact']['last_name'], array('controller'=> 'users', 'action'=>'view', $enquiryRes['Contact']['id'])); ?></td>
|
||||||
<td><?php echo $html->link('View', array('controller'=>'enquiries', 'action'=>'view', $enquiryRes['Enquiry']['id'])); ?></td>
|
<td><?php echo $html->link('View', array('controller'=>'enquiries', 'action'=>'view', $enquiryRes['Enquiry']['id'])); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -136,8 +135,8 @@
|
||||||
?>
|
?>
|
||||||
<td><?php echo $contact['Contact']['first_name'];?></td>
|
<td><?php echo $contact['Contact']['first_name'];?></td>
|
||||||
<td><?php echo $contact['Contact']['last_name'];?></td>
|
<td><?php echo $contact['Contact']['last_name'];?></td>
|
||||||
<td><?php echo $html->link($contact['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $contact['Customer']['id'])); ?></td>
|
<td><?php echo $html->link($contact['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $contact['Contact']['customer_id'])); ?></td>
|
||||||
<td><?php echo $html->link(__('View', true), array('controller'=>'contacts', 'action'=>'view', $contact['Contact']['id'])); ?></td>
|
<td><?php echo $html->link(__('View', true), array('controller'=>'users', 'action'=>'view', $contact['Contact']['id'])); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$i++;
|
$i++;
|
||||||
|
|
|
||||||
|
|
@ -46,3 +46,12 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="related">
|
||||||
|
<h3>
|
||||||
|
Emails From this User<?php echo $html->image('internet-mail.png'); ?>
|
||||||
|
</h3>
|
||||||
|
<?php echo $this->element('email_table_ajax', array('emails' => $emails)); ?>
|
||||||
|
<?php //echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue