Changeset 2639095
- Timestamp:
- 12/03/2021 12:23:14 PM (4 years ago)
- Location:
- billingo
- Files:
-
- 29 added
- 2 deleted
- 8 edited
-
tags/2.5.0/includes/class-billingo.php (deleted)
-
tags/2.5.0/includes/index.php (deleted)
-
tags/3.3.2 (added)
-
tags/3.3.2/admin (added)
-
tags/3.3.2/admin/class-billingo-admin.php (added)
-
tags/3.3.2/admin/css (added)
-
tags/3.3.2/admin/css/global.css (added)
-
tags/3.3.2/admin/images (added)
-
tags/3.3.2/admin/images/ajax-loader.gif (added)
-
tags/3.3.2/admin/images/invoice.png (added)
-
tags/3.3.2/admin/images/payment_request.png (added)
-
tags/3.3.2/admin/index.php (added)
-
tags/3.3.2/admin/js (added)
-
tags/3.3.2/admin/js/global.js (added)
-
tags/3.3.2/assets (added)
-
tags/3.3.2/assets/screenshot-1.jpg (added)
-
tags/3.3.2/assets/screenshot-2.jpg (added)
-
tags/3.3.2/assets/screenshot-3.jpg (added)
-
tags/3.3.2/assets/screenshot-4.jpg (added)
-
tags/3.3.2/changelog.md (added)
-
tags/3.3.2/includes (added)
-
tags/3.3.2/includes/PWSBillingo.php (added)
-
tags/3.3.2/includes/class-billingo-order.php (added)
-
tags/3.3.2/includes/class-billingo.php (added)
-
tags/3.3.2/includes/index.php (added)
-
tags/3.3.2/index.php (added)
-
tags/3.3.2/log (added)
-
tags/3.3.2/log/.keep (added)
-
tags/3.3.2/log/index.php (added)
-
tags/3.3.2/readme.txt (added)
-
tags/3.3.2/uninstall.php (added)
-
trunk/admin/class-billingo-admin.php (modified) (11 diffs)
-
trunk/admin/js/global.js (modified) (2 diffs)
-
trunk/changelog.md (modified) (1 diff)
-
trunk/includes/PWSBillingo.php (modified) (6 diffs)
-
trunk/includes/class-billingo-order.php (modified) (1 diff)
-
trunk/includes/class-billingo.php (modified) (11 diffs)
-
trunk/index.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
billingo/trunk/admin/class-billingo-admin.php
r2593273 r2639095 1 1 <?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 */ 2 11 3 12 if (!defined('WPINC')) { … … 7 16 use PWSBillingo\PWSBillingo; 8 17 9 /**10 * Handling Billingo - WooCommerce Admin Area11 *12 * @author Bokor & Vizmeg GbR <[email protected]>13 * @since Class available since Release 1.0.014 */15 18 class Billingo_Admin 16 19 { … … 134 137 public static function get_settings() 135 138 { 139 $order_statuses = wc_get_order_statuses(); 140 136 141 $taxes = [-1 => '']; 137 142 foreach (PWSBillingo::ALL_TAXES as $v) { … … 153 158 $roundings[$k] = __($v, 'billingo'); 154 159 } 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'); 155 166 156 167 $settings = [ … … 163 174 ], 164 175 [ 165 'title' => __('Számlatömb API ID', 'billingo'),176 'title' => __('Számlatömb', 'billingo'), 166 177 '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'), 169 181 ], 170 182 ['type' => 'sectionend', 'id' => 'woocommerce_billingo_options'], 171 183 ['type' => 'title', 'title' => __('Billingo Számla Beállítások', 'billingo'), 'id' => 'woocommerce_billingo_options'], 172 184 [ 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', 176 202 ], 177 203 [ … … 195 221 'id' => 'wc_billingo_electronic', 196 222 '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.'), 197 229 ], 198 230 [ … … 211 243 'id' => 'wc_billingo_auto_state', 212 244 'type' => 'select', 213 'options' => $order_statuses = wc_get_order_statuses(),245 'options' => $order_statuses, 214 246 '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'), 215 247 ], … … 224 256 'id' => 'wc_billingo_auto_storno', 225 257 '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), 231 259 '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'), 232 260 ], … … 571 599 <textarea name="wc_billingo_support_code" id="wc_billingo_support_code" readonly="readonly" title="<?=$debug_normal?>" rows="7"><?=$debug?></textarea> 572 600 <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> 574 602 </td> 575 603 </tr> … … 584 612 <label for="wc_billingo_support_code"><?php esc_html_e('Naplófájlok elérhetősége', 'billingo'); ?>:</label> 585 613 </th> 586 <td class="forminp forminp-text">/wp-content/ plugins/billingo/log/</td>614 <td class="forminp forminp-text">/wp-content/uploads/billingo/</td> 587 615 </tr> 588 616 </tbody> … … 762 790 763 791 <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])"> 765 793 766 794 <h4><?php esc_html_e('Számla típusa', 'billingo'); ?></h4> -
billingo/trunk/admin/js/global.js
r2536978 r2639095 78 78 79 79 let setTaxOverrideEntitlementsFor = function (id) { 80 let selectedTaxOverride = $('#' + id + ' option:selected').val();80 let selectedTaxOverride = $('#' + id).val(); 81 81 let possibleEntitlements = taxEntitlements[selectedTaxOverride]; 82 let selectedEntitlement = $('#' + id + ' _entitlement option:selected').val();82 let selectedEntitlement = $('#' + id + '_entitlement').val(); 83 83 84 84 if (possibleEntitlements) { … … 124 124 } 125 125 else { 126 $('#' + id + '_entitlement option[value=" ${selectedEntitlement}"]').prop("selected", true);126 $('#' + id + '_entitlement option[value="' + selectedEntitlement + '"]').prop("selected", true); 127 127 } 128 128 -
billingo/trunk/changelog.md
r2593273 r2639095 1 1 # 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 2 21 3 22 - **3.2.5** - 2021-08-11 -
billingo/trunk/includes/PWSBillingo.php
r2593273 r2639095 1 1 <?php 2 2 /** 3 * Created by Bokor & Vizmeg GbR.3 * Created by PWS Online Kft. 4 4 * 5 * @author Bokor & Vizmeg GbR<[email protected]>6 * @copyright 2021 Bokor & Vizmeg GbR7 * @license Copyright 2021 Bokor & Vizmeg GbR5 * @author Viktor Vizmeg <[email protected]> 6 * @copyright 2021 PWS Online Kft. 7 * @license Copyright 2021 PWS Online Kft. 8 8 * @date 2021-04-16 9 9 * @time 14:50 … … 14 14 class PWSBillingo 15 15 { 16 const VERSION = '3.1. 2';16 const VERSION = '3.1.4'; 17 17 18 18 const REMOTE_HOST = 'https://api.billingo.hu/v3/'; // with trailing slash! … … 473 473 } 474 474 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 475 509 // ----------------------------------------------------------------------------------------------------------------- 476 510 // helper functions … … 699 733 public static function log($dir, $filename, $message, $value = null) 700 734 { 701 $log_file = rtrim($dir, '/') . '/' . date('Y-m-d') . '_' . $filename; 735 $dir = rtrim($dir, '/') . '/'; 736 $log_file = $dir . date('Y-m-d') . '_' . $filename; 702 737 703 738 if (!file_exists($dir)) { … … 723 758 public static function createHtaccessInDir($dir) 724 759 { 760 $dir = rtrim($dir, '/') . '/'; 725 761 $fp = fopen($dir . '.htaccess', 'w'); 726 762 fwrite($fp, <<<STR … … 743 779 /* 744 780 * 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 * 745 794 * - 3.1.0 - 2021-04-21 746 795 * - Expose last http response and response code -
billingo/trunk/includes/class-billingo-order.php
r2536978 r2639095 1 1 <?php 2 2 /** 3 * Created by Bokor & Vizmeg GbR.3 * Created by PWS Online Kft. 4 4 * 5 * @author Bokor & Vizmeg GbR<[email protected]>6 * @copyright 2021 Bokor & Vizmeg GbR7 * @license Copyright 2021 Bokor & Vizmeg GbR5 * @author Viktor Vizmeg <[email protected]> 6 * @copyright 2021 PWS Online Kft. 7 * @license Copyright 2021 PWS Online Kft. 8 8 * @date 2021-04-16 9 9 * @time 14:50 -
billingo/trunk/includes/class-billingo.php
r2593273 r2639095 1 1 <?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 */ 2 11 3 12 if (!defined('WPINC')) { … … 7 16 use PWSBillingo\PWSBillingo; 8 17 9 /**10 * Handling Billingo Documents11 *12 * @author Bokor & Vizmeg GbR <[email protected]>13 * @since Class available since Release 1.0.014 */15 18 class WC_Billingo 16 19 { … … 69 72 static::install(); 70 73 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); 71 81 } 72 82 } … … 135 145 $plugin_version = $plugin_data['Version']; 136 146 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); 138 148 } 139 149 … … 240 250 } 241 251 242 if ($ order->get_billing_company()) {252 if ($company = trim($order->get_billing_company())) { 243 253 if (get_option('wc_billingo_company_name')) { 244 $name = $ order->get_billing_company();254 $name = $company; 245 255 } else { 246 $name = $ order->get_billing_company(). ' - ' . $name;256 $name = $company . ' - ' . $name; 247 257 } 248 258 } … … 516 526 $note = isset($_POST['note']) ? sanitize_text_field($_POST['note']) : get_option('wc_billingo_note'); 517 527 $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()); 519 529 520 530 … … 543 553 544 554 //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)); 550 557 551 558 // set tax override variables … … 562 569 $invoice_data = [ 563 570 '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')), 565 572 'payment_method' => $paymentMethod, 566 573 'comment' => $note, 567 574 'language' => $lang, 568 'electronic' => (get_option('wc_billingo_electronic') == 'yes')? 1 : 0,575 'electronic' => get_option('wc_billingo_electronic') == 'yes' ? 1 : 0, 569 576 'currency' => $order->get_currency() ?: 'HUF', 570 577 'partner_id' => $partner_id, … … 574 581 'settings' => [ 575 582 'round' => get_option('wc_billingo_invoice_round'), 583 'without_financial_fulfillment' => $mark_paid && get_option('mark_paid_without_financial_fulfillment') == 'yes', 576 584 ], 577 585 'items' => static::createProductItems($order), 578 586 ]; 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 } 579 593 580 594 //Create invoice … … 732 746 if ($order_shipping_tax > 0) { 733 747 $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 } 738 765 } 739 766 … … 1255 1282 1256 1283 // 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'])) { 1258 1285 $pdf_link = static::generateDownloadLink($order->get_id(), PWSBillingo::INVOICE_TYPE_INVOICE); 1259 1286 -
billingo/trunk/index.php
r2593273 r2639095 6 6 * Plugin Name: Integration for Billingo & WooCommerce 7 7 * Plugin URI: 8 * Version: 3. 2.58 * Version: 3.3.2 9 9 * Description: Billingo online számlázó összeköttetés WooCommercehez 10 * Author: Bokor & Vizmeg GbR<[email protected]>10 * Author: PWS Online Kft. <[email protected]> 11 11 * Author URI: https://pws-online.com 12 12 * Text Domain: billingo -
billingo/trunk/readme.txt
r2593273 r2639095 2 2 Contributors: BlueDeath 3 3 Tags: billingo.hu, billingo, woocommerce, szamlazas, magyar 4 Requires at least: 4.74 Requires at least: 5.3 5 5 Tested up to: 5.8 6 Stable tag: 3. 2.56 Stable tag: 3.3.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 56 56 57 57 <?php 58 // Számlanyelv változtatás59 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) { 61 61 $data['template_lang_code'] = 'en'; 62 62 return $data; … … 77 77 78 78 == 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 79 98 80 99 = 3.2.5 =
Note: See TracChangeset
for help on using the changeset viewer.