Plugin Directory

Changeset 3205727


Ignore:
Timestamp:
12/10/2024 02:32:52 PM (15 months ago)
Author:
primersoftware
Message:

Update

Location:
primer-mydata
Files:
2140 added
21 edited

Legend:

Unmodified
Added
Removed
  • primer-mydata/trunk/README.txt

    r3188823 r3205727  
    33Tags: MyData, receipts, Greece, invoices, Primer MyData
    44Requires at least: 5.3
    5 Tested up to: 6.7.0
     5Tested up to: 6.7.1
    66Requires PHP: 7.4
    7 Stable tag: 4.2.1
     7Stable tag: 4.2.2
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • primer-mydata/trunk/admin/class-primer-admin.php

    r3186553 r3205727  
    890890    public function primer_admin_order_success_message() { ?>
    891891        <div class="notice notice-success is-dismissible">
    892             <p><strong><?php _e('Editing of this order has been disabled because it has been converted to invoice', 'primer'); ?></strong></p>
     892            <p><strong><?php esc_html_e('Editing of this order has been disabled because it has been converted to invoice', 'primer'); ?></strong></p>
    893893            <button type="button" class="notice-dismiss">
    894894                <span class="screen-reader-text">Dismiss this notice.</span>
     
    899899    public function primer_admin_order_error_message() { ?>
    900900        <div class="notice notice-error">
    901             <p><strong><?php _e('Editing of this order has been disabled because data have been send to AADE, but there was an error in the conversion. Please check conversion log and fix conversion error to continue', 'primer'); ?></strong></p>
     901            <p><strong><?php esc_html_e('Editing of this order has been disabled because data have been send to AADE, but there was an error in the conversion. Please check conversion log and fix conversion error to continue', 'primer'); ?></strong></p>
    902902        </div>
    903903    <?php }
  • primer-mydata/trunk/admin/includes/my_data_json.php

    r3187782 r3205727  
    117117        $series_array['Ω'] = 'V';
    118118        $discount_total = $discount_percentage = 0;
     119        $total_refund   = $order->get_total_refunded() ?: 0;
    119120        if ($order_total_price > 0) {
    120121            foreach ($order->get_items('fee') as $item_fee) {
     
    138139            'Services' => 0
    139140        );
    140         $invoice_products_types = [];
    141         foreach ($order->get_items() as $items) {
     141        $refunded_shipping_total = $refunded_shipping_tax  = 0;
     142        $invoice_products_types = $refunded_product_total = $refunded_product_tax = $refunded_product_quantity = [];
     143        foreach ($order->get_items() as $item_id => $items) {
    142144            $product = $items->get_product();
    143145            if ($product) {
     
    155157                if ($order_total_price > 0) {
    156158                    $item_total = $items->get_total();
     159                    if ($order->get_refunds()) {
     160                        foreach ($order->get_refunds() as $refund) {
     161                            $refund_items = $refund->get_items();
     162                            foreach ($refund_items as $refund_item) {
     163                                if ($refund_item->get_meta('_refunded_item_id') == $item_id) {
     164                                    $refunded_product_total[$item_id] = $refund_item->get_total() ?: 0;
     165                                    $refunded_product_tax[$item_id] = $refund_item->get_total_tax() ?: 0;
     166                                    $refunded_product_quantity[$item_id] = $refund_item->get_quantity() ?: 0;
     167                                }
     168                            }
     169                            $refunded_shipping_total = $refund->get_shipping_total() ?: 0;
     170                            $refunded_shipping_tax   = $refund->get_shipping_tax() ?: 0;
     171                        }
     172                    }
    157173                    if (isset($category_amounts[$product_types])) {
    158174                        $category_amounts[$product_types] += number_format((float)$item_total, 2, '.', '');
     
    160176                            $category_amounts[$product_types] -= wc_round_discount($item_total * $discount_percentage / 100, 2);
    161177                        }
     178                    }
     179                    if ($total_refund > 0) {
     180                        $category_amounts[$product_types] += $refunded_product_total[$item_id] ?: 0;
     181                    }
     182                }
     183            } else {
     184                $product_types = $predefined_category;
     185                $item_total = $items->get_total();
     186                if (isset($category_amounts[$product_types])) {
     187                    $category_amounts[$product_types] += number_format((float)$item_total, 2, '.', '');
     188                    if ($discount_percentage > 0) {
     189                        $category_amounts[$product_types] -= wc_round_discount($item_total * $discount_percentage / 100, 2);
    162190                    }
    163191                }
     
    321349        $total_tax = $order->get_total_tax();
    322350        $get_coupon = $order->get_coupon_codes();
    323         $shipping_total = $order->get_shipping_total();
    324         $shipping_tax = $order->get_shipping_tax();
     351        $shipping_total = $order->get_shipping_total() + $refunded_shipping_total;
     352        $shipping_tax = $order->get_shipping_tax() + $refunded_shipping_tax;
    325353        $invoice_data['invoice'][0]['invoiceHeader']['series'] = $serie == 'EMPTY' ? '0' : $serie;
    326354        $invoice_data['invoice'][0]['invoiceHeader']['aa'] = $number;
     
    413441            $outside_vat_total = 0;
    414442            foreach ($order->get_items() as $item_id => $item_data) {
    415                 $quantity     = $item_data->get_quantity();
     443                $quantity     = $item_data->get_quantity() + $refunded_product_quantity[$item_id];
    416444                $product_name = $item_data->get_name();
    417445                if ($general_settings['display_attr_var'] == 'on') {
     
    428456                $product_code = $item_data->get_id();
    429457                $product      = $item_data->get_product();
    430                 $product_id   = $product->get_id();
    431                 $classificationCategory = $categories_map[$invoice_products_types[$product_id]];
     458                if ($product) {
     459                    $product_id   = $product->get_id();
     460                    $classificationCategory = $categories_map[$invoice_products_types[$product_id]];
     461                } else {
     462                    $classificationCategory = $categories_map[$predefined_category];
     463                }
    432464                $sum += $quantity;
    433465                $subtotal_order_payment = $item_data->get_total();
     
    436468                        $subtotal_order_payment -= wc_round_discount($subtotal_order_payment * ($discount_percentage / 100), 2);
    437469                    }
     470                }
     471                if ($total_refund > 0) {
     472                    $subtotal_order_payment += $refunded_product_total[$item_id];
    438473                }
    439474                if ($subtotal_order_payment == 0) {
     
    488523                    }
    489524                }
     525                if ($total_refund > 0) {
     526                    $subtotal_item_tax += $refunded_product_tax[$item_id];
     527                }
    490528                $tax_classes       = WC_Tax::get_tax_classes();
    491529                $classes_names     = array();
     
    528566                    return "break";
    529567                }
     568
     569                $classProduct      = (string) str_replace('-', '_', $product_tax_class);
     570                $classMessage      = str_replace('_' , ' ', $classProduct);
     571                $mydataOptionReset = array_change_key_case($mydata_options, CASE_LOWER);
     572
     573                if (!isset($mydataOptionReset[$classProduct]) && !empty($classProduct) || $mydataOptionReset[$classProduct] == 0 && !empty($classProduct)) {
     574                    $receipt_log_value .= sprintf(__('Error! Please enter a VAT exemption reason for the %s rate by going to the MyData settings of the add-on', 'primer'), $classMessage);
     575                    $receipt_log_value_array[] = sprintf(__('Error! Please enter a VAT exemption reason for the %s rate by going to the MyData settings of the add-on', 'primer'), $classMessage);
     576                    update_post_meta($receipt_log_id, 'receipt_log_error', $receipt_log_value);
     577                    $response_data .= '<div class="primer_popup popup_error"><div></br><h3>' . __('Error!', 'primer') . '</br>' . sprintf(__('Please enter a VAT exemption reason for the %s rate by going to the MyData settings of the add-on.', 'primer'), var_export($classMessage, true)) . '</h3><br><br></div>';
     578                    $response_data .= '<button class="popup_ok button button-primary">OK</button></div>';
     579                    if ($callingFunction == "convert_order_to_invoice") {
     580                        update_post_meta($receipt_log_id, 'receipt_log_automation_error', $receipt_log_value);
     581                    } else {
     582                        update_post_meta($receipt_log_id, 'receipt_log_error', $receipt_log_value);
     583                    }
     584                    return "break";
     585                }
     586
    530587                if ($order_country != 'GR' && ($order_vat_exemption_category == '' || empty($order_vat_exemption_category) || $order_vat_exemption_category == 0)) {
    531588                    $order_vat_exemption_category = 27;
     
    593650                    }
    594651                    if ($vies == 'yes') {
    595                         if ($invoice_products_types[$product_id] !== 'Services') {
     652                        if ($classificationCategory !== 'category1_3') {
    596653                            $invoice_data['invoice'][0]['invoiceDetails'][$item_count]['vatExemptionCategory'] = 14;
    597654                        } else {
     
    898955            $total = number_format($total, 2, '.', '');
    899956            $invoice_data['invoice'][0]['paymentMethods']['paymentMethodDetails'][0]['type'] = 1;
    900             $invoice_data['invoice'][0]['paymentMethods']['paymentMethodDetails'][0]['amount'] = number_format($order->get_total(), 2, '.', '');
     957            $invoice_data['invoice'][0]['paymentMethods']['paymentMethodDetails'][0]['amount'] = number_format($order->get_total() - $total_refund, 2, '.', '');
    901958            $subtotal           = $total_net_value;
    902959            $subtotal           = number_format((float)$subtotal, 2, '.', '');
     
    922979            $invoice_data['invoice'][0]['invoiceSummary']['totalDeductionsAmount'] = 0;
    923980            $invoice_data['invoice'][0]['invoiceSummary']['totalOtherTaxesAmount'] = 0;
     981
    924982            $goods_total            = number_format((float)$category_amounts['Goods'], 2, '.', '');
    925983            $products_total         = number_format((float)$category_amounts['Products'], 2, '.', '');
    926984            $services_total         = number_format((float)$category_amounts['Services'], 2, '.', '');
    927985            $shipping_and_fee_total = (max(0, $fee_total) + max(0, $shipping_total));
     986
    928987            if ($goods_total > 0) {
    929988                $invoice_data['invoice'][0]['invoiceSummary']['incomeClassification'][] = [
     
    12981357                    $zip_file_name = $upload_dir . '/exported_html_files/' . $post_ids_str . '_html.zip';
    12991358                    ob_start();
    1300                     echo $primer_options->create_zip($files, $zip_file_name, $all_files . '/');
     1359                    //echo $primer_options->create_zip($files, $zip_file_name, $all_files . '/');
     1360                    echo esc_url($primer_options->create_zip($files, $zip_file_name, $all_files . '/'));
    13011361                    $create_zip = ob_get_clean();
    13021362                    if ($create_zip == 'created') {
     
    15841644        return $Vat_exemption_categories;
    15851645    }
     1646
    15861647    public function getVatCategories(): array{
    15871648        $Vat_categories = array();
  • primer-mydata/trunk/admin/includes/primer-admin-options.php

    r3186553 r3205727  
    187187                    }
    188188                    ?>
    189                     <a class="<?php echo esc_attr( $nav_class ); ?>" href="<?php echo $admin_url; ?>"><?php esc_attr_e( $option_tab['title'], 'primer' ); ?></a>
     189                    <a class="<?php echo esc_attr( $nav_class ); ?>" href="<?php echo esc_url($admin_url); ?>"><?php esc_attr_e( $option_tab['title'], 'primer' ); ?></a>
    190190                <?php endforeach; ?>
    191191            </h2>
    192192
    193             <div class="plugin_caption_version"><?php echo PRIMER_NAME . ' v'. PRIMER_VERSION; ?></div>
     193            <div class="plugin_caption_version"><?php echo esc_attr(PRIMER_NAME . ' v'. PRIMER_VERSION); ?></div>
    194194
    195195            <!-- End of Nav Tabs -->
     
    199199                        <div class="postbox">
    200200                            <h3 class="title"><?php esc_html_e($tab_form['title'], 'primer'); ?></h3>
    201                             <div class="desc"><?php echo $tab_form['desc'] ?></div>
     201                            <div class="desc"><?php echo esc_url($tab_form['desc']); ?></div>
    202202                            <?php cmb2_metabox_form( $tab_form, $tab_form['id'] ); ?>
    203203                        </div>
     
    32503250        }
    32513251
    3252         throw new Exception( 'Invalid property: ' . $field );
     3252        throw new Exception( 'Invalid property: ' . esc_url($field) );
    32533253    }
    32543254
     
    34243424            }
    34253425        }
    3426 
    3427 
    3428         wp_die($json_r);
     3426        wp_die($json_r);
    34293427    }
    34303428
     
    34723470        $receipt_ids        = isset($_POST["receipts"]) ? $_POST["receipts"] : "";
    34733471        array_map( 'sanitize_text_field', $receipt_ids );
     3472        if(is_array($receipt_ids)) {
     3473            $receipt_ids = array_unique($receipt_ids);
     3474        }
    34743475        $orders = array();
    34753476        if (!isset($_GET['orders']) && !empty($mydata_options['last_request']) && isset($_GET['resend_html'])) {
     
    35013502                }
    35023503                $order_paid_date = null;
    3503                 $order_paid_hour = null;
    35043504                if (!empty($order->get_date_paid())) {
    35053505                    $order_paid_date = date( 'F j, Y', $order->get_date_paid()->getTimestamp());
    3506                     $order_paid_hour = date( 'H:i:s', $order->get_date_paid()->getTimestamp());
    35073506                } else {
    35083507                    $order_paid_date = date( 'F j, Y', $order->get_date_created()->getTimestamp());
    3509                     $order_paid_hour = date( 'H:i:s', $order->get_date_created()->getTimestamp());
    35103508                }
    35113509                update_post_meta($receipt_log_id, 'receipt_log_order_id', $id_of_order);
  • primer-mydata/trunk/admin/includes/primer-admin-receipt-log-automation-table.php

    r3008952 r3205727  
    3131            'receipt_log_automation_invoice_id'     => __( 'Invoice No', 'primer' ),
    3232            'receipt_log_automation_invoice_date'   => __( 'Invoice Date', 'primer' ),
    33             'receipt_log_automation_client' => __( 'Client', 'primer' ),
    34             'receipt_log_automation_status' => __( 'Issued receipt', 'primer' ),
    35             'receipt_log_automation_email'  => __( 'Email Send', 'primer' ),
    36             'receipt_log_automation_error'  => __( 'Receipt Error', 'primer' ),
    37             'receipt_log_automation_email_error' => __( 'Email error', 'primer' ),
     33            'receipt_log_automation_client'         => __( 'Client', 'primer' ),
     34            'receipt_log_automation_status'         => __( 'Issued receipt', 'primer' ),
     35            'receipt_log_automation_email'          => __( 'Email Send', 'primer' ),
     36            'receipt_log_automation_error'          => __( 'Receipt Error', 'primer' ),
     37            'receipt_log_automation_email_error'    => __( 'Email error', 'primer' ),
    3838        );
    3939    }
     
    6767            ?>
    6868            <div class="alignleft actions">
    69                 <h2><?php _e('Issue Receipts Report', 'primer'); ?></h2>
     69                <h2><?php esc_html_e('Issue Receipts Report', 'primer'); ?></h2>
    7070                <div class="filter_blocks_wrapper">
    7171                    <?php $check_errors = isset($_GET['only_errors']) ? sanitize_text_field($_GET['only_errors']) : ''; ?>
     
    7777                                    checked($_GET['only_errors'], 'on');
    7878                                } elseif (empty($check_errors) && empty($check_issued)) { echo 'checked';} ?> id="only_errors">
    79                             <?php _e('Show only errors', 'primer'); ?>
     79                            <?php esc_html_e('Show only errors', 'primer'); ?>
    8080                        </label>
    8181                    </div>
     
    8686                                    checked($_GET['only_issued'], 'on');
    8787                                } elseif (empty($check_errors) && empty($check_issued)) { echo 'checked';} ?> id="only_issued">
    88                             <?php _e('Show only issued', 'primer'); ?>
     88                            <?php esc_html_e('Show only issued', 'primer'); ?>
    8989                        </label>
    9090                    </div>
    91                     <div class="apply_btn"><input type="submit" class="button" name="filter_action" value="<?php _e('Apply filter', 'primer'); ?>" /></div>
     91                    <div class="apply_btn"><input type="submit" class="button" name="filter_action" value="<?php esc_html_e('Apply filter', 'primer'); ?>" /></div>
    9292
    9393                </div>
     
    241241
    242242    function no_items() {
    243         _e( 'No receipts report found.', 'primer' );
     243        esc_html_e( 'No receipts report found.', 'primer' );
    244244    }
    245245
     
    287287        <?php
    288288         if ($_GET['page'] === 'wp_ajax_list_order') { ?>
    289             <h2><?php _e('Orders', 'primer'); ?>
     289            <h2><?php esc_html_e('Orders', 'primer'); ?>
    290290            <?php //Trigger hooks that allows an extension to add extra nav tabs in the members menu.
    291291            do_action( 'primer_menu_nav_tabs', $selected ); ?>
  • primer-mydata/trunk/admin/includes/primer-admin-receipt-log-table.php

    r3186553 r3205727  
    6161            ?>
    6262            <div class="alignleft actions">
    63                 <h2><?php _e('Issue Receipts Report', 'primer'); ?></h2>
     63                <h2><?php esc_html_e('Issue Receipts Report', 'primer'); ?></h2>
    6464                <div class="filter_blocks_wrapper">
    6565                    <?php $check_errors = isset($_GET['only_errors']) ? sanitize_text_field($_GET['only_errors']) : ''; ?>
     
    7171                                    checked($_GET['only_errors'], 'on');
    7272                                } elseif (empty($check_errors) && empty($check_issued)) { echo 'checked';} ?> id="only_errors">
    73                             <?php _e('Show only errors', 'primer'); ?>
     73                            <?php esc_html_e('Show only errors', 'primer'); ?>
    7474                        </label>
    7575                    </div>
     
    8080                                    checked($_GET['only_issued'], 'on');
    8181                                } elseif (empty($check_errors) && empty($check_issued)) { echo 'checked';} ?> id="only_issued">
    82                             <?php _e('Show only issued', 'primer'); ?>
     82                            <?php esc_html_e('Show only issued', 'primer'); ?>
    8383                        </label>
    8484                    </div>
    85                     <div class="apply_btn"><input type="submit" class="button" name="filter_action" value="<?php _e('Apply filter', 'primer'); ?>" /></div>
     85                    <div class="apply_btn"><input type="submit" class="button" name="filter_action" value="<?php esc_html_e('Apply filter', 'primer'); ?>" /></div>
    8686
    8787                </div>
     
    221221
    222222    function no_items():void {
    223         _e( 'No receipts report found.', 'primer' );
     223        esc_html_e( 'No receipts report found.', 'primer' );
    224224    }
    225225
     
    265265        <?php
    266266         if ($_GET['page'] === 'wp_ajax_list_order') { ?>
    267             <h2><?php _e('Orders', 'primer'); ?>
     267            <h2><?php esc_html_e('Orders', 'primer'); ?>
    268268            <?php
    269269            do_action( 'primer_menu_nav_tabs', $selected ); ?>
  • primer-mydata/trunk/admin/includes/primer-admin-receipt-table.php

    r3186553 r3205727  
    198198            <div class="actions">
    199199
    200                 <h2><?php _e('Filters', 'primer'); ?></h2>
    201                 <h3><?php _e('Date Range:', 'primer'); ?></h3>
     200                <h2><?php esc_html_e('Filters', 'primer'); ?></h2>
     201                <h3><?php esc_html_e('Date Range:', 'primer'); ?></h3>
    202202
    203203                <div class="filter_blocks_wrapper">
     
    206206                        <div class="filter_block">
    207207
    208                             <label for="primer_receipt_year" style="float: left;"><?php _e('Year: ', 'primer'); ?></label>
     208                            <label for="primer_receipt_year" style="float: left;"><?php esc_html_e('Year: ', 'primer'); ?></label>
    209209                            <select name="primer_receipt_year" id="primer_receipt_year">
    210210
     
    228228
    229229                            <label for="receipt_date_from">
    230                                 <?php _e('From: ', 'primer'); ?></label>
     230                                <?php esc_html_e('From: ', 'primer'); ?></label>
    231231                            <input type="text" id="receipt_date_from" name="receipt_date_from" placeholder="Date From" value="" />
    232232                            <label for="receipt_date_to">
    233                                 <?php _e('To: ', 'primer'); ?></label>
     233                                <?php esc_html_e('To: ', 'primer'); ?></label>
    234234                            <input type="text" id="receipt_date_to" name="receipt_date_to" placeholder="Date To" value="" />
    235235
     
    238238                        <div class="filter_block">
    239239
    240                             <label for="primer_receipt_client" style="float: left;"><?php _e('Client: ', 'primer'); ?></label>
    241                             <select name="primer_receipt_client" id="primer_receipt_client" data-placeholder="<?php _e('Select clients', 'primer'); ?>">
     240                            <label for="primer_receipt_client" style="float: left;"><?php esc_html_e('Client: ', 'primer'); ?></label>
     241                            <select name="primer_receipt_client" id="primer_receipt_client" data-placeholder="<?php esc_html_e('Select clients', 'primer'); ?>">
    242242                                <option value=""></option>
    243243
     
    249249                                        <option value="<?php echo esc_attr($receipt_customer['receipt_client']); ?>" <?php selected($get_customer, $receipt_customer['receipt_client']); ?>><?php echo esc_attr($receipt_customer['receipt_client']); ?></option>
    250250                                    <?php } else { ?>
    251                                         <option value="<?php echo esc_attr($receipt_customer['receipt_client']); ?>" <?php selected($get_customer, $receipt_customer['receipt_client']); ?>><?php _e( 'Guest client', 'primer' ); ?></option>
     251                                        <option value="<?php echo esc_attr($receipt_customer['receipt_client']); ?>" <?php selected($get_customer, $receipt_customer['receipt_client']); ?>><?php esc_html_e( 'Guest client', 'primer' ); ?></option>
    252252                                    <?php }
    253253                                } ?>
     
    261261                        <div class="filter_block">
    262262
    263                             <label for="primer_receipt_status" style="float: left;"><?php _e('Receipt Status: ', 'primer'); ?></label>
    264                             <select name="primer_receipt_status" title="<?php _e('Select receipt status', 'primer'); ?>" id="primer_receipt_status">
     263                            <label for="primer_receipt_status" style="float: left;"><?php esc_html_e('Receipt Status: ', 'primer'); ?></label>
     264                            <select name="primer_receipt_status" title="<?php esc_html_e('Select receipt status', 'primer'); ?>" id="primer_receipt_status">
    265265
    266266                                <?php
     
    281281                        <div class="filter_block">
    282282
    283                             <label for="primer_receipt_type" style="float: left;"><?php _e('Invoice Type: ', 'primer'); ?></label>
    284                             <select name="primer_receipt_type" title="<?php _e('Select invoice type', 'primer'); ?>" id="primer_receipt_type">
     283                            <label for="primer_receipt_type" style="float: left;"><?php esc_html_e('Invoice Type: ', 'primer'); ?></label>
     284                            <select name="primer_receipt_type" title="<?php esc_html_e('Select invoice type', 'primer'); ?>" id="primer_receipt_type">
    285285
    286286                                <?php
     
    305305                        </div>
    306306
    307                         <div class="apply_btn"><input type="submit" id="filter_action_receipt" class="button" name="filter_action" value="<?php _e('Apply filter', 'primer'); ?>" /></div>
     307                        <div class="apply_btn"><input type="submit" id="filter_action_receipt" class="button" name="filter_action" value="<?php esc_html_e('Apply filter', 'primer'); ?>" /></div>
    308308                    </div>
    309309                </div>
     
    693693
    694694    function no_items():void {
    695         _e( 'No receipts found.', 'primer' );
     695        esc_html_e( 'No receipts found.', 'primer' );
    696696    }
    697697
     
    731731        <?php
    732732        if ($_GET['page'] === 'wp_ajax_list_order') { ?>
    733             <h2><?php _e('Orders', 'primer'); ?>
     733            <h2><?php esc_html_e('Orders', 'primer'); ?>
    734734                <?php
    735735                do_action( 'primer_menu_nav_tabs', $selected ); ?>
  • primer-mydata/trunk/admin/includes/primer-admin-table.php

    r3186553 r3205727  
    4646            'receipt_date'          => __('Receipt date', 'primer'),
    4747            'receipt_status'        => __('Receipt Log', 'primer'),
    48             'credit_receipt'        =>__('Credit Receipt', 'primer'),
    49             'credit_log'            =>__('Credit Log', 'primer'),
     48            'credit_receipt'        => __('Credit Receipt', 'primer'),
     49            'credit_log'            => __('Credit Log', 'primer'),
    5050            'receipt_id'            => __('Receipt ID', 'primer'),
    5151            'accept_48'             => __('Accept 48','primer')
     
    155155
    156156    function extra_tablenav($which):void {
    157 
    158157        if ($which !== 'bottom') {
    159158            $primer_orders = new PrimerOrderList();
     
    166165            }
    167166            $order_customers = array_values($unique_customers);
    168 
    169167            ?>
    170168
    171169            <div class="alignleft actions">
    172 
    173                 <h2><?php _e('Filters', 'primer'); ?></h2>
    174                 <h3><?php _e('Date Range:', 'primer'); ?></h3>
     170                <h2><?php esc_html_e('Filters', 'primer'); ?></h2>
     171                <h3><?php esc_html_e('Date Range:', 'primer'); ?></h3>
    175172                <div class="filter_blocks_wrapper">
    176 
    177173                    <div class="left_wrap">
    178 
    179174                        <div class="filter_block">
    180                                 <label for="primer_order_year" style="float: left;"><?php _e('Year: ', 'primer'); ?></label>
     175                                <label for="primer_order_year" style="float: left;"><?php esc_html_e('Year: ', 'primer'); ?></label>
    181176                                <select name="primer_order_year" id="primer_order_year">
    182177                                    <?php
    183 
    184178                                    $year_from = !empty($orders_dates = $primer_orders->get_dates_from_orders()) ? date('Y', min($orders_dates)) : '';
    185179                                    $year_to = date('Y');
    186180                                    $primer_order_year = isset($_GET['primer_order_year']) ? sanitize_text_field($_GET['primer_order_year']) : $year_to;
    187181                                    $range_years = range($year_from, $year_to);
    188 
    189182                                    foreach ($range_years as $range_year) { ?>
    190                                         <option value="<?php echo $range_year; ?>" <?php selected($range_year, $primer_order_year); ?>><?php echo $range_year; ?></option>
     183                                        <option value="<?php echo esc_attr($range_year); ?>" <?php selected($range_year, $primer_order_year); ?>><?php echo esc_attr($range_year); ?></option>
    191184                                    <?php }
    192185                                    ?>
     
    195188
    196189                        <div class="filter_block">
    197 
    198190                            <label for="order_date_from">
    199                                 <?php _e('From: ', 'primer'); ?></label>
     191                                <?php esc_html_e('From: ', 'primer'); ?></label>
    200192                                <input type="text" id="order_date_from" name="order_date_from" placeholder="Date From" value="" />
    201193                            <label for="order_date_to">
    202                                 <?php _e('To: ', 'primer'); ?></label>
     194                                <?php esc_html_e('To: ', 'primer'); ?></label>
    203195                                <input type="text" id="order_date_to" name="order_date_to" placeholder="Date To" value="" />
    204 
    205196                        </div>
    206197
    207198                        <div class="filter_block">
    208 
    209                             <label for="primer_order_client" style="float: left;"><?php _e('Client: ', 'primer'); ?></label>
    210                                 <select name="primer_order_client" id="primer_order_client" data-placeholder="<?php _e('Select clients', 'primer'); ?>">
     199                            <label for="primer_order_client" style="float: left;"><?php esc_html_e('Client: ', 'primer'); ?></label>
     200                                <select name="primer_order_client" id="primer_order_client" data-placeholder="<?php esc_html_e('Select clients', 'primer'); ?>">
    211201                                    <option value=""></option>
    212 
    213202                                    <?php
    214203                                    $get_customer = isset($_GET['primer_order_client']) ? sanitize_text_field($_GET['primer_order_client']) : '';
    215204                                    foreach ( $order_customers as $primer_orders_customer => $order_customer ) {
    216205                                        if ($order_customer['order_client_id']) { ?>
    217                                             <option value="<?php echo $order_customer['order_client_id']; ?>" <?php selected($get_customer, $order_customer['order_client_id']); ?>><?php echo $order_customer['order_client']; ?></option>
     206                                            <option value="<?php echo esc_attr($order_customer['order_client_id']); ?>" <?php selected($get_customer, $order_customer['order_client_id']); ?>><?php echo esc_attr($order_customer['order_client']); ?></option>
    218207                                        <?php } else { ?>
    219                                             <option value="<?php echo $order_customer['order_client_id']; ?>" <?php selected($get_customer, $order_customer['order_client_id']); ?>><?php _e('Guest client', 'primer'); ?></option>
     208                                            <option value="<?php echo esc_attr($order_customer['order_client_id']); ?>" <?php selected($get_customer, $order_customer['order_client_id']); ?>><?php esc_html_e('Guest client', 'primer'); ?></option>
    220209                                        <?php }
    221210                                    } ?>
    222 
    223211                                </select>
    224 
    225212                        </div>
    226 
    227213                    </div>
    228214
    229215                    <div class="right_wrap">
    230216                        <div class="filter_block">
    231 
    232                                     <label for="primer_order_status" style="float: left;"><?php _e('Order Status: ', 'primer'); ?></label>
    233                                     <select name="primer_order_status" title="<?php _e('Select order status', 'primer'); ?>" id="primer_order_status">
    234                                     <option selected disabled>Select order status</option>
    235 
     217                                    <label for="primer_order_status" style="float: left;"><?php esc_html_e('Order Status: ', 'primer'); ?></label>
     218                                    <select name="primer_order_status" title="<?php esc_html_e('Select order status', 'primer'); ?>" id="primer_order_status">
     219                                    <option selected disabled><?php esc_html_e('Select order status', 'primer'); ?></option>
    236220                                    <?php
    237221                                    $status_of_orders = wc_get_order_statuses();
    238222                                    $get_order_status = isset($_GET['primer_order_status']) ? sanitize_text_field($_GET['primer_order_status']) : '';
    239223                                    foreach ( $status_of_orders as $status_k => $status_value ) { ?>
    240                                         <option value="<?php echo $status_k; ?>" <?php
     224                                        <option value="<?php echo esc_attr($status_k); ?>" <?php
    241225                                             selected($status_k, $get_order_status);?>
    242                                              ><?php echo $status_value; ?></option>
     226                                             ><?php echo esc_attr($status_value); ?></option>
    243227                                    <?php }
    244228                                    ?>
    245 
    246229                                    </select>
    247 
    248230                        </div>
    249 
    250231                        <div class="filter_block">
    251 
    252                                 <label for="primer_receipt_status" style="float: left;"><?php _e('Receipt Status: ', 'primer'); ?></label>
     232                                <label for="primer_receipt_status" style="float: left;"><?php esc_html_e('Receipt Status: ', 'primer'); ?></label>
    253233                                <select name="primer_receipt_status" id="primer_receipt_status">
    254 
    255234                                <?php
    256235                                $get_status = isset($_GET['primer_receipt_status']) ? sanitize_text_field($_GET['primer_receipt_status']) : '';
    257236                                $status_of_receipts = array(
    258                                         '' => 'All',
     237                                        '' => __('All'),
    259238                                        'issued' => __('Issued', 'primer'),
    260                                         'not_issued' => __('Not Issued', 'primer')
     239                                        'not_issued' => __('Not Issued', 'primer'),
     240                                        'transmission_failure_check' => __('Transmission Failure', 'primer')
    261241                                    );
    262242                                foreach ( $status_of_receipts as $status_k => $status_value ) { ?>
    263                                         <option value="<?php echo $status_k; ?>" <?php selected($status_k, $get_status); ?>><?php echo $status_value; ?></option>
     243                                        <option value="<?php echo esc_attr($status_k); ?>" <?php selected($status_k, $get_status); ?>><?php echo esc_attr($status_value); ?></option>
    264244                                    <?php }
    265245                                ?>
    266 
    267246                                </select>
    268 
    269247                        </div>
    270 
    271                         <div class="apply_btn btn_order"><input type="submit" class="button" id="filter_action" name="filter_action" value="<?php _e('Apply filter', 'primer'); ?>" /></div>
     248                        <div class="apply_btn btn_order"><input type="submit" class="button" id="filter_action" name="filter_action" value="<?php esc_html_e('Apply filter', 'primer'); ?>" /></div>
    272249                    </div>
    273 
    274250                </div>
    275251
     
    279255            /// ??
    280256            if (!(in_array(3, $primer_licenses['wpModules']))) {
    281                 echo '<h4><i>'.__('Orders for invoices are not shown because license key does not support them', 'primer').'</i></h4>';
     257                echo '<h4><i>'. esc_html(__('Orders for invoices are not shown because license key does not support them', 'primer')) .'</i></h4>';
    282258            }
    283259            if (!(in_array(4, $primer_licenses['wpModules']))) {
    284                 echo '<h4><i>'.__('Orders for invoices-receipts within E.U or out E.U. are not shown because license key does not support them', 'primer').'</i></h4>';
     260                echo '<h4><i>'. esc_html(__('Orders for invoices-receipts within E.U or out E.U. are not shown because license key does not support them', 'primer')).'</i></h4>';
    285261            }
    286262             ?>
     
    452428
    453429    function no_items():void {
    454         _e('No orders found.', 'primer');
     430        esc_html_e('No orders found.', 'primer');
    455431    }
    456432
     
    488464        ?>
    489465        <div class="wrap primer-admin-menu-wrap">
    490             <div class="plugin_caption_version"><?php echo PRIMER_NAME . ' v'. PRIMER_VERSION; ?></div>
     466            <div class="plugin_caption_version"><?php echo esc_attr(PRIMER_NAME . ' v'. PRIMER_VERSION); ?></div>
    491467        <?php
    492468
    493469         if ($_GET['page'] === 'wp_ajax_list_order') { ?>
    494             <h2><?php _e('Orders', 'primer'); ?>
     470            <h2><?php esc_html_e('Orders', 'primer'); ?>
    495471            <?php
    496472            do_action('primer_menu_nav_tabs', $action); ?>
     
    524500                    break;
    525501            }
    526 
    527502            echo '</div>';
    528503    }
     
    808783                            $zip_file_name = $upload_dir . '/exported_html_files/'.$post_ids_str.'_html.zip';
    809784                            ob_start();
    810                             echo $primer_options->create_zip($files, $zip_file_name, $all_files . '/');
     785                            echo esc_url($primer_options->create_zip($files, $zip_file_name, $all_files . '/'));
    811786                            $create_zip = ob_get_clean();
    812787                            if ($create_zip == 'created') {
  • primer-mydata/trunk/includes/class-primer-smtp.php

    r3186553 r3205727  
    368368                    ?>
    369369                    <a href="<?php echo add_query_arg('do_not_show_again', '1'); ?>" style="margin-left: 10px;">
    370                         <?php _e('Do Not Show Again', 'primer'); ?>
     370                        <?php esc_html_e('Do Not Show Again', 'primer'); ?>
    371371                    </a>
    372372                    <?php
  • primer-mydata/trunk/includes/template-tags/primer-tags-display-modules.php

    r3187782 r3205727  
    8686                $issuer_container .= '<span class="issuer_name skin">' . __('ISSUER\'S COMPANY NAME', 'primer') . '</span>';
    8787            }
     88            if (!empty($primer_license_data['companySmallName'])) {
     89                if ($order_customer_country != 'GR' && !empty($primer_license_data['translated_company_small_name'])) {
     90                    $issuer_container .= '<p><span class="issuer_name skin">' . $primer_license_data['translated_company_small_name'] . '</span></p>';
     91                } else {
     92                    $issuer_container .= '<p><span class="issuer_name skin">' . $primer_license_data['companySmallName'] . '</span></p>';
     93                }
     94            }
    8895            if (!empty($primer_license_data['companyActivity'])) {
    8996                if ($order_customer_country != 'GR' && !empty($primer_license_data['translated_company_activity'])) {
     
    122129            } else {
    123130                $issuer_container .= '<span class="issuer_name skin">' . __('ISSUER\'S COMPANY NAME', 'primer') . '</span>';
     131            }
     132            if (!empty($primer_license_data['companySmallName'])) {
     133                if ($order_customer_country != 'GR' && !empty($primer_license_data['translated_company_small_name'])) {
     134                    $issuer_container .= '<p><span class="issuer_name skin">' . $primer_license_data['translated_company_small_name'] . '</span></p>';
     135                } else {
     136                    $issuer_container .= '<p><span class="issuer_name skin">' . $primer_license_data['companySmallName'] . '</span></p>';
     137                }
    124138            }
    125139            if (!empty($primer_license_data['companyActivity'])) {
     
    373387    $log_for_order     = get_post_meta($receipt_id, $is_credit_receipt ? 'credit_log_id_for_order' : 'log_id_for_order', true);
    374388    $json_send_to_api  = get_post_meta($log_for_order, 'json_send_to_api', true);
    375     $cleaned_json      = preg_replace(
    376         ['/\"name\":\s*\".*?\",/', '/,\"extra\":\s*\{[^}]*\},?/'],
    377         '',
    378         $json_send_to_api
    379     );
    380     $json_send_to_api = json_decode($cleaned_json, true);
    381 
     389    $json_send_to_api = json_decode($json_send_to_api, true);
    382390    $totals = $vat_values = $net_values = $vat_category = [];
    383 
    384391    foreach ($json_send_to_api['invoice'][0]['invoiceDetails'] as $product) {
    385392        $net_values[]   = $product['netValue'];
     
    600607    $log_for_order          = get_post_meta($receipt_id, $is_credit_receipt ? 'credit_log_id_for_order' : 'log_id_for_order', true);
    601608    $json_send_to_api       = get_post_meta($log_for_order, 'json_send_to_api', true);
    602     $cleaned_json           = preg_replace(
    603         ['/\"name\":\s*\".*?\",/', '/,\"extra\":\s*\{[^}]*\},?/'],
    604         '',
    605         $json_send_to_api
    606     );
    607     $json_receipt           = json_decode($cleaned_json, true);
     609    $json_receipt           = json_decode($json_send_to_api, true);
    608610    $totalNetValue          = number_format($json_receipt['invoice'][0]['invoiceSummary']['totalNetValue'], 2, '.', '');
    609611    $totalVatAmount         = number_format($json_receipt['invoice'][0]['invoiceSummary']['totalVatAmount'], 2, '.', '');
     
    739741        )
    740742    );
    741 
    742743    echo wp_kses($issuer_total, $allowed_html);
    743744}
     
    11651166        $count_product ++;
    11661167    }
    1167     $fee_total = 0;
    1168 
    11691168    if ($zero_order_total != 0) {
    11701169        foreach( $order->get_items('fee') as $item_id => $item_fee ){
    11711170            $fee_total = $item_fee->get_total();
    1172             $fee_total_tax = $item_fee->get_total_tax();
    1173             $fee_net_value = $fee_total-$fee_total_tax;
    1174             $fee_tax_rate = round($item_fee->get_total_tax() / $item_fee->get_total(), 2) * 100;
    1175         }
    1176     }
    1177 
    1178     if ($fee_total > 0) {
    1179         $count_product ++;
     1171            if ($fee_total > 0) {
     1172                $count_product ++;
     1173            }
     1174        }
    11801175    }
    11811176    if ($count_product > $per_page_product) {
  • primer-mydata/trunk/languages/primer-el.po

    r3187782 r3205727  
    22msgstr ""
    33"Project-Id-Version: Primer receipts\n"
    4 "POT-Creation-Date: 2024-11-13 11:58+0200\n"
    5 "PO-Revision-Date: 2024-11-13 11:59+0200\n"
     4"POT-Creation-Date: 2024-11-26 11:58+0200\n"
     5"PO-Revision-Date: 2024-11-26 12:04+0200\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    13 "X-Generator: Poedit 3.4.2\n"
     13"X-Generator: Poedit 3.5\n"
    1414"X-Poedit-Basepath: ..\n"
    1515"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
     
    281281msgstr "EMPTY"
    282282
    283 #: admin/includes/my_data_json.php:345 admin/includes/my_data_json.php:346
    284 #: admin/includes/my_data_json.php:347
     283#: admin/includes/my_data_json.php:347 admin/includes/my_data_json.php:348
     284#: admin/includes/my_data_json.php:349
    285285msgid "Only euro is accepted."
    286286msgstr "Μόνο το ευρώ γίνεται αποδεκτό."
    287287
    288 #: admin/includes/my_data_json.php:401 admin/includes/my_data_json.php:402
    289 #: admin/includes/my_data_json.php:403
     288#: admin/includes/my_data_json.php:403 admin/includes/my_data_json.php:404
     289#: admin/includes/my_data_json.php:405
    290290msgid ""
    291291"AADE does not accept zero value orders please enable \"Accept zero total "
     
    296296"θέλετε να εκδώσετε αυτήν την παραγγελία."
    297297
    298 #: admin/includes/my_data_json.php:478
     298#: admin/includes/my_data_json.php:492
    299299msgid "Standard rate"
    300300msgstr "Βασικός Συντελεστής"
    301301
    302 #: admin/includes/my_data_json.php:491 admin/includes/my_data_json.php:492
    303 #: admin/includes/my_data_json.php:494
     302#: admin/includes/my_data_json.php:505 admin/includes/my_data_json.php:506
     303#: admin/includes/my_data_json.php:508
    304304msgid ""
    305305"The order has 0% VAT included.The edition that you currently have does not "
     
    311311"μετατροπή ή μεταβείτε στο www.primer.gr/shop και επιλέξτε άλλη έκδοση."
    312312
    313 #: admin/includes/my_data_json.php:504 admin/includes/my_data_json.php:505
    314 #: admin/includes/my_data_json.php:507
     313#: admin/includes/my_data_json.php:518 admin/includes/my_data_json.php:519
     314#: admin/includes/my_data_json.php:521
    315315msgid ""
    316316"The order has 0% VAT included.Please go to MyData settings and configure a "
     
    322322"φόρου στην οποία συνδέεται το προϊόν."
    323323
    324 #: admin/includes/my_data_json.php:774 admin/includes/my_data_json.php:775
    325 #: admin/includes/my_data_json.php:777
     324#: admin/includes/my_data_json.php:531 admin/includes/my_data_json.php:532
     325#, php-format
     326msgid ""
     327"Error! Please enter a VAT exemption reason for the %s rate by going to the "
     328"MyData settings of the add-on"
     329msgstr ""
     330"Error! Please enter a VAT exemption reason for the %s rate by going to the "
     331"MyData settings of the add-on"
     332
     333#: admin/includes/my_data_json.php:534
     334msgid "Error!"
     335msgstr "Σφάλμα!"
     336
     337#: admin/includes/my_data_json.php:534
     338#, php-format
     339msgid ""
     340"Please enter a VAT exemption reason for the %s rate by going to the MyData "
     341"settings of the add-on."
     342msgstr ""
     343"Παρακαλώ εισάγετε αιτία εξαίρεσης Φ.Π.Α. για τον συντελεστη %s, πηγαίνοντας "
     344"στις ρυθμίσεις MyData του προσθέτου."
     345
     346#: admin/includes/my_data_json.php:803 admin/includes/my_data_json.php:804
     347#: admin/includes/my_data_json.php:806
    326348msgid ""
    327349"order could not be converted because product value sum is not equal with "
     
    336358"επιλέξετε μια άλλη έκδοση πρόσθετου MyData."
    337359
    338 #: admin/includes/my_data_json.php:1160 admin/includes/my_data_json.php:1162
     360#: admin/includes/my_data_json.php:1197 admin/includes/my_data_json.php:1199
    339361#: admin/includes/primer-admin-options.php:3497
    340362#: admin/includes/primer-admin-options.php:3499
    341 #: admin/includes/primer-admin-table.php:606
    342 #: admin/includes/primer-admin-table.php:608
    343 #: admin/includes/primer-admin-table.php:609 includes/class-primer-cron.php:214
     363#: admin/includes/primer-admin-table.php:607
     364#: admin/includes/primer-admin-table.php:609
     365#: admin/includes/primer-admin-table.php:610 includes/class-primer-cron.php:214
    344366#: includes/class-primer-cron.php:216 includes/class-primer-cron.php:217
    345367#: includes/class-primer-cron.php:805 includes/class-primer-cron.php:807
     
    352374"πάροχο hosting για να το ενεργοποιήσετε."
    353375
    354 #: admin/includes/my_data_json.php:1396
     376#: admin/includes/my_data_json.php:1433
    355377#: admin/includes/primer-admin-options.php:3368
    356378#: admin/includes/primer-admin-options.php:3840
    357379#: admin/includes/primer-admin-options.php:5261
    358 #: admin/includes/primer-admin-table.php:924 includes/class-primer-cron.php:537
    359 #: includes/class-primer-cron.php:1080 includes/class-primer-cron.php:1600
     380#: admin/includes/primer-admin-table.php:925 includes/class-primer-cron.php:552
     381#: includes/class-primer-cron.php:1094 includes/class-primer-cron.php:1617
    360382#: includes/class-primer-cron.php:2803
    361383msgid "Test email subject"
    362384msgstr "Δοκιμαστικό θέμα email"
    363385
    364 #: admin/includes/my_data_json.php:1418
     386#: admin/includes/my_data_json.php:1455
    365387#: admin/includes/primer-admin-options.php:3387
    366388#: admin/includes/primer-admin-options.php:3857
    367389#: admin/includes/primer-admin-options.php:5266
    368 #: admin/includes/primer-admin-table.php:941 includes/class-primer-cron.php:555
    369 #: includes/class-primer-cron.php:1098 includes/class-primer-cron.php:1619
     390#: admin/includes/primer-admin-table.php:942 includes/class-primer-cron.php:570
     391#: includes/class-primer-cron.php:1112 includes/class-primer-cron.php:1636
    370392msgid "Test email message"
    371393msgstr "Δοκιμαστικό μήνυμα email"
    372394
    373 #: admin/includes/my_data_json.php:1463 admin/includes/my_data_json.php:1480
     395#: admin/includes/my_data_json.php:1500 admin/includes/my_data_json.php:1517
    374396#: admin/includes/primer-admin-options.php:3881
    375397#: admin/includes/primer-admin-options.php:3884
    376398#: admin/includes/primer-admin-options.php:3901
    377 #: admin/includes/primer-admin-table.php:964
    378 #: admin/includes/primer-admin-table.php:967
    379 #: admin/includes/primer-admin-table.php:983 includes/class-primer-cron.php:599
     399#: admin/includes/primer-admin-table.php:965
     400#: admin/includes/primer-admin-table.php:968
     401#: admin/includes/primer-admin-table.php:984 includes/class-primer-cron.php:599
    380402#: includes/class-primer-cron.php:622 includes/class-primer-cron.php:1135
    381403#: includes/class-primer-cron.php:1152 includes/class-primer-cron.php:1658
     
    384406msgstr "Διαμορφώστε τα διαπιστευτήρια SMTP"
    385407
    386 #: admin/includes/my_data_json.php:1482
     408#: admin/includes/my_data_json.php:1519
    387409#: admin/includes/primer-admin-options.php:3903
    388 #: admin/includes/primer-admin-table.php:985 includes/class-primer-cron.php:624
     410#: admin/includes/primer-admin-table.php:986 includes/class-primer-cron.php:624
    389411#: includes/class-primer-cron.php:1154 includes/class-primer-cron.php:1679
    390412msgid "Send email automatically on order conversion disabled"
    391413msgstr "Αποστολή email αυτόματα σε κάθε μετατροπή  παραγγελίας"
    392414
    393 #: admin/includes/my_data_json.php:1495
     415#: admin/includes/my_data_json.php:1532
    394416#: admin/includes/primer-admin-options.php:3934
    395 #: admin/includes/primer-admin-table.php:1011
     417#: admin/includes/primer-admin-table.php:1012
    396418#: includes/class-primer-cron.php:649 includes/class-primer-cron.php:1163
    397419#: includes/class-primer-cron.php:1685
     
    399421msgstr "Επιτυχής έκδοση παραστατικού"
    400422
    401 #: admin/includes/my_data_json.php:1500 admin/includes/my_data_json.php:1512
     423#: admin/includes/my_data_json.php:1537 admin/includes/my_data_json.php:1549
    402424msgid "Something went wrong. Please try again!"
    403425msgstr "Κάτι πήγε στραβά. Παρακαλώ δοκιμάστε ξανά!"
     
    426448#: admin/includes/primer-admin-receipt-table.php:733
    427449#: admin/includes/primer-admin-table.php:21
    428 #: admin/includes/primer-admin-table.php:494
     450#: admin/includes/primer-admin-table.php:495
    429451msgid "Orders"
    430452msgstr "Παραγγελίες"
     
    15351557#: admin/includes/primer-admin-options.php:2421
    15361558#: admin/includes/primer-admin-table.php:233
     1559#: admin/includes/primer-admin-table.php:234
    15371560msgid "Select order status"
    15381561msgstr "Επιλέξτε κατάσταση παραγγελίας"
     
    15611584#: admin/includes/primer-admin-options.php:3593
    15621585#: admin/includes/primer-admin-options.php:3595
    1563 #: admin/includes/primer-admin-table.php:689
    15641586#: admin/includes/primer-admin-table.php:690
    1565 #: admin/includes/primer-admin-table.php:692 includes/class-primer-cron.php:326
     1587#: admin/includes/primer-admin-table.php:691
     1588#: admin/includes/primer-admin-table.php:693 includes/class-primer-cron.php:326
    15661589#: includes/class-primer-cron.php:327 includes/class-primer-cron.php:328
    15671590#: includes/class-primer-cron.php:1366 includes/class-primer-cron.php:1367
     
    15791602#: admin/includes/primer-admin-options.php:3606
    15801603#: admin/includes/primer-admin-options.php:3608
    1581 #: admin/includes/primer-admin-table.php:702
    15821604#: admin/includes/primer-admin-table.php:703
    1583 #: admin/includes/primer-admin-table.php:705 includes/class-primer-cron.php:338
     1605#: admin/includes/primer-admin-table.php:704
     1606#: admin/includes/primer-admin-table.php:706 includes/class-primer-cron.php:338
    15841607#: includes/class-primer-cron.php:339 includes/class-primer-cron.php:340
    15851608#: includes/class-primer-cron.php:883 includes/class-primer-cron.php:884
     
    15961619#: admin/includes/primer-admin-options.php:3915
    15971620#: admin/includes/primer-admin-options.php:3916
    1598 #: admin/includes/primer-admin-table.php:995
    1599 #: admin/includes/primer-admin-table.php:996 includes/class-primer-cron.php:634
     1621#: admin/includes/primer-admin-table.php:996
     1622#: admin/includes/primer-admin-table.php:997 includes/class-primer-cron.php:634
    16001623#: includes/class-primer-cron.php:635
    16011624msgid "Unable to connect Provider and AADE."
     
    16031626
    16041627#: admin/includes/primer-admin-options.php:3921
    1605 #: admin/includes/primer-admin-table.php:1000
     1628#: admin/includes/primer-admin-table.php:1001
    16061629#: includes/class-primer-cron.php:639
    16071630msgid "Unable to connect Entity and provider.."
     
    16091632
    16101633#: admin/includes/primer-admin-options.php:3922
    1611 #: admin/includes/primer-admin-table.php:1001
     1634#: admin/includes/primer-admin-table.php:1002
    16121635#: includes/class-primer-cron.php:640
    16131636msgid "Unable to connect Entity and provider."
     
    18071830#: admin/includes/primer-admin-receipt-log-table.php:85
    18081831#: admin/includes/primer-admin-receipt-table.php:307
    1809 #: admin/includes/primer-admin-table.php:271
     1832#: admin/includes/primer-admin-table.php:272
    18101833msgid "Apply filter"
    18111834msgstr "Εφαρμόστε φίλτρο"
     
    19191942
    19201943#: admin/includes/primer-admin-receipt-table.php:290
     1944#: admin/includes/primer-admin-table.php:258
    19211945msgid "All"
    1922 msgstr ""
     1946msgstr "Όλες"
    19231947
    19241948#: admin/includes/primer-admin-receipt-table.php:292
     
    19832007
    19842008#: admin/includes/primer-admin-table.php:260
    1985 #, fuzzy
    1986 #| msgid "Issued"
    19872009msgid "Not Issued"
    1988 msgstr "Εκδόθηκε"
    1989 
    1990 #: admin/includes/primer-admin-table.php:281
     2010msgstr "Δεν εκδόθηκε"
     2011
     2012#: admin/includes/primer-admin-table.php:261
     2013msgid "Transmission Failure"
     2014msgstr "Αδυναμία σύνδεσης"
     2015
     2016#: admin/includes/primer-admin-table.php:282
    19912017msgid ""
    19922018"Orders for invoices are not shown because license key does not support them"
     
    19952021"υποστηρίζει"
    19962022
    1997 #: admin/includes/primer-admin-table.php:284
     2023#: admin/includes/primer-admin-table.php:285
    19982024msgid ""
    19992025"Orders for invoices-receipts within E.U or out E.U. are not shown because "
     
    20032029"άδεια χρήσης δεν τις υποστηρίζει"
    20042030
    2005 #: admin/includes/primer-admin-table.php:454
     2031#: admin/includes/primer-admin-table.php:455
    20062032msgid "No orders found."
    20072033msgstr "Δεν βρέθηκαν παραγγελίες."
    20082034
    2009 #: admin/includes/primer-admin-table.php:613
     2035#: admin/includes/primer-admin-table.php:614
    20102036msgid "This order has already been issued. Please refresh the page."
    20112037msgstr ""
    20122038"Η ενέργεια απέτυχε. Παρακαλώ ανανεώστε την σελίδα και προσπαθήστε ξανά."
    20132039
    2014 #: admin/includes/primer-admin-table.php:615
    20152040#: admin/includes/primer-admin-table.php:616
     2041#: admin/includes/primer-admin-table.php:617
    20162042msgid "This order has already been issued by the automation. Press refresh."
    20172043msgstr ""
    20182044"Η παραγγελία αυτή έχει ήδη εκδοθεί από τον αυτοματισμό. Πατήστε ανανέωση."
    20192045
    2020 #: admin/includes/primer-admin-table.php:1218
     2046#: admin/includes/primer-admin-table.php:1219
    20212047msgid "Send JSON for order "
    20222048msgstr "Αποστολή JSON για την παραγγελια "
    20232049
    2024 #: admin/includes/primer-admin-table.php:1230
     2050#: admin/includes/primer-admin-table.php:1231
    20252051msgid "Send HTML JSON for order "
    20262052msgstr "Αποστολή HTML JSON για την παραγγελία "
  • primer-mydata/trunk/primer.php

    r3188823 r3205727  
    1818 * Plugin URI:        primer.gr/plugin/
    1919 * Description:       Issue receipts and invoices with woocommerce.
    20  * Version:           4.2.1
     20 * Version:           4.2.2
    2121 * Author:            Primer Software
    2222 * Author URI:        primer.gr
     
    3434 * Rename this for your plugin and update it as you release new versions.
    3535 */
    36 define( 'PRIMER_VERSION', '4.2.1');
     36define( 'PRIMER_VERSION', '4.2.2');
    3737define( 'PRIMER_NAME', 'Primer MyData' );
    3838
  • primer-mydata/trunk/public/partials/gr_invoicetemplate_defaultA4.php

    r3122050 r3205727  
     1<?php
     2if (!defined( 'ABSPATH')) {
     3    define( 'ABSPATH', $_SERVER['DOCUMENT_ROOT'] . '/');
     4    require_once ABSPATH . 'wp-load.php';
     5}
     6?>
    17<!DOCTYPE html>
    28<html>
    3 
    49<head lang="el">
    510    <title>template_default_A4</title>
     
    491496                                    <tr>
    492497                                        <?php
    493                                         $img_src = isset($_GET['img_src']) ? $_GET['img_src'] : '';
     498                                        $img_src = isset($_GET['img_src']) ? esc_url($_GET['img_src']) : '';
    494499                                        ?>
    495500                                        <td class="logo_container">
     
    497502                                            if (isset($_GET['primer_use_logo'])) {
    498503                                                if ($_GET['primer_use_logo'] == 'on') { ?>
    499                                                     <img src="<?php echo $img_src; ?>" alt=""  class="logo_img">
     504                                                    <img src="<?php echo esc_url($img_src); ?>" alt=""  class="logo_img">
    500505                                                <?php }
    501506                                            } ?>
    502507                                        </td>
    503 
    504508                                        <td class="issuer_container">
    505509                                            <span class="issuer_name skin">{ISSUER_NAME}</span>
    506510                                            <p> <span class="issuer_subjectField skin">{ISSUER_SUBJECTFIELD}</span></p>
    507511                                            <p><span class="issuer_address skin">{ISSUER_ADDRESS}</span></p>
    508 
    509512                                            <p> <span class="skin">ΑΦΜ: </span><span class="issuer_vat skin">{ISSUER_VAT}</span> <span class="skin">ΔΟΥ: </span> <span class="issuer_doy skin">{ISSUER_DOY}</span></p>
    510513                                            <p class="gemh_issuer_p skin"> <span class="skin">ΑΡ.ΓΕΜΗ: </span> <span class="issuer_gemh">{ISSUER_GEMH}</span></p>
     
    542545                                                    <span class="invoice_type">{INVOICE_TYPE}</span>
    543546                                                </td>
    544 
    545547                                                <td>
    546548                                                    <span class="invoice_number">{INVOICE_NUMBER}</span>
    547549                                                </td>
    548550                                                <td>
    549                                                     <span class="invoice_date"> {INVOICE_DATE}</span>
     551                                                    <span class="invoice_date">{INVOICE_DATE}</span>
    550552                                                </td>
    551553                                                <td>
    552                                                     <span class="invoice_time"> {INVOICE_TIME}</span>
     554                                                    <span class="invoice_time">{INVOICE_TIME}</span>
    553555                                                </td>
    554556                                            </tr>
     
    886888    </div>
    887889</body>
    888 
    889890</html>
  • primer-mydata/trunk/public/partials/invoicetemplate_defaultA4.php

    r3186553 r3205727  
     1<?php
     2if (!defined( 'ABSPATH')) {
     3    define( 'ABSPATH', $_SERVER['DOCUMENT_ROOT'] . '/');
     4    require_once ABSPATH . 'wp-load.php';
     5}
     6?>
    17<!DOCTYPE html>
    28<html>
     
    491497                                    <tr>
    492498                                        <?php
    493                                         $img_src = isset($_GET['img_src']) ? $_GET['img_src'] : '';
    494                                         ?>
     499                                        $img_src = isset($_GET['img_src']) ? esc_url($_GET['img_src']) : '';
     500                                        ?>
    495501                                        <td class="logo_container">
    496502                                            <?php
    497503                                            if (isset($_GET['primer_use_logo'])) {
    498504                                                if ($_GET['primer_use_logo'] == 'on') { ?>
    499                                                     <img src="<?php echo htmlspecialchars($img_src); ?>" alt=""  class="logo_img">
     505                                                    <img src="<?php echo esc_url($img_src); ?>" alt=""  class="logo_img">
    500506                                                <?php }
    501507                                            } ?>
  • primer-mydata/trunk/views/admin_order_list.php

    r3186553 r3205727  
    5050                <div class="submit convert_orders">
    5151                    <div class="send_receipts_wrap">
    52                         <a href="<?php echo admin_url('admin.php?page=primer_receipts_logs'); ?>" target="_blank" class="button"><?php _e('Log', 'primer'); ?></a>
     52                        <a href="<?php echo admin_url('admin.php?page=primer_receipts_logs'); ?>" target="_blank" class="button"><?php esc_html_e('Log', 'primer'); ?></a>
    5353                    </div>
    5454                    <input type="hidden" name="order_nonce" value="<?php echo wp_create_nonce('order_nonce'); ?>">
    5555                    <input type="hidden" name="action" value="convert_select_orders">
    56                     <input type="submit" class="submit_convert_orders" value="<?php _e('Issue Receipts for selected orders', 'primer'); ?>" disabled>
     56                    <input type="submit" class="submit_convert_orders" value="<?php esc_html_e('Issue Receipts for selected orders', 'primer'); ?>" disabled>
    5757                </div>
    5858            </form>
  • primer-mydata/trunk/views/admin_receipt_list.php

    r3186553 r3205727  
    1010
    1111        <div class="send_receipts_wrap">
    12             <a href="<?php echo admin_url('admin.php?page=primer_receipts_logs'); ?>" target="_blank" class="button"><?php _e('Log', 'primer'); ?></a>
     12            <a href="<?php echo admin_url('admin.php?page=primer_receipts_logs'); ?>" target="_blank" class="button"><?php esc_html_e('Log', 'primer'); ?></a>
    1313        </div>
    1414
    1515        <div class="send_receipts_wrap">
    16             <button type="button" class="cancel_receipt button button-secondary" disabled><?php _e('Cancel Invoice', 'primer'); ?></button>
     16            <button type="button" class="cancel_receipt button button-secondary" disabled><?php esc_html_e('Cancel Invoice', 'primer'); ?></button>
    1717        </div>
    1818
    1919        <div class="send_receipts_wrap">
    20             <button type="button" class="resend_receipt_to_customer button button-secondary" disabled><?php _e('Send to customer', 'primer'); ?></button>
     20            <button type="button" class="resend_receipt_to_customer button button-secondary" disabled><?php esc_html_e('Send to customer', 'primer'); ?></button>
    2121        </div>
    2222
    23         <a href="" class="button download-btn hide" download><?php _e('Download selected receipts', 'primer'); ?></a>
    24         <input type="submit" class="button" id="zip_load" value="<?php _e('Download selected receipts', 'primer'); ?>" disabled>
     23        <a href="" class="button download-btn hide" download><?php esc_html_e('Download selected receipts', 'primer'); ?></a>
     24        <input type="submit" class="button" id="zip_load" value="<?php esc_html_e('Download selected receipts', 'primer'); ?>" disabled>
    2525
    2626    </div>
  • primer-mydata/trunk/views/admin_receipt_log_automation_list.php

    r3186553 r3205727  
    4141                    ?>
    4242                    <input type="hidden" data-parent_order="<?php echo esc_attr($parent_post); ?>" value="<?php echo esc_attr($json_file); ?>">
    43                     <button type="button" name="download_json" id="primer-download-order-json" class="button-primary" style="margin-left: 10px;"><?php _e('Download JSON', 'primer'); ?></button>
     43                    <button type="button" name="download_json" id="primer-download-order-json" class="button-primary" style="margin-left: 10px;"><?php esc_html_e('Download JSON', 'primer'); ?></button>
    4444                <?php } ?>
    4545                <?php
    4646                if (!empty($html_request)) { ?>
    4747                    <input type="hidden" data-parent_order="<?php echo esc_attr($parent_post); ?>" value="<?php echo esc_attr($html_request); ?>">
    48                     <button type="button" name="download_html_json" id="primer-download-html-json" class="button-primary" style="margin-left: 10px;"><?php _e('Download HTML JSON', 'primer'); ?></button>
     48                    <button type="button" name="download_html_json" id="primer-download-html-json" class="button-primary" style="margin-left: 10px;"><?php esc_html_e('Download HTML JSON', 'primer'); ?></button>
    4949                    <?php if ($receipt_status == 'issued') { ?>
    50                         <a href="<?php echo esc_attr($file_name_link); ?>" class="button-primary download-btn " download><?php _e('Download HTML', 'primer'); ?></a>
     50                        <a href="<?php echo esc_attr($file_name_link); ?>" class="button-primary download-btn " download><?php esc_html_e('Download HTML', 'primer'); ?></a>
    5151                    <?php } ?>
    5252                <?php }
  • primer-mydata/trunk/views/admin_receipt_log_list.php

    r3186553 r3205727  
    4444                    ?>
    4545                    <input type="hidden" data-parent_order="<?php echo esc_attr($parent_post); ?>" value="<?php echo esc_attr($json_file); ?>">
    46                     <button type="button" name="download_json" id="primer-download-order-json" class="button-primary" style="margin-left: 10px;"><?php _e('Download JSON', 'primer'); ?></button>
     46                    <button type="button" name="download_json" id="primer-download-order-json" class="button-primary" style="margin-left: 10px;"><?php esc_html_e('Download JSON', 'primer'); ?></button>
    4747                <?php } ?>
    4848                <?php
    4949                    if (!empty($html_request)) { ?>
    5050                        <input type="hidden" data-parent_order="<?php echo esc_attr($parent_post); ?>" value="<?php echo esc_attr($html_request); ?>">
    51                         <button type="button" name="download_html_json" id="primer-download-html-json" class="button-primary" style="margin-left: 10px;"><?php _e('Download HTML JSON', 'primer'); ?></button>
     51                        <button type="button" name="download_html_json" id="primer-download-html-json" class="button-primary" style="margin-left: 10px;"><?php esc_html_e('Download HTML JSON', 'primer'); ?></button>
    5252                        <?php if ($receipt_status == 'issued') { ?>
    53                             <a href="<?php echo esc_attr($file_name_link); ?>" class="button-primary download-btn " download><?php _e('Download HTML', 'primer'); ?></a>
     53                            <a href="<?php echo esc_attr($file_name_link); ?>" class="button-primary download-btn " download><?php esc_html_e('Download HTML', 'primer'); ?></a>
    5454                    <?php }
    5555                    }
  • primer-mydata/trunk/views/get_order_list.php

    r3186553 r3205727  
    1616
    1717        $orders = wc_get_orders(array(
     18            'order'          => 'DESC',
    1819            'posts_per_page' => $posts_per_page,
    1920            'paged'          => $page_number,
    2021            'offset'         => ($page_number - 1) * $posts_per_page,
    21             'limit'          => 20
     22            'limit'          => 20,
     23            'post_type'      => array('shop_order', 'shop_subscription')
    2224        ));
    2325
     
    4446            $order_paid_date       = $order_date->format('F j, Y');
    4547            $order_paid_hour       = $order_date->format('H:i:s');
    46             $order_total_price     = $order->get_total();
    4748            $user                  = $order->get_user();
    4849            $user_full_name        = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
     
    5455            $exist_receipt_id      = get_order_from_receipt($id_of_order);
    5556            $exist_credit_id       = get_post_meta($id_of_order, 'cancelled', true);
     57            $order_total_price     = number_format($order->get_total() - ($order->get_total_refunded() ?: 0), 2, '.', '');
    5658
    5759            if (!empty($exist_credit_id)) {
     
    9496                'receipt_status'       => $receipt_status_from_meta_url,
    9597                'receipt_id'           => $exist_receipt_id ? $exist_receipt_id[0] : '',
    96                 'credit_receipt_id'    => $exist_credit_id ? $exist_credit_id[0] : ''
     98                'credit_receipt_id'    => $exist_credit_id ? $exist_credit_id[0] : '',
    9799            ];
    98100            $order_count++;
     
    140142
    141143        $order_args = array(
     144            'order'           => 'DESC',
    142145            'return'          => 'ids',
    143146            'limit'           => 20,
    144             'order'           => 'DESC',
    145147            'posts_per_page'  => $posts_per_page,
    146             'paged'           => $page_number
     148            'paged'           => $page_number,
     149            'type'            => array('shop_order', 'shop_subscription')
    147150        );
    148151
     
    173176        if (!empty($order_receipt_status)) {
    174177            sanitize_text_field($order_receipt_status);
    175             $order_args['meta_key']         = 'receipt_status';
    176             $order_args['meta_value']       = $order_receipt_status;
    177             $order_args_total['meta_key']   = 'receipt_status';
    178             $order_args_total['meta_value'] = $order_receipt_status;
     178            if ($order_receipt_status == 'issued' || $order_receipt_status == 'not_issued') {
     179                $order_args['meta_key']         = 'receipt_status';
     180                $order_args['meta_value']       = $order_receipt_status;
     181                $order_args_total['meta_key']   = 'receipt_status';
     182                $order_args_total['meta_value'] = $order_receipt_status;
     183            } elseif ($order_receipt_status == 'transmission_failure_check') {
     184                $order_args['meta_key']         = 'order_date_failed';
     185                //$order_args['meta_value']       = array(1, 3);
     186                $order_args_total['meta_key']   = 'order_date_failed';
     187               // $order_args_total['meta_value'] = array(1, 3);
     188            }
    179189        }
    180190
     
    223233            $exist_credit_id       = '';
    224234
     235            if ($order->get_total_refunded() > 0) {
     236                $order_total_price -= $order->get_total_refunded();
     237            }
    225238            if (!empty($exist_credit)) {
    226239                $credit_receipt_date = 'CANCELLED';
  • primer-mydata/trunk/views/get_receipt_list.php

    r3186553 r3205727  
    4545                }
    4646
     47                $json_send_to_api = get_post_meta($log_for_order, 'json_send_to_api', true);
     48                $json_decoded     = json_decode(preg_replace(['/\"name\":\s*\".*?\",/', '/,\"extra\":\s*\{[^}]*\},?/'], '', $json_send_to_api), true);
     49                $receipt_price    = number_format($json_decoded['invoice'][0]['invoiceSummary']['totalGrossValue'], 2, '.', '');
     50
    4751                $this->receipt_array[] = array(
    4852                    'receipt_id'           => $get_the_id,
     
    5054                    'receipt_hour'         => get_the_time('H:i:s'),
    5155                    'receipt_client'       => $invoice_client,
    52                     'receipt_price'        => get_post_meta($get_the_id, 'receipt_price', true),
     56                    'receipt_price'        => $receipt_price,
    5357                    'receipt_status'       => $receipt_status_text,
    5458                    'receipt_error_status' => $receipt_status_from_meta_url,
     
    209213            $is_cancelled_receipt = get_post_meta($receipt_id, 'cancelled', true);
    210214            $total_order          = wc_get_order($order_id);
    211             $user_full_name       = $total_order->get_billing_first_name() . ' ' . $total_order->get_billing_last_name();
     215            if(!empty($total_order)){
     216                $user_full_name       = $total_order->get_billing_first_name() . ' ' . $total_order->get_billing_last_name();
     217            } else {
     218                $user_full_name = '';
     219            }
    212220            $invoice_client       = $invoice_client ?: $user_full_name;
    213221            $receipt_status_text  = ($receipt_status === 'issued') ? 'Issued' : 'Not Issued';
Note: See TracChangeset for help on using the changeset viewer.