From 33bd0e1f2ef6e12217bc95e18502200c9a395a95 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 21 Aug 2014 00:06:47 +0530 Subject: [PATCH 01/19] Attachments are not attached in outbound mails Fixes #223 --- classes/class-supportflow-emails.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/classes/class-supportflow-emails.php b/classes/class-supportflow-emails.php index a5adb13..77582f0 100644 --- a/classes/class-supportflow-emails.php +++ b/classes/class-supportflow-emails.php @@ -169,11 +169,7 @@ public function email_conversation( $ticket_id, $to ) { $msg .= SupportFlow()->sanitize_ticket_reply( $ticket_reply->post_content ); $msg .= '

'; - if ( $ticket_attachments = get_posts( array( 'post_type' => 'attachment', 'post_parent' => $ticket_reply->ID, 'posts_per_page' => -1 ) ) ) { - foreach ( $ticket_attachments as $attachment ) { - $attachments[] = get_attached_file( $attachment->ID ); - } - } + $attachments[] = $this->get_attached_files( $ticket_reply->ID ); } self::mail( $to, $subject, $msg, 'Content-Type: text/html', $attachments ); } @@ -247,9 +243,9 @@ public function get_quoted_text( $ticket ) { public function get_attached_files( $reply_id ) { $attachments = array(); - if ( $ticket_attachments = get_posts( array( 'post_type' => 'attachment', 'post_parent' => $reply_id, 'posts_per_page' => -1 ) ) ) { + if ( $ticket_attachments = get_post_meta( $reply_id, 'sf_attachments' ) ) { foreach ( $ticket_attachments as $attachment ) { - $attachments[] = get_attached_file( $attachment->ID ); + $attachments[] = get_attached_file( $attachment ); } } From 28476e8ca59c6521cc632317d4c740505adfd1dc Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 21 Aug 2014 00:51:01 +0530 Subject: [PATCH 02/19] Removed unrequired file --- classes/class-supportflow-ui-submissionform.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/classes/class-supportflow-ui-submissionform.php b/classes/class-supportflow-ui-submissionform.php index 6b672c9..042f21b 100644 --- a/classes/class-supportflow-ui-submissionform.php +++ b/classes/class-supportflow-ui-submissionform.php @@ -106,8 +106,6 @@ public function action_init_handle_form_submission() { return; } - // Load required file - require_once( SupportFlow()->plugin_dir . 'classes/class-supportflow-admin.php' ); $ticket_id = SupportFlow()->create_ticket( array( From a158a920583923cb37da639dec8fac72ae293834 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 21 Aug 2014 02:02:43 +0530 Subject: [PATCH 03/19] Created a function to generate predefines replie dropdown --- classes/class-supportflow-admin.php | 29 +------------ .../class-supportflow-predefined-replies.php | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/classes/class-supportflow-admin.php b/classes/class-supportflow-admin.php index 38303f2..8f0e673 100644 --- a/classes/class-supportflow-admin.php +++ b/classes/class-supportflow-admin.php @@ -929,28 +929,6 @@ public function meta_box_cc_bcc() { public function meta_box_replies() { global $pagenow; - $predefined_replies = get_posts( array( 'post_type' => SupportFlow()->predefinded_replies_type, 'posts_per_page' => -1 ) ); - $pre_defs = array( array( 'title' => __( 'Pre-defined Replies', 'supportflow' ), 'content' => '' ) ); - - foreach ( $predefined_replies as $predefined_reply ) { - $content = $predefined_reply->post_content; - - if ( ! empty( $predefined_reply->post_title ) ) { - $title = $predefined_reply->post_title; - } else { - $title = $predefined_reply->post_content; - } - - // Limit size to 75 characters - if ( strlen( $title ) > 75 ) { - $title = substr( $title, 0, 75 - 3 ) . '...'; - } - - if ( 0 != strlen( $content ) ) { - $pre_defs[] = array( 'title' => $title, 'content' => $content ); - } - } - $email_account_id = get_post_meta( get_the_ID(), 'email_account', true ); $email_account = SupportFlow()->extend->email_accounts->get_email_account( $email_account_id ); @@ -971,11 +949,8 @@ public function meta_box_replies() { echo '

' . __( 'Conversation', 'supportflow' ) . '

'; echo '
'; - echo '
'; + SupportFlow()->extend->predefined_replies->get_dropdown_input(); + echo ''; echo '
'; echo "