Plugin Directory

Changeset 1546822


Ignore:
Timestamp:
12/06/2016 11:44:32 PM (9 years ago)
Author:
drumba
Message:

Release 1.4.3, see readme.txt for the changelog.

Location:
edd-fastbill
Files:
8 added
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • edd-fastbill/tags/1.4.3/edd-fastbill.php

    r1457180 r1546822  
    66Author: Markus Drubba
    77Author URI: http://markusdrubba.de
    8 Version: 1.4.2
     8Version: 1.4.3
    99Text Domain: edd-fastbill
    1010Domain Path: /languages
  • edd-fastbill/tags/1.4.3/includes/fastbill-functions.php

    r1457180 r1546822  
    383383
    384384/**
     385 * drubba_fastbill_cancel_invoice()
     386 *
     387 * Cancel invoice in FastBill for the given order.
     388 *
     389 * @param  $payment_id
     390 *
     391 * @access public
     392 * @return void
     393 *
     394 **/
     395function drubba_fastbill_cancel_invoice( $payment_id ) {
     396
     397    $fb_invoice_id = (int) get_post_meta( $payment_id, '_fastbill_invoice_id', true );
     398
     399    if ( $fb_invoice_id > 0 ) {
     400        // there is an invoice ID, so cancel invoice
     401
     402        drubba_fastbill_addlog( 'START - Canceling invoice in FastBill for invoice ID: ' . $fb_invoice_id );
     403
     404        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
     405        $xml .= "<FBAPI>";
     406        $xml .= "<SERVICE>invoice.cancel</SERVICE>";
     407        $xml .= "<DATA>";
     408        $xml .= "<INVOICE_ID>" . $fb_invoice_id . "</INVOICE_ID>";
     409        $xml .= "</DATA>";
     410        $xml .= "</FBAPI>";
     411
     412        try {
     413
     414            $result = drubba_fastbill_apicall( $xml );
     415
     416        } catch ( Exception $e ) {
     417
     418            drubba_fastbill_addlog( $e->getMessage() );
     419
     420            return;
     421
     422        }
     423        $response = new SimpleXMLElement( $result );
     424        $is_error = isset( $response->RESPONSE->ERRORS ) ? true : false;
     425
     426        if ( ! $is_error ) {
     427            drubba_fastbill_addlog( 'END - Canceling invoice for order #' . $payment_id );
     428        } else {
     429            // An error occured
     430            $error_string = __( 'There was an error canceling an invoice in FastBill:', 'edd-fastbill' ) . "\n" .
     431                            __( 'Error: ', 'edd-fastbill' ) . $response->RESPONSE->ERRORS->ERROR;
     432            drubba_fastbill_addlog( $error_string );
     433        }
     434    } else {
     435        // no invoice id so exit.
     436        return;
     437    }
     438}
     439
     440
     441/**
    385442 * drubba_fastbill_invoice_sendbyemail()
    386443 *
     
    786843 **/
    787844function drubba_fastbill_addlog( $log_string ) {
    788     if ( WP_DEBUG ) {
    789         $path       = DRUBBAFASTBILL_DIR . "log/fastbill_debug.log";
    790         $log_string = "Log Date: " . date( "r" ) . "\n" . $log_string . "\n";
    791         if ( file_exists( $path ) ) {
    792             if ( $log = fopen( $path, "a" ) ) {
    793                 fwrite( $log, $log_string, strlen( $log_string ) );
    794                 fclose( $log );
    795             }
    796         } else {
    797             if ( $log = fopen( $path, "c" ) ) {
    798                 fwrite( $log, $log_string, strlen( $log_string ) );
    799                 fclose( $log );
    800             }
    801         }
    802     }
    803 }
     845    global $edd_options;
     846
     847    if ( isset( $edd_options['drubba_fb_fastbill_debug_log'] ) && 1 == $edd_options['drubba_fb_fastbill_debug_log'] ) {
     848
     849        $current_log = get_option( 'edd_fastbill_error_log', '' );
     850        $log_string  = "Log Date: " . date( "r" ) . "\n" . trim( $log_string ) . "\n\n";
     851
     852        $final_log = $current_log . $log_string;
     853
     854        update_option( 'edd_fastbill_error_log', $final_log );
     855
     856    }
     857}
  • edd-fastbill/tags/1.4.3/includes/payment-actions.php

    r1448780 r1546822  
    4747
    4848add_action( 'edd_update_payment_status', 'drubba_fastbill_complete_purchase', 10, 3 );
     49
     50function drubba_fastbill_refund_purchase( $payment_id, $new_status, $old_status ) {
     51    global $edd_options;
     52
     53    if ( $new_status == 'refunded' ) {
     54        drubba_fastbill_cancel_invoice( $payment_id );
     55    }
     56}
     57
     58add_action( 'edd_update_payment_status', 'drubba_fastbill_refund_purchase', 10, 3 );
  • edd-fastbill/tags/1.4.3/includes/payment-history.php

    r1448780 r1546822  
    146146
    147147    if ( isset( $_GET['edd-message'] ) && 'got_fastbill_invoice_error' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    148         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved-error', __( 'The invoice link could not be generated.', 'edd-fastbill' ), 'error' );
     148        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved-error', __( 'The invoice link could not be generated.', 'edd-fastbill' ), 'error' );
    149149    }
    150150    if ( isset( $_GET['edd-message'] ) && 'got_fastbill_invoice' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    151         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved', __( 'The invoice link was generated.', 'edd-fastbill' ), 'updated' );
     151        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved', __( 'The invoice link was generated.', 'edd-fastbill' ), 'updated' );
    152152    }
    153153
    154154    if ( isset( $_GET['edd-message'] ) && 'mailed_fastbill_invoice_error' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    155         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved', __( 'The invoice could not be sent.', 'edd-fastbill' ), 'error' );
     155        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved', __( 'The invoice could not be sent.', 'edd-fastbill' ), 'error' );
    156156    }
    157157
    158158    if ( isset( $_GET['edd-message'] ) && 'mailed_fastbill_invoice' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    159         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved', __( 'The invoice was sent.', 'edd-fastbill' ), 'updated' );
    160     }
    161 
    162     settings_errors( 'edd-notices' );
     159        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved', __( 'The invoice was sent.', 'edd-fastbill' ), 'updated' );
     160    }
     161
     162    settings_errors( 'edd-fastbill-notices' );
    163163}
    164164
  • edd-fastbill/tags/1.4.3/includes/register-settings.php

    r1448780 r1546822  
    9090
    9191
    92 
    9392    if ( drubba_fb_cfm_active() ) { // @since 1.1.0
    9493
     
    119118        }
    120119    }
     120
     121    $fastbill_settings[] = array(
     122        'id'   => 'drubba_fb_fastbill_debug_log',
     123        'name' => __( 'Debug mode', 'edd-fastbill' ),
     124        'desc' => __( 'Write debug logs into the database.', 'edd-fastbill' ),
     125        'type' => 'checkbox',
     126    );
     127
     128    $fastbill_settings[] = array(
     129        'id'   => 'drubba_fb_fastbill_reset_debug_log',
     130        'name' => __( 'Reset debug entries', 'edd-fastbill' ),
     131        'desc' => __( 'Remove debug logs from database.', 'edd-fastbill' ),
     132        'type' => 'checkbox',
     133    );
    121134
    122135    if ( version_compare( EDD_VERSION, 2.5, '>=' ) ) {
     
    217230    return $templates;
    218231}
     232
     233/**
     234 * Display field for debug output
     235 *
     236 * @param $html
     237 * @param $args
     238 *
     239 * @return string
     240 */
     241function drubba_fb_fastbill_show_debug_log_field( $html, $args ) {
     242    if ( $args['id'] == 'drubba_fb_fastbill_debug_log' ) {
     243        $current_log = get_option( 'edd_fastbill_error_log', '' );
     244        if ( ! empty( $current_log ) ) {
     245            $html = $html . '<br><br><textarea style="width:100%;height:400px;" readonly>' . $current_log . '</textarea>';
     246        }
     247    }
     248
     249    return $html;
     250}
     251
     252add_filter( 'edd_after_setting_output', 'drubba_fb_fastbill_show_debug_log_field', 10, 2 );
     253
     254/**
     255 * Reset database debug log
     256 *
     257 * @param $new_value
     258 * @param $old_value
     259 *
     260 * @return mixed
     261 */
     262function drubba_fb_fastbill_reset_debug_log( $new_value, $old_value ) {
     263    if ( $new_value['drubba_fb_fastbill_reset_debug_log'] == 1 ) {
     264        update_option( 'edd_fastbill_error_log', '' );
     265        $new_value['drubba_fb_fastbill_reset_debug_log'] = - 1;
     266    }
     267
     268    return $new_value;
     269}
     270
     271add_action( 'pre_update_option_edd_settings', 'drubba_fb_fastbill_reset_debug_log', 10, 2 );
  • edd-fastbill/tags/1.4.3/languages/edd-fastbill.pot

    r1457180 r1546822  
    11# Copyright (C) 2016 Easy Digital Downloads - FastBill Integration
    22# This file is distributed under the same license as the Easy Digital Downloads - FastBill Integration package.
     3#, fuzzy
    34msgid ""
    45msgstr ""
    5 "Project-Id-Version: Easy Digital Downloads - FastBill Integration 1.4.1\n"
    6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/edd-fastbill\n"
    7 "POT-Creation-Date: 2016-07-19 20:21:24+00:00\n"
     6"Project-Id-Version: EDD - FastBill\n"
     7"Report-Msgid-Bugs-To: \n"
     8"POT-Creation-Date: 2016-12-07 00:40+0100\n"
     9"PO-Revision-Date: 2016-12-07 00:33+0100\n"
     10"Last-Translator: Markus Drubba <kontakt@markusdrubba.de>\n"
     11"Language-Team: \n"
     12"Language: de_DE\n"
    813"MIME-Version: 1.0\n"
    914"Content-Type: text/plain; charset=UTF-8\n"
    1015"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
    12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    13 "Language-Team: LANGUAGE <LL@li.org>\n"
     16"Plural-Forms: nplurals=2; plural=n != 1;\n"
     17"X-Generator: Poedit 1.8.5\n"
     18"X-Poedit-SourceCharset: UTF-8\n"
     19"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;"
     20"_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
     21"X-Poedit-Basepath: ..\n"
     22"X-Textdomain-Support: yes\n"
     23"X-Poedit-SearchPath-0: .\n"
    1424
    1525#: includes/fastbill-functions.php:70
     
    2535msgstr ""
    2636
    27 #: includes/fastbill-functions.php:177 includes/fastbill-functions.php:261
    28 #: includes/fastbill-functions.php:319 includes/fastbill-functions.php:375
    29 #: includes/fastbill-functions.php:412 includes/fastbill-functions.php:419
    30 #: includes/fastbill-functions.php:456 includes/fastbill-functions.php:585
    31 #: includes/fastbill-functions.php:639 includes/fastbill-functions.php:698
     37#: includes/fastbill-functions.php:177 includes/fastbill-functions.php:261 includes/fastbill-functions.php:319
     38#: includes/fastbill-functions.php:375 includes/fastbill-functions.php:431 includes/fastbill-functions.php:469
     39#: includes/fastbill-functions.php:476 includes/fastbill-functions.php:513 includes/fastbill-functions.php:642
     40#: includes/fastbill-functions.php:696 includes/fastbill-functions.php:755
    3241msgid "Error: "
    3342msgstr ""
     
    4150msgstr ""
    4251
    43 #: includes/fastbill-functions.php:455
     52#: includes/fastbill-functions.php:430
     53msgid "There was an error canceling an invoice in FastBill:"
     54msgstr ""
     55
     56#: includes/fastbill-functions.php:512
    4457msgid "There was an error sending an invoice via FastBill:"
    4558msgstr ""
    4659
    47 #: includes/fastbill-functions.php:584
     60#: includes/fastbill-functions.php:641
    4861msgid "There was an error creating this customer in FastBill:"
    4962msgstr ""
    5063
    51 #: includes/fastbill-functions.php:638
     64#: includes/fastbill-functions.php:695
    5265msgid "There was an error looking up this customer in FastBill:"
    5366msgstr ""
    5467
    55 #: includes/fastbill-functions.php:697
     68#: includes/fastbill-functions.php:754
    5669msgid "There was an error when receiving templates from FastBill:"
    5770msgstr ""
     
    6174msgstr ""
    6275
    63 #: includes/frontend-functions.php:48 includes/frontend-functions.php:77
    64 #: includes/payment-history.php:33 includes/template-tags.php:50
     76#: includes/frontend-functions.php:48 includes/frontend-functions.php:77 includes/payment-history.php:33
     77#: includes/template-tags.php:50
    6578msgid "Download Invoice"
    6679msgstr ""
     
    111124
    112125#: includes/register-settings.php:51
    113 msgid ""
    114 "Choose invoice template. If you edit a Template in FastBill, you have to "
    115 "reassign it here."
     126msgid "Choose invoice template. If you edit a Template in FastBill, you have to reassign it here."
    116127msgstr ""
    117128
     
    137148
    138149#: includes/register-settings.php:72
    139 msgid ""
    140 "Create payment in FastBill when order is placed, requires invoice status "
    141 "COMPLETE"
     150msgid "Create payment in FastBill when order is placed, requires invoice status COMPLETE"
    142151msgstr ""
    143152
     
    156165#: includes/register-settings.php:86
    157166msgid ""
    158 "I activated the online invoice functionalty within my Fastbill account to "
    159 "accessing the generated invoice."
    160 msgstr ""
    161 
    162 #: includes/register-settings.php:98
     167"I activated the online invoice functionalty within my Fastbill account to accessing the generated invoice."
     168msgstr ""
     169
     170#: includes/register-settings.php:97
    163171msgid "FastBill Customer Fields"
    164172msgstr ""
    165173
    166 #: includes/register-settings.php:179
     174#: includes/register-settings.php:123
     175msgid "Debug mode"
     176msgstr ""
     177
     178#: includes/register-settings.php:124
     179msgid "Write debug logs into the database."
     180msgstr ""
     181
     182#: includes/register-settings.php:130
     183msgid "Reset debug entries"
     184msgstr ""
     185
     186#: includes/register-settings.php:131
     187msgid "Remove debug logs from database."
     188msgstr ""
     189
     190#: includes/register-settings.php:192
    167191msgid "Organization"
    168192msgstr ""
    169193
    170 #: includes/register-settings.php:180
     194#: includes/register-settings.php:193
    171195msgid "If set by customer, than Business"
    172196msgstr ""
    173197
    174 #: includes/register-settings.php:183
     198#: includes/register-settings.php:196
    175199msgid "Salutation"
    176200msgstr ""
    177201
    178 #: includes/register-settings.php:184
     202#: includes/register-settings.php:197
    179203msgid "Use Herr, Hr., Hr, Mister, Mr, Mr. & Frau, Fr., Fr, Misses, Miss, Mrs."
    180204msgstr ""
    181205
    182 #: includes/register-settings.php:186
     206#: includes/register-settings.php:199
    183207msgid "Phone"
    184208msgstr ""
    185209
    186 #: includes/register-settings.php:187
     210#: includes/register-settings.php:200
    187211msgid "Fax"
    188212msgstr ""
    189213
    190 #: includes/register-settings.php:188
     214#: includes/register-settings.php:201
    191215msgid "Mobile"
    192216msgstr ""
    193217
    194 #: includes/register-settings.php:202
     218#: includes/register-settings.php:215
    195219msgid "Default"
    196220msgstr ""
     
    199223msgid "Creates a link to the downloadable Fastbill invoice"
    200224msgstr ""
    201 
    202 #. Plugin Name of the plugin/theme
    203 msgid "Easy Digital Downloads - FastBill Integration"
    204 msgstr ""
    205 
    206 #. Plugin URI of the plugin/theme
    207 msgid ""
    208 "https://easydigitaldownloads.com/extensions/fastbill-integration/?ref=2325"
    209 msgstr ""
    210 
    211 #. Description of the plugin/theme
    212 msgid ""
    213 "Integrates <a href=\"https://easydigitaldownloads.com/\" target=\"_blank"
    214 "\">Easy Digital Downloads</a> with the <a href=\"http://www.fastbill.com\" "
    215 "target=\"_blank\">FastBill - fast money</a> accounting software."
    216 msgstr ""
    217 
    218 #. Author of the plugin/theme
    219 msgid "Markus Drubba"
    220 msgstr ""
    221 
    222 #. Author URI of the plugin/theme
    223 msgid "http://markusdrubba.de"
    224 msgstr ""
  • edd-fastbill/tags/1.4.3/readme.txt

    r1457180 r1546822  
    11=== EDD - FastBill Integration ===
    22Contributors: drumba
    3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BCVM7FZ6ZCM2A
     3Donate link: https://www.paypal.me/markusdrubba
    44Tags: Digital Downloads, EDD, Fastbill, Accounting, Invoice
    55Requires at least: 4.5
    6 Tested up to: 4.5.3
    7 Stable tag: 1.4.2
     6Tested up to: 4.7
     7Stable tag: 1.4.3
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2424* Activate the plugin in your WordPress admin area.
    2525
     26== Screenshots ==
     27
     281. FastBill Settings
     292. Payment column
     30
    2631== Configuration ==
    2732
     
    3439
    3540== Changelog ==
     41
     42= 2016-12-06 1.4.3 =
     43
     44* New: Cancel Payments when customer get a refund
     45* Tweak: debug logs are written to the database
    3646
    3747= 2016-07-04 1.4.2 =
  • edd-fastbill/trunk/edd-fastbill.php

    r1457180 r1546822  
    66Author: Markus Drubba
    77Author URI: http://markusdrubba.de
    8 Version: 1.4.2
     8Version: 1.4.3
    99Text Domain: edd-fastbill
    1010Domain Path: /languages
  • edd-fastbill/trunk/includes/fastbill-functions.php

    r1457180 r1546822  
    383383
    384384/**
     385 * drubba_fastbill_cancel_invoice()
     386 *
     387 * Cancel invoice in FastBill for the given order.
     388 *
     389 * @param  $payment_id
     390 *
     391 * @access public
     392 * @return void
     393 *
     394 **/
     395function drubba_fastbill_cancel_invoice( $payment_id ) {
     396
     397    $fb_invoice_id = (int) get_post_meta( $payment_id, '_fastbill_invoice_id', true );
     398
     399    if ( $fb_invoice_id > 0 ) {
     400        // there is an invoice ID, so cancel invoice
     401
     402        drubba_fastbill_addlog( 'START - Canceling invoice in FastBill for invoice ID: ' . $fb_invoice_id );
     403
     404        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
     405        $xml .= "<FBAPI>";
     406        $xml .= "<SERVICE>invoice.cancel</SERVICE>";
     407        $xml .= "<DATA>";
     408        $xml .= "<INVOICE_ID>" . $fb_invoice_id . "</INVOICE_ID>";
     409        $xml .= "</DATA>";
     410        $xml .= "</FBAPI>";
     411
     412        try {
     413
     414            $result = drubba_fastbill_apicall( $xml );
     415
     416        } catch ( Exception $e ) {
     417
     418            drubba_fastbill_addlog( $e->getMessage() );
     419
     420            return;
     421
     422        }
     423        $response = new SimpleXMLElement( $result );
     424        $is_error = isset( $response->RESPONSE->ERRORS ) ? true : false;
     425
     426        if ( ! $is_error ) {
     427            drubba_fastbill_addlog( 'END - Canceling invoice for order #' . $payment_id );
     428        } else {
     429            // An error occured
     430            $error_string = __( 'There was an error canceling an invoice in FastBill:', 'edd-fastbill' ) . "\n" .
     431                            __( 'Error: ', 'edd-fastbill' ) . $response->RESPONSE->ERRORS->ERROR;
     432            drubba_fastbill_addlog( $error_string );
     433        }
     434    } else {
     435        // no invoice id so exit.
     436        return;
     437    }
     438}
     439
     440
     441/**
    385442 * drubba_fastbill_invoice_sendbyemail()
    386443 *
     
    786843 **/
    787844function drubba_fastbill_addlog( $log_string ) {
    788     if ( WP_DEBUG ) {
    789         $path       = DRUBBAFASTBILL_DIR . "log/fastbill_debug.log";
    790         $log_string = "Log Date: " . date( "r" ) . "\n" . $log_string . "\n";
    791         if ( file_exists( $path ) ) {
    792             if ( $log = fopen( $path, "a" ) ) {
    793                 fwrite( $log, $log_string, strlen( $log_string ) );
    794                 fclose( $log );
    795             }
    796         } else {
    797             if ( $log = fopen( $path, "c" ) ) {
    798                 fwrite( $log, $log_string, strlen( $log_string ) );
    799                 fclose( $log );
    800             }
    801         }
    802     }
    803 }
     845    global $edd_options;
     846
     847    if ( isset( $edd_options['drubba_fb_fastbill_debug_log'] ) && 1 == $edd_options['drubba_fb_fastbill_debug_log'] ) {
     848
     849        $current_log = get_option( 'edd_fastbill_error_log', '' );
     850        $log_string  = "Log Date: " . date( "r" ) . "\n" . trim( $log_string ) . "\n\n";
     851
     852        $final_log = $current_log . $log_string;
     853
     854        update_option( 'edd_fastbill_error_log', $final_log );
     855
     856    }
     857}
  • edd-fastbill/trunk/includes/payment-actions.php

    r1448780 r1546822  
    4747
    4848add_action( 'edd_update_payment_status', 'drubba_fastbill_complete_purchase', 10, 3 );
     49
     50function drubba_fastbill_refund_purchase( $payment_id, $new_status, $old_status ) {
     51    global $edd_options;
     52
     53    if ( $new_status == 'refunded' ) {
     54        drubba_fastbill_cancel_invoice( $payment_id );
     55    }
     56}
     57
     58add_action( 'edd_update_payment_status', 'drubba_fastbill_refund_purchase', 10, 3 );
  • edd-fastbill/trunk/includes/payment-history.php

    r1448780 r1546822  
    146146
    147147    if ( isset( $_GET['edd-message'] ) && 'got_fastbill_invoice_error' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    148         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved-error', __( 'The invoice link could not be generated.', 'edd-fastbill' ), 'error' );
     148        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved-error', __( 'The invoice link could not be generated.', 'edd-fastbill' ), 'error' );
    149149    }
    150150    if ( isset( $_GET['edd-message'] ) && 'got_fastbill_invoice' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    151         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved', __( 'The invoice link was generated.', 'edd-fastbill' ), 'updated' );
     151        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved', __( 'The invoice link was generated.', 'edd-fastbill' ), 'updated' );
    152152    }
    153153
    154154    if ( isset( $_GET['edd-message'] ) && 'mailed_fastbill_invoice_error' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    155         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved', __( 'The invoice could not be sent.', 'edd-fastbill' ), 'error' );
     155        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved', __( 'The invoice could not be sent.', 'edd-fastbill' ), 'error' );
    156156    }
    157157
    158158    if ( isset( $_GET['edd-message'] ) && 'mailed_fastbill_invoice' == $_GET['edd-message'] && current_user_can( 'view_shop_reports' ) ) {
    159         add_settings_error( 'edd-notices', 'fastbill-invoice-retrieved', __( 'The invoice was sent.', 'edd-fastbill' ), 'updated' );
    160     }
    161 
    162     settings_errors( 'edd-notices' );
     159        add_settings_error( 'edd-fastbill-notices', 'fastbill-invoice-retrieved', __( 'The invoice was sent.', 'edd-fastbill' ), 'updated' );
     160    }
     161
     162    settings_errors( 'edd-fastbill-notices' );
    163163}
    164164
  • edd-fastbill/trunk/includes/register-settings.php

    r1448780 r1546822  
    9090
    9191
    92 
    9392    if ( drubba_fb_cfm_active() ) { // @since 1.1.0
    9493
     
    119118        }
    120119    }
     120
     121    $fastbill_settings[] = array(
     122        'id'   => 'drubba_fb_fastbill_debug_log',
     123        'name' => __( 'Debug mode', 'edd-fastbill' ),
     124        'desc' => __( 'Write debug logs into the database.', 'edd-fastbill' ),
     125        'type' => 'checkbox',
     126    );
     127
     128    $fastbill_settings[] = array(
     129        'id'   => 'drubba_fb_fastbill_reset_debug_log',
     130        'name' => __( 'Reset debug entries', 'edd-fastbill' ),
     131        'desc' => __( 'Remove debug logs from database.', 'edd-fastbill' ),
     132        'type' => 'checkbox',
     133    );
    121134
    122135    if ( version_compare( EDD_VERSION, 2.5, '>=' ) ) {
     
    217230    return $templates;
    218231}
     232
     233/**
     234 * Display field for debug output
     235 *
     236 * @param $html
     237 * @param $args
     238 *
     239 * @return string
     240 */
     241function drubba_fb_fastbill_show_debug_log_field( $html, $args ) {
     242    if ( $args['id'] == 'drubba_fb_fastbill_debug_log' ) {
     243        $current_log = get_option( 'edd_fastbill_error_log', '' );
     244        if ( ! empty( $current_log ) ) {
     245            $html = $html . '<br><br><textarea style="width:100%;height:400px;" readonly>' . $current_log . '</textarea>';
     246        }
     247    }
     248
     249    return $html;
     250}
     251
     252add_filter( 'edd_after_setting_output', 'drubba_fb_fastbill_show_debug_log_field', 10, 2 );
     253
     254/**
     255 * Reset database debug log
     256 *
     257 * @param $new_value
     258 * @param $old_value
     259 *
     260 * @return mixed
     261 */
     262function drubba_fb_fastbill_reset_debug_log( $new_value, $old_value ) {
     263    if ( $new_value['drubba_fb_fastbill_reset_debug_log'] == 1 ) {
     264        update_option( 'edd_fastbill_error_log', '' );
     265        $new_value['drubba_fb_fastbill_reset_debug_log'] = - 1;
     266    }
     267
     268    return $new_value;
     269}
     270
     271add_action( 'pre_update_option_edd_settings', 'drubba_fb_fastbill_reset_debug_log', 10, 2 );
  • edd-fastbill/trunk/languages/edd-fastbill.pot

    r1457180 r1546822  
    11# Copyright (C) 2016 Easy Digital Downloads - FastBill Integration
    22# This file is distributed under the same license as the Easy Digital Downloads - FastBill Integration package.
     3#, fuzzy
    34msgid ""
    45msgstr ""
    5 "Project-Id-Version: Easy Digital Downloads - FastBill Integration 1.4.1\n"
    6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/edd-fastbill\n"
    7 "POT-Creation-Date: 2016-07-19 20:21:24+00:00\n"
     6"Project-Id-Version: EDD - FastBill\n"
     7"Report-Msgid-Bugs-To: \n"
     8"POT-Creation-Date: 2016-12-07 00:40+0100\n"
     9"PO-Revision-Date: 2016-12-07 00:33+0100\n"
     10"Last-Translator: Markus Drubba <kontakt@markusdrubba.de>\n"
     11"Language-Team: \n"
     12"Language: de_DE\n"
    813"MIME-Version: 1.0\n"
    914"Content-Type: text/plain; charset=UTF-8\n"
    1015"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
    12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    13 "Language-Team: LANGUAGE <LL@li.org>\n"
     16"Plural-Forms: nplurals=2; plural=n != 1;\n"
     17"X-Generator: Poedit 1.8.5\n"
     18"X-Poedit-SourceCharset: UTF-8\n"
     19"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;"
     20"_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
     21"X-Poedit-Basepath: ..\n"
     22"X-Textdomain-Support: yes\n"
     23"X-Poedit-SearchPath-0: .\n"
    1424
    1525#: includes/fastbill-functions.php:70
     
    2535msgstr ""
    2636
    27 #: includes/fastbill-functions.php:177 includes/fastbill-functions.php:261
    28 #: includes/fastbill-functions.php:319 includes/fastbill-functions.php:375
    29 #: includes/fastbill-functions.php:412 includes/fastbill-functions.php:419
    30 #: includes/fastbill-functions.php:456 includes/fastbill-functions.php:585
    31 #: includes/fastbill-functions.php:639 includes/fastbill-functions.php:698
     37#: includes/fastbill-functions.php:177 includes/fastbill-functions.php:261 includes/fastbill-functions.php:319
     38#: includes/fastbill-functions.php:375 includes/fastbill-functions.php:431 includes/fastbill-functions.php:469
     39#: includes/fastbill-functions.php:476 includes/fastbill-functions.php:513 includes/fastbill-functions.php:642
     40#: includes/fastbill-functions.php:696 includes/fastbill-functions.php:755
    3241msgid "Error: "
    3342msgstr ""
     
    4150msgstr ""
    4251
    43 #: includes/fastbill-functions.php:455
     52#: includes/fastbill-functions.php:430
     53msgid "There was an error canceling an invoice in FastBill:"
     54msgstr ""
     55
     56#: includes/fastbill-functions.php:512
    4457msgid "There was an error sending an invoice via FastBill:"
    4558msgstr ""
    4659
    47 #: includes/fastbill-functions.php:584
     60#: includes/fastbill-functions.php:641
    4861msgid "There was an error creating this customer in FastBill:"
    4962msgstr ""
    5063
    51 #: includes/fastbill-functions.php:638
     64#: includes/fastbill-functions.php:695
    5265msgid "There was an error looking up this customer in FastBill:"
    5366msgstr ""
    5467
    55 #: includes/fastbill-functions.php:697
     68#: includes/fastbill-functions.php:754
    5669msgid "There was an error when receiving templates from FastBill:"
    5770msgstr ""
     
    6174msgstr ""
    6275
    63 #: includes/frontend-functions.php:48 includes/frontend-functions.php:77
    64 #: includes/payment-history.php:33 includes/template-tags.php:50
     76#: includes/frontend-functions.php:48 includes/frontend-functions.php:77 includes/payment-history.php:33
     77#: includes/template-tags.php:50
    6578msgid "Download Invoice"
    6679msgstr ""
     
    111124
    112125#: includes/register-settings.php:51
    113 msgid ""
    114 "Choose invoice template. If you edit a Template in FastBill, you have to "
    115 "reassign it here."
     126msgid "Choose invoice template. If you edit a Template in FastBill, you have to reassign it here."
    116127msgstr ""
    117128
     
    137148
    138149#: includes/register-settings.php:72
    139 msgid ""
    140 "Create payment in FastBill when order is placed, requires invoice status "
    141 "COMPLETE"
     150msgid "Create payment in FastBill when order is placed, requires invoice status COMPLETE"
    142151msgstr ""
    143152
     
    156165#: includes/register-settings.php:86
    157166msgid ""
    158 "I activated the online invoice functionalty within my Fastbill account to "
    159 "accessing the generated invoice."
    160 msgstr ""
    161 
    162 #: includes/register-settings.php:98
     167"I activated the online invoice functionalty within my Fastbill account to accessing the generated invoice."
     168msgstr ""
     169
     170#: includes/register-settings.php:97
    163171msgid "FastBill Customer Fields"
    164172msgstr ""
    165173
    166 #: includes/register-settings.php:179
     174#: includes/register-settings.php:123
     175msgid "Debug mode"
     176msgstr ""
     177
     178#: includes/register-settings.php:124
     179msgid "Write debug logs into the database."
     180msgstr ""
     181
     182#: includes/register-settings.php:130
     183msgid "Reset debug entries"
     184msgstr ""
     185
     186#: includes/register-settings.php:131
     187msgid "Remove debug logs from database."
     188msgstr ""
     189
     190#: includes/register-settings.php:192
    167191msgid "Organization"
    168192msgstr ""
    169193
    170 #: includes/register-settings.php:180
     194#: includes/register-settings.php:193
    171195msgid "If set by customer, than Business"
    172196msgstr ""
    173197
    174 #: includes/register-settings.php:183
     198#: includes/register-settings.php:196
    175199msgid "Salutation"
    176200msgstr ""
    177201
    178 #: includes/register-settings.php:184
     202#: includes/register-settings.php:197
    179203msgid "Use Herr, Hr., Hr, Mister, Mr, Mr. & Frau, Fr., Fr, Misses, Miss, Mrs."
    180204msgstr ""
    181205
    182 #: includes/register-settings.php:186
     206#: includes/register-settings.php:199
    183207msgid "Phone"
    184208msgstr ""
    185209
    186 #: includes/register-settings.php:187
     210#: includes/register-settings.php:200
    187211msgid "Fax"
    188212msgstr ""
    189213
    190 #: includes/register-settings.php:188
     214#: includes/register-settings.php:201
    191215msgid "Mobile"
    192216msgstr ""
    193217
    194 #: includes/register-settings.php:202
     218#: includes/register-settings.php:215
    195219msgid "Default"
    196220msgstr ""
     
    199223msgid "Creates a link to the downloadable Fastbill invoice"
    200224msgstr ""
    201 
    202 #. Plugin Name of the plugin/theme
    203 msgid "Easy Digital Downloads - FastBill Integration"
    204 msgstr ""
    205 
    206 #. Plugin URI of the plugin/theme
    207 msgid ""
    208 "https://easydigitaldownloads.com/extensions/fastbill-integration/?ref=2325"
    209 msgstr ""
    210 
    211 #. Description of the plugin/theme
    212 msgid ""
    213 "Integrates <a href=\"https://easydigitaldownloads.com/\" target=\"_blank"
    214 "\">Easy Digital Downloads</a> with the <a href=\"http://www.fastbill.com\" "
    215 "target=\"_blank\">FastBill - fast money</a> accounting software."
    216 msgstr ""
    217 
    218 #. Author of the plugin/theme
    219 msgid "Markus Drubba"
    220 msgstr ""
    221 
    222 #. Author URI of the plugin/theme
    223 msgid "http://markusdrubba.de"
    224 msgstr ""
  • edd-fastbill/trunk/readme.txt

    r1457180 r1546822  
    11=== EDD - FastBill Integration ===
    22Contributors: drumba
    3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BCVM7FZ6ZCM2A
     3Donate link: https://www.paypal.me/markusdrubba
    44Tags: Digital Downloads, EDD, Fastbill, Accounting, Invoice
    55Requires at least: 4.5
    6 Tested up to: 4.5.3
    7 Stable tag: 1.4.2
     6Tested up to: 4.7
     7Stable tag: 1.4.3
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2424* Activate the plugin in your WordPress admin area.
    2525
     26== Screenshots ==
     27
     281. FastBill Settings
     292. Payment column
     30
    2631== Configuration ==
    2732
     
    3439
    3540== Changelog ==
     41
     42= 2016-12-06 1.4.3 =
     43
     44* New: Cancel Payments when customer get a refund
     45* Tweak: debug logs are written to the database
    3646
    3747= 2016-07-04 1.4.2 =
Note: See TracChangeset for help on using the changeset viewer.