Plugin Directory

Changeset 2974072


Ignore:
Timestamp:
10/03/2023 06:39:12 AM (2 years ago)
Author:
billingo
Message:

3.4.6

Location:
billingo
Files:
26 added
7 edited

Legend:

Unmodified
Added
Removed
  • billingo/trunk/admin/class-billingo-admin.php

    r2790343 r2974072  
    236236                'type' => 'checkbox',
    237237                'desc' => __('Fizetettnek jelölt számlákon a "A számla pénzügyi teljesítést nem igényel." jelölés bekapcsolása.'),
     238            ],
     239            [
     240                'title' => __('Manuális számlakészítés típus', 'billingo'),
     241                'id' => 'wc_billingo_manual_type',
     242                'type' => 'select',
     243                'options' => [
     244                    'invoice'  => __('Számla', 'billingo'),
     245                    'proforma' => __('Proforma', 'billingo'),
     246                    'draft'    => __('Piszkozat', 'billingo'),
     247                ],
     248                'desc' => __('Manuális számlakészítés esetén ez a típus lesz kiválasztva.', 'billingo'),
    238249            ],
    239250            [
     
    799810                </div>
    800811            <?php else: ?>
     812                <?php $default_type = get_option('wc_billingo_manual_type', 'invoice'); ?>
    801813                <div style="text-align:center;<?php if (get_post_meta($post->ID, '_wc_billingo_own', true)): ?>display:none;<?php endif; ?>" id="wc-billingo-generate-button">
    802814                    <p>
    803815                        <a href="#" id="wc_billingo_generate" data-order="<?php echo(esc_attr($post->ID)); ?>" data-nonce="<?php echo(esc_attr(wp_create_nonce('wc_generate_invoice'))); ?>" class="button button-primary"><?php esc_html_e('Számlakészítés', 'billingo'); ?></a>
    804                         <br>
     816
     817                        <br />
     818                        <small>Alapértelmezett típus: <?php esc_html_e($default_type == 'draft' ? 'Piszkozat' : ($default_type == 'invoice' ? 'Számla' : 'Proforma'), 'billingo'); ?></small>
     819
     820                        <br />
    805821                        <a href="#" id="wc_billingo_options"><?php esc_html_e('Opciók', 'billingo'); ?></a>
    806822                    </p>
     
    823839
    824840                            <h4><?php esc_html_e('Számla típusa', 'billingo'); ?></h4>
     841
    825842                            <select name="wc_billingo_invoice_type" id="wc_billingo_invoice_type">
    826                                 <option value="invoice"><?php esc_html_e('Számla', 'billingo'); ?></option>
    827                                 <option value="proforma"><?php esc_html_e('Díjbekérő', 'billingo'); ?></option>
    828                                 <option value="draft"><?php esc_html_e('Piszkozat', 'billingo'); ?></option>
     843                                <option value="invoice" <?php selected($default_type, 'invoice') ?>><?php esc_html_e('Számla', 'billingo'); ?></option>
     844                                <option value="proforma" <?php selected($default_type, 'proforma') ?>><?php esc_html_e('Díjbekérő', 'billingo'); ?></option>
     845                                <option value="draft" <?php selected($default_type, 'draft') ?>><?php esc_html_e('Piszkozat', 'billingo'); ?></option>
    829846                            </select>
    830847                        </div>
  • billingo/trunk/admin/js/global.js

    r2676188 r2974072  
    11jQuery(document).ready(function ($) {
    2     // https://support.billingo.hu/content/282624019
    32    let entitlements = [
    43        {
    5             value: 'AAM',
     4            value: "AAM",
    65            text: "Alanyi adómentesség"
    76        },
    87        {
    9             value: 'ANTIQUES',
     8            value: "ANTIQUES",
    109            text: "Különbözet szerinti szabályozás - gyűjteménydarabok és régiségek"
    1110        },
    1211        {
    13             value: 'ARTWORK',
     12            value: "ARTWORK",
    1413            text: "Különbözet szerinti szabályozás - műalkotások"
    1514        },
    1615        {
    17             value: 'ATK',
     16            value: "ATK",
    1817            text: "Áfa tv. tárgyi hatályán kívüli ügylet"
    1918        },
    2019        {
    21             value: 'EAM',
     20            value: "EAM",
    2221            text: "Áfamentes termékexport, azzal egy tekintet alá eső értékesítések, nemzetközi közlekedéshez kapcsolódó áfamentes ügyletek (Áfa tv. 98-109. §)"
    2322        },
    2423        {
    25             value: 'EUE',
     24            value: "EUE",
    2625            text: "EU más tagállamában áfaköteles (áfa fizetésére az értékesítő köteles)"
    2726        },
    2827        {
    29             value: 'EUFAD37',
     28            value: "EUFAD37",
    3029            text: "Áfa tv. 37. § (1) bekezdése alapján a szolgáltatás teljesítése helye az EU más tagállama (áfa fizetésére a vevő köteles)"
    3130        },
    3231        {
    33             value: 'EUFADE',
     32            value: "EUFADE",
    3433            text: "Áfa tv. szerint egyéb rendelkezése szerint a teljesítés helye EU más tagállama (áfa fizetésére a vevő köteles)"
    3534        },
    3635        {
    37             value: 'HO',
     36            value: "HO",
    3837            text: "Áfa tv. szerint EU-n kívül teljesített ügylet"
    3938        },
    4039        {
    41             value: 'KBAET',
     40            value: "KBAET",
    4241            text: "Más tagállamba irányuló áfamentes termékértékesítés (Áfa tv. 89. §)"
    4342        },
    4443        {
    45             value: 'NAM_1',
     44            value: "NAM_1",
    4645            text: "Áfamentes közvetítői tevékenység (Áfa tv. 110. §)"
    4746        },
    4847        {
    49             value: 'NAM_2',
     48            value: "NAM_2",
    5049            text: "Termékek nemzetközi forgalmához kapcsolódó áfamentes ügylet (Áfa tv. 111-118. §)"
    5150        },
    5251        {
    53             value: 'SECOND_HAND',
     52            value: "SECOND_HAND",
    5453            text: "Különbözet szerinti szabályozás - használt cikkek"
    5554        },
    5655        {
    57             value: 'TAM',
     56            value: "TAM",
    5857            text: "Tevékenység közérdekű jellegére vagy egyéb sajátos jellegére tekintettel áfamentes (Áfa tv. 85-87.§)"
    5958        },
    6059        {
    61             value: 'TRAVEL_AGENCY',
     60            value: "TRAVEL_AGENCY",
    6261            text: "Különbözet szerinti szabályozás - utazási irodák"
    6362        }
     
    6564
    6665    let taxEntitlements = {
    67         AAM: ['AAM'],
    68         TAM: ['TAM'],
    69         EU: ['KBAET'],
    70         EUK: ['EAM'],
    71         ÁKK: ['ATK'],
    72         '0%': ['AAM', 'EAM', 'KBAET', 'NAM_1', 'NAM_2', 'TAM'],
    73         AM: ['AAM', 'EAM', 'KBAET', 'NAM_1', 'NAM_2', 'TAM'],
    74         MAA: ['AAM', 'EAM', 'KBAET', 'NAM_1', 'NAM_2', 'TAM'],
    75         ÁTHK: ['EUE', 'EUFAD37', 'EUFADE', 'HO'],
    76         'K.AFA': ['ANTIQUES', 'ARTWORK', 'SECOND_HAND', 'TRAVEL_AGENCY'],
     66        "AAM":   ["AAM"],
     67        "TAM":   ["TAM"],
     68        "EU":    ["KBAET"],
     69        "EUK":   ["EAM"],
     70        "ÁKK":   ["ATK"],
     71        "0%":    ["AAM", "EAM", "KBAET", "NAM_1", "NAM_2", "TAM"],
     72        "AM":    ["AAM", "EAM", "KBAET", "NAM_1", "NAM_2", "TAM"],
     73        "MAA":   ["AAM", "EAM", "KBAET", "NAM_1", "NAM_2", "TAM"],
     74        "ÁTHK":  ["EUE", "EUFAD37", "EUFADE", "HO"],
     75        "K.AFA": ["ANTIQUES", "ARTWORK", "SECOND_HAND", "TRAVEL_AGENCY"],
    7776    };
    7877
    7978    let setTaxOverrideEntitlementsFor = function (id) {
    80         let selectedTaxOverride = $('#' + id).val();
     79        let selectedTaxOverride = jQuery("#" + id).val();
    8180        let possibleEntitlements = taxEntitlements[selectedTaxOverride];
    82         let selectedEntitlement = $('#' + id + '_entitlement').val();
     81        let selectedEntitlement = jQuery("#" + id + "_entitlement").val();
    8382
    8483        if (possibleEntitlements) {
    8584            // If there is an entitlement given for the selected tax override
    86             $('#' + id + '_entitlement').prop("disabled", false);
    87             $('#' + id + '_entitlement').next().text('A választott ÁFA kulcshoz kötelező a megadott jogcímekből választani.')
     85            jQuery("#" + id + "_entitlement").prop("disabled", false);
     86            jQuery("#" + id + "_entitlement").next().text("A választott ÁFA kulcshoz kötelező a megadott jogcímekből választani.");
    8887
    8988            // Remove all entitlement options for a fresh start
    90             $('#' + id + '_entitlement option').each(function () {
    91                 $(this).remove();
     89            jQuery("#" + id + "_entitlement option").each(function () {
     90                jQuery(this).remove();
    9291            });
    9392
     
    9695            entitlements.forEach(function (entitlement) {
    9796                if (possibleEntitlements.indexOf(entitlement.value) > -1) {
    98                     $('#' + id + '_entitlement').append(new Option(entitlement.text, entitlement.value));
     97                    jQuery("#" + id + "_entitlement").append(new Option(entitlement.text, entitlement.value));
    9998                    validEntitlements.push(entitlement.value);
    10099                }
     
    104103            if (validEntitlements.indexOf(selectedEntitlement) == -1) {
    105104                switch (selectedTaxOverride) {
    106                     case '0%':    $('#' + id + '_entitlement option[value="TAM"]').prop("selected", true); break;
    107                     case 'AM':    $('#' + id + '_entitlement option[value="NAM_1"]').prop("selected", true); break;
    108                     case 'MAA':   $('#' + id + '_entitlement option[value="NAM_1"]').prop("selected", true); break;
    109                     case 'ÁTHK':  $('#' + id + '_entitlement option[value="EUFAD37"]').prop("selected", true); break;
    110                     case 'K.AFA': $('#' + id + '_entitlement option[value="SECOND_HAND"]').prop("selected", true); break;
    111                     default:      $('#' + id + '_entitlement option:eq(0)').prop("selected", true);
     105                    case "0%":    jQuery("#" + id + '_entitlement option[value="TAM"]').prop("selected", true); break;
     106                    case "AM":    jQuery("#" + id + '_entitlement option[value="NAM_1"]').prop("selected", true); break;
     107                    case "MAA":   jQuery("#" + id + '_entitlement option[value="NAM_1"]').prop("selected", true); break;
     108                    case "ÁTHK":  jQuery("#" + id + '_entitlement option[value="EUFAD37"]').prop("selected", true); break;
     109                    case "K.AFA": jQuery("#" + id + '_entitlement option[value="SECOND_HAND"]').prop("selected", true); break;
     110                    default:      jQuery("#" + id + '_entitlement option:eq(0)').prop("selected", true);
    112111                }
    113112            } else {
    114                 $('#' + id + '_entitlement option[value="' + selectedEntitlement + '"]').prop("selected", true);
     113                jQuery("#" + id + '_entitlement option[value="' + selectedEntitlement + '"]').prop("selected", true);
    115114            }
    116115        } else {
    117116            // No entitlement for the selected tax override
    118             $('#' + id + '_entitlement').prop("disabled", true);
    119             $('#' + id + '_entitlement').next().text('A választott ÁFA kulcshoz nem tartozik jogcím.')
     117            jQuery("#" + id + "_entitlement").prop("disabled", true);
     118            jQuery("#" + id + "_entitlement").next().text("A választott ÁFA kulcshoz nem tartozik jogcím.");
    120119
    121120            // Remove all entitlement options
    122             $('#' + id + '_entitlement option').each(function () {
    123                 $(this).remove();
     121            jQuery("#" + id + "_entitlement option").each(function () {
     122                jQuery(this).remove();
    124123            });
    125124        }
    126125    };
    127126
    128     setTaxOverrideEntitlementsFor('wc_billingo_tax_override');
    129     $('#wc_billingo_tax_override').change(function (e) {
    130         setTaxOverrideEntitlementsFor('wc_billingo_tax_override');
    131     });
    132 
    133     setTaxOverrideEntitlementsFor('wc_billingo_tax_override_zero');
    134     $('#wc_billingo_tax_override_zero').change(function (e) {
    135         setTaxOverrideEntitlementsFor('wc_billingo_tax_override_zero');
    136     });
    137 
    138     $('#wc_billingo_generate').click(function (e) {
     127    setTaxOverrideEntitlementsFor("wc_billingo_tax_override");
     128    jQuery("#wc_billingo_tax_override").change(function (e) {
     129        setTaxOverrideEntitlementsFor("wc_billingo_tax_override");
     130    });
     131
     132    setTaxOverrideEntitlementsFor("wc_billingo_tax_override_zero");
     133    jQuery("#wc_billingo_tax_override_zero").change(function (e) {
     134        setTaxOverrideEntitlementsFor("wc_billingo_tax_override_zero");
     135    });
     136
     137    jQuery("#wc_billingo_generate").click(function (e) {
    139138        e.preventDefault();
    140139        let r = confirm("Biztosan létrehozod a számlát?");
     
    142141            return false;
    143142        }
    144         let nonce = $(this).data('nonce');
    145         let order = $(this).data('order');
    146         let button = $('#wc_billingo_generate');
    147         let note = $('#wc_billingo_invoice_note').val();
    148         let deadline = $('#wc_billingo_invoice_deadline').val();
    149         let ignore_proforma = $('#wc_billingo_ignore_proforma').val();
    150         let completed = $('#wc_billingo_invoice_completed').val();
    151         let invoice_type = $('#wc_billingo_invoice_type').val();
     143        let nonce = jQuery(this).data("nonce");
     144        let order = jQuery(this).data("order");
     145        let button = jQuery("#wc_billingo_generate");
     146        let note = jQuery("#wc_billingo_invoice_note").val();
     147        let deadline = jQuery("#wc_billingo_invoice_deadline").val();
     148        let ignore_proforma = jQuery("#wc_billingo_ignore_proforma").val();
     149        let completed = jQuery("#wc_billingo_invoice_completed").val();
     150        let invoice_type = jQuery("#wc_billingo_invoice_type").val();
    152151
    153152        let data = {
    154             action: 'wc_billingo_generate_invoice',
     153            action: "wc_billingo_generate_invoice",
    155154            nonce: nonce,
    156155            order: order,
     
    165164            message: null,
    166165            overlayCSS: {
    167                 background: '#fff url(' + wc_billingo_params.loading + ') no-repeat center',
    168                 backgroundSize: '16px 16px',
     166                background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center",
     167                backgroundSize: "16px 16px",
    169168                opacity: 0.6
    170169            }
    171170        });
    172171
    173         $.post(ajaxurl, data, function (response) {
     172        jQuery.post(ajaxurl, data, function (response) {
    174173            //Remove old messages
    175             $('.wc-billingo-message').remove();
     174            jQuery(".wc-billingo-message").remove();
    176175
    177176            //Generate the error/success messages
     
    183182
    184183            //Get the error messages
    185             let ul = $('<ul>');
    186             $.each(response.data.messages, function (i, value) {
    187                 let li = $('<li>')
     184            let ul = jQuery("<ul>");
     185            jQuery.each(response.data.messages, function (i, value) {
     186                let li = jQuery("<li>");
    188187                li.append(value);
    189188                ul.append(li);
    190189            });
    191             $('.wc-billingo-message').append(ul);
     190            jQuery(".wc-billingo-message").append(ul);
    192191
    193192            //If success, hide the button
     
    201200    });
    202201
    203     $('#wc_billingo_options').click(function () {
    204         $('#wc_billingo_options_form').slideToggle();
     202    jQuery("#wc_billingo_options").click(function () {
     203        jQuery("#wc_billingo_options_form").slideToggle();
    205204        return false;
    206205    });
    207206
    208     $('#wc_billingo_already').click(function (e) {
     207    jQuery("#wc_billingo_already").click(function (e) {
    209208        e.preventDefault();
    210209        let note = prompt("Számlakészítés kikapcsolása. Mi az indok?", "Ehhez a rendeléshez nem kell számla.");
     
    213212        }
    214213
    215         let nonce = $(this).data('nonce');
    216         let order = $(this).data('order');
    217         let button = $('#wc_billingo_already');
     214        let nonce = jQuery(this).data("nonce");
     215        let order = jQuery(this).data("order");
     216        let button = jQuery("#wc_billingo_already");
    218217
    219218        let data = {
    220             action: 'wc_billingo_already',
     219            action: "wc_billingo_already",
    221220            nonce: nonce,
    222221            order: order,
     
    227226            message: null,
    228227            overlayCSS: {
    229                 background: '#fff url(' + wc_billingo_params.loading + ') no-repeat center',
    230                 backgroundSize: '16px 16px',
     228                background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center",
     229                backgroundSize: "16px 16px",
    231230                opacity: 0.6
    232231            }
    233232        });
    234233
    235         $.post(ajaxurl, data, function (response) {
     234        jQuery.post(ajaxurl, data, function (response) {
    236235            //Remove old messages
    237             $('.wc-billingo-message').remove();
     236            jQuery(".wc-billingo-message").remove();
    238237
    239238            //Generate the error/success messages
     
    245244
    246245            //Get the error messages
    247             let ul = $('<ul>');
    248             $.each(response.data.messages, function (i, value) {
    249                 let li = $('<li>')
     246            let ul = jQuery("<ul>");
     247            jQuery.each(response.data.messages, function (i, value) {
     248                let li = jQuery("<li>");
    250249                li.append(value);
    251250                ul.append(li);
    252251            });
    253             $('.wc-billingo-message').append(ul);
     252            jQuery(".wc-billingo-message").append(ul);
    254253
    255254            //If success, hide the button
     
    263262    });
    264263
    265     $('#wc_billingo_already_back').click(function (e) {
     264    jQuery("#wc_billingo_already_back").click(function (e) {
    266265        e.preventDefault();
    267266        let r = confirm("Biztosan visszakapcsolod a számlakészítés ennél a rendelésnél?");
     
    270269        }
    271270
    272         let nonce = $(this).data('nonce');
    273         let order = $(this).data('order');
    274         let button = $('#wc_billingo_already_back');
     271        let nonce = jQuery(this).data("nonce");
     272        let order = jQuery(this).data("order");
     273        let button = jQuery("#wc_billingo_already_back");
    275274
    276275        let data = {
    277             action: 'wc_billingo_already_back',
     276            action: "wc_billingo_already_back",
    278277            nonce: nonce,
    279278            order: order
    280279        };
    281280
    282         $('#billingo_already_div').block({
     281        jQuery("#billingo_already_div").block({
    283282            message: null,
    284283            overlayCSS: {
    285                 background: '#fff url(' + wc_billingo_params.loading + ') no-repeat center',
    286                 backgroundSize: '16px 16px',
     284                background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center",
     285                backgroundSize: "16px 16px",
    287286                opacity: 0.6
    288287            }
    289288        });
    290289
    291         $.post(ajaxurl, data, function (response) {
     290        jQuery.post(ajaxurl, data, function (response) {
    292291            //Remove old messages
    293             $('.wc-billingo-message').remove();
     292            jQuery(".wc-billingo-message").remove();
    294293
    295294            //Generate the error/success messages
     
    301300
    302301            //Get the error messages
    303             let ul = $('<ul>');
    304             $.each(response.data.messages, function (i, value) {
    305                 let li = $('<li>')
     302            let ul = jQuery("<ul>");
     303            jQuery.each(response.data.messages, function (i, value) {
     304                let li = jQuery("<li>");
    306305                li.append(value);
    307306                ul.append(li);
    308307            });
    309             $('.wc-billingo-message').append(ul);
     308            jQuery(".wc-billingo-message").append(ul);
    310309
    311310            //If success, show the button
     
    314313            }
    315314
    316             $('#billingo_already_div').unblock().slideUp();
    317         });
    318     });
    319 
    320 
    321     $('#wc_billingo_storno').click(function (e) {
     315            jQuery("#billingo_already_div").unblock().slideUp();
     316        });
     317    });
     318
     319
     320    jQuery("#wc_billingo_storno").click(function (e) {
    322321        e.preventDefault();
    323322        let r = confirm("Biztosan sztornózod a számlát?");
     
    325324            return false;
    326325        }
    327         let nonce = $(this).data('nonce');
    328         let order = $(this).data('order');
    329         let button = $('#wc_billingo_storno');
     326        let nonce = jQuery(this).data("nonce");
     327        let order = jQuery(this).data("order");
     328        let button = jQuery("#wc_billingo_storno");
    330329
    331330        let data = {
    332             action: 'wc_billingo_storno_invoice',
     331            action: "wc_billingo_storno_invoice",
    333332            nonce: nonce,
    334333            order: order
     
    338337            message: null,
    339338            overlayCSS: {
    340                 background: '#fff url(' + wc_billingo_params.loading + ') no-repeat center',
    341                 backgroundSize: '16px 16px',
     339                background: "#fff url(" + wc_billingo_params.loading + ") no-repeat center",
     340                backgroundSize: "16px 16px",
    342341                opacity: 0.6
    343342            }
    344343        });
    345344
    346         $.post(ajaxurl, data, function (response) {
     345        jQuery.post(ajaxurl, data, function (response) {
    347346            //Remove old messages
    348             $('.wc-billingo-message').remove();
     347            jQuery(".wc-billingo-message").remove();
    349348
    350349            //Generate the error/success messages
     
    356355
    357356            //Get the error messages
    358             let ul = $('<ul>');
    359             $.each(response.data.messages, function (i, value) {
    360                 let li = $('<li>')
     357            let ul = jQuery("<ul>");
     358            jQuery.each(response.data.messages, function (i, value) {
     359                let li = jQuery("<li>");
    361360                li.append(value);
    362361                ul.append(li);
    363362            });
    364             $('.wc-billingo-message').append(ul);
     363            jQuery(".wc-billingo-message").append(ul);
    365364
    366365            //If success, hide the button
  • billingo/trunk/changelog.md

    r2787040 r2974072  
    11# Changelog
     2
     3- **3.4.6** - 2023-06-26
     4  - Improved tax number retrieval (prioritiy order meta, ignore guest user)
     5
     6- **3.4.5** - 2023-05-04
     7  - Option to change default behaviour of manual invoice generation to make draft or proforma
     8
     9- **3.4.4** - 2023-04-24
     10  - Fix tax entitlement getting stuck
     11
     12- **3.4.3** - 3024-04-04
     13  - Fix shipping tax compatibility issue where there was an empty entry with the wrong tax type. (Encountered with FoxPost plugin.)
     14
     15- **3.4.2** - 2023-03-22
     16  - Fix line tax issue where it's below 0.5 (woocommerce rounds it down to 0)
     17
     18- **3.4.1** - 2023-01-10
     19  - PHP version compatibility fix
    220
    321- **3.4.0** - 2022-09-16
  • billingo/trunk/includes/PWSBillingo.php

    r2794100 r2974072  
    2121class PWSBillingo
    2222{
    23     const VERSION = 'WP3.2.1';
     23    const VERSION = 'WP3.2.2';
    2424
    2525    const REMOTE_HOST = 'https://api.billingo.hu/v3/';
     
    3737    const EU_COUNTRIES = ['AT', 'BE', 'HR', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE'];
    3838    const ALL_CURRENCIES = ['AUD', 'BGN', 'BRL', 'CAD', 'CHF', 'CNY', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HRK', 'HUF', 'IDR', 'ILS', 'INR', 'ISK', 'JPY', 'KRW', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'RON', 'RSD', 'RUB', 'SEK', 'SGD', 'THB', 'TRY', 'UAH', 'USD', 'ZAR'];
    39     const ALL_ENTITLEMENTS = ['AAM', 'ANTIQUES', 'ARTWORK', 'ATK', 'EAM', 'EUE', 'EUFAD37', 'EUFADE', 'HO', 'KBAET', 'NAM_1', 'NAM_2', 'SECOND_HAND', 'TAM', 'TRAVEL_AGENCY'];
     39    const ALL_ENTITLEMENTS = ['', 'AAM', 'ANTIQUES', 'ARTWORK', 'ATK', 'EAM', 'EUE', 'EUFAD37', 'EUFADE', 'HO', 'KBAET', 'NAM_1', 'NAM_2', 'SECOND_HAND', 'TAM', 'TRAVEL_AGENCY'];
    4040    const DEFAULT_PAYMENT = 'cash';
    4141    const ALL_PAYMENTS = [
  • billingo/trunk/includes/class-billingo.php

    r2790343 r2974072  
    5757                    static::install();
    5858                    update_option('wc_billingo_db_status', 32);
     59                }
     60
     61                if ($db_status < 33) {
     62                    update_option('wc_billingo_manual_type', 'invoice');
     63                    update_option('wc_billingo_db_status', 33);
    5964                }
    6065
     
    174179    {
    175180        $id_order = $order->get_id();
    176 
    177         $userdatas = get_user_by('email', $order->get_billing_email());
     181        $id_user = $order->get_user_id();
     182
    178183        $tax_number = '';
    179184        if (get_option('wc_billingo_vat_number_form_checkbox_custom') == 'yes' && ($taxfield = get_option('wc_billingo_vat_number_form_custom'))) { // custom tax number field by other plugins
    180             if ($adoszam = get_user_meta($userdatas->ID, $taxfield, true)) {
     185            if ($adoszam = get_post_meta($id_order, $taxfield, true)) {
    181186                $tax_number = $adoszam;
    182             } elseif ($adoszam = get_post_meta($id_order, $taxfield, true)) {
     187            } elseif ($id_user && ($adoszam = get_user_meta($id_user, $taxfield, true))) {
    183188                $tax_number = $adoszam;
    184189            }
     
    187192        } elseif ($adoszam = get_post_meta($id_order, '_billing_tax_number', true)) { // HuCommerce plugin's tax number field in order
    188193            $tax_number = $adoszam;
    189         } elseif ($adoszam = get_user_meta($userdatas->ID, 'billing_tax_number', true)) { // HuCommerce plugin's tax number field in customer
     194        } elseif ($id_user && ($adoszam = get_user_meta($id_user, 'billing_tax_number', true))) { // HuCommerce plugin's tax number field in customer
    190195            $tax_number = $adoszam;
    191196        }
     
    715720
    716721        foreach ($order->get_items() as $item) {
    717             // can't use line_tax directly because of the rounding issues
    718             if ($item['line_tax']) { // should solve is_vat_exempt issue, bypass the normal tax class if no tax was used
     722            // Can't use line_tax directly because of the rounding issue, this should solve it. (product with gross 10 huf and 5% tax shows 0 in line_tax, should be 0.476.)
     723            $line_tax = 0.0;
     724            foreach ($item['line_tax_data']['total'] as $tax_id => $tax_amount) {
     725                $line_tax += $tax_amount;
     726            }
     727
     728            if ($line_tax) { // should solve is_vat_exempt issue, bypass the normal tax class if no tax was used
    719729                $tax_rate = 0;
    720730                $tax_rates = static::get_rates($item->get_tax_class(), $order_tax_location);
     
    773783                    if (isset($item['taxes']) && ($taxes = $item->get_taxes())) {
    774784                        if (array_key_exists('total', $taxes)) {
    775                             $tax_ids = array_keys($taxes['total']);
     785                            $tax_list = $taxes['total'];
     786                            if (count($tax_list) > 1) { // fix for foxpost module having an empty 5% tax entry for 27% shipping
     787                                foreach ($tax_list as $k => $v) {
     788                                    if (!$v) {
     789                                        unset($tax_list[$k]);
     790                                    }
     791                                }
     792                            }
     793                            $tax_ids = array_keys($tax_list);
    776794                            $tax_rate_id = reset($tax_ids);
    777795                            if ($tax_rate_id) {
     
    782800
    783801                    if (!$tax_rate) {
    784                         $tax_rates = self::get_shipping_tax_rates($item->get_tax_class(), $order_tax_location);
     802                        $tax_rates = self::get_shipping_tax_rates($order_tax_location, $item->get_tax_class());
    785803                        if (!empty($tax_rates)) {
    786804                            $tax_rate = reset($tax_rates);
     
    883901
    884902    // part of WC_Tax::get_shipping_tax_rates
    885     public static function get_shipping_tax_rates($tax_class = null, $location)
     903    public static function get_shipping_tax_rates($location, $tax_class = null)
    886904    {
    887905        // See if we have an explicitly set shipping tax class
  • billingo/trunk/index.php

    r2790343 r2974072  
    22/**
    33 * Plugin Name: Integration for Billingo & WooCommerce
    4  * Version: 3.4.0
     4 * Version: 3.4.6
    55 * Requires at least: 5.3
    66 * Requires PHP: 5.6
  • billingo/trunk/readme.txt

    r2787651 r2974072  
    22Tags: billingo.hu, billingo, woocommerce, szamlazas, magyar
    33Requires at least: 5.3
    4 Tested up to: 6.0.2
    5 Stable tag: 3.4.0
     4Tested up to: 6.3.0
     5Stable tag: 3.4.6
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7777== Changelog ==
    7878
     79= 3.4.6
     80* Fejlesztés: Adószám kinyerés optimalizálása, vendég vásárlónál felhasználó figyelmen kívül hagyása
     81
     82= 3.4.5
     83* Fejlesztés: Opció a manuális számlakészítésnél használt típus alapértelmezett beállítására
     84
     85= 3.4.4
     86* Javítás: ÁFA Jogcím speciális esetben beragadt
     87
     88= 3.4.3
     89* Fejlesztés: Szállítási adóknál az extra üres ÁFA kulcsok kihagyása.
     90
     91= 3.4.2
     92* Fejlesztés: <0.5 sor adó számítás javítás
     93
     94= 3.4.1
     95* Fejlesztés: PHP verzió kompatibilitás javítása
     96
    7997= 3.4.0
    8098* Fejlesztés: Biztonsági frissítés
Note: See TracChangeset for help on using the changeset viewer.