diff --git a/controllers/email_attachments_controller.php b/controllers/email_attachments_controller.php index ab5d7f81..63b1d1a1 100755 --- a/controllers/email_attachments_controller.php +++ b/controllers/email_attachments_controller.php @@ -12,8 +12,6 @@ class EmailAttachmentsController extends AppController { $file = $this->EmailAttachment->findById($id); $file_path = Configure::read('email_directory'); - echo $file_path."/".$file['EmailAttachment']['name']; - die(); if(file_exists($file_path."/".$file['EmailAttachment']['name'])) { diff --git a/models/email.php b/models/email.php index dcbe0cfb..d507cc36 100755 --- a/models/email.php +++ b/models/email.php @@ -12,6 +12,7 @@ class Email extends AppModel { 'EmailAttachment' => array('className' => 'EmailAttachment', 'foreignKey' => 'email_id', 'dependent' => true, + 'order' => 'EmailAttachment.size DESC', 'counterCache'=>'email_attachment_count'), 'EmailRecipient' => array('className' => 'EmailRecipient', diff --git a/models/email_attachment.php b/models/email_attachment.php index b0329957..e03dc9b5 100755 --- a/models/email_attachment.php +++ b/models/email_attachment.php @@ -3,6 +3,10 @@ class EmailAttachment extends AppModel { var $name = 'EmailAttachment'; + + var $order = "EmailAttachment.size DESC"; + + var $belongsTo = array( 'Email' => array('className' => 'Email', 'foreignKey' => 'email_id', diff --git a/views/enquiries/add.ctp b/views/enquiries/add.ctp index 16815835..66e4b2e5 100755 --- a/views/enquiries/add.ctp +++ b/views/enquiries/add.ctp @@ -11,7 +11,7 @@ doesn't appear in the drop down list, click 'New Contact'")); ?> echo $form->input('Customer.name', array('readonly'=>'readonly', 'value'=>$customer['Customer']['name'])); echo $form->input('user_id', array('label' =>'Assigned to User'), $users); echo '
'; - echo $form->input('contact_user_id', array('div' => false)); + echo $form->input('contact_user_id', array('type'=>'select', 'options'=>$contacts)); echo '
'; //echo $ajax->link('New Contact', array('controller' => 'contacts', 'action' => 'add_one',$customer['Customer']['id']), array('update'=>'contact')); //echo $html->image('contact-new.png'); diff --git a/webroot/js/add_edit_user.js b/webroot/js/add_edit_user.js index d954e14c..53bb0fe3 100644 --- a/webroot/js/add_edit_user.js +++ b/webroot/js/add_edit_user.js @@ -32,13 +32,15 @@ $(function() { autoOpen: false, width: 450, modal: true, - title: 'Add a Contact' + position: 'top', }); - $("#addContactUser").click(function() { //Meh, we'll just repeat this for the 3 user types. Easiest way to handle this.' + $("#addContactUser").click(function() { //Adding a Contact to a Customer. var userType = 'contact'; var customer_id = $('.customer_id').attr('id'); var thisAction = 'add' + + $("#addUserDiv").dialog( "option", "title", 'Add Contact to Customer' ); $("#addUserDiv").load('/users/add_edit/action:'+thisAction+'/type:'+userType+'/customer_id:'+customer_id); $("#addUserDiv").dialog('open'); return false; @@ -50,7 +52,7 @@ $(function() { var userType ='contact'; var thisAction = 'edit'; var user_id = $(this).attr('id'); - + $("#addUserDiv").dialog( "option", "title", 'Edit Customer Contact' ); $("#addUserDiv").load('/users/add_edit/action:'+thisAction+'/type:'+userType+'/user_id:'+user_id); $("#addUserDiv").dialog('open');