Display if emails are manually sent

This commit is contained in:
Mike Jolley 2015-11-03 15:40:10 +00:00
parent d95f863d79
commit 8457dbb57d
5 changed files with 43 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -2111,9 +2111,20 @@ img.help_tip {
margin: 0 0 0 9px;
}
.status-enabled {
.status-enabled,
.status-manual {
font-size: 1.4em;
@include ir();
}
.status-manual {
&:before {
@include icon( "\e008" );
color: #999;
}
}
.status-enabled {
&:before {
@include icon( "\e015" );
color: $woocommerce;

View File

@ -231,8 +231,8 @@ class WC_Settings_Emails extends WC_Settings_Page {
$columns = apply_filters( 'woocommerce_email_setting_columns', array(
'status' => '',
'name' => __( 'Email', 'woocommerce' ),
'email_type' => __( 'Type', 'woocommerce' ),
'recipient' => __( 'Recipient', 'woocommerce' ),
'email_type' => __( 'Content Type', 'woocommerce' ),
'recipient' => __( 'Recipient(s)', 'woocommerce' ),
'actions' => ''
) );
foreach ( $columns as $key => $column ) {
@ -257,17 +257,25 @@ class WC_Settings_Emails extends WC_Settings_Page {
break;
case 'recipient' :
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
' . esc_html( $email->is_customer_email() ? __( 'Customer', 'woocommerce' ) : $email->recipient ) . '
' . esc_html( $email->is_customer_email() ? __( 'Customer', 'woocommerce' ) : $email->get_recipient() ) . '
</td>';
break;
case 'status' :
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';
echo $email->is_enabled() ? '<span class="status-enabled tips" data-tip="' . __( 'Enabled', 'woocommerce' ) . '">' . __ ( 'Yes', 'woocommerce' ) . '</span>' : '<span class="status-disabled tips" data-tip="' . __ ( 'Disabled', 'woocommerce' ) . '">-</span>';
if ( $email->is_manual() ) {
echo '<span class="status-manual tips" data-tip="' . __( 'Manually sent', 'woocommerce' ) . '">' . __( 'Manual', 'woocommerce' ) . '</span>';
} elseif ( $email->is_enabled() ) {
echo '<span class="status-enabled tips" data-tip="' . __( 'Enabled', 'woocommerce' ) . '">' . __( 'Yes', 'woocommerce' ) . '</span>';
} else {
echo '<span class="status-disabled tips" data-tip="' . __( 'Disabled', 'woocommerce' ) . '">-</span>';
}
echo '</td>';
break;
case 'email_type' :
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
' . esc_html( $email->get_email_type() ) . '
' . esc_html( $email->get_content_type() ) . '
</td>';
break;
case 'actions' :

View File

@ -44,7 +44,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
parent::__construct();
$this->customer_email = true;
$this->enabled = 'yes'; // Always enabled - this email is manual
$this->manual = true;
$this->heading_paid = $this->get_option( 'heading_paid', $this->heading_paid );
$this->subject_paid = $this->get_option( 'subject_paid', $this->subject_paid );
}

View File

@ -35,7 +35,7 @@ class WC_Email extends WC_Settings_API {
/**
* 'yes' if the method is enabled.
* @var string
* @var string yes, no
*/
public $enabled;
@ -117,6 +117,12 @@ class WC_Email extends WC_Settings_API {
*/
public $sending;
/**
* True when the email notification is sent manually only.
* @var bool
*/
protected $manual = false;
/**
* True when the email notification is sent to customers.
* @var bool
@ -263,7 +269,7 @@ class WC_Email extends WC_Settings_API {
$recipient = apply_filters( 'woocommerce_email_recipient_' . $this->id, $this->recipient, $this->object );
$recipients = array_map( 'trim', explode( ',', $recipient ) );
$recipients = array_filter( $recipients, 'is_email' );
return implode( ',', $recipients );
return implode( ', ', $recipients );
}
/**
@ -339,16 +345,22 @@ class WC_Email extends WC_Settings_API {
/**
* Checks if this email is enabled and will be sent.
*
* @return bool
*/
public function is_enabled() {
return apply_filters( 'woocommerce_email_enabled_' . $this->id, 'yes' === $this->enabled, $this->object );
}
/**
* Checks if this email is manually sent
* @return bool
*/
public function is_manual() {
return $this->manual;
}
/**
* Checks if this email is customer focussed.
*
* @return bool
*/
public function is_customer_email() {