Plugin Directory

Changeset 926784


Ignore:
Timestamp:
06/04/2014 09:57:42 PM (12 years ago)
Author:
ashdurham
Message:
  • Added functionality to populate date field based when creating
  • Date invoice was last sent information added
  • Added variable support in open content fields 1 and 2
  • CSS update for latest version of WP
  • Update to KPP logo
Location:
invoice-king-pro
Files:
102 added
12 edited

Legend:

Unmodified
Added
Removed
  • invoice-king-pro/trunk/css/invoicekingpro-styles.css

    r811307 r926784  
    147147
    148148#invkp_invoice.default .inv_columns tbody td .remove_invkp_row {float: right;}
     149
     150#postinvoiceoptionsdatadiv .invkp_datepicker {width: 100px;}
    149151
    150152#postinvoiceclientdatadiv {position: relative;}
  • invoice-king-pro/trunk/includes/admin_area.php

    r876146 r926784  
    244244            background: url(<?= plugins_url('/images/invkp-icon_16x16_sat.png', dirname(__FILE__)) ?>) no-repeat center center !important;
    245245        }
     246        #menu-posts-invkp_invoices .wp-menu-image:before {display: none;}
    246247    #menu-posts-invkp_invoices:hover .wp-menu-image, #menu-posts-invkp_invoices.wp-has-current-submenu .wp-menu-image {
    247248            background: url(<?= plugins_url('/images/invkp-icon_16x16.png', dirname(__FILE__)) ?>) no-repeat center center !important;
     
    263264        'total' => __( 'Total' , "invkptext"),
    264265        'invoice_paid' => __( 'Paid?' , "invkptext"),
    265         'date' => __( 'Date' , "invkptext"),
     266        'date' => __( 'Date Created' , "invkptext"),
     267        'invoice_sent' => __('Last Sent', "invkptext")
    266268    );
    267269
     
    296298            if (!empty($paid) && $paid[0] == 1) echo "<a href='".admin_url('admin.php?action=invkpmarkunpaid&post='.$ID)."'><img src='".str_replace('includes', 'images', plugin_dir_url(__FILE__))."tick.png' /></a>";
    297299            else echo "<a href='".admin_url('admin.php?action=invkpmarkpaid&post='.$ID)."'><img src='".str_replace('includes', 'images', plugin_dir_url(__FILE__))."cross.png' /></a>";
     300            break;
     301           
     302        case 'invoice_sent' :
     303            // Display last sent date
     304            $sent = get_post_meta($ID, 'invkp_sent_invoice');
     305            if (!empty($sent) && is_numeric($sent[0]) && $sent[0] > 0) echo date("F j, Y g:i a", $sent[0]);
     306            else echo "Not Sent";
    298307            break;
    299308    }
     
    401410    $paid_watermark = get_option('invkp_paid_watermark');
    402411    //print_r($invoice[0]->custom);die;
    403    
    404     do_action('invkp_additional_pdf_invoice_data');
    405    
    406     $pdf_theme = get_option('invkp_theme');
    407     if (file_exists(str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php'))
    408         include str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php';
    409     else
    410         include 'pdf.php';
    411    
    412     header("Location: ".str_replace("includes/","",plugin_dir_url(__FILE__))."outputs/".$pdf_filename.".pdf");
    413    
    414 }
    415 add_action( 'admin_action_invkpviewpdf', 'invkpviewpdf_admin_action' );
    416 
    417 function invkpemailpdf_admin_action()
    418 {
    419     global $wpdb;
    420     $post_id = $_GET['post'];
    421     $invoice = query_posts(array('post_type'=>'invkp_invoices', 'p'=>$post_id));
    422     $invoice[0]->custom = invkp_return_fields($post_id);
    423    
    424     if (isset($invoice[0]->custom['invkp_selected_client_email'][0]) && $invoice[0]->custom['invkp_selected_client_email'][0] !== '')
    425         $email = $invoice[0]->custom['invkp_selected_client_email'][0];
    426     elseif (isset($invoice[0]->custom['invkp_client_email'][0]) && $invoice[0]->custom['invkp_client_email'][0] !== '')
    427         $email = $invoice[0]->custom['invkp_client_email'][0];
    428     else header("Location: ".$_SERVER['HTTP_REFERER']."&send=0");
    429    
    430     $name = $invoice[0]->custom['invkp_selected_client_attn'][0];
    431    
    432     $from = get_option('invkp_from');
    433     $from_email = get_option('invkp_from_email');
    434    
    435     $headers = "From: ".$from." <".$from_email.">";
    436     if (get_option('invkp_bcc')) $headers = "Bcc: ".$from." <".$from_email.">";
    437    
    438     include plugin_dir_path(__FILE__)."../packages/fpdf/fpdf.php";
    439     if (isset($invoice[0]->custom['invkp_column'][0])) {
    440         if (!is_array($invoice[0]->custom['invkp_column'][0]))
    441             $rows = unserialize($invoice[0]->custom['invkp_column'][0]);
    442         else $rows = $invoice[0]->custom['invkp_column'][0];
    443     }
    444     $columns = unserialize($invoice[0]->custom['invkp_columns'][0]);
    445     $column_types = unserialize($invoice[0]->custom['invkp_column_types'][0]);
    446     $column_widths = unserialize($invoice[0]->custom['invkp_column_widths'][0]);
    447     $currency_symbol = get_option('invkp_revenue_currency');
    448     $tax_label = get_option("invkp_tax_label");
    449     $subtotal_label = get_option("invkp_subtotal_label");
    450     $discount_label = get_option("invkp_discount_label");
    451     $total_label = get_option("invkp_total_label");
    452     $paid_label = get_option("invkp_paid_invoice_type");
    453     $paid_watermark = get_option('invkp_paid_watermark');
    454    
    455     do_action('invkp_additional_pdf_invoice_data');
    456    
    457     $pdf_theme = get_option('invkp_theme');
    458     if (file_exists(str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php'))
    459         include str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php';
    460     else
    461         include 'pdf.php';
    462    
    463     $attachments = array(str_replace("includes/","",plugin_dir_path(__FILE__))."outputs/".$pdf_filename.".pdf");
    464    
    465     if ($invoice[0]->custom['invkp_paid_invoice'][0] == 1) {
    466         $paid = 'paid_';
    467         $invoice_type = $paid_label;
    468     } else {
    469         $paid = '';
    470         $invoice_type = $invoice[0]->custom['invkp_invoice_type'][0];
    471     }
    472412   
    473413    $search = array(
     
    491431        $invoice[0]->custom['invkp_total'][0],
    492432    );
     433   
     434    $invoice[0]->custom['invkp_open_content_1'][0] = str_replace($search, $replace, $invoice[0]->custom['invkp_open_content_1'][0]);
     435    $invoice[0]->custom['invkp_open_content_2'][0] = str_replace($search, $replace, $invoice[0]->custom['invkp_open_content_2'][0]);
     436   
     437    do_action('invkp_additional_pdf_invoice_data');
     438   
     439    $pdf_theme = get_option('invkp_theme');
     440    if (file_exists(str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php'))
     441        include str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php';
     442    else
     443        include 'pdf.php';
     444   
     445    header("Location: ".str_replace("includes/","",plugin_dir_url(__FILE__))."outputs/".$pdf_filename.".pdf");
     446   
     447}
     448add_action( 'admin_action_invkpviewpdf', 'invkpviewpdf_admin_action' );
     449
     450function invkpemailpdf_admin_action()
     451{
     452    global $wpdb;
     453    $post_id = $_GET['post'];
     454    $invoice = query_posts(array('post_type'=>'invkp_invoices', 'p'=>$post_id));
     455    $invoice[0]->custom = invkp_return_fields($post_id);
     456   
     457    if (isset($invoice[0]->custom['invkp_selected_client_email'][0]) && $invoice[0]->custom['invkp_selected_client_email'][0] !== '')
     458        $email = $invoice[0]->custom['invkp_selected_client_email'][0];
     459    elseif (isset($invoice[0]->custom['invkp_client_email'][0]) && $invoice[0]->custom['invkp_client_email'][0] !== '')
     460        $email = $invoice[0]->custom['invkp_client_email'][0];
     461    else header("Location: ".$_SERVER['HTTP_REFERER']."&send=0");
     462   
     463    $name = $invoice[0]->custom['invkp_selected_client_attn'][0];
     464   
     465    $from = get_option('invkp_from');
     466    $from_email = get_option('invkp_from_email');
     467   
     468    $headers = "From: ".$from." <".$from_email.">";
     469    if (get_option('invkp_bcc')) $headers = "Bcc: ".$from." <".$from_email.">";
     470   
     471    include plugin_dir_path(__FILE__)."../packages/fpdf/fpdf.php";
     472    if (isset($invoice[0]->custom['invkp_column'][0])) {
     473        if (!is_array($invoice[0]->custom['invkp_column'][0]))
     474            $rows = unserialize($invoice[0]->custom['invkp_column'][0]);
     475        else $rows = $invoice[0]->custom['invkp_column'][0];
     476    }
     477    $columns = unserialize($invoice[0]->custom['invkp_columns'][0]);
     478    $column_types = unserialize($invoice[0]->custom['invkp_column_types'][0]);
     479    $column_widths = unserialize($invoice[0]->custom['invkp_column_widths'][0]);
     480    $currency_symbol = get_option('invkp_revenue_currency');
     481    $tax_label = get_option("invkp_tax_label");
     482    $subtotal_label = get_option("invkp_subtotal_label");
     483    $discount_label = get_option("invkp_discount_label");
     484    $total_label = get_option("invkp_total_label");
     485    $paid_label = get_option("invkp_paid_invoice_type");
     486    $paid_watermark = get_option('invkp_paid_watermark');
     487   
     488    $search = array(
     489        '{{invoice_type}}',
     490        '{{invoice_number_label}}',
     491        '{{invoice_number}}',
     492        '{{invoice_date}}',
     493        '{{invoice_due_date}}',
     494        '{{client_company_name}}',
     495        '{{client_name}}',
     496        '{{invoice_total}}',
     497    );
     498    $replace = array(
     499        $invoice_type,
     500        $invoice[0]->custom['invkp_invoice_no_label'][0],
     501        $invoice[0]->custom['invkp_invoice_no'][0],
     502        $invoice[0]->custom['invkp_date'][0],
     503        $invoice[0]->custom['invkp_due_date'][0],
     504        $invoice[0]->custom['invkp_selected_client_company'][0],
     505        $invoice[0]->custom['invkp_selected_client_attn'][0],
     506        $invoice[0]->custom['invkp_total'][0],
     507    );
     508   
     509    $invoice[0]->custom['invkp_open_content_1'][0] = str_replace($search, $replace, $invoice[0]->custom['invkp_open_content_1'][0]);
     510    $invoice[0]->custom['invkp_open_content_2'][0] = str_replace($search, $replace, $invoice[0]->custom['invkp_open_content_2'][0]);
     511   
     512    do_action('invkp_additional_pdf_invoice_data');
     513   
     514    $pdf_theme = get_option('invkp_theme');
     515    if (file_exists(str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php'))
     516        include str_replace("includes/","",plugin_dir_path(__FILE__)).'themes/'.$pdf_theme.'/pdf.php';
     517    else
     518        include 'pdf.php';
     519   
     520    $attachments = array(str_replace("includes/","",plugin_dir_path(__FILE__))."outputs/".$pdf_filename.".pdf");
     521   
     522    if ($invoice[0]->custom['invkp_paid_invoice'][0] == 1) {
     523        $paid = 'paid_';
     524        $invoice_type = $paid_label;
     525    } else {
     526        $paid = '';
     527        $invoice_type = $invoice[0]->custom['invkp_invoice_type'][0];
     528    }
     529   
    493530    $subject = str_replace($search, $replace, get_option('invkp_'.$paid.'email_subject'));
    494531    $message = str_replace($search, $replace, get_option('invkp_'.$paid.'email_message'));
     
    501538
    502539    if (@wp_mail($email, $subject, $message, $headers, $attachments)) $sent = 1; else $sent = 0;
     540   
     541    if ($sent == 1) {
     542        update_post_meta( $post_id, 'invkp_sent_invoice', current_time('timestamp') );
     543    }
    503544   
    504545    header("Location: ".$_SERVER['HTTP_REFERER']."&send=".$sent);
     
    510551    global $post;
    511552    if($post->post_type == 'invkp_invoices')
    512         return $title = __('Invoice Description for your convinence', "invkptext");
     553        return $title = __('Invoice Description for your convenience', "invkptext");
    513554    if($post->post_type == 'invkp_clients')
    514555        return $title = __('Company Name', "invkptext");
     
    643684    $output['invkp_selected_client_phone'] = (get_post_meta( $post->ID, 'invkp_selected_client_phone' ) ? get_post_meta( $post->ID, 'invkp_selected_client_phone' ) : array(''));
    644685   
    645     $clients = query_posts(array('post_type'=>'invkp_clients'));
     686    $clients = query_posts(array('post_type'=>'invkp_clients', "posts_per_page"=>-1));
    646687    $client_dropdown = '';
    647688    foreach ($clients as $client) {
     
    713754                update_post_meta( $post->ID, 'invkp_postcode', $_POST['invkp_postcode'] );
    714755            if (isset($_POST['invkp_date']))
    715                 update_post_meta( $post->ID, 'invkp_date', $_POST['invkp_date'] );
     756                update_post_meta( $post->ID, 'invkp_date', ($_POST['invkp_date'] != '' ? $_POST['invkp_date'] : the_date()) );
    716757            if (isset($_POST['invkp_due_date']))
    717758                update_post_meta( $post->ID, 'invkp_due_date', $_POST['invkp_due_date'] );
     
    9761017        $output['invkp_postcode'] = get_post_meta( $id, 'invkp_postcode' );
    9771018        if (!isset($output['invkp_postcode'][0])) $output['invkp_postcode'][0] = get_option('invkp_postcode');
    978         $output['invkp_date'] = (get_post_meta( $id, 'invkp_date' ) ? get_post_meta( $id, 'invkp_date' ) : array(''));
     1019        $output['invkp_date'] = (get_post_meta( $id, 'invkp_date' ) ? get_post_meta( $id, 'invkp_date', get_the_date() ) : array(get_the_date()));
    9791020        $output['invkp_due_date'] = (get_post_meta( $id, 'invkp_due_date' ) ? get_post_meta( $id, 'invkp_due_date' ) : array(''));
    9801021        $output['invkp_invoice_no_label'] = get_post_meta( $id, 'invkp_invoice_no_label' );
     
    11491190        wp_localize_script( 'invkp_admin_js', 'invkp_ajax_object',
    11501191            array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'invkp_ajaxnonce' => wp_create_nonce( 'invkpN0nc3' ) ) );
     1192       
     1193        // For attachments plugin
     1194        wp_enqueue_media();
    11511195    endif;
    11521196}
  • invoice-king-pro/trunk/includes/pdf.php

    r876146 r926784  
    145145        if ($c == count($columns)-2) :
    146146            $pdf->SetFont('Arial','B',9);
    147             $pdf->Cell($col_width,5,'Subtotal',0,0,'R',0);
     147            $pdf->Cell($col_width,5,$subtotal_label,0,0,'R',0);
    148148        elseif ($c == count($columns)-1) :
    149149            $pdf->SetFont('Arial','',9);
     
    158158        if ($c == count($columns)-2) :
    159159            $pdf->SetFont('Arial','B',9);
    160             $pdf->Cell($col_width,5,'Discount',0,0,'R',0);
     160            $pdf->Cell($col_width,5,$discount_label,0,0,'R',0);
    161161        elseif ($c == count($columns)-1) :
    162162            $pdf->SetFont('Arial','',9);
     
    184184        if ($c == count($columns)-2) :
    185185            $pdf->SetFont('Arial','B',9);
    186             $pdf->Cell($col_width,5,"Total",0,0,'R',0);
     186            $pdf->Cell($col_width,5,$total_label,0,0,'R',0);
    187187        elseif ($c == count($columns)-1) :
    188188            $pdf->SetFont('Arial','',9);
  • invoice-king-pro/trunk/invoicekingpro.php

    r876146 r926784  
    44    Plugin URI: http://kingpro.me/plugins/invoice-king-pro/
    55    Description: Invoice King Pro allows you to create, send and manage invoices for whatever purpose. If AdKingPro is installed as well, automatically generate invoices for revenue outputs.
    6     Version: 1.1.3
     6    Version: 1.1.4
    77    Author: Ash Durham
    88    Author URI: http://durham.net.au/
     
    2828
    2929    global $invkp_db_version;
    30     $invkp_db_version = "1.1.3";
     30    $invkp_db_version = "1.1.4";
    3131    $invkp_safe_theme = '1.2';
    3232   
  • invoice-king-pro/trunk/js/invoicekingpro-admin-functions.js

    r799581 r926784  
    135135            }
    136136        }
     137        console.log(run_calc);
    137138        var total = eval(run_calc);
    138139        row.find('input.'+total_col).val(total.toFixed(2));
  • invoice-king-pro/trunk/readme.txt

    r876146 r926784  
    44Tags: invoice, invoicing, pdf, clients, revenue, money, themes, theme, dollars, paid, payment, receipt, clients, email
    55Requires at least: 3.0.1
    6 Tested up to: 3.8.1
    7 Stable tag: 1.1.3
     6Tested up to: 3.9
     7Stable tag: 1.1.4
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    115115== Changelog ==
    116116
     117= 1.1.4 =
     118* Added functionality to populate date field based when creating
     119* Date invoice was last sent information added
     120* Added variable support in open content fields 1 and 2
     121* CSS update for latest version of WP
     122* Update to KPP logo
     123
    117124= 1.1.3 =
    118125* Made totals labels editable within admin
    119126* Converted text to enable translations
     127* Update to client dropdown display amount
    120128
    121129= 1.1.2 =
     
    177185== Upgrade Notice ==
    178186
     187= 1.1.4 =
     188* Added functionality to populate date field based when creating
     189* Date invoice was last sent information added
     190* Added variable support in open content fields 1 and 2
     191* CSS update for latest version of WP
     192
    179193= 1.1.3 =
    180194* Made totals labels editable within admin
    181195* Converted text to enable translations
     196* Update to client dropdown display amount
    182197
    183198= 1.1.2 =
  • invoice-king-pro/trunk/themes/default/pdf.php

    r811307 r926784  
    153153        if ($c == count($columns)-2) :
    154154            $pdf->SetFont('Arial','B',9);
    155             $pdf->Cell($col_width,5,'Subtotal',0,0,'R',0);
     155            $pdf->Cell($col_width,5,$subtotal_label,0,0,'R',0);
    156156        elseif ($c == count($columns)-1) :
    157157            $pdf->SetFont('Arial','',9);
     
    167167        if ($c == count($columns)-2) :
    168168            $pdf->SetFont('Arial','B',9);
    169             $pdf->Cell($col_width,5,'Discount',0,0,'R',0);
     169            $pdf->Cell($col_width,5,$discount_label,0,0,'R',0);
    170170        elseif ($c == count($columns)-1) :
    171171            $pdf->SetFont('Arial','',9);
     
    195195        if ($c == count($columns)-2) :
    196196            $pdf->SetFont('Arial','B',9);
    197             $pdf->Cell($col_width,5,"Total",0,0,'R',0);
     197            $pdf->Cell($col_width,5,$total_label,0,0,'R',0);
    198198        elseif ($c == count($columns)-1) :
    199199            $pdf->SetFont('Arial','',9);
  • invoice-king-pro/trunk/themes/default/version

    r876146 r926784  
    1 1.4
     11.5
Note: See TracChangeset for help on using the changeset viewer.