WordPress.org

Plugin Directory

Changeset 1702714


Ignore:
Timestamp:
07/25/17 23:59:31 (3 months ago)
Author:
dancameron
Message:

Deploy version 15

Location:
sprout-invoices
Files:
765 added
5 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • sprout-invoices/trunk/Sprout_Invoices.class.php

    r1688474 r1702714  
    3333     * Current version. Should match sprout-invoices.php plugin version. 
    3434     */ 
    35     const SI_VERSION = '14.0.5'; 
     35    const SI_VERSION = '15.0'; 
    3636    /** 
    3737     * DB Version 
  • sprout-invoices/trunk/bundles/Addon_Payment_Processors.php

    r1613648 r1702714  
    2020            require_once SI_PATH.'/bundles/sprout-invoices-addon-woocommerce/inc/Woo_Payment_Processor.php'; 
    2121        } 
     22 
     23        if ( file_exists( SI_PATH.'/bundles/sprout-invoices-addon-squareup/inc/Square_Up.php' ) ) { 
     24            if ( ! defined( 'SA_ADDON_SQUARE_URL' ) ) { 
     25                define( 'SA_ADDON_SQUARE_URL', plugins_url( '/sprout-invoices-addon-squareup', __FILE__ ) ); 
     26            } 
     27            require_once SI_PATH.'/bundles/sprout-invoices-addon-squareup/inc/Square_Up.php'; 
     28        } 
    2229    } 
    2330} 
  • sprout-invoices/trunk/changelog.txt

    r1688474 r1702714  
     1= 15.0 = 
     2 
     3* NEW: New Default Theme!!!! 
     4* NEW: Updates to support the new Service Fee add-on. 
     5* NEW: Fees are added to reports. 
     6* NEW: Support for Square payments, new add-on will be released soon. 
     7* NEW: Added info for recurring invoice on the invoice admin. 
     8* NEW: Notification shortcode to show payments 
     9* FIX: Bulk edit causing lost client association. 
     10 
    111= 14.0.5 = 
    212 
  • sprout-invoices/trunk/controllers/_Controller.php

    r1688474 r1702714  
    158158            'ajax_url' => get_admin_url().'admin-ajax.php', 
    159159            'plugin_url' => SI_URL, 
    160             'thank_you_string' => __( 'Thank you', 'sprout-invoices' ), 
     160            'thank_you_string' => __( 'Thank you!', 'sprout-invoices' ), 
    161161            'updating_string' => __( 'Updating...', 'sprout-invoices' ), 
    162162            'sorry_string' => __( 'Maybe next time?', 'sprout-invoices' ), 
     
    327327            $view .= '.php'; 
    328328        } 
     329        // in case locate template was used 
     330        $view = str_replace( SI_PATH.'/views/', '', $view ); 
     331 
    329332        $path = apply_filters( 'si_views_path', SI_PATH.'/views/' ); 
    330333        $file = $path.$view; 
  • sprout-invoices/trunk/controllers/clients/Clients.php

    r1586829 r1702714  
    600600        } 
    601601 
    602         $fields = apply_filters( 'si_client_form_fields', $fields ); 
     602        $fields = apply_filters( 'si_client_form_fields', $fields, $client ); 
    603603        uasort( $fields, array( __CLASS__, 'sort_by_weight' ) ); 
    604604        return $fields; 
  • sprout-invoices/trunk/controllers/compat/Compatibility.php

    r1688503 r1702714  
    2121        add_filter( 'manage_edit-'.SI_Invoice::POST_TYPE.'_columns', array( __CLASS__, 'deregister_columns' ) ); 
    2222        add_filter( 'manage_edit-'.SI_Estimate::POST_TYPE.'_columns', array( __CLASS__, 'deregister_columns' ) ); 
     23 
     24        add_filter( 'wpseo_enable_notification_post_slug_change', '__return_false' ); 
    2325 
    2426        add_action( 'post_updated', array( __CLASS__, 'set_updated_post_id' ), -100 ); 
  • sprout-invoices/trunk/controllers/fees/Fees.php

    r1649232 r1702714  
    3131            if ( isset( $data['total_callback'] ) && is_callable( $data['total_callback'] ) ) { 
    3232                    $fee_total = call_user_func_array( $data['total_callback'], array( $doc, $data ) ); 
    33             } elseif ( $data['total'] ) { 
     33            } elseif ( isset( $data['total'] ) ) { 
    3434                $fee_total = $data['total']; 
    3535            } 
  • sprout-invoices/trunk/controllers/invoices/Invoices_Template.php

    r1649232 r1702714  
    1717 
    1818        add_filter( 'si_line_item_content', array( __CLASS__, 'line_item_content_filter' ) ); 
    19  
    20         // Templating 
    21         add_action( 'wp_enqueue_scripts', array( __CLASS__, 'remove_scripts_and_styles' ), PHP_INT_MAX ); 
    22         add_action( 'wp_print_scripts', array( __CLASS__, 'remove_scripts_and_styles_from_stupid_themes_and_plugins' ), -PHP_INT_MAX ); // can't rely on themes to abide by enqueing correctly 
    2319    } 
    2420 
     
    7369        ), false ); 
    7470    } 
    75  
    76     /** 
    77      * Remove all actions to wp_print_scripts since stupid themes (and plugins) want to use it as a 
    78      * hook to enqueue scripts and plugins. Ideally we would live in a world where this wasn't necessary 
    79      * but it is. 
    80      * @return 
    81      */ 
    82     public static function remove_scripts_and_styles_from_stupid_themes_and_plugins() { 
    83         if ( SI_Invoice::is_invoice_query() && is_single() ) { 
    84             if ( apply_filters( 'si_remove_scripts_styles_on_doc_pages', '__return_true' ) ) { 
    85                 remove_all_actions( 'wp_print_scripts' ); 
    86             } 
    87         } 
    88     } 
    89  
    90     /** 
    91      * Remove all scripts and styles from the estimate view and then add those specific to si. 
    92      * @return 
    93      */ 
    94     public static function remove_scripts_and_styles() { 
    95         if ( SI_Invoice::is_invoice_query() && is_single() ) { 
    96             if ( apply_filters( 'si_remove_scripts_styles_on_doc_pages', '__return_true' ) ) { 
    97                 global $wp_scripts, $wp_styles; 
    98                 $allowed_scripts = apply_filters( 'si_allowed_doc_scripts', array( 'sprout_doc_scripts', 'qtip', 'dropdown' ) ); 
    99                 $allowed_admin_scripts = apply_filters( 'si_allowed_admin_doc_scripts', array_merge( array( 'admin-bar' ), $allowed_scripts ) ); 
    100                 if ( current_user_can( 'edit_sprout_invoices' ) ) { 
    101                     $wp_scripts->queue = $allowed_admin_scripts; 
    102                 } else { 
    103                     $wp_scripts->queue = $allowed_scripts; 
    104                 } 
    105                 $allowed_styles = apply_filters( 'si_allowed_doc_styles', array( 'sprout_doc_style', 'qtip', 'dropdown' ) ); 
    106                 $allowed_admin_styles = apply_filters( 'si_allowed_admin_doc_styles', array_merge( array( 'admin-bar' ), $allowed_styles ) ); 
    107                 if ( current_user_can( 'edit_sprout_invoices' ) ) { 
    108                     $wp_styles->queue = $allowed_admin_styles; 
    109                 } else { 
    110                     $wp_styles->queue = $allowed_styles; 
    111                 } 
    112                 do_action( 'si_doc_enqueue_filtered' ); 
    113             } else { 
    114                 // scripts 
    115                 wp_enqueue_script( 'sprout_doc_scripts' ); 
    116                 wp_enqueue_script( 'dropdown' ); 
    117                 wp_enqueue_script( 'qtip' ); 
    118                 // Styles 
    119                 wp_enqueue_style( 'sprout_doc_style' ); 
    120                 wp_enqueue_style( 'dropdown' ); 
    121                 wp_enqueue_style( 'qtip' ); 
    122             } 
    123         } 
    124     } 
    12571} 
  • sprout-invoices/trunk/controllers/line-items/Line_Items.php

    r1476062 r1702714  
    6767                $columns += array( 
    6868                        'desc' => array( 
    69                                 'label' => __( 'Services', 'sprout-invoices' ), 
     69                                'label' => __( 'Service', 'sprout-invoices' ), 
    7070                                'type' => 'textarea', 
    7171                                'calc' => false, 
     
    114114                $columns += array( 
    115115                        'desc' => array( 
    116                                 'label' => __( 'Products', 'sprout-invoices' ), 
     116                                'label' => __( 'Product', 'sprout-invoices' ), 
    117117                                'type' => 'textarea', 
    118118                                'calc' => false, 
     
    163163                $columns += array( 
    164164                        'desc' => array( 
    165                                 'label' => __( 'Tasks', 'sprout-invoices' ), 
     165                                'label' => __( 'Task', 'sprout-invoices' ), 
    166166                                'type' => 'textarea', 
    167167                                'calc' => false, 
     
    443443    ////////// 
    444444 
    445     public static function front_end_line_items( $doc_id = 0 ) { 
     445    public static function front_end_line_items( $doc_id = 0, $theme = '' ) { 
    446446        if ( ! $doc_id ) { 
    447447            $doc_id = get_the_id(); 
     
    450450        $line_items = $doc->get_line_items(); 
    451451        $context = ( is_a( $doc, 'SI_Invoice' ) ) ? 'invoice' : 'estimate' ; 
    452         self::load_view( 'templates/' . si_get_doc_context( $doc_id ) . '/line-items', array( 
     452 
     453        $template_path = self::locate_template( array( 
     454            $context . '/line-items.php', 
     455            '/line-items.php', 
     456        ), false ); 
     457 
     458        self::load_view( $template_path, array( 
    453459                'id' => $doc_id, 
    454460                'line_items' => $line_items, 
  • sprout-invoices/trunk/controllers/notifications/Notifications.php

    r1586829 r1702714  
    7373                    'name' => __( 'Invoice Available', 'sprout-invoices' ), 
    7474                    'description' => __( 'Customize the invoice email that is sent to selected recipients.', 'sprout-invoices' ), 
    75                     'shortcodes' => array( 'date', 'name', 'username', 'admin_note', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_deposit_amount', 'invoice_total_due', 'invoice_total_payments', 'client_name', 'client_address', 'client_company_website' ), 
     75                    'shortcodes' => array( 'date', 'name', 'username', 'admin_note', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_payments_list', 'invoice_payments_list_html', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_deposit_amount', 'invoice_total_due', 'invoice_total_payments', 'client_name', 'client_address', 'client_company_website' ), 
    7676                    'default_title' => sprintf( __( '%s: Your Invoice is Available', 'sprout-invoices' ), get_bloginfo( 'name' ) ), 
    7777                    'default_content' => self::load_view_to_string( 'notifications/invoice', null ), 
     
    8181                    'name' => __( 'Deposit Payment Received', 'sprout-invoices' ), 
    8282                    'description' => __( 'Customize the payment email that is sent to the client recipients when a deposit is made.', 'sprout-invoices' ), 
    83                     'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name',  'client_address', 'client_company_website' ), 
     83                    'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_payments_list', 'invoice_payments_list_html', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name',  'client_address', 'client_company_website' ), 
    8484                    'default_title' => sprintf( __( '%s: Deposit Received', 'sprout-invoices' ), get_bloginfo( 'name' ) ), 
    8585                    'default_content' => self::load_view_to_string( 'notifications/payment-deposit', null, false ), 
     
    8989                    'name' => __( 'Invoice Paid', 'sprout-invoices' ), 
    9090                    'description' => __( 'Customize the email sent to the client recipients when the final payment for an invoice is made.', 'sprout-invoices' ), 
    91                     'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name',  'client_address', 'client_company_website' ), 
     91                    'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_payments_list', 'invoice_payments_list_html', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name',  'client_address', 'client_company_website' ), 
    9292                    'default_title' => sprintf( __( '%s: Thank You', 'sprout-invoices' ), get_bloginfo( 'name' ) ), 
    9393                    'default_content' => self::load_view_to_string( 'notifications/payment-final', null, false ), 
     
    9696                    'name' => __( 'Payment Reminder', 'sprout-invoices' ), 
    9797                    'description' => __( 'Customize the email that is sent to the client recipients in order to remind them that their payment is overdue.', 'sprout-invoices' ), 
    98                     'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name', 'client_address', 'client_company_website' ), 
     98                    'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_tax_total', 'invoice_tax', 'invoice_tax2', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_payments_list', 'invoice_payments_list_html', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name', 'client_address', 'client_company_website' ), 
    9999                    'default_title' => sprintf( __( '%s: Invoice Payment Overdue', 'sprout-invoices' ),  get_bloginfo( 'name' ) ), 
    100100                    'default_content' => self::load_view_to_string( 'notifications/payment-reminder', null, false ), 
     
    127127                    'name' => __( 'Payment Received', 'sprout-invoices' ), 
    128128                    'description' => __( 'Customize the email sent to an admin when any payment is received.', 'sprout-invoices' ), 
    129                     'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name', 'client_edit_url', 'client_address', 'client_company_website' ), 
     129                    'shortcodes' => array( 'date', 'name', 'username', 'payment_total', 'payment_id', 'line_item_table', 'line_item_list', 'line_item_plain_list', 'invoice_subject', 'invoice_id', 'invoice_edit_url', 'invoice_url', 'invoice_issue_date', 'invoice_due_date', 'invoice_past_due_date', 'invoice_po_number', 'invoice_terms', 'invoice_notes', 'invoice_total', 'invoice_payments_list', 'invoice_payments_list_html', 'invoice_subtotal', 'invoice_calculated_total', 'invoice_total_due', 'invoice_deposit_amount', 'invoice_total_payments', 'client_name', 'client_edit_url', 'client_address', 'client_company_website' ), 
    130130                    'default_title' => sprintf( __( '%s: Payment Received', 'sprout-invoices' ), get_bloginfo( 'name' ) ), 
    131131                    'default_content' => self::load_view_to_string( 'notifications/admin-payment', null, false ), 
     
    230230                        'description' => __( 'Used to display the invoice total.', 'sprout-invoices' ), 
    231231                        'callback' => array( 'SI_Notifications', 'shortcode_invoice_total' ), 
     232                    ), 
     233                'invoice_payments_list' => array( 
     234                        'description' => __( 'Used to display the invoice payments.', 'sprout-invoices' ), 
     235                        'callback' => array( 'SI_Notifications', 'shortcode_invoice_payments_list' ), 
     236                    ), 
     237                'invoice_payments_list_html' => array( 
     238                        'description' => __( 'Used to display the invoice payments (in html).', 'sprout-invoices' ), 
     239                        'callback' => array( 'SI_Notifications', 'shortcode_invoice_payments_list_html' ), 
    232240                    ), 
    233241                'invoice_calculated_total' => array( 
     
    11771185    } 
    11781186 
     1187 
     1188 
     1189    /** 
     1190     * Return the invoice get_payments_total 
     1191     * 
     1192     * @param  array $atts 
     1193     * @param  string $content 
     1194     * @param  string $code 
     1195     * @param  array $data 
     1196     * @return string          filtered 
     1197     */ 
     1198    public static function shortcode_invoice_payments_list( $atts, $content, $code, $data ) { 
     1199        if ( ! isset( $data['invoice'] ) || ! is_a( $data['invoice'], 'SI_Invoice' ) ) { 
     1200            return; 
     1201        } 
     1202        $invoice_id = $data['invoice']->get_id(); 
     1203        $payments = $data['invoice']->get_payments(); 
     1204        if ( empty( $payments ) ) { 
     1205            return; 
     1206        } 
     1207 
     1208        $payments_list = ''; 
     1209 
     1210        foreach ( $payments as $payment_id ) { 
     1211            $payment = SI_Payment::get_instance( $payment_id ); 
     1212            $method = ( strpos( strtolower( $payment->get_payment_method() ), 'credit' ) !== false && $payment->get_payment_method() !== 'Credit' ) ? __( 'Credit Card', 'sprout-invoices' ) : $payment->get_payment_method(); 
     1213            $method_name = apply_filters( 'si_display_payment_name', $method, $payment ); 
     1214 
     1215            $payments_list = sprintf( __( '%1$s: %2$s on %3$s\\n', 'sprout-invoices' ), $method_name, sa_get_formatted_money( $payment->get_amount(), $invoice_id ), date( get_option( 'date_format' ), strtotime( $payment->get_post_date() ) ) ); 
     1216        } 
     1217 
     1218        return apply_filters( 'shortcode_invoice_payments_list', $payments_list, $data ); 
     1219    } 
     1220 
     1221 
     1222    /** 
     1223     * Return the invoice get_payments_total 
     1224     * 
     1225     * @param  array $atts 
     1226     * @param  string $content 
     1227     * @param  string $code 
     1228     * @param  array $data 
     1229     * @return string          filtered 
     1230     */ 
     1231    public static function shortcode_invoice_payments_list_html( $atts, $content, $code, $data ) { 
     1232        if ( ! isset( $data['invoice'] ) || ! is_a( $data['invoice'], 'SI_Invoice' ) ) { 
     1233            return; 
     1234        } 
     1235        $invoice_id = $data['invoice']->get_id(); 
     1236        $payments = $data['invoice']->get_payments(); 
     1237        if ( empty( $payments ) ) { 
     1238            return; 
     1239        } 
     1240 
     1241        $payments_list = ''; 
     1242 
     1243        foreach ( $payments as $payment_id ) { 
     1244            $payment = SI_Payment::get_instance( $payment_id ); 
     1245            $method = ( strpos( strtolower( $payment->get_payment_method() ), 'credit' ) !== false && $payment->get_payment_method() !== 'Credit' ) ? __( 'Credit Card', 'sprout-invoices' ) : $payment->get_payment_method(); 
     1246            $method_name = apply_filters( 'si_display_payment_name', $method, $payment ); 
     1247 
     1248            $payments_list = sprintf( __( '<strong>%1$s</strong>: %2$s on %3$s<br/>', 'sprout-invoices' ), $method_name, sa_get_formatted_money( $payment->get_amount(), $invoice_id ), date( get_option( 'date_format' ), strtotime( $payment->get_post_date() ) ) ); 
     1249        } 
     1250 
     1251        return apply_filters( 'shortcode_invoice_payments_list_html', $payments_list, $data ); 
     1252    } 
     1253 
    11791254    /** 
    11801255     * Return the 
  • sprout-invoices/trunk/controllers/notifications/Notifications_Control.php

    r1579080 r1702714  
    472472        } 
    473473        $headers = implode( "\r\n", $headers ) . "\r\n"; 
    474         $filtered_headers = apply_filters( 'si_notification_headers', $headers, $notification_name, $data, $from_email, $from_name, $html ); 
     474        $filtered_headers = apply_filters( 'si_notification_headers', stripslashes_deep( $headers ), $notification_name, $data, $from_email, $from_name, $html ); 
    475475        $attachments = apply_filters( 'si_notification_attachments', array(), $notification_name, $data, $from_email, $from_name, $html ); 
    476476 
     
    531531        } 
    532532        $headers = implode( "\r\n", $headers ) . "\r\n"; 
    533         $filtered_headers = apply_filters( 'si_notification_headers', $headers, $notification_name, $data, $from_email, $from_name, $html ); 
     533        $filtered_headers = apply_filters( 'si_notification_headers', stripslashes_deep( $headers ), $notification_name, $data, $from_email, $from_name, $html ); 
    534534        $attachments = apply_filters( 'si_notification_attachments', array(), $notification_name, $data, $from_email, $from_name, $html ); 
    535535 
  • sprout-invoices/trunk/controllers/payment-processing/Payment_Processors.php

    r1591334 r1702714  
    6565        } 
    6666        return apply_filters( 'si_enabled_processors', array_filter( $enabled ) ); 
     67    } 
     68 
     69    public static function doc_enabled_processors( $doc_id = 0 ) { 
     70        $enabled = get_option( self::ENABLED_PROCESSORS_OPTION, array() ); 
     71        if ( ! is_array( $enabled ) ) { 
     72            $enabled = array(); 
     73        } 
     74        return apply_filters( 'si_doc_enabled_processors', array_filter( $enabled ), $doc_id ); 
    6775    } 
    6876 
  • sprout-invoices/trunk/controllers/templating/Customizer.php

    r1613648 r1702714  
    99    public static function init() { 
    1010        add_action( 'customize_register', array( __CLASS__, 'customizer' ) ); 
    11         add_action( 'customize_preview_init', array( __CLASS__, 'customizer_js' ) ); 
    12         add_action( 'si_head', array( __CLASS__, 'inject_css' ) ); 
    1311 
    1412        // Admin bar 
     
    3432    } 
    3533 
    36  
    37     public static function customizer_js() { 
    38         wp_enqueue_script( 
    39             'si_customizer', 
    40             SI_URL . '/resources/admin/js/customizer.js', 
    41             array( 'jquery', 'customize-preview' ), 
    42             '0.3.0', 
    43             true 
    44         ); 
    45         add_filter( 'si_allowed_admin_doc_scripts', array( __CLASS__, 'allow_customizer_js' ) ); 
    46     } 
    47  
    48     public static function allow_customizer_js( $queue = array() ) { 
    49         $queue[] = 'customize-preview'; 
    50         $queue[] = 'si_customizer'; 
    51         return $queue; 
    52     } 
    53  
    5434    public static function customizer( $wp_customize ) { 
    55  
    5635        // Logo uploader 
    5736        $wp_customize->add_section( 'si_custommizer_section' , array( 
     
    7251        ) ) ); 
    7352 
    74         // Highlight and link color 
    75         $wp_customize->add_setting( 'si_invoices_color', array( 
    76             'default'           => '#FF5B4D', 
    77             'sanitize_callback' => 'sanitize_hex_color', 
    78             //'transport' => 'postMessage', 
    79         ) ); 
    80  
    81         $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'si_invoices_color', array( 
    82             'label'    => __( 'Invoice Highlight Color', 'sprout-invoices' ), 
    83             'section'  => 'si_custommizer_section', 
    84             'settings' => 'si_invoices_color', 
    85         ) ) ); 
    86  
    87         // Highlight and link color 
    88         $wp_customize->add_setting( 'si_estimates_color', array( 
    89             'default'           => '#4D9FFF', 
    90             'sanitize_callback' => 'sanitize_hex_color', 
    91             //'transport' => 'postMessage', 
    92         ) ); 
    93  
    94         $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'si_estimates_color', array( 
    95             'label'    => __( 'Estimate Highlight Color', 'sprout-invoices' ), 
    96             'section'  => 'si_custommizer_section', 
    97             'settings' => 'si_estimates_color', 
    98         ) ) ); 
    99     } 
    100  
    101     public static function inject_css() { 
    102         $inv_color = self::sanitize_hex_color( get_theme_mod( 'si_invoices_color' ) ); 
    103         $est_color = self::sanitize_hex_color( get_theme_mod( 'si_estimates_color' ) ); 
    104         ?> 
    105             <!-- Debut customizer CSS --> 
    106             <style> 
    107             #doc .doc_total, 
    108             .button.primary_button { 
    109                 background-color: <?php echo esc_attr( $est_color ); ?>; 
    110             } 
    111  
    112             #invoice #doc .doc_total, 
    113             #invoice .button.primary_button { 
    114                 background-color: <?php echo esc_attr( $inv_color ); ?>; 
    115             } 
    116  
    117             #invoice.paid #doc .doc_total, 
    118             #invoice .button.deposit_paid { 
    119                 background-color: <?php echo esc_attr( $est_color ); ?>; 
    120             } 
    121  
    122             #line_total { 
    123                 color: <?php echo esc_attr( $est_color ); ?>; 
    124             } 
    125  
    126             #invoice #line_total { 
    127                 color: <?php echo esc_attr( $inv_color ); ?>; 
    128             } 
    129             </style> 
    130         <?php 
    13153    } 
    13254 
     
    14971        return null; 
    15072    } 
     73 
     74    public static function sanitize_checkbox( $checked = false ) { 
     75         return ( ( isset( $checked ) && true == $checked ) ? true : false ); 
     76    } 
    15177} 
  • sprout-invoices/trunk/controllers/templating/Templating.php

    r1366210 r1702714  
    1313    const FILTER_QUERY_VAR = 'filter_doc'; 
    1414    const BLANK_SHORTCODE = 'si_blank'; 
     15    const INV_THEME_OPION = 'si_inv_theme_template'; 
     16    const EST_THEME_OPION = 'si_est_theme_template'; 
    1517 
    1618    private static $pages = array(); 
    1719    private static $shortcodes = array(); 
     20    private static $inv_theme_option = ''; 
     21    private static $est_theme_option = ''; 
     22    private static $themes = array( 
     23            'default' => 'Default', 
     24            'slate' => 'Slate', 
     25            'original' => 'Original', 
     26        ); 
    1827 
    1928    public static function get_template_pages() { 
     
    2534    } 
    2635 
     36    public static function theme_templates() { 
     37        return self::$themes; 
     38    } 
     39 
     40    public static function get_invoice_theme_option() { 
     41        // defaults to old theme but new installs get a default saved when activated 
     42        $option = get_option( self::INV_THEME_OPION, 'original' ); 
     43        return $option; 
     44    } 
     45 
     46    public static function get_estimate_theme_option() { 
     47        // defaults to old theme but new installs get a default saved when activated 
     48        $option = get_option( self::EST_THEME_OPION, 'original' ); 
     49        return $option; 
     50    } 
     51 
    2752    public static function init() { 
     53 
     54        // Theme Selection 
     55        self::$inv_theme_option = get_option( self::INV_THEME_OPION, 'original' ); 
     56        self::$est_theme_option = get_option( self::EST_THEME_OPION, 'original' ); 
     57        self::register_settings(); 
     58 
    2859        // Register Shortcodes 
    2960        add_action( 'sprout_shortcode', array( __CLASS__, 'register_shortcode' ), 0, 3 ); 
     
    3768        // Determine template for estimates or invoices 
    3869        add_filter( 'template_include', array( __CLASS__, 'override_template' ) ); 
     70        add_action( 'init', array( __CLASS__, 'add_theme_functions' ), 1000 ); 
     71 
     72        add_filter( 'sprout_invoice_template_possibilities', array( __CLASS__, 'add_theme_template_possibilities' ) ); 
     73        add_filter( 'si_locate_file_possibilites', array( __CLASS__, 'add_theme_template_possibilities' ) ); 
    3974 
    4075        add_action( 'doc_information_meta_box_client_row_last', array( __CLASS__, 'doc_template_selection' ) ); 
     
    5085 
    5186        // blank shortcode 
    52         do_action( 'sprout_shortcode', self::BLANK_SHORTCODE, array( __CLASS__, 'blank_shortcode' ) ); 
    53  
     87        do_action( 'si_version_upgrade', self::BLANK_SHORTCODE, array( __CLASS__, 'blank_shortcode' ) ); 
     88 
     89        // set defaults for new installs 
     90        add_action( 'si_plugin_activation_hook', array( __CLASS__, 'set_defaults' ), 0 ); 
     91 
     92    } 
     93 
     94    public static function set_defaults( $upgraded_from ) { 
     95        $si_version = get_option( 'si_current_version', false ); 
     96        if ( ! $si_version ) { // wasn't activated before 
     97            update_option( self::INV_THEME_OPION, 'default' ); 
     98            update_option( self::EST_THEME_OPION, 'default' ); 
     99        } 
    54100    } 
    55101 
     
    134180    } 
    135181 
    136     public static function head_scripts() { 
    137         global $wp_scripts; 
     182    public static function head_scripts( $v2_theme = false ) { 
    138183        ?> 
    139             <link rel="stylesheet" id="open-sans-css" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&amp;subset=latin%2Clatin-ext" type="text/css" media="all"> 
    140             <link rel="stylesheet" id="dashicons-css" href="<?php echo site_url() ?>/wp-includes/css/dashicons.min.css" type="text/css" media="all"> 
    141             <link rel="stylesheet" id="qtip-css" href="<?php echo SI_RESOURCES ?>admin/plugins/qtip/jquery.qtip.min.css" type="text/css" media=""> 
    142             <link rel="stylesheet" id="dropdown-css" href="<?php echo SI_RESOURCES ?>admin/plugins/dropdown/jquery.dropdown.css" type="text/css" media=""> 
    143  
    144             <link rel="stylesheet" id="sprout_doc_style-css" href="<?php echo SI_RESOURCES ?>front-end/css/sprout-invoices.style.css" type="text/css" media="all"> 
    145             <?php SI_Customizer::inject_css() ?> 
     184            <?php if ( ! $v2_theme ) :  ?> 
     185                <link rel="stylesheet" id="open-sans-css" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&amp;subset=latin%2Clatin-ext" type="text/css" media="all"> 
     186                <link rel="stylesheet" id="dashicons-css" href="<?php echo site_url() ?>/wp-includes/css/dashicons.min.css" type="text/css" media="all"> 
     187                <link rel="stylesheet" id="qtip-css" href="<?php echo SI_RESOURCES ?>admin/plugins/qtip/jquery.qtip.min.css" type="text/css" media=""> 
     188                <link rel="stylesheet" id="dropdown-css" href="<?php echo SI_RESOURCES ?>admin/plugins/dropdown/jquery.dropdown.css" type="text/css" media=""> 
     189 
     190                <link rel="stylesheet" id="sprout_doc_style-css" href="<?php echo SI_RESOURCES ?>deprecated-front-end/css/sprout-invoices.style.css" type="text/css" media="all"> 
     191            <?php endif ?> 
     192             
    146193            <?php self::load_custom_stylesheet() ?> 
    147194 
    148             <script type="text/javascript" src="<?php echo site_url() ?>/wp-includes/js/jquery/jquery.js"></script> 
    149             <script type="text/javascript" src="<?php echo site_url() ?>/wp-includes/js/jquery/jquery-migrate.min.js"></script> 
    150             <script type="text/javascript" src="<?php echo SI_RESOURCES ?>admin/plugins/qtip/jquery.qtip.min.js"></script> 
    151             <script type="text/javascript" src="<?php echo SI_RESOURCES ?>admin/plugins/dropdown/jquery.dropdown.min.js"></script> 
    152             <script type="text/javascript" src="<?php echo SI_RESOURCES ?>front-end/js/sprout-invoices.js"></script> 
     195            <?php if ( ! $v2_theme ) :  ?> 
     196                <script type="text/javascript" src="<?php echo site_url() ?>/wp-includes/js/jquery/jquery.js"></script> 
     197                <script type="text/javascript" src="<?php echo site_url() ?>/wp-includes/js/jquery/jquery-migrate.min.js"></script> 
     198                <script type="text/javascript" src="<?php echo SI_RESOURCES ?>admin/plugins/qtip/jquery.qtip.min.js"></script> 
     199                <script type="text/javascript" src="<?php echo SI_RESOURCES ?>admin/plugins/dropdown/jquery.dropdown.min.js"></script> 
     200                <script type="text/javascript" src="<?php echo SI_RESOURCES ?>deprecated-front-end/js/sprout-invoices.js"></script> 
     201            <?php endif ?> 
     202 
     203            <?php self::load_custom_js() ?> 
     204 
    153205            <script type="text/javascript"> 
    154206                /* <![CDATA[ */ 
     
    156208                /* ]]> */ 
    157209            </script> 
     210             
    158211        <?php 
    159212    } 
     
    165218        } 
    166219 
     220        $theme_option = ( 'invoice' === $context ) ? self::$inv_theme_option : self::$est_theme_option ; 
     221 
     222        $base_stylesheet_path = self::locate_template( array( 
     223            'theme/' . $theme_option . '/docs.css', 
     224            $theme_option . '.css', 
     225        ), false ); 
     226 
     227        if ( $base_stylesheet_path ) { 
     228            $stylesheet_url = _convert_content_file_path_to_url( $base_stylesheet_path ); 
     229            printf( '<link rel="stylesheet" id="sprout_doc_style-%s-css" href="%s" type="text/css" media="all">', $theme_option, esc_url_raw( $stylesheet_url ) ); 
     230        } 
     231 
    167232        $context_stylesheet_path = self::locate_template( array( 
     233            'theme/' . $theme_option . '/' . $context . '/' . $context . 's.css', 
    168234            $context . 's.css', 
    169235            $context . '/' . $context . 's.css', 
    170236        ), false ); 
     237 
    171238        if ( $context_stylesheet_path ) { 
    172239            $stylesheet_url = _convert_content_file_path_to_url( $context_stylesheet_path ); 
     
    181248            $general_stylesheet_url = _convert_content_file_path_to_url( $stylesheet_path ); 
    182249            printf( '<link rel="stylesheet" id="sprout_doc_style-%s-css" href="%s" type="text/css" media="all">', 'general', esc_url_raw( $general_stylesheet_url ) ); 
     250        } 
     251    } 
     252 
     253    public static function load_custom_js() { 
     254        $context = si_get_doc_context(); 
     255        if ( '' === $context ) { 
     256            return; 
     257        } 
     258 
     259        $theme_option = ( 'invoice' === $context ) ? self::$inv_theme_option : self::$est_theme_option ; 
     260 
     261        $base_js_path = self::locate_template( array( 
     262            'theme/' . $theme_option . '/docs.js', 
     263            $theme_option . '.js', 
     264        ), false ); 
     265 
     266        if ( $base_js_path ) { 
     267            $js_url = _convert_content_file_path_to_url( $base_js_path ); 
     268            printf( '<script type="text/javascript" id="sprout_doc_style-%s-css" src="%s"></script>', $theme_option, esc_url_raw( $js_url ) ); 
     269        } 
     270 
     271        $context_js_path = self::locate_template( array( 
     272            'theme/' . $theme_option . '/' . $context . '/' . $context . 's.js', 
     273            $context . 's.js', 
     274            $context . '/' . $context . 's.js', 
     275        ), false ); 
     276 
     277        if ( $context_js_path ) { 
     278            $js_url = _convert_content_file_path_to_url( $context_js_path ); 
     279            printf( '<script type="text/javascript" id="sprout_doc_style-%s-css" src="%s"></script>', $context, esc_url_raw( $js_url ) ); 
     280        } 
     281 
     282        $js_path = self::locate_template( array( 
     283            'sprout-invoices.js', 
     284        ), false ); 
     285 
     286        if ( $js_path ) { 
     287            $general_js_url = _convert_content_file_path_to_url( $js_path ); 
     288            printf( '<script type="text/javascript" id="sprout_doc_style-%s-css" src="%s"></script>', 'general', esc_url_raw( $js_url ) ); 
    183289        } 
    184290    } 
     
    188294            <?php if ( current_user_can( 'edit_post', get_the_id() ) ) : ?> 
    189295                <link rel="stylesheet" id="admin-bar-css" href="<?php echo site_url() ?>/wp-includes/css/admin-bar.min.css" type="text/css" media="all"> 
     296                <link rel="stylesheet" id="dashicons-css" href="<?php echo site_url() ?>/wp-includes/css/dashicons.min.css" type="text/css" media="all"> 
    190297                <?php wp_admin_bar_render() ?> 
    191298             
     
    274381                $template = self::locate_template( array( 
    275382                    $custom_path, 
     383                    'theme/' . self::$inv_theme_option . '/invoice/invoice.php', 
    276384                    'invoice-'.get_locale().'.php', 
    277385                    'invoice.php', 
    278386                    'invoice/invoice.php', 
    279387                ), $template ); 
     388 
    280389            } else { 
    281390                $status = get_query_var( self::FILTER_QUERY_VAR ); 
     
    307416                $template = self::locate_template( array( 
    308417                    $custom_path, 
     418                    'theme/' . self::$est_theme_option . '/estimate/estimate.php', 
    309419                    'estimate-'.get_locale().'.php', 
    310420                    'estimate.php', 
     
    324434        } 
    325435        return $template; 
     436    } 
     437 
     438    public static function add_theme_functions() { 
     439        $theme = ( SI_Invoice::is_invoice_query() ) ? self::$inv_theme_option : self::$est_theme_option ; 
     440        $template = SI_Controller::locate_template( array( 
     441            'theme/'.$theme.'/functions.php', 
     442        ) ); 
     443        include $template; 
     444    } 
     445 
     446    public static function add_theme_template_possibilities( $possibilities ) { 
     447        $possibilities = array_filter( $possibilities ); 
     448        $theme = ( SI_Invoice::is_invoice_query() ) ? self::$inv_theme_option : self::$est_theme_option ; 
     449 
     450        $new_possibilities = array(); 
     451        foreach ( $possibilities as $key => $path ) { 
     452            if ( '' === $path ) { 
     453                continue; 
     454            } 
     455            $new_possibilities[] = 'theme/' . $theme . '/' . str_replace( 'templates/', '', $path ); 
     456        } 
     457        return array_merge( $new_possibilities, $possibilities ); 
     458    } 
     459 
     460    //////////// 
     461    // admin // 
     462    //////////// 
     463 
     464    /** 
     465     * Hooked on init add the settings page and options. 
     466     * 
     467     */ 
     468    public static function register_settings() { 
     469        // Settings 
     470        $settings = array( 
     471            'invoice_template_selection' => array( 
     472                'weight' => 20, // Add-on settings are 1000 plus 
     473                'tab' => 'settings', 
     474                'settings' => array( 
     475                    self::INV_THEME_OPION => array( 
     476                        'label' => __( 'Invoice Theme', 'sprout-invoices' ), 
     477                        'option' => array( 
     478                            'type' => 'select', 
     479                            'options' => self::theme_templates(), 
     480                            'default' => self::$inv_theme_option, 
     481                            'description' => __( 'Select the theme your invoices should use.', 'sprout-invoices' ), 
     482                            ), 
     483                        ), 
     484                    ), 
     485                ), 
     486            'estimate_template_selection' => array( 
     487                'weight' => 25, // Add-on settings are 1000 plus 
     488                'tab' => 'settings', 
     489                'settings' => array( 
     490                    self::EST_THEME_OPION => array( 
     491                        'label' => __( 'Estimate Theme', 'sprout-invoices' ), 
     492                        'option' => array( 
     493                            'type' => 'select', 
     494                            'options' => self::theme_templates(), 
     495                            'default' => self::$est_theme_option, 
     496                            'description' => __( 'Select the theme your estimate should use.', 'sprout-invoices' ), 
     497                            ), 
     498                        ), 
     499                    ), 
     500                ), 
     501            ); 
     502        do_action( 'sprout_settings', $settings, self::SETTINGS_PAGE ); 
    326503    } 
    327504 
  • sprout-invoices/trunk/models/Estimate.php

    r1613648 r1702714  
    9090            self::STATUS_ARCHIVED => __( 'Archived', 'sprout-invoices' ), 
    9191        ); 
    92         return $statuses; 
     92        return apply_filters( 'si_estimate_statuses', $statuses ); 
    9393    } 
    9494 
  • sprout-invoices/trunk/models/Invoice.php

    r1678783 r1702714  
    8181            self::STATUS_ARCHIVED => __( 'Archived', 'sprout-invoices' ), 
    8282        ); 
    83         return $statuses; 
     83        return apply_filters( 'si_invoice_statuses', $statuses ); 
    8484    } 
    8585 
     
    680680                    $fee_total = call_user_func_array( $data['total_callback'], array( $this, $data ) ); 
    681681                    $fees_total += apply_filters( 'si_fee_total', $fee_total, $data, true ); 
    682                 } elseif ( $data['total'] ) { 
     682                } elseif ( isset( $data['total'] ) ) { 
    683683                    $fees_total += apply_filters( 'si_fee_total', $data['total'], $data ); 
    684684                } 
  • sprout-invoices/trunk/readme.txt

    r1688474 r1702714  
    55Requires at least: 3.8 
    66Tested up to: 4.8 
    7 Stable tag: 14.0.5 
     7Stable tag: 15.0 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    142142 
    143143== Changelog == 
     144 
     145= 15.0 = 
     146 
     147* NEW: Default Theme!!!! 
     148* NEW: Theme selection 
     149* NEW: Updates to support the new Service Fee add-on. 
     150* NEW: Fees are added to reports. 
     151* NEW: Support for Square payments, new add-on will be released soon. 
     152* NEW: Added info for recurring invoice on the invoice admin. 
     153* NEW: Notification shortcode to show payments 
     154* FIX: Bulk edit causing lost client association. 
    144155 
    145156= 14.0.5 = 
  • sprout-invoices/trunk/resources/admin/css/sprout-invoice.css

    r1649232 r1702714  
    25122512    color: #C7C7C7; 
    25132513} 
     2514.si_recurring_status { 
     2515    padding-top: 10px; 
     2516} 
  • sprout-invoices/trunk/sprout-invoices.php

    r1688474 r1702714  
    33/** 
    44 * @package Sprout_Invoices 
    5  * @version 14.0.5 
     5 * @version 15.0 
    66 */ 
    77 
     
    1111 * Description: App allows for any WordPress site to accept estimates, create invoices and receive invoice payments. Learn more at <a href="https://sproutapps.co">Sprout Apps</a>. 
    1212 * Author: Sprout Apps 
    13  * Version: 14.0.5 
     13 * Version: 15.0 
    1414 * Author URI: https://sproutapps.co 
    1515 * Text Domain: sprout-invoices 
  • sprout-invoices/trunk/template-tags/docs.php

    r1613648 r1702714  
    22 
    33 
    4 function si_head() { 
    5     do_action( 'si_head' ); 
     4function si_head( $v2_theme = false ) { 
     5    do_action( 'si_head', $v2_theme ); 
    66} 
    77 
    88 
    9 function si_footer() { 
    10     do_action( 'si_footer' ); 
     9function si_footer( $v2_theme = false ) { 
     10    do_action( 'si_footer', $v2_theme ); 
    1111} 
    1212 
  • sprout-invoices/trunk/template-tags/forms.php

    r1492701 r1702714  
    5454                <legend class="legend form-heading <?php echo $context . $key . ' ' . $wrap_class ?>" ><?php echo esc_html( $data['label'] ) ?></legend> 
    5555            <?php elseif ( $data['type'] != 'checkbox' ) : ?> 
    56                 <div class="sa-control-group <?php echo $context . $key . ' ' . $wrap_class ?>"> 
     56                <div class="sa-control-group <?php echo $context . $key . ' ' . $wrap_class ?> <?php esc_attr_e( $data['type'] ) ?>"> 
    5757                    <span class="label_wrap"><?php sa_form_label( $key, $data, $context ); ?></span> 
    5858                    <span class="input_wrap"><?php sa_form_field( $key, $data, $context ); ?></span> 
    5959                </div> 
    6060            <?php else : ?> 
    61                 <div class="sa-control-group <?php echo $context . $key . ' ' . $wrap_class ?>"> 
     61                <div class="sa-control-group <?php echo $context . $key . ' ' . $wrap_class ?> <?php esc_attr_e( $data['type'] ) ?>"> 
    6262                    <div class="sa-controls input_wrap"> 
    6363                        <label for="sa_<?php echo esc_attr( $context ) ?>_<?php echo esc_attr( $key ) ?>" class="sa-checkbox"> 
  • sprout-invoices/trunk/template-tags/invoices.php

    r1665470 r1702714  
    10981098} 
    10991099 
     1100function si_doc_last_updated( $doc_id = 0, $filtered = true ) { 
     1101    $history = si_doc_history_records( $doc_id, $filtered ); 
     1102 
     1103    // Sort in descending order 
     1104    rsort( $history ); 
     1105 
     1106    if ( ! isset( $history[0] ) ) { 
     1107        return false; 
     1108    } 
     1109    return strtotime( $history[0]['post_date'] ); 
     1110} 
     1111 
    11001112/////////////// 
    11011113// Recurring // 
  • sprout-invoices/trunk/template-tags/line-items.php

    r1418187 r1702714  
    262262    return $value; 
    263263} 
     264 
     265 
     266function si_front_end_line_item_columns( $item_data = array(), $position = 0, $prev_type = '', $has_children = false ) { 
     267    print si_get_front_end_line_item_columns( $item_data, $position, $prev_type, $has_children ); 
     268} 
     269 
     270function si_get_front_end_line_item_columns( $item_data = array(), $position = 0, $prev_type = '', $has_children = false ) { 
     271    $item_type = ( isset( $item_data['type'] ) && '' !== $item_data['type'] ) ? $item_data['type'] : SI_Line_Items::DEFAULT_TYPE ; 
     272    $columns = si_get_line_item_columns( $item_type, $item_data, $position, $prev_type, $has_children ); 
     273 
     274    ob_start(); ?> 
     275 
     276        <?php do_action( 'si_get_front_end_line_item_column_pre_row', $item_data, $position, $prev_type, $has_children ) ?> 
     277 
     278        <?php foreach ( $columns as $column_slug => $column ) { 
     279 
     280            $value = ( isset( $item_data[ $column_slug ] ) ) ? $item_data[ $column_slug ] : '' ; 
     281 
     282            $column_type = ( isset( $column['type'] ) ) ? $column['type'] : 0 ; 
     283 
     284            if ( ! $column_type || 'hidden' === $column_type ) { 
     285                continue; 
     286            } 
     287 
     288            if ( $has_children && isset( $column['hide_if_parent'] ) && (bool) $column['hide_if_parent'] ) { 
     289                continue; 
     290            } ?> 
     291 
     292            <div class="column column_<?php echo esc_attr( $column_slug ) ?>"> 
     293                <?php if ( 'textarea' === $column_type ) :  ?> 
     294                    <h3><?php printf( __( '%2$s <small>%1$s</small>', 'sprout-invoices' ), number_format( (float) $position, 1, '.', '' ), $column['label'] ) ?></h3> 
     295                <?php else : ?> 
     296                    <h3><?php echo $column['label'] ?></h3>  
     297                <?php endif ?> 
     298                 
     299 
     300                <div class="content"> 
     301                    <?php echo apply_filters( 'si_format_front_end_line_item_value', $value, $column_slug, $item_data ) ?> 
     302                </div> 
     303            </div><!-- <?php echo esc_attr( $column_slug ) ?> --> 
     304             
     305        <?php } // end foreach ?> 
     306 
     307    <?php do_action( 'si_get_front_end_line_item_column_post_row', $item_data, $position, $prev_type, $has_children ) ?> 
     308 
     309    <?php 
     310    $view = ob_get_contents(); 
     311    ob_end_clean(); 
     312    return apply_filters( 'si_get_front_end_line_item_column', $view, $item_data, $position ); 
     313} 
  • sprout-invoices/trunk/template-tags/ui.php

    r1217748 r1702714  
    88    function si_doc_header_logo_url() { 
    99        $fullpath = si_locate_file( array( 
    10                     'logo.png', 
    11                     'logo.jpg', 
    12                     'logo.gif', 
    13                 ) ); 
     10            'logo.png', 
     11            'logo.jpg', 
     12            'logo.gif', 
     13        ) ); 
    1414        $path = str_replace( WP_CONTENT_DIR, '', $fullpath ); 
    1515        return content_url( $path ); 
  • sprout-invoices/trunk/template-tags/utility.php

    r1613648 r1702714  
    319319        } 
    320320        return apply_filters( 'sa_day_ordinal_formatter', $formatted_day, $day ); 
     321    } 
     322 
     323endif; 
     324 
     325if ( ! function_exists( 'si_get_days_ago' ) ) : 
     326    /** 
     327     * Get the days since based on today 
     328     * @param  integer $number 
     329     * @return string 
     330     */ 
     331    function si_get_days_ago( $last_updated = 0 ) { 
     332        $time_between_update = current_time( 'timestamp' ) - $last_updated; 
     333        $days_since = round( (($time_between_update / 24) / 60) / 60 ); 
     334        return apply_filters( 'si_get_days_ago', $days_since ); 
    321335    } 
    322336 
  • sprout-invoices/trunk/views/admin/reports/premium/invoices.php

    r1688474 r1702714  
    2626                    <th><?php _e( 'Paid', 'sprout-invoices' ) ?></th> 
    2727                    <th><?php _e( 'Tax', 'sprout-invoices' ) ?></th> 
     28                    <th><?php _e( 'Fees', 'sprout-invoices' ) ?></th> 
    2829                    <?php if ( apply_filters( 'si_show_gst_in_reports', class_exists( 'SI_Hearts_Canada' ) ) ) :  ?> 
    2930                        <th><?php _e( 'GST', 'sprout-invoices' ) ?></th> 
     
    3637                    $table_total_invoiced = 0; 
    3738                    $table_total_paid = 0; 
     39                    $table_total_fees = 0; 
    3840                    $table_total_tax = 0; 
    3941                    $table_gst_total_tax = 0; 
     
    7173                        $table_total_invoiced += si_get_invoice_calculated_total(); 
    7274                        $table_total_paid += si_get_invoice_payments_total(); 
     75                        $table_total_fees += si_get_invoice_fees_total(); 
    7376                        $table_total_tax += si_get_invoice_taxes_total(); 
    7477                        $table_total_balance += si_get_invoice_balance(); 
     
    9699                            <td><?php si_invoice_payments_total() ?></td> 
    97100                            <td><?php sa_formatted_money( si_get_invoice_taxes_total() ) ?></td> 
     101                            <td><?php sa_formatted_money( si_get_invoice_fees_total() ) ?></td> 
    98102                            <?php if ( apply_filters( 'si_show_gst_in_reports', class_exists( 'SI_Hearts_Canada' ) ) ) :  ?> 
    99103                                <th><?php sa_formatted_money( $gst_for_line_item ) ?></th> 
     
    115119                    <th><span id="footer_total_paid"></span>&nbsp;<?php printf( __( '(of %s)', 'sprout-invoices' ), sa_get_formatted_money( $table_total_paid ) ) ?></th> 
    116120                    <th><span id="footer_total_tax"></span>&nbsp;<?php printf( __( '(of %s)', 'sprout-invoices' ), sa_get_formatted_money( $table_total_tax ) ) ?></th> 
     121                    <th><span id="footer_total_fees"></span>&nbsp;<?php printf( __( '(of %s)', 'sprout-invoices' ), sa_get_formatted_money( $table_total_fees ) ) ?></th> 
    117122                    <?php if ( apply_filters( 'si_show_gst_in_reports', class_exists( 'SI_Hearts_Canada' ) ) ) :  ?> 
    118123                        <th><span id="footer_total_tax"></span>&nbsp;<?php printf( __( '(of %s)', 'sprout-invoices' ), sa_get_formatted_money( $table_gst_total_tax ) ) ?></th> 
  • sprout-invoices/trunk/views/admin/sections/estimate-status-change-drop.php

    r1678783 r1702714  
    11<div class="quick_status_update"> 
     2    <?php do_action( 'si_start_status_change_drop', $id ) ?> 
    23    <span id="status_<?php echo (int) $id ?>"> 
    34        <span class="status_change" data-dropdown="#status_change_<?php echo (int) $id ?>"> 
     
    1516            <?php elseif ( $status === SI_Estimate::STATUS_ARCHIVED ) : ?> 
    1617                <?php printf( '<span class="si_status draft si_tooltip button current_status" title="%s" disabled><span>%s</span>%s</span>', __( 'Archive Estimate', 'sprout-invoices' ), __( 'Archive', 'sprout-invoices' ), $status_change_span ); ?> 
     18            <?php elseif ( apply_filters( 'si_is_estimate_currently_custom_status', false, $id ) ) : ?> 
     19                <?php do_action( 'si_estimate_custom_status_current_label', $id ); ?> 
    1720            <?php else : ?> 
    1821                <?php printf( '<span class="si_status draft si_tooltip button current_status" title="%s" disabled><span>%s</span>%s</span>', __( 'Pending Estimate Request.', 'sprout-invoices' ), __( 'Draft', 'sprout-invoices' ), $status_change_span ); ?> 
     
    2932                <?php printf( '<li><a class="doc_status_change publish" title="%s" href="%s" data-id="%s" data-status-change="%s" data-nonce="%s">%s</a></li>', __( 'Mark Approved', 'sprout-invoices' ), get_edit_post_link( $id ), $id, SI_Estimate::STATUS_APPROVED, wp_create_nonce( SI_Controller::NONCE ), __( '<b>Complete:</b> Estimate Approved', 'sprout-invoices' ) ); ?> 
    3033            <?php endif ?> 
     34            <?php if ( ! apply_filters( 'si_is_estimate_currently_custom_status', $id ) ) : ?> 
     35                <?php do_action( 'si_estimate_custom_status_current_option', $id ); ?> 
     36            <?php endif; ?> 
    3137            <?php if ( $status != SI_Estimate::STATUS_DECLINED ) : ?> 
    3238                <?php printf( '<li><a class="doc_status_change decline" title="%s" href="%s" data-id="%s" data-status-change="%s" data-nonce="%s">%s</a></li>', __( 'Mark Declined', 'sprout-invoices' ), get_edit_post_link( $id ), $id, SI_Estimate::STATUS_DECLINED, wp_create_nonce( SI_Controller::NONCE ), __( '<b>Void:</b> Estimate Declined', 'sprout-invoices' ) ); ?> 
    3339            <?php endif ?> 
     40            <?php if ( ! apply_filters( 'si_is_estimate_currently_custom_status', false, $id ) ) : ?> 
     41                <?php do_action( 'si_estimate_custom_status_current_option', $id ); ?> 
     42            <?php endif; ?> 
    3443            <li><hr/></li> 
    3544            <?php if ( $status != SI_Invoice::STATUS_ARCHIVED ) : ?> 
     
    4251        </ul> 
    4352    </div> 
     53    <?php do_action( 'si_end_status_change_drop', $id ) ?> 
    4454</div> 
     55<?php do_action( 'si_status_change_drop_outside', $id ) ?> 
  • sprout-invoices/trunk/views/admin/sections/invoice-status-change-drop.php

    r1366210 r1702714  
    11<div class="quick_status_update"> 
     2    <?php do_action( 'si_start_status_change_drop', $id ) ?> 
    23    <span id="status_<?php echo(int) $id ?>"> 
    34        <span class="status_change" data-dropdown="#status_change_<?php echo (int) $id ?>"> 
     
    1718            <?php elseif ( $status === SI_Invoice::STATUS_ARCHIVED ) : ?> 
    1819                <?php printf( '<span class="si_status temp si_tooltip button current_status" title="%s" disabled><span>%s</span>%s</span>', __( 'Archived Invoice', 'sprout-invoices' ), __( 'Archived', 'sprout-invoices' ), $status_change_span ); ?> 
     20            <?php elseif ( apply_filters( 'si_is_invoice_currently_custom_status', false, $id ) ) : ?> 
     21                <?php do_action( 'si_invoice_custom_status_current_label', $id ); ?> 
    1922            <?php else : ?> 
    2023                <?php printf( '<span class="si_status temp si_tooltip button current_status" title="%s" disabled><span>%s</span>%s</span>', __( 'Temp Invoice', 'sprout-invoices' ), __( 'Temp', 'sprout-invoices' ), $status_change_span ); ?> 
     
    3538                <?php printf( '<li><a class="doc_status_change publish" title="%s" href="%s" data-id="%s" data-status-change="%s" data-nonce="%s">%s</a></li>', __( 'Mark as Paid.', 'sprout-invoices' ), get_edit_post_link( $id ), $id, SI_Invoice::STATUS_PAID, wp_create_nonce( SI_Controller::NONCE ), __( '<b>Complete:</b> Paid in Full', 'sprout-invoices' ) ); ?> 
    3639            <?php endif; ?> 
     40            <?php if ( ! apply_filters( 'si_is_invoice_currently_custom_status', false, $id ) ) : ?> 
     41                <?php do_action( 'si_invoice_custom_status_current_option', $id ); ?> 
     42            <?php endif; ?> 
    3743            <?php if ( $status != SI_Invoice::STATUS_TEMP && $status != 'auto-draft' ) : ?> 
    3844            <li><hr/></li> 
     
    5258        </ul> 
    5359    </div> 
     60    <?php do_action( 'si_end_status_change_drop', $id ) ?> 
    5461</div> 
     62<?php do_action( 'si_status_change_drop_outside', $id ) ?> 
Note: See TracChangeset for help on using the changeset viewer.