Fixed view_user_email query

This commit is contained in:
Karl Cordes 2011-03-21 17:12:26 +11:00
parent 026be164bf
commit 72ccd205ef
4 changed files with 32 additions and 2 deletions

View file

@ -67,6 +67,7 @@ class EmailsController extends AppController {
return $attachment['id'];
}
}
//Should do something else here to take a stab at it at least.
return false;
}
@ -95,8 +96,12 @@ class EmailsController extends AppController {
else {
//$this->set('emails', $this->paginate());
$fromMailIDs = $this->Email->find('list', array('conditions'=>array('Email.user_id'=>$id)));
$recMailIDs = $this->Email->EmailRecipient->find('list', array('conditions'=>array('EmailRecipient.user_id'=>$id)));
$recMailIDs = $this->Email->EmailRecipient->find('list', array('conditions'=>array('EmailRecipient.user_id'=>$id),
'fields'=>array('EmailRecipient.email_id', 'EmailRecipient.email_id')));
// print_r($recMailIDs);
// print_r($fromMailIDs);
$allIDs = $fromMailIDs + $recMailIDs;
sort($allIDs);

View file

@ -99,6 +99,10 @@ class UsersController extends AppController {
switch($user['User']['type']) {
case 'contact':
if(isset($user['User']['customer_id'])) {
$this->set('customer', $this->User->Customer->find('first',array('conditions'=>array('Customer.id'=>$user['User']['customer_id']), 'recursive'=>0)));
}
$this->render('viewContact');
break;
@ -111,6 +115,8 @@ class UsersController extends AppController {
//$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id)));
$this->render('viewUser');
break;

View file

@ -25,3 +25,4 @@ User Email<?php echo $html->image('internet-mail.png'); ?>
<?php //echo $this->element('email_table_ajax', $enquiry, array('cache'=>'+1 day')); ?>
</div>
<?php debug($userMail); ?>

View file

@ -1,6 +1,11 @@
<?=$javascript->link('view_user_email'); ?>
<div class="users view">
<h2><?php __('Contact: '.$user['User']['username'] );?></h2>
<h3>Customer: <?=$html->link($user['Customer']['name'], '/customers/view/'.$user['Customer']['id']);?></h3>
<? if(isset($customer)):?>
<h3>Customer: <?=$html->link($customer['Customer']['name'], '/customers/view/'.$customer['Customer']['id']);?></h3>
<? endif;?>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Username'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
@ -62,4 +67,17 @@
</dl>
</div>
<div class="related">
<h3>Email Correspondence with this Contact.</h3>
<button id="showEmail" class="showHide">Show</button>
<button id="hideEmail" class="showHide">Hide</button>
<div id="ajaxLoadEmail" style="display:none;"><?php echo $html->image('ajax-loader.gif'); ?></div>
<div id="emailTable">
</div>
</div>
<?php debug($user);?>