Changeset 2275758
- Timestamp:
- 04/04/2020 10:24:26 AM (6 years ago)
- Location:
- apollo/trunk
- Files:
-
- 2 edited
-
apollo.php (modified) (9 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
apollo/trunk/apollo.php
r2249467 r2275758 4 4 * Plugin URI: https://wordpress.org/plugins/apollo 5 5 * Description: Manually or automatically generate invoices and send PDFs as attachments for WooCommerce orders. 6 * Version: 1.1. 46 * Version: 1.1.5 7 7 * Author: Studio404 8 8 * Text Domain: apollo 9 9 * Domain Path: /languages 10 * WC tested up to: 5.3.210 * WC tested up to: 4.0.1 11 11 * WC requires at least: 3.0 12 12 */ … … 14 14 defined( 'ABSPATH' ) or exit; 15 15 16 define( 'APOLLO_VERSION', '1.1. 4' );16 define( 'APOLLO_VERSION', '1.1.5' ); 17 17 18 18 function apollo_load_plugin() { … … 68 68 function add_apollo_document_to_email( $attachments, $status, $order ) { 69 69 // this is called when Woocommerce email is sent, functions creates/sends apollo documents based on settings 70 71 // Only add attachment if new order, completed order or invoice mail 72 if($status != 'customer_invoice' && $status != 'new_order' && $status != 'customer_completed_order') { 73 return; 74 } 75 76 // only send attachments for new order if payment 77 if($status == 'new_order' && !($order->get_payment_method() == 'bacs' || $order->get_payment_method() == 'cod')) { 78 return; 79 } 80 70 81 $lang = explode('_', get_locale())[0]; 71 82 … … 77 88 $pdf_invoice_path = APOLLO_DOCUMENTS_DIR."/invoice - ".$invoice_number.".pdf"; 78 89 79 80 90 $auto_estimate = (bool) get_option('apollo_general_settings')['apollo_send-estimate']; // send estimate automatically setting 81 91 $estimate_number = get_post_meta( $order->get_id(), 'apollo_estimate_number', true); … … 83 93 $pdf_estimate_path = APOLLO_DOCUMENTS_DIR."/estimate - ".$estimate_number.".pdf"; 84 94 $payment_type = 'apollo_payment-'.$order->get_payment_method(); 95 $order_paid = get_post_meta( $order->get_id(), '_date_paid', true); 85 96 86 97 //chechk if order payment matches any of the payments set in apollo settings … … 113 124 update_post_meta( $order->get_id(), 'apollo_invoice_sent', true ); 114 125 115 } else if ($auto_estimate && $order->get_payment_method() === 'bacs' ) { // new order; bank transfer126 } else if ($auto_estimate && $order->get_payment_method() === 'bacs' && $status !== 'customer_completed_order') { // new order; bank transfer 116 127 $estimate = Apollo_invoice::create($order->get_id(), 'estimate'); 117 128 $attachments[] = Apollo_invoice::getPdf($estimate['id'], $estimate['number'], 'estimate'); … … 119 130 120 131 } else if ($auto_invoice && $payment_enabled && $order_paid !== '') { // new order; status matches invoice settings 132 $invoice = Apollo_invoice::create($order->get_id(), 'invoice'); 133 $attachments[] = Apollo_invoice::getPdf($invoice['id'], $invoice['number'], 'invoice'); 134 update_post_meta( $order->get_id(), 'apollo_invoice_sent', true ); 135 136 } else if ($auto_invoice && $payment_enabled && $order->get_payment_method() == 'cod') { // new order; status matches invoice settings and payment is cash on delivery 121 137 $invoice = Apollo_invoice::create($order->get_id(), 'invoice'); 122 138 $attachments[] = Apollo_invoice::getPdf($invoice['id'], $invoice['number'], 'invoice'); … … 136 152 137 153 //chechk if order payment matches any of the payments set in apollo settings 138 $payment_enabled = isset(get_option('apollo_general_settings')[$payment_type]) ? (bool) get_option('apollo_general_settings')[$payment_type] : false;154 $payment_enabled = isset(get_option('apollo_general_settings')[$payment_type]) ? (bool) get_option('apollo_general_settings')[$payment_type] : false; 139 155 140 156 if ( $order->get_payment_method() === 'bacs') { // new order; bank transfer 141 157 Apollo_invoice::create($order_id, 'estimate'); 142 } else if ($ payment_enabled) {158 } else if ($order->get_payment_method() === 'cod') { 143 159 Apollo_invoice::create($order_id, 'invoice'); 144 160 } … … 152 168 153 169 $payment_type = 'apollo_payment-'.$order->get_payment_method(); 154 $payment_enabled = isset(get_option('apollo_general_settings')[$payment_type]) ? (bool) get_option('apollo_general_settings')[$payment_type] : false;170 $payment_enabled = isset(get_option('apollo_general_settings')[$payment_type]) ? (bool) get_option('apollo_general_settings')[$payment_type] : false; 155 171 156 172 $order_paid = get_post_meta( $order->get_id(), '_date_paid', true); -
apollo/trunk/readme.txt
r2249467 r2275758 85 85 86 86 == Changelog == 87 = 1.1.5 - April 4, 2020 = 88 89 - Fixed: Sending documents on fail order 90 - Updated: Invoices are now created when order is completed, only exceptin is Cash On Delivery payment, where invoice is created with new order (invoice is not marked as paid in this case) 91 92 == Changelog == 87 93 = 1.1.4 - February 24, 2020 = 88 94
Note: See TracChangeset
for help on using the changeset viewer.