Plugin Directory

Changeset 2639095


Ignore:
Timestamp:
12/03/2021 12:23:14 PM (4 years ago)
Author:
billingo
Message:

3.3.2

Location:
billingo
Files:
29 added
2 deleted
8 edited

Legend:

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

    r2593273 r2639095  
    11<?php
     2/**
     3 * Created by PWS Online Kft.
     4 *
     5 * @author    Viktor Vizmeg <[email protected]>
     6 * @copyright 2021 PWS Online Kft.
     7 * @license   Copyright 2021 PWS Online Kft.
     8 * @date      2021-04-16
     9 * @time      14:50
     10 */
    211
    312if (!defined('WPINC')) {
     
    716use PWSBillingo\PWSBillingo;
    817
    9 /**
    10  * Handling Billingo - WooCommerce Admin Area
    11  *
    12  * @author     Bokor & Vizmeg GbR <[email protected]>
    13  * @since      Class available since Release 1.0.0
    14  */
    1518class Billingo_Admin
    1619{
     
    134137    public static function get_settings()
    135138    {
     139        $order_statuses = wc_get_order_statuses();
     140
    136141        $taxes = [-1 => ''];
    137142        foreach (PWSBillingo::ALL_TAXES as $v) {
     
    153158            $roundings[$k] = __($v, 'billingo');
    154159        }
     160
     161        $connector = WC_Billingo::getBillingoConnector();
     162        $bank_accounts = $connector->getBankAccounts();
     163        $document_blocks = $connector->getDocumentBlocks();
     164        $bank_accounts[''] = __('Alapértelmezett', 'billingo');
     165        $document_blocks[''] = __('Alapértelmezett', 'billingo');
    155166
    156167        $settings = [
     
    163174            ],
    164175            [
    165                 'title' => __('Számlatömb API ID', 'billingo'),
     176                'title' => __('Számlatömb', 'billingo'),
    166177                'id' => 'wc_billingo_invoice_block',
    167                 'type' => 'text',
    168                 'desc' => __('A Billingo vezérlőpultban a beállítások/számlatömböknél található.', 'billingo'),
     178                'type' => 'select',
     179                'options' => $document_blocks,
     180                'desc' => __('A számlázáshoz használandó számlatömb.', 'billingo'),
    169181            ],
    170182            ['type' => 'sectionend', 'id' => 'woocommerce_billingo_options'],
    171183            ['type' => 'title', 'title' => __('Billingo Számla Beállítások', 'billingo'), 'id' => 'woocommerce_billingo_options'],
    172184            [
    173             'title' => __('Megjegyzés', 'billingo'),
    174             'id' => 'wc_billingo_note',
    175             'type' => 'text',
     185                'title' => __('Bankszámla HUF', 'billingo'),
     186                'id' => 'wc_billingo_bank_account_huf',
     187                'type' => 'select',
     188                'options' => $bank_accounts,
     189                'desc' => __('Forint (HUF) számlákhoz használt bankszámla.', 'billingo'),
     190            ],
     191            [
     192                'title' => __('Bankszámla EUR', 'billingo'),
     193                'id' => 'wc_billingo_bank_account_eur',
     194                'type' => 'select',
     195                'options' => $bank_accounts,
     196                'desc' => __('Euró (EUR) számlákhoz használt bankszámla.', 'billingo'),
     197            ],
     198            [
     199                'title' => __('Megjegyzés', 'billingo'),
     200                'id' => 'wc_billingo_note',
     201                'type' => 'text',
    176202            ],
    177203            [
     
    195221                'id' => 'wc_billingo_electronic',
    196222                'type' => 'checkbox',
     223            ],
     224            [
     225                'title' => __('Pénzügyi teljesítést nem igényel jelölés', 'billingo'),
     226                'id' => 'mark_paid_without_financial_fulfillment',
     227                'type' => 'checkbox',
     228                '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.'),
    197229            ],
    198230            [
     
    211243                'id' => 'wc_billingo_auto_state',
    212244                'type' => 'select',
    213                 'options' => $order_statuses = wc_get_order_statuses(),
     245                'options' => $order_statuses,
    214246                'desc' => __('Ha feljebb be van kapcsolva az automata számlakészítés, akkor ebbe a rendelés állapotba váltáskor fog számla vagy piszkozat készülni.', 'billingo'),
    215247            ],
     
    224256                'id' => 'wc_billingo_auto_storno',
    225257                'type' => 'select',
    226                 'options' => array_merge([
    227                         'no'    => __('Nem', 'billingo'),
    228                     ],
    229                     $order_statuses = wc_get_order_statuses()
    230                 ),
     258                'options' => array_merge(['no' => __('Nem', 'billingo')], $order_statuses),
    231259                'desc' => __('Ha be van kapcsolva, a kiválasztott rendelés állapotba váltáskor automatikusan sztornózásra kerül az éles számla, ha már létezett.', 'billingo'),
    232260            ],
     
    571599                        <textarea name="wc_billingo_support_code" id="wc_billingo_support_code" readonly="readonly" title="<?=$debug_normal?>" rows="7"><?=$debug?></textarea>
    572600                        <br />
    573                         <span class="description">Kérjük kapcsolatfelvételkor küldje el nekünk a mező teljes tartalmát szövegként. Ebben néhány fontos információ található, például a telepített plugin verziószáma, PHP verzió, Wordpress verzió, stb. A pontos részletekhez tartsa az egeret a kód fölé.</span>
     601                        <span class="description">Kérjük kapcsolatfelvételkor küldje el nekünk a mező teljes tartalmát <strong>szövegként</strong>. Ebben néhány fontos információ található, például a telepített plugin verziószáma, PHP verzió, Wordpress verzió, stb. A pontos részletekhez tartsa az egeret a kód fölé.</span>
    574602                    </td>
    575603                </tr>
     
    584612                        <label for="wc_billingo_support_code"><?php esc_html_e('Naplófájlok elérhetősége', 'billingo'); ?>:</label>
    585613                    </th>
    586                     <td class="forminp forminp-text">/wp-content/plugins/billingo/log/</td>
     614                    <td class="forminp forminp-text">/wp-content/uploads/billingo/</td>
    587615                </tr>
    588616            </tbody>
     
    762790
    763791                            <h4><?php esc_html_e('Teljesítési dátum', 'billingo'); ?></h4>
    764                             <input type="text" class="date-picker" id="wc_billingo_invoice_completed" maxlength="10" value="<?php echo date('Y-m-d'); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])">
     792                            <input type="text" class="date-picker" id="wc_billingo_invoice_completed" maxlength="10" value="<?php echo wp_date('Y-m-d'); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])">
    765793
    766794                            <h4><?php esc_html_e('Számla típusa', 'billingo'); ?></h4>
  • billingo/trunk/admin/js/global.js

    r2536978 r2639095  
    7878
    7979    let setTaxOverrideEntitlementsFor = function (id) {
    80         let selectedTaxOverride = $('#' + id + ' option:selected').val();
     80        let selectedTaxOverride = $('#' + id).val();
    8181        let possibleEntitlements = taxEntitlements[selectedTaxOverride];
    82         let selectedEntitlement = $('#' + id + ' _entitlement option:selected').val();
     82        let selectedEntitlement = $('#' + id + '_entitlement').val();
    8383
    8484        if (possibleEntitlements) {
     
    124124            }
    125125            else {
    126                 $('#' + id + '_entitlement option[value="${selectedEntitlement}"]').prop("selected", true);
     126                $('#' + id + '_entitlement option[value="' + selectedEntitlement + '"]').prop("selected", true);
    127127            }
    128128
  • billingo/trunk/changelog.md

    r2593273 r2639095  
    11# Changelog
     2
     3- **3.3.2** - 2021-11-22
     4  - Fix entitlement dropdown resetting issue
     5
     6- **3.3.1** - 2021-11-16
     7  - Improved shipping tax detection
     8  - Add trim to company name to prevent " " names...
     9
     10- **3.3.0** - 2021-10-20
     11  - Added option to select bank account for HUF and EUR
     12  - Invoice Block now can be selected instead of having to copy over the ID
     13  - Can mark paid invoices as "without_financial_fulfillment", draft invoice uses the paid settings from real ones
     14
     15- **3.2.7** - 2021-09-24
     16  - Switched to wp_date() from date() to prevent timezone related issues messing with dates (01:15 CEST is 23:15 UTC previous day)
     17  - Moved logs to wp-content/uploads/billingo to prevent deletion when updating the plugin
     18
     19- **3.2.6** - 2021-09-21
     20  - WooCommerce Subscriptions email attachment compatibility
    221
    322- **3.2.5** - 2021-08-11
  • billingo/trunk/includes/PWSBillingo.php

    r2593273 r2639095  
    11<?php
    22/**
    3  * Created by Bokor & Vizmeg GbR.
     3 * Created by PWS Online Kft.
    44 *
    5  * @author    Bokor & Vizmeg GbR <[email protected]>
    6  * @copyright 2021 Bokor & Vizmeg GbR
    7  * @license   Copyright 2021 Bokor & Vizmeg GbR
     5 * @author    Viktor Vizmeg <[email protected]>
     6 * @copyright 2021 PWS Online Kft.
     7 * @license   Copyright 2021 PWS Online Kft.
    88 * @date      2021-04-16
    99 * @time      14:50
     
    1414class PWSBillingo
    1515{
    16     const VERSION = '3.1.2';
     16    const VERSION = '3.1.4';
    1717
    1818    const REMOTE_HOST = 'https://api.billingo.hu/v3/'; // with trailing slash!
     
    473473    }
    474474
     475    public function getBankAccounts()
     476    {
     477        $response = $this->get('/bank-accounts');
     478
     479        if (!is_array($response) || !array_key_exists('data', $response)) {
     480            $this->logw('getBankAccounts FAILED');
     481            return ['' => 'API Error, is the API Key set?'];
     482        }
     483
     484        $list = ['' => ''];
     485        foreach ($response['data'] as $account) {
     486            $list[$account['id']] = $account['name'] . ' (' . $account['currency'] . ')';
     487        }
     488
     489        return $list;
     490    }
     491
     492    public function getDocumentBlocks()
     493    {
     494        $response = $this->get('/document-blocks');
     495
     496        if (!is_array($response) || !array_key_exists('data', $response)) {
     497            $this->logw('getBlocks FAILED');
     498            return ['' => 'API Error, is the API Key set?'];
     499        }
     500
     501        $list = ['' => ''];
     502        foreach ($response['data'] as $account) {
     503            $list[$account['id']] = $account['name'] . ' (' . $account['prefix'] . ')';
     504        }
     505
     506        return $list;
     507    }
     508
    475509    // -----------------------------------------------------------------------------------------------------------------
    476510    // helper functions
     
    699733    public static function log($dir, $filename, $message, $value = null)
    700734    {
    701         $log_file = rtrim($dir, '/') . '/' . date('Y-m-d') . '_' . $filename;
     735        $dir = rtrim($dir, '/') . '/';
     736        $log_file = $dir . date('Y-m-d') . '_' . $filename;
    702737
    703738        if (!file_exists($dir)) {
     
    723758    public static function createHtaccessInDir($dir)
    724759    {
     760        $dir = rtrim($dir, '/') . '/';
    725761        $fp = fopen($dir . '.htaccess', 'w');
    726762        fwrite($fp, <<<STR
     
    743779/*
    744780 * Changelog
     781 * - 3.1.4 - 2021-10-20
     782 *   - Added getters for bank accounts and invoice blocks
     783 *
     784 * - 3.1.3 - 2021-09-24
     785 *   - Fix slash for .htaccess creation
     786 *
     787 * - 3.1.2 - 2021-09-??
     788 *   - Only allow 1-decimal tax value is exists in enum list
     789 *
     790 * - 3.1.1 - 2021-08-04
     791 *   - Added 9,5% tax value
     792 *   - Allow 1-decimal tax values
     793 *
    745794 * - 3.1.0 - 2021-04-21
    746795 *   - Expose last http response and response code
  • billingo/trunk/includes/class-billingo-order.php

    r2536978 r2639095  
    11<?php
    22/**
    3  * Created by Bokor & Vizmeg GbR.
     3 * Created by PWS Online Kft.
    44 *
    5  * @author    Bokor & Vizmeg GbR <[email protected]>
    6  * @copyright 2021 Bokor & Vizmeg GbR
    7  * @license   Copyright 2021 Bokor & Vizmeg GbR
     5 * @author    Viktor Vizmeg <[email protected]>
     6 * @copyright 2021 PWS Online Kft.
     7 * @license   Copyright 2021 PWS Online Kft.
    88 * @date      2021-04-16
    99 * @time      14:50
  • billingo/trunk/includes/class-billingo.php

    r2593273 r2639095  
    11<?php
     2/**
     3 * Created by PWS Online Kft.
     4 *
     5 * @author    Viktor Vizmeg <[email protected]>
     6 * @copyright 2021 PWS Online Kft.
     7 * @license   Copyright 2021 PWS Online Kft.
     8 * @date      2021-04-16
     9 * @time      14:50
     10 */
    211
    312if (!defined('WPINC')) {
     
    716use PWSBillingo\PWSBillingo;
    817
    9 /**
    10  * Handling Billingo Documents
    11  *
    12  * @author     Bokor & Vizmeg GbR <[email protected]>
    13  * @since      Class available since Release 1.0.0
    14  */
    1518class WC_Billingo
    1619{
     
    6972                static::install();
    7073                update_option('wc_billingo_db_status', 32);
     74            }
     75
     76            $log_status = get_option('wc_billingo_log_status');
     77            if ($log_status < 4 && file_exists(BILLINGO__PLUGIN_DIR . 'log')) {
     78                // relocate log directory
     79                rename(BILLINGO__PLUGIN_DIR . 'log', WP_CONTENT_DIR . '/uploads/billingo');
     80                update_option('wc_billingo_log_status', 4);
    7181            }
    7282        }
     
    135145        $plugin_version = $plugin_data['Version'];
    136146
    137         return new PWSBillingo(get_option('wc_billingo_api_key'), BILLINGO__PLUGIN_DIR . 'log/billingo_' . date('Y-m-d') . '.txt', 'Wordpress', $plugin_version);
     147        return new PWSBillingo(get_option('wc_billingo_api_key'), WP_CONTENT_DIR . '/uploads/billingo/billingo_' . date('Y-m-d') . '.txt', 'Wordpress', $plugin_version);
    138148    }
    139149
     
    240250        }
    241251
    242         if ($order->get_billing_company()) {
     252        if ($company = trim($order->get_billing_company())) {
    243253            if (get_option('wc_billingo_company_name')) {
    244                 $name = $order->get_billing_company();
     254                $name = $company;
    245255            } else {
    246                 $name = $order->get_billing_company() . ' - ' . $name;
     256                $name = $company . ' - ' . $name;
    247257            }
    248258        }
     
    516526            $note = isset($_POST['note']) ? sanitize_text_field($_POST['note']) : get_option('wc_billingo_note');
    517527            $deadline = (isset($_POST['deadline']) && $_POST['deadline'] != '') ? (int)$_POST['deadline'] : ((int)get_option('wc_billingo_paymentdue_' . $order_payment_method));
    518             $completed_date = date('Y-m-d', (isset($_POST['completed']) && strtotime($_POST['completed'])) ? strtotime($_POST['completed']) : time());
     528            $completed_date = wp_date('Y-m-d', (isset($_POST['completed']) && strtotime($_POST['completed'])) ? strtotime($_POST['completed']) : time());
    519529
    520530
     
    543553
    544554            //Mark as paid if needed
    545             $mark_paid = false;
    546             if (!$is_draft && (!$payment_request && get_option('wc_billingo_mark_as_paid_' . $order_payment_method))
    547                 || ($payment_request && get_option('wc_billingo_mark_as_paid2_' . $order_payment_method))) {
    548                $mark_paid = true;
    549             }
     555            $mark_paid = (!$payment_request && get_option('wc_billingo_mark_as_paid_' . $order_payment_method))
     556                       || ($payment_request && get_option('wc_billingo_mark_as_paid2_' . $order_payment_method));
    550557
    551558            // set tax override variables
     
    562569            $invoice_data = [
    563570                'fulfillment_date' => $completed_date,
    564                 'due_date'         => date('Y-m-d', strtotime('+' . $deadline . ' days')),
     571                'due_date'         => wp_date('Y-m-d', strtotime('+' . $deadline . ' days')),
    565572                'payment_method'   => $paymentMethod,
    566573                'comment'          => $note,
    567574                'language'         => $lang,
    568                 'electronic'       => (get_option('wc_billingo_electronic') == 'yes') ? 1 : 0,
     575                'electronic'       => get_option('wc_billingo_electronic') == 'yes' ? 1 : 0,
    569576                'currency'         => $order->get_currency() ?: 'HUF',
    570577                'partner_id'       => $partner_id,
     
    574581                'settings'         => [
    575582                    'round' => get_option('wc_billingo_invoice_round'),
     583                    'without_financial_fulfillment' => $mark_paid && get_option('mark_paid_without_financial_fulfillment') == 'yes',
    576584                ],
    577585                'items' => static::createProductItems($order),
    578586            ];
     587
     588            if ($invoice_data['currency'] == 'HUF' && ($bank_account = get_option('wc_billingo_bank_account_huf'))) {
     589                $invoice_data['bank_account_id'] = $bank_account;
     590            } elseif ($invoice_data['currency'] == 'EUR' && ($bank_account = get_option('wc_billingo_bank_account_eur'))) {
     591                $invoice_data['bank_account_id'] = $bank_account;
     592            }
    579593
    580594            //Create invoice
     
    732746            if ($order_shipping_tax > 0) {
    733747                $tax_rate = 0;
    734                 $tax_rates = self::get_shipping_tax_rates($item->get_tax_class(), $order_tax_location);
    735                 if (!empty($tax_rates)) {
    736                     $tax_rate = reset($tax_rates);
    737                     $tax_rate = $tax_rate['rate'];
     748
     749                if (isset($item['taxes']) && ($taxes = $item->get_taxes())) {
     750                    if (array_key_exists('total', $taxes)) {
     751                        $tax_ids = array_keys($taxes['total']);
     752                        $tax_rate_id = reset($tax_ids);
     753                        if ($tax_rate_id) {
     754                            $tax_rate = floatval(WC_Tax::get_rate_percent($tax_rate_id));
     755                        }
     756                    }
     757                }
     758
     759                if (!$tax_rate) {
     760                    $tax_rates = self::get_shipping_tax_rates($item->get_tax_class(), $order_tax_location);
     761                    if (!empty($tax_rates)) {
     762                        $tax_rate = reset($tax_rates);
     763                        $tax_rate = $tax_rate['rate'];
     764                    }
    738765                }
    739766
     
    12551282
    12561283        // invoice
    1257         if (in_array(get_option('wc_billingo_email'), ['attach', 'both']) && $email_id == 'customer_completed_order') {
     1284        if (in_array(get_option('wc_billingo_email'), ['attach', 'both']) && in_array($email_id, ['customer_completed_order', 'customer_completed_renewal_order', 'customer_completed_switch_order'])) {
    12581285            $pdf_link = static::generateDownloadLink($order->get_id(), PWSBillingo::INVOICE_TYPE_INVOICE);
    12591286
  • billingo/trunk/index.php

    r2593273 r2639095  
    66 * Plugin Name: Integration for Billingo & WooCommerce
    77 * Plugin URI:
    8  * Version: 3.2.5
     8 * Version: 3.3.2
    99 * Description: Billingo online számlázó összeköttetés WooCommercehez
    10  * Author: Bokor & Vizmeg GbR <[email protected]>
     10 * Author: PWS Online Kft. <[email protected]>
    1111 * Author URI: https://pws-online.com
    1212 * Text Domain: billingo
  • billingo/trunk/readme.txt

    r2593273 r2639095  
    22Contributors: BlueDeath
    33Tags: billingo.hu, billingo, woocommerce, szamlazas, magyar
    4 Requires at least: 4.7
     4Requires at least: 5.3
    55Tested up to: 5.8
    6 Stable tag: 3.2.5
     6Stable tag: 3.3.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5656
    5757    <?php
    58     //Számlanyelv változtatás
    59     add_filter('wc_billingo_invoicedata','wc_billingo_lang',10,2);
    60     function wc_billingo_lang($data,$order) {
     58    // Számlanyelv változtatás
     59    add_filter('wc_billingo_invoicedata', 'wc_billingo_lang', 10, 2);
     60    function wc_billingo_lang($data, $order) {
    6161        $data['template_lang_code'] = 'en';
    6262        return $data;
     
    7777
    7878== Changelog ==
     79
     80= 3.3.2 =
     81* Javítás: jogcím mező elállítódás
     82
     83= 3.3.1 =
     84* Fejlesztés: Javított szállító ÁFA lekérés
     85* Fejlesztés: Cégnévre whitespace szűrés, hogy ne fogadja el a " "-t cégnévnek
     86
     87= 3.3.0 =
     88* Fejlesztés: Bankszámla választás opció
     89* Fejlesztés: "Pénzügyi teljesítést nem igényel" jelölés
     90* Fejlesztés: Piszkozat is lehet fizetettnek jelölt (éles számla beállításai alapján)
     91
     92= 3.2.7 =
     93* Fejlesztés: Wordpress dátum függvényre váltás, hogy elkerüljük az időzónák miatti gondokat
     94* Fejlesztés: Log áthelyezve wp_content/uploads/billingo mappába, hogy ne törlődjön plugin frissítéskor
     95
     96= 3.2.6 =
     97* Fejlesztés: WooCommerce Subscriptions email csatolmány kompatibilitás
    7998
    8099= 3.2.5 =
Note: See TracChangeset for help on using the changeset viewer.