Plugin Directory

Changeset 1505274


Ignore:
Timestamp:
09/29/2016 04:24:43 PM (9 years ago)
Author:
JohnnyPea
Message:

v1.5.12

Location:
woocommerce-superfaktura/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-superfaktura/trunk/README.txt

    r1476611 r1505274  
    44Tags: superfaktura, invoice, faktura, proforma, woocommerce
    55Requires at least: 4.0
    6 Tested up to: 4.6.0
    7 Stable tag: 1.5.8
     6Tested up to: 4.6.1
     7Stable tag: 1.5.12
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6464== Changelog ==
    6565
    66 = 1.5.7 =
     66= 1.5.12 =
     67* Pridaná možnosť filtrovať vo faktúrach výber SuperFaktúra číselníka
     68
     69= 1.5.11 =
     70* Pridané nastavenie zobrazovania čísla objednávky vo faktúre
     71* Pridaná možnosť nastavenia jazyka faktúry
     72
     73= 1.5.10 =
     74* Pridaný odkaz na proformu a faktúru do zoznamu objednávok, ktorý zákazník vidí na stránke „Môj účet“
     75
     76= 1.5.9 =
     77* Pridaná podpora pre Sequential Order Numbers Pro
     78
     79= 1.5.8 =
    6780* Opravená kompatibilita s WordPress 4.6
    6881
  • woocommerce-superfaktura/trunk/class-wc-superfaktura.php

    r1472995 r1505274  
    2424     * @var     string
    2525     */
    26     protected $version = '1.5.6';
     26    protected $version = '1.5.12';
    2727
    2828    /**
     
    185185
    186186        if ( is_plugin_active( 'woocommerce-sequential-order-numbers/woocommerce-sequential-order-numbers.php' ) ) {
     187            return;
     188        }
     189
     190        if ( is_plugin_active( 'woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php' ) ) {
    187191            return;
    188192        }
     
    221225        // metabox hook
    222226        add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
     227
     228        // customer order list actions filter
     229        add_filter( 'woocommerce_my_account_my_orders_actions', array( $this, 'my_orders_actions' ), 10, 2 );
    223230
    224231        $wc_get_order_statuses = $this->get_order_statuses();
     
    412419        if ( get_option('woocommerce_sf_comments') == 'yes' )
    413420        {
    414             $set_invoice_data['header_comment'] = 'Číslo objednávky: '.$order->get_order_number();
     421            if ( 'no' !== get_option( 'woocommerce_sf_order_number_visibility' ) ) {
     422                $set_invoice_data['header_comment'] = 'Číslo objednávky: '.$order->get_order_number();
     423            }
    415424
    416425            if ( WC()->countries->get_base_country() != $order->billing_country )
     
    572581        else
    573582        {
    574             $invoice_id = apply_filters( 'wc_sf_invoice_id', false, $type, $order );
    575 
    576             if ( ! $invoice_id ) {
    577                 $invoice_id = get_option('woocommerce_sf_invoice_custom_num')=='yes' ? $this->generate_invoice_id($order,$type) : '';
    578             }
    579 
    580             $api->setInvoice(array(
     583            $args = array(
    581584                'type' => $type,
    582                 'invoice_no_formatted' => $invoice_id,
    583             ));
     585            );
     586
     587            $sequence_id = apply_filters( 'wc_sf_sequence_id', false, $type, $order );
     588
     589            if ( ! $sequence_id ) {
     590              $sequence_id = '';
     591            }
     592
     593            if ( $sequence_id ) {
     594              $args['sequence_id'] = $sequence_id;
     595            } else {
     596              $invoice_id = apply_filters( 'wc_sf_invoice_id', false, $type, $order );
     597
     598              if ( ! $invoice_id ) {
     599                  $invoice_id = get_option('woocommerce_sf_invoice_custom_num')=='yes' ? $this->generate_invoice_id($order,$type) : '';
     600              }
     601
     602              $args['invoice_no_formatted'] = $invoice_id;
     603            }
     604
     605            $api->setInvoice( $args );
    584606
    585607            $response = $api->save();
     
    592614            update_post_meta($order->id, 'wc_sf_internal_' . $type . '_id', $internal_id);
    593615
    594             $pdf = $api::SFAPI_URL.'/invoices/pdf/'.$internal_id.'/token:'.$response->data->Invoice->token;
     616            $locale_map = array(
     617                'sk' => 'slo',
     618                'cs' => 'cze',
     619                'en' => 'eng',
     620                'de' => 'deu',
     621                'ru' => 'rus',
     622                'uk' => 'ukr',
     623                'hu' => 'hun',
     624                'pl' => 'pol',
     625            );
     626            $language = get_option( 'woocommerce_sf_invoice_language' );
     627            switch ( $language ) {
     628            case 'locale':
     629                $locale = substr( get_locale(), 0, 2 );
     630                if ( isset( $locale_map[ $locale ] ) ) {
     631                    $language = $locale_map[ $locale ];
     632                    break;
     633                }
     634                // break omitted intentionally
     635            default:
     636                if ( ! in_array( $language, $locale_map ) ) {
     637                    $language = 'cz' === get_option( 'woocommerce_sf_lang' ) ? 'cze' : 'slo';
     638                }
     639                break;
     640            }
     641
     642            $pdf = $api::SFAPI_URL . '/' . $language . '/invoices/pdf/' . $internal_id . '/token:' . $response->data->Invoice->token;
    595643
    596644            update_post_meta($order->id, 'wc_sf_invoice_'.$type, $pdf);
     
    801849            ),
    802850            array(
     851                'title' => __( 'Invoice language', 'wc-superfaktura' ),
     852                'id' => 'woocommerce_sf_invoice_language',
     853                'default' => 'endpoint',
     854                'type' => 'select',
     855                'options' => array(
     856                    'endpoint' => __( 'Default endpoint language', 'wc-superfaktura' ),
     857                    'locale' => __( 'Site locale (fallback to endpoint)', 'wc-superfaktura' ),
     858                    'slo' => __( 'Slovak', 'wc-superfaktura' ),
     859                    'cze' => __( 'Czech', 'wc-superfaktura' ),
     860                    'eng' => __( 'Εnglish', 'wc-superfaktura' ),
     861                    'deu' => __( 'German', 'wc-superfaktura' ),
     862                    'rus' => __( 'Russian', 'wc-superfaktura' ),
     863                    'ukr' => __( 'Ukrainian', 'wc-superfaktura' ),
     864                    'hun' => __( 'Hungarian', 'wc-superfaktura' ),
     865                    'pol' => __( 'Polish', 'wc-superfaktura' ),
     866                ),
     867            ),
     868            array(
    803869                'type' => 'sectionend',
    804870                'id' => 'woocommerce_wi_invoice_title2'
     
    816882                'type' => 'checkbox',
    817883                'desc' => 'Override default comments options in SuperFaktúra. It adds information about order number, custom comment and tax liability if needed.'
     884            ),
     885            array(
     886                'title' => __('Order number', 'wc-superfaktura'),
     887                'id' => 'woocommerce_sf_order_number_visibility',
     888                'type' => 'checkbox',
     889                'desc' => __( 'Display an order number if comments are enabled.', 'wc-superfaktura' ),
     890                'default' => 'yes',
    818891            ),
    819892            array(
     
    10961169    }
    10971170
     1171    function my_orders_actions( $actions, $order )
     1172    {
     1173        $pdf = get_post_meta( $order->id, 'wc_sf_invoice_proforma', true );
     1174        if ( $pdf ) {
     1175            $actions['wc_sf_invoice_proforma'] = array(
     1176                'url' => $pdf,
     1177                'name' => __( 'Proforma', 'wc-superfaktura' ),
     1178            );
     1179        }
     1180        $pdf = get_post_meta( $order->id, 'wc_sf_invoice_regular', true );
     1181        if ( $pdf ) {
     1182            $actions['wc_sf_invoice_regular'] = array(
     1183                'url' => $pdf,
     1184                'name' => __( 'Invoice', 'wc-superfaktura' ),
     1185            );
     1186        }
     1187
     1188        return $actions;
     1189    }
     1190
    10981191    function sf_can_regenerate($order)
    10991192    {
  • woocommerce-superfaktura/trunk/wc-superfaktura.php

    r1476611 r1505274  
    1111 * Plugin URI:  http://www.platobnebrany.sk/
    1212 * Description: WooCommerce integrácia služby <a href="http://www.superfaktura.sk/api/">SuperFaktúra.sk</a> Máte s modulom technický problém? Napíšte nám na <a href="mailto:[email protected]">[email protected]</a>
    13  * Version:     1.5.8
     13 * Version:     1.5.12
    1414 * Author:      Webikon (Ján Bočínec)
    1515 * Author URI:  http://www.webikon.sk
Note: See TracChangeset for help on using the changeset viewer.