Plugin Directory

Changeset 3730776


Ignore:
Timestamp:
10/06/2026 12:24:51 PM (3 weeks ago)
Author:
superfaktura
Message:

Release 1.56.0

Location:
woocommerce-superfaktura
Files:
8 added
26 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-superfaktura/tags/1.56.0/README.txt

    r3719169 r3730776  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.55.3
     7Stable tag: 1.56.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    … …  
    6565
    6666== Changelog ==
     67
     68= 1.56.0 =
     69* Informácia o eFaktúre, ktorá bude pre platiteľov DPH povinná od 1. 1. 2027, a o tom, ako sa na ňu pripraviť so SuperFaktúrou. Nový filter sf_show_efaktura_banner.
     70* Upozornenie v administrácii, keď sa doklad nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre, s odkazmi na objednávky a API log. Nový filter sf_admin_document_errors.
     71* Jazyk faktúry podľa krajiny zákazníka, s nastaviteľným jazykom pre krajiny, ktorých jazyk SuperFaktúra nepodporuje. Nový filter sf_invoice_language_country_map.
    6772
    6873= 1.55.3 =
  • woocommerce-superfaktura/tags/1.56.0/assets/js/admin.js

    r3694932 r3730776  
    2525                        $items.hide();
    2626                }
     27        }
     28
     29        // Invoice language: the fallback language applies only to the customer country option.
     30        var $invoiceLanguage = $('#woocommerce_sf_invoice_language');
     31        if ($invoiceLanguage.length) {
     32                var wc_sf_toggle_language_fallback = function() {
     33                        wc_sf_toggle_settings('#woocommerce_sf_invoice_language_fallback', 'country' === $invoiceLanguage.val());
     34                };
     35                $invoiceLanguage.on('change', wc_sf_toggle_language_fallback);
     36                wc_sf_toggle_language_fallback();
    2737        }
    2838
  • woocommerce-superfaktura/tags/1.56.0/changelog.txt

    r3719169 r3730776  
    11=== SuperFaktura WooCommerce – Changelog ===
     2
     3= 1.56.0 =
     4* Informácia o eFaktúre, ktorá bude pre platiteľov DPH povinná od 1. 1. 2027, a o tom, ako sa na ňu pripraviť so SuperFaktúrou. Nový filter sf_show_efaktura_banner.
     5* Upozornenie v administrácii, keď sa doklad nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre, s odkazmi na objednávky a API log. Nový filter sf_admin_document_errors.
     6* Jazyk faktúry podľa krajiny zákazníka, s nastaviteľným jazykom pre krajiny, ktorých jazyk SuperFaktúra nepodporuje. Nový filter sf_invoice_language_country_map.
    27
    38= 1.55.3 =
  • woocommerce-superfaktura/tags/1.56.0/includes/class-wc-sf-admin.php

    r3551029 r3730776  
    4040        add_action( 'admin_notices', array( $this, 'admin_notices' ) );
    4141        add_action( 'admin_notices', array( __CLASS__, 'order_number_notice_all' ) );
    42         add_action( 'woocommerce_settings_wc_superfaktura', array( __CLASS__, 'order_number_notice' ) );
     42        add_action( 'woocommerce_settings_superfaktura', array( __CLASS__, 'order_number_notice' ) );
    4343        add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
    4444        add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
    … …  
    9797                        update_option( 'wc_sf_order_number_notice_hidden', 1 );
    9898                        wp_safe_redirect( remove_query_arg( 'sf_hide_order_number_notice' ) );
     99                        exit;
    99100                }
    100101    }
    … …  
    181182     */
    182183    public static function order_number_notice_all() {
    183                 if ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && 'wc_superfaktura' === $_GET['tab'] ) {
     184                if ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && 'superfaktura' === $_GET['tab'] ) {
    184185                        return;
    185186                }
  • woocommerce-superfaktura/tags/1.56.0/includes/class-wc-sf-settings.php

    r3694932 r3730776  
    423423                                                        'locale'   => __( 'Site locale (fallback to endpoint)', 'woocommerce-superfaktura' ),
    424424                                                        'wpml'     => __( 'WPML', 'woocommerce-superfaktura' ),
     425                                                        'country'  => __( 'Customer country', 'woocommerce-superfaktura' ),
    425426                                                        'slo'      => __( 'Slovak', 'woocommerce-superfaktura' ),
    426427                                                        'cze'      => __( 'Czech', 'woocommerce-superfaktura' ),
    427                                                         'eng'      => __( 'Εnglish', 'woocommerce-superfaktura' ),
     428                                                        'eng'      => __( 'English', 'woocommerce-superfaktura' ),
     429                                                        'deu'      => __( 'German', 'woocommerce-superfaktura' ),
     430                                                        'nld'      => __( 'Dutch', 'woocommerce-superfaktura' ),
     431                                                        'hrv'      => __( 'Croatian', 'woocommerce-superfaktura' ),
     432                                                        'hun'      => __( 'Hungarian', 'woocommerce-superfaktura' ),
     433                                                        'pol'      => __( 'Polish', 'woocommerce-superfaktura' ),
     434                                                        'rom'      => __( 'Romanian', 'woocommerce-superfaktura' ),
     435                                                        'rus'      => __( 'Russian', 'woocommerce-superfaktura' ),
     436                                                        'slv'      => __( 'Slovenian', 'woocommerce-superfaktura' ),
     437                                                        'spa'      => __( 'Spanish', 'woocommerce-superfaktura' ),
     438                                                        'ita'      => __( 'Italian', 'woocommerce-superfaktura' ),
     439                                                        'ukr'      => __( 'Ukrainian', 'woocommerce-superfaktura' ),
     440                                                ),
     441                                        ),
     442                                        array(
     443                                                'title'   => __( 'Fallback invoice language', 'woocommerce-superfaktura' ),
     444                                                'id'      => 'woocommerce_sf_invoice_language_fallback',
     445                                                'default' => 'endpoint',
     446                                                'type'    => 'select',
     447                                                'class'   => 'wc-enhanced-select',
     448                                                'desc'    => __( 'Used with the customer country option when SuperFaktúra does not support the language of the customer\'s country.', 'woocommerce-superfaktura' ),
     449                                                'options' => array(
     450                                                        'endpoint' => __( 'Default endpoint language', 'woocommerce-superfaktura' ),
     451                                                        'eng'      => __( 'English', 'woocommerce-superfaktura' ),
     452                                                        'slo'      => __( 'Slovak', 'woocommerce-superfaktura' ),
     453                                                        'cze'      => __( 'Czech', 'woocommerce-superfaktura' ),
    428454                                                        'deu'      => __( 'German', 'woocommerce-superfaktura' ),
    429455                                                        'nld'      => __( 'Dutch', 'woocommerce-superfaktura' ),
  • woocommerce-superfaktura/tags/1.56.0/includes/class-wc-superfaktura.php

    r3719141 r3730776  
    3030         * @var string
    3131         */
    32         public $version = '1.55.3';
     32        public $version = '1.56.0';
    3333
    3434        /**
    … …  
    145145         */
    146146        public $subscriptions;
     147
     148        /**
     149         * Admin notices (eFaktúra announcement, failed documents).
     150         *
     151         * @var WC_SF_Notices
     152         */
     153        public $notices;
    147154
    148155
    … …  
    233240                $this->tools = new WC_SF_Tools($this);
    234241                $this->subscriptions = new WC_SF_Subscriptions($this);
     242                $this->notices = new WC_SF_Notices($this);
    235243        }
    236244
    … …  
    404412                $this->checkout_block->init();
    405413                $this->bulk->init();
     414                $this->notices->init();
    406415        }
    407416
    … …  
    696705                $order->save();
    697706
     707                // The invoice is attached without a log entry, so refresh the failed documents warning.
     708                WC_SF_Notices::flush_errors();
     709
    698710                return true;
    699711        }
    … …  
    808820
    809821                        $order->save();
     822
     823                        // The document is attached without a log entry, so refresh the failed documents warning.
     824                        WC_SF_Notices::flush_errors();
    810825
    811826                        return true;
    … …  
    10081023                $log_data['time'] = current_time( 'mysql' );
    10091024                $wpdb->insert( $wpdb->prefix . 'wc_sf_log', $log_data );
     1025
     1026                if ( isset( $log_data['request_type'] ) && in_array( $log_data['request_type'], array( 'create', 'edit' ), true ) ) {
     1027                        WC_SF_Notices::flush_errors();
     1028                }
    10101029        }
    10111030
    … …  
    11351154                $result = __( 'Coupons', 'woocommerce-superfaktura' ) . ': ' . implode( ', ', $coupons );
    11361155                return $result;
     1156        }
     1157
     1158
     1159
     1160        /**
     1161         * Map of customer countries to the SuperFaktúra invoice language of that country.
     1162         *
     1163         * Only countries whose language SuperFaktúra supports; other countries use the fallback language from the settings.
     1164         *
     1165         * @return array Country code => SuperFaktúra language code.
     1166         */
     1167        public function get_language_country_map() {
     1168                $country_map = array(
     1169                        'SK' => 'slo',
     1170                        'CZ' => 'cze',
     1171                        'DE' => 'deu',
     1172                        'AT' => 'deu',
     1173                        'LI' => 'deu',
     1174                        'NL' => 'nld',
     1175                        'HR' => 'hrv',
     1176                        'HU' => 'hun',
     1177                        'PL' => 'pol',
     1178                        'RO' => 'rom',
     1179                        'RU' => 'rus',
     1180                        'SI' => 'slv',
     1181                        'ES' => 'spa',
     1182                        'MX' => 'spa',
     1183                        'AR' => 'spa',
     1184                        'CO' => 'spa',
     1185                        'CL' => 'spa',
     1186                        'PE' => 'spa',
     1187                        'VE' => 'spa',
     1188                        'EC' => 'spa',
     1189                        'GT' => 'spa',
     1190                        'CU' => 'spa',
     1191                        'BO' => 'spa',
     1192                        'DO' => 'spa',
     1193                        'HN' => 'spa',
     1194                        'PY' => 'spa',
     1195                        'SV' => 'spa',
     1196                        'NI' => 'spa',
     1197                        'CR' => 'spa',
     1198                        'PA' => 'spa',
     1199                        'UY' => 'spa',
     1200                        'IT' => 'ita',
     1201                        'SM' => 'ita',
     1202                        'UA' => 'ukr',
     1203                        'GB' => 'eng',
     1204                        'IE' => 'eng',
     1205                        'US' => 'eng',
     1206                        'AU' => 'eng',
     1207                        'NZ' => 'eng',
     1208                );
     1209
     1210                /**
     1211                 * Filter the map of customer countries to invoice languages used by the "Customer country" invoice language.
     1212                 *
     1213                 * @since 1.56.0
     1214                 *
     1215                 * @param array $country_map Country code => SuperFaktúra language code (slo, cze, eng, deu, nld, hrv, hun, pol, rom, rus, slv, spa, ita, ukr).
     1216                 */
     1217                return apply_filters( 'sf_invoice_language_country_map', $country_map );
    11371218        }
    11381219
    … …  
    11861267                                break;
    11871268
     1269                        case 'country':
     1270                                $order   = wc_get_order( $order_id );
     1271                                $country = '';
     1272                                if ( $order ) {
     1273                                        $country = $order->get_billing_country() ? $order->get_billing_country() : $order->get_shipping_country();
     1274                                }
     1275
     1276                                $country_map = $this->get_language_country_map();
     1277                                if ( isset( $country_map[ $country ] ) ) {
     1278                                        $language = $country_map[ $country ];
     1279                                } else {
     1280                                        // SuperFaktúra has no language for this country.
     1281                                        $language = get_option( 'woocommerce_sf_invoice_language_fallback', 'endpoint' );
     1282                                }
     1283                                break;
     1284
    11881285                        case 'endpoint':
    11891286                        default:
  • woocommerce-superfaktura/tags/1.56.0/languages/woocommerce-superfaktura-cs_CZ.po

    r3694932 r3730776  
    464464
    465465#: includes/class-wc-sf-settings.php:352
    466 msgid "Εnglish"
     466msgid "English"
    467467msgstr "Angličtina"
    468468
    … …  
    16021602msgid "Include references to the SuperFaktúra account (number sequences, bank account, cash registers, logo, country overrides)"
    16031603msgstr "Zahrnout odkazy na účet SuperFaktury (číselníky, bankovní účet, pokladny, logo, nastavení pro země)"
     1604
     1605#: includes/class-wc-sf-settings.php
     1606msgid "Customer country"
     1607msgstr "Země zákazníka"
     1608
     1609#: includes/class-wc-sf-settings.php
     1610msgid "Fallback invoice language"
     1611msgstr "Náhradní jazyk faktury"
     1612
     1613#: includes/class-wc-sf-settings.php
     1614msgid "Used with the customer country option when SuperFaktúra does not support the language of the customer's country."
     1615msgstr "Použije se při volbě Země zákazníka, pokud SuperFaktura nepodporuje jazyk země zákazníka."
     1616
     1617#: includes/class-wc-sf-notices.php
     1618msgid "%d document could not be created or updated in SuperFaktúra in the last 30 days."
     1619msgid_plural "%d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1620msgstr[0] "%d doklad se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1621msgstr[1] "%d doklady se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1622msgstr[2] "%d dokladů se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1623
     1624#: includes/class-wc-sf-notices.php
     1625msgid "Order #%s"
     1626msgstr "Objednávka #%s"
     1627
     1628#: includes/class-wc-sf-notices.php
     1629msgid "and %d more"
     1630msgid_plural "and %d more"
     1631msgstr[0] "a další %d"
     1632msgstr[1] "a další %d"
     1633msgstr[2] "a dalších %d"
     1634
     1635#: includes/class-wc-sf-notices.php
     1636msgid "Open API log"
     1637msgstr "Otevřít API log"
     1638
     1639#: includes/class-wc-sf-notices.php
     1640msgid "More than %d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1641msgstr "Více než %d dokladů se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1642
     1643#: includes/class-wc-sf-notices.php
     1644msgid "and more"
     1645msgstr "a další"
  • woocommerce-superfaktura/tags/1.56.0/languages/woocommerce-superfaktura-sk_SK.po

    r3694932 r3730776  
    464464
    465465#: includes/class-wc-sf-settings.php:352
    466 msgid "Εnglish"
     466msgid "English"
    467467msgstr "Angličtina"
    468468
    … …  
    16061606msgid "Include references to the SuperFaktúra account (number sequences, bank account, cash registers, logo, country overrides)"
    16071607msgstr "Zahrnúť odkazy na účet SuperFaktúry (číselníky, bankový účet, pokladne, logo, nastavenia pre krajiny)"
     1608
     1609#: includes/class-wc-sf-settings.php
     1610msgid "Customer country"
     1611msgstr "Krajina zákazníka"
     1612
     1613#: includes/class-wc-sf-settings.php
     1614msgid "Fallback invoice language"
     1615msgstr "Náhradný jazyk faktúry"
     1616
     1617#: includes/class-wc-sf-settings.php
     1618msgid "Used with the customer country option when SuperFaktúra does not support the language of the customer's country."
     1619msgstr "Použije sa pri voľbe Krajina zákazníka, ak SuperFaktúra nepodporuje jazyk krajiny zákazníka."
     1620
     1621#: includes/class-wc-sf-notices.php
     1622msgid "%d document could not be created or updated in SuperFaktúra in the last 30 days."
     1623msgid_plural "%d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1624msgstr[0] "%d doklad sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1625msgstr[1] "%d doklady sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1626msgstr[2] "%d dokladov sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1627
     1628#: includes/class-wc-sf-notices.php
     1629msgid "Order #%s"
     1630msgstr "Objednávka #%s"
     1631
     1632#: includes/class-wc-sf-notices.php
     1633msgid "and %d more"
     1634msgid_plural "and %d more"
     1635msgstr[0] "a ďalší %d"
     1636msgstr[1] "a ďalšie %d"
     1637msgstr[2] "a ďalších %d"
     1638
     1639#: includes/class-wc-sf-notices.php
     1640msgid "Open API log"
     1641msgstr "Otvoriť API log"
     1642
     1643#: includes/class-wc-sf-notices.php
     1644msgid "More than %d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1645msgstr "Viac ako %d dokladov sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1646
     1647#: includes/class-wc-sf-notices.php
     1648msgid "and more"
     1649msgstr "a ďalšie"
  • woocommerce-superfaktura/tags/1.56.0/languages/woocommerce-superfaktura.pot

    r3694932 r3730776  
    466466
    467467#: includes/class-wc-sf-settings.php:352
    468 msgid "Εnglish"
     468msgid "English"
    469469msgstr ""
    470470
    … …  
    15451545msgid "Include references to the SuperFaktúra account (number sequences, bank account, cash registers, logo, country overrides)"
    15461546msgstr ""
     1547
     1548#: includes/class-wc-sf-settings.php
     1549msgid "Customer country"
     1550msgstr ""
     1551
     1552#: includes/class-wc-sf-settings.php
     1553msgid "Fallback invoice language"
     1554msgstr ""
     1555
     1556#: includes/class-wc-sf-settings.php
     1557msgid "Used with the customer country option when SuperFaktúra does not support the language of the customer's country."
     1558msgstr ""
     1559
     1560#: includes/class-wc-sf-notices.php
     1561msgid "%d document could not be created or updated in SuperFaktúra in the last 30 days."
     1562msgid_plural "%d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1563msgstr[0] ""
     1564msgstr[1] ""
     1565
     1566#: includes/class-wc-sf-notices.php
     1567msgid "Order #%s"
     1568msgstr ""
     1569
     1570#: includes/class-wc-sf-notices.php
     1571msgid "and %d more"
     1572msgid_plural "and %d more"
     1573msgstr[0] ""
     1574msgstr[1] ""
     1575
     1576#: includes/class-wc-sf-notices.php
     1577msgid "Open API log"
     1578msgstr ""
     1579
     1580#: includes/class-wc-sf-notices.php
     1581msgid "More than %d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1582msgstr ""
     1583
     1584#: includes/class-wc-sf-notices.php
     1585msgid "and more"
     1586msgstr ""
  • woocommerce-superfaktura/tags/1.56.0/uninstall.php

    r2794434 r3730776  
    1616
    1717// TODO: Define uninstall functionality here.
     18
     19// Notices closed by users (eFaktúra announcement, failed documents).
     20global $wpdb;
     21$wc_sf_site_ids = ( is_multisite() && function_exists( 'get_sites' ) ) ? get_sites( array( 'fields' => 'ids', 'number' => 0 ) ) : array( get_current_blog_id() );
     22foreach ( $wc_sf_site_ids as $wc_sf_site_id ) {
     23        delete_metadata( 'user', 0, $wpdb->get_blog_prefix( $wc_sf_site_id ) . 'wc_sf_dismissed_notices', '', true );
     24        if ( is_multisite() ) {
     25                switch_to_blog( $wc_sf_site_id );
     26        }
     27        delete_transient( 'wc_sf_document_errors' );
     28        if ( is_multisite() ) {
     29                restore_current_blog();
     30        }
     31}
  • woocommerce-superfaktura/tags/1.56.0/woocommerce-superfaktura.php

    r3719141 r3730776  
    1313 * Plugin URI:  https://www.superfaktura.sk/integracia/
    1414 * Description: Integrácia služby <a href="http://www.superfaktura.sk/api/">SuperFaktúra.sk</a> pre WooCommerce. Máte s modulom technický problém? Napíšte nám na <a href="mailto:superfaktura@2day.sk">superfaktura@2day.sk</a>
    15  * Version:     1.55.3
     15 * Version:     1.56.0
    1616 * Author:      2day.sk
    1717 * Author URI:  https://www.superfaktura.sk/integracia/
    … …  
    3838require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-helper.php';
    3939require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-invoice.php';
     40require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-notices.php';
    4041require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-subscriptions.php';
    4142require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-tools.php';
  • woocommerce-superfaktura/trunk/README.txt

    r3719169 r3730776  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.55.3
     7Stable tag: 1.56.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    … …  
    6565
    6666== Changelog ==
     67
     68= 1.56.0 =
     69* Informácia o eFaktúre, ktorá bude pre platiteľov DPH povinná od 1. 1. 2027, a o tom, ako sa na ňu pripraviť so SuperFaktúrou. Nový filter sf_show_efaktura_banner.
     70* Upozornenie v administrácii, keď sa doklad nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre, s odkazmi na objednávky a API log. Nový filter sf_admin_document_errors.
     71* Jazyk faktúry podľa krajiny zákazníka, s nastaviteľným jazykom pre krajiny, ktorých jazyk SuperFaktúra nepodporuje. Nový filter sf_invoice_language_country_map.
    6772
    6873= 1.55.3 =
  • woocommerce-superfaktura/trunk/assets/js/admin.js

    r3694932 r3730776  
    2525                        $items.hide();
    2626                }
     27        }
     28
     29        // Invoice language: the fallback language applies only to the customer country option.
     30        var $invoiceLanguage = $('#woocommerce_sf_invoice_language');
     31        if ($invoiceLanguage.length) {
     32                var wc_sf_toggle_language_fallback = function() {
     33                        wc_sf_toggle_settings('#woocommerce_sf_invoice_language_fallback', 'country' === $invoiceLanguage.val());
     34                };
     35                $invoiceLanguage.on('change', wc_sf_toggle_language_fallback);
     36                wc_sf_toggle_language_fallback();
    2737        }
    2838
  • woocommerce-superfaktura/trunk/changelog.txt

    r3719169 r3730776  
    11=== SuperFaktura WooCommerce – Changelog ===
     2
     3= 1.56.0 =
     4* Informácia o eFaktúre, ktorá bude pre platiteľov DPH povinná od 1. 1. 2027, a o tom, ako sa na ňu pripraviť so SuperFaktúrou. Nový filter sf_show_efaktura_banner.
     5* Upozornenie v administrácii, keď sa doklad nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre, s odkazmi na objednávky a API log. Nový filter sf_admin_document_errors.
     6* Jazyk faktúry podľa krajiny zákazníka, s nastaviteľným jazykom pre krajiny, ktorých jazyk SuperFaktúra nepodporuje. Nový filter sf_invoice_language_country_map.
    27
    38= 1.55.3 =
  • woocommerce-superfaktura/trunk/includes/class-wc-sf-admin.php

    r3551029 r3730776  
    4040        add_action( 'admin_notices', array( $this, 'admin_notices' ) );
    4141        add_action( 'admin_notices', array( __CLASS__, 'order_number_notice_all' ) );
    42         add_action( 'woocommerce_settings_wc_superfaktura', array( __CLASS__, 'order_number_notice' ) );
     42        add_action( 'woocommerce_settings_superfaktura', array( __CLASS__, 'order_number_notice' ) );
    4343        add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
    4444        add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
    … …  
    9797                        update_option( 'wc_sf_order_number_notice_hidden', 1 );
    9898                        wp_safe_redirect( remove_query_arg( 'sf_hide_order_number_notice' ) );
     99                        exit;
    99100                }
    100101    }
    … …  
    181182     */
    182183    public static function order_number_notice_all() {
    183                 if ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && 'wc_superfaktura' === $_GET['tab'] ) {
     184                if ( isset( $_GET['page'], $_GET['tab'] ) && 'wc-settings' === $_GET['page'] && 'superfaktura' === $_GET['tab'] ) {
    184185                        return;
    185186                }
  • woocommerce-superfaktura/trunk/includes/class-wc-sf-settings.php

    r3694932 r3730776  
    423423                                                        'locale'   => __( 'Site locale (fallback to endpoint)', 'woocommerce-superfaktura' ),
    424424                                                        'wpml'     => __( 'WPML', 'woocommerce-superfaktura' ),
     425                                                        'country'  => __( 'Customer country', 'woocommerce-superfaktura' ),
    425426                                                        'slo'      => __( 'Slovak', 'woocommerce-superfaktura' ),
    426427                                                        'cze'      => __( 'Czech', 'woocommerce-superfaktura' ),
    427                                                         'eng'      => __( 'Εnglish', 'woocommerce-superfaktura' ),
     428                                                        'eng'      => __( 'English', 'woocommerce-superfaktura' ),
     429                                                        'deu'      => __( 'German', 'woocommerce-superfaktura' ),
     430                                                        'nld'      => __( 'Dutch', 'woocommerce-superfaktura' ),
     431                                                        'hrv'      => __( 'Croatian', 'woocommerce-superfaktura' ),
     432                                                        'hun'      => __( 'Hungarian', 'woocommerce-superfaktura' ),
     433                                                        'pol'      => __( 'Polish', 'woocommerce-superfaktura' ),
     434                                                        'rom'      => __( 'Romanian', 'woocommerce-superfaktura' ),
     435                                                        'rus'      => __( 'Russian', 'woocommerce-superfaktura' ),
     436                                                        'slv'      => __( 'Slovenian', 'woocommerce-superfaktura' ),
     437                                                        'spa'      => __( 'Spanish', 'woocommerce-superfaktura' ),
     438                                                        'ita'      => __( 'Italian', 'woocommerce-superfaktura' ),
     439                                                        'ukr'      => __( 'Ukrainian', 'woocommerce-superfaktura' ),
     440                                                ),
     441                                        ),
     442                                        array(
     443                                                'title'   => __( 'Fallback invoice language', 'woocommerce-superfaktura' ),
     444                                                'id'      => 'woocommerce_sf_invoice_language_fallback',
     445                                                'default' => 'endpoint',
     446                                                'type'    => 'select',
     447                                                'class'   => 'wc-enhanced-select',
     448                                                'desc'    => __( 'Used with the customer country option when SuperFaktúra does not support the language of the customer\'s country.', 'woocommerce-superfaktura' ),
     449                                                'options' => array(
     450                                                        'endpoint' => __( 'Default endpoint language', 'woocommerce-superfaktura' ),
     451                                                        'eng'      => __( 'English', 'woocommerce-superfaktura' ),
     452                                                        'slo'      => __( 'Slovak', 'woocommerce-superfaktura' ),
     453                                                        'cze'      => __( 'Czech', 'woocommerce-superfaktura' ),
    428454                                                        'deu'      => __( 'German', 'woocommerce-superfaktura' ),
    429455                                                        'nld'      => __( 'Dutch', 'woocommerce-superfaktura' ),
  • woocommerce-superfaktura/trunk/includes/class-wc-superfaktura.php

    r3719141 r3730776  
    3030         * @var string
    3131         */
    32         public $version = '1.55.3';
     32        public $version = '1.56.0';
    3333
    3434        /**
    … …  
    145145         */
    146146        public $subscriptions;
     147
     148        /**
     149         * Admin notices (eFaktúra announcement, failed documents).
     150         *
     151         * @var WC_SF_Notices
     152         */
     153        public $notices;
    147154
    148155
    … …  
    233240                $this->tools = new WC_SF_Tools($this);
    234241                $this->subscriptions = new WC_SF_Subscriptions($this);
     242                $this->notices = new WC_SF_Notices($this);
    235243        }
    236244
    … …  
    404412                $this->checkout_block->init();
    405413                $this->bulk->init();
     414                $this->notices->init();
    406415        }
    407416
    … …  
    696705                $order->save();
    697706
     707                // The invoice is attached without a log entry, so refresh the failed documents warning.
     708                WC_SF_Notices::flush_errors();
     709
    698710                return true;
    699711        }
    … …  
    808820
    809821                        $order->save();
     822
     823                        // The document is attached without a log entry, so refresh the failed documents warning.
     824                        WC_SF_Notices::flush_errors();
    810825
    811826                        return true;
    … …  
    10081023                $log_data['time'] = current_time( 'mysql' );
    10091024                $wpdb->insert( $wpdb->prefix . 'wc_sf_log', $log_data );
     1025
     1026                if ( isset( $log_data['request_type'] ) && in_array( $log_data['request_type'], array( 'create', 'edit' ), true ) ) {
     1027                        WC_SF_Notices::flush_errors();
     1028                }
    10101029        }
    10111030
    … …  
    11351154                $result = __( 'Coupons', 'woocommerce-superfaktura' ) . ': ' . implode( ', ', $coupons );
    11361155                return $result;
     1156        }
     1157
     1158
     1159
     1160        /**
     1161         * Map of customer countries to the SuperFaktúra invoice language of that country.
     1162         *
     1163         * Only countries whose language SuperFaktúra supports; other countries use the fallback language from the settings.
     1164         *
     1165         * @return array Country code => SuperFaktúra language code.
     1166         */
     1167        public function get_language_country_map() {
     1168                $country_map = array(
     1169                        'SK' => 'slo',
     1170                        'CZ' => 'cze',
     1171                        'DE' => 'deu',
     1172                        'AT' => 'deu',
     1173                        'LI' => 'deu',
     1174                        'NL' => 'nld',
     1175                        'HR' => 'hrv',
     1176                        'HU' => 'hun',
     1177                        'PL' => 'pol',
     1178                        'RO' => 'rom',
     1179                        'RU' => 'rus',
     1180                        'SI' => 'slv',
     1181                        'ES' => 'spa',
     1182                        'MX' => 'spa',
     1183                        'AR' => 'spa',
     1184                        'CO' => 'spa',
     1185                        'CL' => 'spa',
     1186                        'PE' => 'spa',
     1187                        'VE' => 'spa',
     1188                        'EC' => 'spa',
     1189                        'GT' => 'spa',
     1190                        'CU' => 'spa',
     1191                        'BO' => 'spa',
     1192                        'DO' => 'spa',
     1193                        'HN' => 'spa',
     1194                        'PY' => 'spa',
     1195                        'SV' => 'spa',
     1196                        'NI' => 'spa',
     1197                        'CR' => 'spa',
     1198                        'PA' => 'spa',
     1199                        'UY' => 'spa',
     1200                        'IT' => 'ita',
     1201                        'SM' => 'ita',
     1202                        'UA' => 'ukr',
     1203                        'GB' => 'eng',
     1204                        'IE' => 'eng',
     1205                        'US' => 'eng',
     1206                        'AU' => 'eng',
     1207                        'NZ' => 'eng',
     1208                );
     1209
     1210                /**
     1211                 * Filter the map of customer countries to invoice languages used by the "Customer country" invoice language.
     1212                 *
     1213                 * @since 1.56.0
     1214                 *
     1215                 * @param array $country_map Country code => SuperFaktúra language code (slo, cze, eng, deu, nld, hrv, hun, pol, rom, rus, slv, spa, ita, ukr).
     1216                 */
     1217                return apply_filters( 'sf_invoice_language_country_map', $country_map );
    11371218        }
    11381219
    … …  
    11861267                                break;
    11871268
     1269                        case 'country':
     1270                                $order   = wc_get_order( $order_id );
     1271                                $country = '';
     1272                                if ( $order ) {
     1273                                        $country = $order->get_billing_country() ? $order->get_billing_country() : $order->get_shipping_country();
     1274                                }
     1275
     1276                                $country_map = $this->get_language_country_map();
     1277                                if ( isset( $country_map[ $country ] ) ) {
     1278                                        $language = $country_map[ $country ];
     1279                                } else {
     1280                                        // SuperFaktúra has no language for this country.
     1281                                        $language = get_option( 'woocommerce_sf_invoice_language_fallback', 'endpoint' );
     1282                                }
     1283                                break;
     1284
    11881285                        case 'endpoint':
    11891286                        default:
  • woocommerce-superfaktura/trunk/languages/woocommerce-superfaktura-cs_CZ.po

    r3694932 r3730776  
    464464
    465465#: includes/class-wc-sf-settings.php:352
    466 msgid "Εnglish"
     466msgid "English"
    467467msgstr "Angličtina"
    468468
    … …  
    16021602msgid "Include references to the SuperFaktúra account (number sequences, bank account, cash registers, logo, country overrides)"
    16031603msgstr "Zahrnout odkazy na účet SuperFaktury (číselníky, bankovní účet, pokladny, logo, nastavení pro země)"
     1604
     1605#: includes/class-wc-sf-settings.php
     1606msgid "Customer country"
     1607msgstr "Země zákazníka"
     1608
     1609#: includes/class-wc-sf-settings.php
     1610msgid "Fallback invoice language"
     1611msgstr "Náhradní jazyk faktury"
     1612
     1613#: includes/class-wc-sf-settings.php
     1614msgid "Used with the customer country option when SuperFaktúra does not support the language of the customer's country."
     1615msgstr "Použije se při volbě Země zákazníka, pokud SuperFaktura nepodporuje jazyk země zákazníka."
     1616
     1617#: includes/class-wc-sf-notices.php
     1618msgid "%d document could not be created or updated in SuperFaktúra in the last 30 days."
     1619msgid_plural "%d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1620msgstr[0] "%d doklad se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1621msgstr[1] "%d doklady se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1622msgstr[2] "%d dokladů se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1623
     1624#: includes/class-wc-sf-notices.php
     1625msgid "Order #%s"
     1626msgstr "Objednávka #%s"
     1627
     1628#: includes/class-wc-sf-notices.php
     1629msgid "and %d more"
     1630msgid_plural "and %d more"
     1631msgstr[0] "a další %d"
     1632msgstr[1] "a další %d"
     1633msgstr[2] "a dalších %d"
     1634
     1635#: includes/class-wc-sf-notices.php
     1636msgid "Open API log"
     1637msgstr "Otevřít API log"
     1638
     1639#: includes/class-wc-sf-notices.php
     1640msgid "More than %d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1641msgstr "Více než %d dokladů se za posledních 30 dní nepodařilo vytvořit nebo aktualizovat v SuperFaktuře."
     1642
     1643#: includes/class-wc-sf-notices.php
     1644msgid "and more"
     1645msgstr "a další"
  • woocommerce-superfaktura/trunk/languages/woocommerce-superfaktura-sk_SK.po

    r3694932 r3730776  
    464464
    465465#: includes/class-wc-sf-settings.php:352
    466 msgid "Εnglish"
     466msgid "English"
    467467msgstr "Angličtina"
    468468
    … …  
    16061606msgid "Include references to the SuperFaktúra account (number sequences, bank account, cash registers, logo, country overrides)"
    16071607msgstr "Zahrnúť odkazy na účet SuperFaktúry (číselníky, bankový účet, pokladne, logo, nastavenia pre krajiny)"
     1608
     1609#: includes/class-wc-sf-settings.php
     1610msgid "Customer country"
     1611msgstr "Krajina zákazníka"
     1612
     1613#: includes/class-wc-sf-settings.php
     1614msgid "Fallback invoice language"
     1615msgstr "Náhradný jazyk faktúry"
     1616
     1617#: includes/class-wc-sf-settings.php
     1618msgid "Used with the customer country option when SuperFaktúra does not support the language of the customer's country."
     1619msgstr "Použije sa pri voľbe Krajina zákazníka, ak SuperFaktúra nepodporuje jazyk krajiny zákazníka."
     1620
     1621#: includes/class-wc-sf-notices.php
     1622msgid "%d document could not be created or updated in SuperFaktúra in the last 30 days."
     1623msgid_plural "%d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1624msgstr[0] "%d doklad sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1625msgstr[1] "%d doklady sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1626msgstr[2] "%d dokladov sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1627
     1628#: includes/class-wc-sf-notices.php
     1629msgid "Order #%s"
     1630msgstr "Objednávka #%s"
     1631
     1632#: includes/class-wc-sf-notices.php
     1633msgid "and %d more"
     1634msgid_plural "and %d more"
     1635msgstr[0] "a ďalší %d"
     1636msgstr[1] "a ďalšie %d"
     1637msgstr[2] "a ďalších %d"
     1638
     1639#: includes/class-wc-sf-notices.php
     1640msgid "Open API log"
     1641msgstr "Otvoriť API log"
     1642
     1643#: includes/class-wc-sf-notices.php
     1644msgid "More than %d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1645msgstr "Viac ako %d dokladov sa za posledných 30 dní nepodarilo vytvoriť alebo aktualizovať v SuperFaktúre."
     1646
     1647#: includes/class-wc-sf-notices.php
     1648msgid "and more"
     1649msgstr "a ďalšie"
  • woocommerce-superfaktura/trunk/languages/woocommerce-superfaktura.pot

    r3694932 r3730776  
    466466
    467467#: includes/class-wc-sf-settings.php:352
    468 msgid "Εnglish"
     468msgid "English"
    469469msgstr ""
    470470
    … …  
    15451545msgid "Include references to the SuperFaktúra account (number sequences, bank account, cash registers, logo, country overrides)"
    15461546msgstr ""
     1547
     1548#: includes/class-wc-sf-settings.php
     1549msgid "Customer country"
     1550msgstr ""
     1551
     1552#: includes/class-wc-sf-settings.php
     1553msgid "Fallback invoice language"
     1554msgstr ""
     1555
     1556#: includes/class-wc-sf-settings.php
     1557msgid "Used with the customer country option when SuperFaktúra does not support the language of the customer's country."
     1558msgstr ""
     1559
     1560#: includes/class-wc-sf-notices.php
     1561msgid "%d document could not be created or updated in SuperFaktúra in the last 30 days."
     1562msgid_plural "%d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1563msgstr[0] ""
     1564msgstr[1] ""
     1565
     1566#: includes/class-wc-sf-notices.php
     1567msgid "Order #%s"
     1568msgstr ""
     1569
     1570#: includes/class-wc-sf-notices.php
     1571msgid "and %d more"
     1572msgid_plural "and %d more"
     1573msgstr[0] ""
     1574msgstr[1] ""
     1575
     1576#: includes/class-wc-sf-notices.php
     1577msgid "Open API log"
     1578msgstr ""
     1579
     1580#: includes/class-wc-sf-notices.php
     1581msgid "More than %d documents could not be created or updated in SuperFaktúra in the last 30 days."
     1582msgstr ""
     1583
     1584#: includes/class-wc-sf-notices.php
     1585msgid "and more"
     1586msgstr ""
  • woocommerce-superfaktura/trunk/uninstall.php

    r2794434 r3730776  
    1616
    1717// TODO: Define uninstall functionality here.
     18
     19// Notices closed by users (eFaktúra announcement, failed documents).
     20global $wpdb;
     21$wc_sf_site_ids = ( is_multisite() && function_exists( 'get_sites' ) ) ? get_sites( array( 'fields' => 'ids', 'number' => 0 ) ) : array( get_current_blog_id() );
     22foreach ( $wc_sf_site_ids as $wc_sf_site_id ) {
     23        delete_metadata( 'user', 0, $wpdb->get_blog_prefix( $wc_sf_site_id ) . 'wc_sf_dismissed_notices', '', true );
     24        if ( is_multisite() ) {
     25                switch_to_blog( $wc_sf_site_id );
     26        }
     27        delete_transient( 'wc_sf_document_errors' );
     28        if ( is_multisite() ) {
     29                restore_current_blog();
     30        }
     31}
  • woocommerce-superfaktura/trunk/woocommerce-superfaktura.php

    r3719141 r3730776  
    1313 * Plugin URI:  https://www.superfaktura.sk/integracia/
    1414 * Description: Integrácia služby <a href="http://www.superfaktura.sk/api/">SuperFaktúra.sk</a> pre WooCommerce. Máte s modulom technický problém? Napíšte nám na <a href="mailto:superfaktura@2day.sk">superfaktura@2day.sk</a>
    15  * Version:     1.55.3
     15 * Version:     1.56.0
    1616 * Author:      2day.sk
    1717 * Author URI:  https://www.superfaktura.sk/integracia/
    … …  
    3838require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-helper.php';
    3939require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-invoice.php';
     40require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-notices.php';
    4041require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-subscriptions.php';
    4142require_once plugin_dir_path( WC_SF_FILE_PATH ) . 'includes/class-wc-sf-tools.php';
Note: See TracChangeset for help on using the changeset viewer.