Plugin Directory

Changeset 2822848


Ignore:
Timestamp:
11/23/2022 12:07:54 PM (3 years ago)
Author:
primersoftware
Message:

Update

Location:
primer-mydata
Files:
2325 added
1 deleted
9 edited

Legend:

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

    r2821718 r2822848  
    55Tested up to: 6.1.1
    66Requires PHP: 7.4
    7 Stable tag: 2.0.5
     7Stable tag: 2.0.6
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    10 Text Domain: Primer-MyData-Woocommerse
     10Text Domain: Primer-MyData-Woocommerce
    1111
    1212Issue legal receipts automatically directly from your wordpress using MyData provider Services.
     
    7474== Changelog ==
    7575
    76 = 2.0.5 - 2022-11-21 =
    77 * Added a new feature that now you can change only for one time your company details for foreign invoice template
    78 * Added a new feature that now you can select how many invoices will be issued foreach run of automation
    79 * Minor Bug Fixes
    80 = 2.0.4 - 2022-11-10 =
    81 * Added new error messages for orders with deleted products and clients that cannot be issued
    82 * Added a new feature that now you can select how many products you want per page on the receipt to be shown
    83 * Minor Bug Fixes
    84 = 2.0.3 - 2022-11-06 =
    85 * Minus bug fixes
    86 = 2.0.2 - 2022-11-04 =
    87 * Minus bug fixes
    88 * New search box in orders page for search by order id
    89 = 2.0.1 - 2022-10-27 =
    90 * Fixed thousand-decimal separators in export-excel
    91 * Fixed minus sign for cancelled receipts in export-excel
    92 = 2.0.0 - 2022-09-23 =
    93 * Fixed Compatability with PHP 8.0 and PHP 8.1
    94 = 1.9.8 - 2022-09-23 =
    95 * Fixed issueing receipts automation bugs
    96 * Fixed search filters functionalities
    97 * Fixed Minor Bugs during issueing receipts
    98 = 1.9.5 - 2022-07-07 =
    99 * New feuture for mass searching Invoices through our website with a password in License and General Settings.
    100 * Informative Email when during automation when there is a major error
    101 * Fixed Minor Bugs during issueing receipts
    102 = 1.9.4 - 2022-06-21 =
    103 * Fixed Minor Bugs for automation cron
    104 * Added feauture to Export for showing vat amount per tax rate
    105 * Fixed Minor Bugs during issueing receipts
    106 = 1.9.3 - 2022-05-19 =
    107 * Added product metadata in the html product name
    108 * Fix for rounding issue with woocommerce orders
    109 * Fix for plugin to be compatible with php version 8.0 and above
    110 * Major Performace Fixes
    111 = 1.9.0 - 2022-04-12 =
    112 * Add Notes in Invoice comment section
    113 * Now you can export by dates and show totals in the last row
    114 * Major Performace Fixes
    115 = 1.7.7 - 2022-03-22 =
    116 * Minor Fixes
     76= 1.3.3 - 2022-01-31 =
     77* First version.
    11778= 1.7.6 - 2022-03-17 =
    11879* New Invoice types: Credit Invoices. Now you can cancel your invoice with a credit invoice-receipt.
     
    12384* Minor functionality fixes
    12485* Your customers can now see their invoices-receipts in my account page.
    125 = 1.3.3 - 2022-01-31 =
    126 * First version.
     86= 1.7.7 - 2022-03-22 =
     87* Minor Fixes
     88= 1.9.0 - 2022-04-12 =
     89* Major Performace Fixes
     90* Now you can export by dates and show totals in the last row
     91* Add Notes in Invoice comment section
     92= 1.9.3 - 2022-05-19 =
     93* Major Performace Fixes
     94* Fix for plugin to be compatible with php version 8.0 and above
     95* Fix for rounding issue with woocommerce orders
     96* Added product metadata in the html product name
     97= 1.9.4 - 2022-06-21 =
     98* Fixed Minor Bugs during issueing receipts
     99* Added feauture to Export for showing vat amount per tax rate
     100* Fixed Minor Bugs for automation cron
     101= 1.9.5 - 2022-07-07 =
     102* Fixed Minor Bugs during issueing receipts
     103* Informative Email when during automation when there is a major error
     104* New feuture for mass searching Invoices through our website with a password in License and General Settings.
     105= 1.9.8 - 2022-09-23 =
     106* Fixed Minor Bugs during issueing receipts
     107* Fixed search filters functionalities
     108* Fixed issueing receipts automation bugs
     109= 2.0.0 - 2022-09-23 =
     110* Fixed Compatability with PHP 8.0 and PHP 8.1
     111= 2.0.1 - 2022-10-27 =
     112* Fixed minus sign for cancelled receipts in export-excel
     113* Fixed thousand-decimal separators in export-excel
     114= 2.0.2 - 2022-11-04 =
     115* New search box in orders page for search by order id
     116* Minus bug fixes
     117= 2.0.3 - 2022-11-06 =
     118* Minus bug fixes
     119= 2.0.4 - 2022-11-10 =
     120* Minor Bug Fixes
     121* Added a new feature that now you can select how many products you want per page on the receipt to be shown
     122* Added new error messages for orders with deleted products and clients that cannot be issued
     123= 2.0.5 - 2022-11-21 =
     124* Minor Bug Fixes
     125* Added a new feature that now you can select how many invoices will be issued foreach run of automation
     126* Added a new feature that now you can change only for one time your company details for foreign invoice template
     127= 2.0.6 - 2022-11-23 =
     128* Minor Bug Fixes
  • primer-mydata/trunk/admin/class-primer-admin.php

    r2812297 r2822848  
    10111011            }
    10121012        }
    1013     }
    1014 
    1015 
    1016     /**
    1017      * Trigger notices for any issues with settings, etc.
    1018      *
    1019      * @since 1.0.0
    1020      */
    1021     public function settings_check() {
    1022         if ( ! method_exists( 'Primer_Admin_notices', 'add_notice' ) ) {
    1023             return;
    1024         }
    1025 
    1026         // 1) invalid_mydata_page check
    1027         if (is_admin()) {
    1028             if ( isset( $_POST['object_id'] ) && $_POST['object_id'] === 'primer_mydata' && isset( $_POST['standard_vat_rates'] ) ) {
    1029                 // true if we just hit save from the primer_mydata settings page
    1030                 // CMB2 will not have saved the value in time for this message to fire, so we'll grab it from $_POST:
    1031                 $standard_vat_rates = array( 'standard_vat_rates' => intval( sanitize_text_field( $_POST['standard_vat_rates'] ) ) );
    1032             } else {
    1033                 $standard_vat_rates = get_option( 'primer_mydata' );
    1034             }
    1035 
    1036         }
    1037 
    1038 
    10391013    }
    10401014
  • primer-mydata/trunk/admin/includes/primer-admin-options.php

    r2821718 r2822848  
    43314331
    43324332                        $last_curl_args = array(
    4333                             'timeout'       => 30,
     4333                            'timeout'       => 15,
    43344334                            'redirection'   => 10,
    43354335                            'method'        => 'POST',
     
    45004500                                    $args = array(
    45014501                                        'method'        => 'POST',
    4502                                         'timeout'       => 30,
    45034502                                        'headers'       => array(
    45044503                                            'Authorization' => 'Basic ' . base64_encode( $username.':'.$password ),
     
    48794878                                    $payload .= '--' . $boundary . '--';
    48804879                                    $args = array(
    4881                                         'timeout'   => 30,
     4880                                        'timeout'   => 10,
    48824881                                        'method'        => 'POST',
    48834882                                        'headers'       => array(
  • primer-mydata/trunk/admin/includes/primer-admin-table.php

    r2821718 r2822848  
    231231                                $status_of_orders = wc_get_order_statuses();
    232232                                $get_order_status = isset($_GET['primer_order_status']) ? sanitize_text_field($_GET['primer_order_status']) : '';
    233                                 //array_map( 'sanitize_text_field', $get_order_status );
    234                                 update_post_meta(1234,'aaa',$status_of_orders);
    235233
    236234                                foreach ( $status_of_orders as $status_k => $status_value ) { ?>
     
    575573    $mydata_options['running_conversion'] = 'yes';
    576574    update_option('primer_mydata', $mydata_options);
    577     $send_characterizations = $mydata_options['send_characterizations'];
    578575    $classificationType = '';
    579576    $classificationCategory = '';
     
    622619        $response_ret = wp_remote_post($item_url, $ret);
    623620        $ret_code = wp_remote_retrieve_response_code($response_ret);
    624         $ret_body = wp_remote_retrieve_body($response_ret);
    625 
    626621        if ( ! is_wp_error( $response_ret ) ) {
    627622            if ($ret_code !== 502) {
     
    661656    $invoiceType = '';
    662657    $post_ids = array();
    663     $order_ids = array();
    664658    $log_ids = array();
    665     $response_data = '';
    666     $receipt_log_value = '';
    667     $receipt_log_value_array = array();
    668659
    669660    $orders = isset($_GET['orders']) ? $_GET['orders'] : '';
     
    673664        $orders = $mydata_options['last_request'];
    674665    }
    675 
    676     $order_item_tax = array();
    677     $check_gr_tax = true;
    678 
    679666    if (!empty($orders)) {
    680667        $mydata_options['already_running_orders'] = count($orders) * 5;
     
    698685            }
    699686
    700             $order_ids[] = $id_of_order;
    701687            $order_country = $order->get_billing_country();
    702             $order_create_date = date( 'F j, Y', $order->get_date_created()->getOffsetTimestamp());
    703688            $order_paid_date = null;
    704             $order_paid_hour = null;
    705689            if (!empty($order->get_date_paid())) {
    706690                $order_paid_date = date( 'F j, Y', $order->get_date_paid()->getTimestamp());
    707                 $order_paid_hour = date( 'H:i:s', $order->get_date_paid()->getTimestamp());
    708691            } else {
    709692                $order_paid_date = date( 'F j, Y', $order->get_date_created()->getTimestamp());
    710                 $order_paid_hour = date( 'H:i:s', $order->get_date_created()->getTimestamp());
    711693            }
    712 
    713694            $order_total_price = $order->get_total();
    714695            $user_id   = $order->get_user_id();
    715             $user      = $order->get_user();
    716696            if(!empty($order->get_billing_first_name())){
    717697            $user_first_name = $order->get_billing_first_name();
     
    724704            }
    725705            $order_invoice_type = get_post_meta($id_of_order, '_billing_invoice_type', true);
    726             $vat_number = get_post_meta($id_of_order, '_billing_vat', true);
    727706            $insert_taxonomy = 'receipt_status';
    728707            $invoice_term = '';
     
    733712                $invoice_data['invoice'][0]['issuer']['branch'] = "0";
    734713            }
    735 
    736714            $number = 0;
    737715            $series_array = array();
     
    970948            ));
    971949            update_post_meta($receipt_log_id, 'receipt_log_order_id', $id_of_order);
    972 
    973950            if (!empty($receipt_log_id)) {
    974951                update_post_meta($id_of_order, 'log_id_for_order', $receipt_log_id);
     
    987964            $shipping_total = $order->get_shipping_total();
    988965            $shipping_tax   = $order->get_shipping_tax();
    989               //  if ($currency == 'EUR') {
    990966                        $invoice_data['invoice'][0]['invoiceHeader']['series'] = $serie;
    991967                        $invoice_data['invoice'][0]['invoiceHeader']['aa'] = $number;
     
    10251001                        }
    10261002                        $inside_tax_rate = '';
    1027                         $count_products = count($order->get_items());
    10281003                        $general_settings = get_option('primer_generals');
    10291004                        $zero_total_value = $order->get_total();
     
    12011176                                    $invoice_data['invoice'][0]['invoiceDetails'][$item_count]['vatExemptionCategory'] = $order_vat_exemption_category;
    12021177                                }
    1203                                 update_post_meta(2123,'fsdfsd', $order_vat_exemption_category);
    12041178                            } else{
    12051179                                $total_net_value += $subtotal_order_payment;
     
    14141388                                }
    14151389                                }else{
    1416                                 if($shipping_total > 0){
    1417                                     // $item_count++;
    1418                                 }
    14191390                                $total_net_value += $fee_total;
    14201391                                $vatCategory_fee = 7;
     
    14641435                            $invoice_data['invoice'][0]['paymentMethods']['paymentMethodDetails'][0]['amount'] = "$total";
    14651436                        }
    1466 
    1467                          $shipping_price = $order->get_shipping_total();
    1468                         //$total_receipt_price = $total - $shipping_price;
    14691437                        $subtotal = $total_net_value;
    14701438                        $subtotal = number_format((float)$subtotal, 2,'.','');
     
    16641632
    16651633            $last_curl_args = array(
    1666                 'timeout'       => 30,
     1634                'timeout'       => 15,
    16671635                'redirection'   => 10,
    16681636                'method'        => 'POST',
     
    18681836                            $args = array(
    18691837                                'method'        => 'POST',
    1870                                 'timeout'       => 30,
    18711838                                'headers'       => array(
    18721839                                    'Authorization' => 'Basic ' . base64_encode( $username.':'.$password ),
     
    19211888                                            $attachments = $upload_dir . '/email-invoices/'.$post_name.'.pdf';
    19221889                                            $post_issued = 'issued';
    1923                                         /*  if (empty($user_data)) {
    1924                                                 $post_issued = 'not_issued';
    1925                                                 $receipt_log_value .= __('Order Client name is required!', 'primer');
    1926                                             } */
    1927 
    19281890                                            update_post_meta($post_id, 'receipt_status', $post_issued);
    19291891                                            update_post_meta($id_of_order, 'receipt_status', $post_issued);
     
    20361998                                        $mydata_options['last_request_url'] = $url_slug;
    20371999                                        }
    2038                                 //$receipt_log_value_array[] = __('Conversion failed!Because AADE return null uid,auth code,mark.Please contact technical support.', 'primer');
    20392000                                break;
    20402001                            }
    2041 
    20422002                    }else{
    20432003                        $response_data .= '<div class="notice notice-error"><p>'. __("Something went wrong.The order has already html","primer") .'</p></div>';
     
    21262086
    21272087                                update_post_meta($post_id, 'order_id_to_receipt', $id_of_order);
    2128 
    21292088                                update_post_meta($id_of_order, 'order_id_from_receipt', $post_id);
    2130 
    21312089                                add_post_meta($post_id, 'receipt_client', $user_data);
    21322090                                add_post_meta($post_id, 'receipt_client_id', $user_id);
    21332091                                add_post_meta($post_id, 'receipt_price', $order_total_price . ' ' .$currency_symbol);
    2134 
    21352092                                update_post_meta( $post_id, '_primer_receipt_number', $number );
    21362093                                update_post_meta( $post_id, '_primer_receipt_series', $serie );
     
    21942151        update_option( 'primer_mydata', $mydata_options );
    21952152        //
    2196 
    21972153                                if (!empty($invoice_uid)) {
    21982154                                    update_post_meta($post_id, 'response_invoice_uid', $invoice_uid);
     
    22072163                                    update_post_meta($post_id, 'response_invoice_authcode', $invoice_authcode);
    22082164                                }
    2209 
    22102165                                $post_ids[] = $post_id;
    22112166                            }
    22122167
    2213                             $html_body_args = array();
    22142168                            $html_url = $url_slug . '/v2/invoice/html';
    22152169                            $html_post_fields= array();
     
    22252179                                $photo_id_arg = explode(':', $mydata_options['image_api_id']);
    22262180                                if (count($photo_id_arg) > 1) {
    2227                                     $response_key = $photo_id_arg[0];
    22282181                                    $response_value = $photo_id_arg[1];
    2229                                     $response_key = str_replace('"', '', $response_key);
    22302182                                    $response_value = str_replace('"', '', $response_value);
    22312183                                    $photo_id = ltrim($response_value);
     
    22422194                            $use_url_params = '?type_logo=id';
    22432195                            $generate_html_response = $primer_options->export_receipt_as_static_html_by_page_id($post_arr_id, $use_url_params);
    2244                             $zip_response = '';
    22452196                            $upload_dir = wp_upload_dir()['basedir'];
    2246                             $upload_url = wp_upload_dir()['baseurl'] . '/exported_html_files';
    2247 
    22482197                            if ($generate_html_response) {
    22492198                                $all_files = $upload_dir . '/exported_html_files/tmp_files';
     
    22572206                                    $primer_options->rmdir_recursive($upload_dir . '/exported_html_files/tmp_files');
    22582207                                }
    2259                                 $zip_response = ($create_zip == 'created') ? $upload_url . '/'.$post_ids_str.'_html.zip' : false;
    2260                             }
    2261                             if ($zip_response !== false) {
    2262                                 $html_body_args['invoiceFile'] = curl_file_create(WP_CONTENT_DIR . '/uploads/exported_html_files/'.$post_ids_str.'_html.zip', 'application/zip', $post_ids_str.'_html.zip');
    22632208                            }
    22642209                            if($mydata_options['primer_use_api_smtp'] == 'on'){
     
    22872232                            $payload .= '--' . $boundary . '--';
    22882233                            $args = array(
    2289                                     'timeout'   => 30,
     2234                                    'timeout'   => 10,
    22902235                                'method'        => 'POST',
    22912236                                'headers'       => array(
     
    22992244                        update_post_meta($id_of_order, 'html_body_post_fields', json_encode($html_post_fields));
    23002245                            $request_html = wp_remote_post($html_url,$args);
     2246                            if(!is_wp_error($request_html)){
    23012247                            $response_with_html = wp_remote_retrieve_body($request_html);
    23022248                            $info_html = wp_remote_retrieve_response_code($request_html);
     
    23372283                                                file_put_contents($upload_dir_file, $output);
    23382284                                            }
    2339 
    23402285                                    $attachments = $upload_dir . '/email-invoices/'.$post_name.'.pdf';
    23412286                                    $post_issued = 'issued';
    2342                                 /*  if (empty($user_data) || ($response_code == 512 || $code_position !== false)) {
    2343                                         $post_issued = 'not_issued';
    2344                                         $receipt_log_value .= __('Order Client name is required!', 'primer');
    2345                                     } */
    2346 
    23472287                                    update_post_meta($post_id, 'receipt_status', $post_issued);
    23482288                                    update_post_meta($id_of_order, 'receipt_status', $post_issued);
     
    23512291                                    add_post_meta($post_id, 'receipt_price', $order_total_price . ' ' .$currency_symbol);
    23522292                                    $primer_smtp_options = get_option('primer_emails');
    2353 
    2354                                     //$headers = 'From: ' . $primer_smtp_options['from_email_field'] ? $primer_smtp_options['from_email_field'] : 'Primer '. get_bloginfo('admin_email');
    23552293                                    if (!empty($primer_smtp_options['email_subject'])) {
    23562294                                        $primer_smtp_subject = $primer_smtp_options['email_subject'];
     
    23642302                                        $primer_smtp_message = __('Test email message', 'primer');
    23652303                                    }
    2366 
    23672304                                    $primer_automatically_send_file = $primer_smtp_options['automatically_send_on_conversation'];
    23682305                                    $primer_smtp_type = $primer_smtp_options['smtp_type'];
     
    23702307                                        $primer_automatically_send_file = 'yes';
    23712308                                    }
    2372 
    23732309                                    $order_log_id = get_post_meta($id_of_order, 'log_id_for_order', true);
    2374 
    23752310                                    if ($order_log_id) {
    23762311                                        update_post_meta($post_id, 'log_id_for_order', $order_log_id);
     
    23832318                                            $get_issue_status = 'issued';
    23842319                                        }
    2385 
    23862320                                        update_post_meta($order_log_id, 'receipt_log_status', $get_issue_status);
    23872321                                        update_post_meta($order_log_id, 'receipt_log_error', $receipt_log_value);
     
    24002334                                                $from_name_email = '';
    24012335                                            }
    2402                                         //$mailResultSMTP = $primer_smtp->primer_mail_sender($user_order_email, $from_name_email, $primer_smtp_subject, $primer_smtp_message, $attachments);
    24032336                                            if($primer_smtp_type == 'wordpress_default'){
    24042337                                                    $headers = array('Content-Type: text/html; charset=UTF-8');
     
    24672400                                break;
    24682401                            }
     2402                            } else {
     2403                            $receipt_log_value_array[] = __('HTML Response is empty', 'primer');
     2404                                $mydata_options['last_request'] = $orders;
     2405                                update_post_meta($id_of_order, 'receipt_status', 'not_issued');
     2406                                    update_post_meta($id_of_order, 'transmission_failure_check', 4);
     2407                                    if (!empty($url_slug)) {
     2408                                        $mydata_options['last_request_url'] = $url_slug;
     2409                                        }
     2410                                break;
     2411                            }
    24692412                        } else {
    24702413                            $mydata_options['last_request'] = $orders;
     
    25912534            $order_country = $order->get_billing_country();
    25922535            $order_create_date = date( 'F j, Y', $order->get_date_created()->getOffsetTimestamp());
    2593             $order_paid_date = null;
    2594             $order_paid_hour = null;
    2595             if (!empty($order->get_date_paid())) {
    2596                 $order_paid_date = date( 'F j, Y', $order->get_date_paid()->getTimestamp());
    2597                 $order_paid_hour = date( 'H:i:s', $order->get_date_paid()->getTimestamp());
    2598             } else {
    2599                 $order_paid_date = date( 'F j, Y', $order->get_date_created()->getTimestamp());
    2600                 $order_paid_hour = date( 'H:i:s', $order->get_date_created()->getTimestamp());
    2601             }
    2602 
    26032536            $currency      = $order->get_currency();
    26042537            $currency_symbol = get_woocommerce_currency_symbol( $currency );
     
    26152548            $user_order_email = $order->get_billing_email();
    26162549            $user_data = $user_full_name ? $user_full_name : 'Customer';
    2617             $order_ids[] = $id_of_order;
    26182550            $html_body_args = array();
    26192551            $html_url = $url . '/v2/invoice/html';
     
    26302562
    26312563            $last_curl_args = array(
    2632                 'timeout'       => 30,
     2564                'timeout'       => 15,
    26332565                'method' => 'POST',
    26342566                'httpversion'   => '1.1',
     
    27442676                                    $payload .= '--' . $boundary . '--';
    27452677                                    $args = array(
    2746                                             'timeout'   => 30,
     2678                                            'timeout'   => 10,
    27472679                                        'method'        => 'POST',
    27482680                                        'headers'       => array(
     
    30212953                                    $args = array(
    30222954                                        'method'        => 'POST',
    3023                                         'timeout'       => 30,
    30242955                                        'headers'       => array(
    30252956                                            'Authorization' => 'Basic ' . base64_encode( $username.':'.$password ),
  • primer-mydata/trunk/includes/class-primer-cron.php

    r2821718 r2822848  
    128128        global $wpdb, $woocommerce;
    129129        $log_ids = array();
    130         $LOG = '';
    131         $LOG .= "cron started " . "\n";
    132         $receipt_log_automation_value = '';
    133         $emails = array();
    134         $send_to_admin = '';
    135         $automation_duration = '';
    136 
    137130        // Get Notification Emails
    138131        $automation_options = get_option('primer_automation');
     
    237230            $log_ids = array();
    238231            $order_item_tax = array();
    239             $check_gr_tax = true;
    240232            $activation_automation = $automation_options['activation_automation'];
    241233            $limit_automation_orders = $automation_options['automation_limit'];
     
    251243
    252244                if (!empty($primer_conditions)) {
    253                     $automation_duration = $automation_options['automation_duration'];
    254245                    $condition_order_status = '';
    255246                    foreach ($primer_conditions as $primer_condition) {
     
    269260                        $orders = wc_get_orders($order_args);
    270261                        $orders = array_unique($orders);
    271                         $LOG .= "orders " . print_r($orders, 1) . "\n";
    272262                        $mydata_options['already_running_orders'] = count($orders) * 5;
    273263                        update_option('primer_mydata', $mydata_options);
     
    284274                            }
    285275                            $id_of_order = $order->get_id();
    286                             $order_ids[] = $id_of_order;
    287276                            $issued_order = get_post_meta($id_of_order, 'receipt_status', true);
    288277                            if ($issued_order != 'issued') {
    289                                 $LOG .= "issued_order $id_of_order " . print_r($issued_order, 1) . "\n";
     278                                $order_ids[] = strval($id_of_order);
    290279                                $check_timeout = get_post_meta($id_of_order, 'failed_48',true);
    291280                                $check_transmission_failure_48 = get_post_meta($id_of_order, 'transmission_failure_check',true);
    292281                                if(($mydata_options['timeout_check_48'] == 1 && $check_timeout != 'yes') || ($mydata_options['timeout_check_48'] == 1 && $check_transmission_failure_48 != 1)){
    293282                                    $receipt_log_value .= __('Could not connect to aade for 48 hours. Please check your settings or contact primer software.', 'primer');
    294                                     $response_data .= '<div class="notice notice-error"><p>'.__('Could not connect to aade for 48 hours. Please check your settings or contact primer software.', 'primer').'</p></div>';
    295283                                    $receipt_log_value_array[] = __('Could not connect to aade for 48 hours. Please check your settings or contact primer software.','primer');
    296284                                    break;
     
    299287                                $order_create_date = date('F j, Y', $order->get_date_created()->getOffsetTimestamp());
    300288                                $order_paid_date = null;
    301                                 $order_paid_hour = null;
    302289                                if ( ! empty( $order->get_date_paid() ) ) {
    303290                                    $order_paid_date = date( 'F j, Y', $order->get_date_paid()->getTimestamp() );
    304                                     $order_paid_hour = date( 'H:i:s', $order->get_date_paid()->getTimestamp() );
    305291                                } else {
    306292                                    $order_paid_date = date( 'F j, Y', $order->get_date_created()->getTimestamp() );
    307                                     $order_paid_hour = date( 'H:i:s', $order->get_date_created()->getTimestamp() );
    308293                                }
    309294                                $issue_date = new DateTime("now", new DateTimeZone("Europe/Athens"));
    310                                 $gr_time = $issue_date->format('Y-m-d');
    311                                 $order_paid_date = date('F j, Y', $order->get_date_created()->getTimestamp());
    312                                 $order_paid_hour = date('H:i:s', $order->get_date_created()->getTimestamp());
    313295                                $order_total_price = $order->get_total();
    314296                                $user_id = $order->get_user_id();
    315                                 $user = $order->get_user();
    316297                                if($order->get_billing_email() == null){
    317298                                    continue;
     
    326307                                    $user_full_name = 'RETAIL CLIENT';
    327308                                }
    328 
    329                                 foreach ($order->get_items() as $item_id => $item_data) {
    330                                     $product_id = $item_data->get_product_id();
    331                                     $product_instance = wc_get_product($product_id);
    332                                     $product_tax_class = $product_instance->get_tax_class();
    333                                     $taxes = WC_Tax::get_rates_for_tax_class($product_tax_class);
    334 
    335                                     $tax_arr = json_decode(json_encode($taxes), true);
    336                                     $inside_tax_rate = '';
    337                                     foreach ($tax_arr as $tax) {
    338                                         if ($product_tax_class == $tax['tax_rate_class']) {
    339                                             $inside_tax_rate = $tax['tax_rate'];
    340                                         }
    341                                     }
    342                                     if(is_int($inside_tax_rate) || is_float($inside_tax_rate)){
    343                                         $inside_tax_rate = round($inside_tax_rate);
    344                                     }
    345                                     $order_item_tax[] = $inside_tax_rate;
    346                                 }
    347 
    348309                                $order_invoice_type = get_post_meta($id_of_order, '_billing_invoice_type', true);
    349310                                $insert_taxonomy = 'receipt_status';
     
    351312
    352313                                $invoice_data['invoice'][0]['issuer']['vatNumber'] = "$user_vat";
    353 //                          $invoice_data['invoice'][0]['issuer']['vatNumber'] = "800434990";
    354314                                $invoice_data['invoice'][0]['issuer']['country'] = 'GR';
    355315                                if ($order_country == 'GR') {
     
    386346                                $licenses = get_option('primer_licenses');
    387347                                if(!$licenses['productKind'] || $licenses['productKind'] == 'other'){
    388                                     $response_data .= '<div class="notice notice-error"><p>'.__('Product Kind is not configured.PLease try re-activating your product.', 'primer').'</p></div>';
    389348                                    $receipt_log_value_array[] = __('Product Kind is not configured.PLease try re-activating your product.','primer');
    390349                                    break;
     
    599558
    600559                                $log_ids[] = $receipt_log_id;
    601 
    602                                 foreach ($order_item_tax as $item_of_tax) {
    603                                     if ($order_country == 'GR') {
    604 
    605                                         switch ($item_of_tax) {
    606                                             case '24':
    607                                             case '17':
    608                                             case '13':
    609                                             case '9':
    610                                             case '6':
    611                                             case '4':
    612                                                 $check_gr_tax = true;
    613                                                 break;
    614                                             default:
    615                                                 $check_gr_tax = false;
    616 
    617                                         }
    618                                     } else {
    619                                         $check_gr_tax = true;
    620                                     }
    621                                 }
    622 
    623560                                $total_tax = $order->get_total_tax();
    624561                                $get_coupon = $order->get_coupon_codes();
     
    626563                                    $receipt_log_value .= __('Order could not be converted because product value sum is not equal with total value. A coupon discount was used and your edition does not support payment fees. Please create a new order without coupon discount or go to www.primer.gr to select another MyData plugin version.', 'primer');
    627564                                    $receipt_log_value_array[] = __('Order could not be converted because product value sum is not equal with total value. A coupon discount was used and your edition does not support payment fees. Please create a new order without coupon discount or go to www.primer.gr to select another MyData plugin version.', 'primer');
    628                                     $response_data .= '<div class="notice notice-error"><p>' . __('Order could not be converted because product value sum is not equal with total value. A coupon discount was used and your edition does not support payment fees. Please create a new order without coupon discount or go to www.primer.gr to select another MyData plugin version.', 'primer') . '</p></div>';
    629565                                    continue;
    630566                                }
     
    701637                                                $receipt_log_value = 'The order has a deleted product and cannot be issued.';
    702638                                                $receipt_log_value_array[] = __('The order has a deleted product and cannot be issued.', 'primer');
    703                                                 $response_data .= '<div class="notice notice-error"><p>'.__('The order has a deleted product and cannot be issued.', 'primer').'</p></div>';
    704639                                                update_post_meta($receipt_log_id, 'receipt_log_error', $receipt_log_value);
    705640                                                break 2;
     
    811746                                                $receipt_log_value_array[] = __('The order has 0% VAT included.The edition that you currently have does not support zero vat orders.Please choose another order to convert or go to www.primer.gr/shop and choose another edition.', 'primer');
    812747                                                update_post_meta($receipt_log_id, 'receipt_log_error', $receipt_log_value);
    813                                                 $response_data .= '<div class="notice notice-error"><p>'.__('The order has 0% VAT included.The edition that you currently have does not support zero vat orders.Please choose another order to convert or go to www.primer.gr/shop and choose another edition.', 'primer').'</p></div>';
    814748                                                break 2;
    815749                                            }
     
    817751                                                $receipt_log_value_array[] = __('The order has 0% VAT included.Please go to MyData settings and configure a vat exemption category for the specific tax class that the product is attached to it.', 'primer');
    818752                                                update_post_meta($receipt_log_id, 'receipt_log_error', $receipt_log_value);
    819                                                 $response_data .= '<div class="notice notice-error"><p>'.__('The order has 0% VAT included.Please go to MyData settings and configure a vat exemption category for the specific tax class that the product is attached to it.', 'primer').'</p></div>';
    820753                                                break 2;
    821754                                            }
     
    918851                                                    $outside_vat = 'yes';
    919852                                            }
    920 
    921                                             $shipping_tax_total_tax = $shipping_tax;
    922853                                            $shipping_total = number_format((float)$shipping_total, 2,'.','');
    923854                                            $shipping_tax = number_format((float)$shipping_tax, 2,'.','');
     
    1058989                                                }
    1059990                                            }else{
    1060                                                 if($shipping_total > 0){
    1061                                                    // $item_count++;
    1062                                                 }
    1063991                                                $total_net_value += $fee_total;
    1064992                                                $vatCategory_fee = 7;
     
    13181246
    13191247                                        $last_curl_args = array(
    1320                                             'timeout'       => 30,
     1248                                            'timeout'       => 15,
    13211249                                            'redirection'   => 10,
    13221250                                            'method'        => 'POST',
     
    13351263                                            if ($last_info == '200') {
    13361264                                                $last_response_to_array = json_decode($last_response);
    1337                                                 $responseSerialNumber = $last_response_to_array[0]->jsonCode;
    13381265                                                $responseSent = $last_response_to_array[0]->sent;
    13391266                                                $responseUid = $last_response_to_array[0]->uid;
     
    14691396                                                        $photo_id_arg = explode(':', $mydata_options['image_api_id']);
    14701397                                                        if (count($photo_id_arg) > 1) {
    1471                                                             $response_key = $photo_id_arg[0];
    14721398                                                            $response_value = $photo_id_arg[1];
    1473                                                             $response_key = str_replace('"', '', $response_key);
    14741399                                                            $response_value = str_replace('"', '', $response_value);
    14751400                                                            $photo_id = ltrim($response_value);
     
    15391464                                                    $args = array(
    15401465                                                        'method'        => 'POST',
    1541                                                         'timeout'       => 30,
    15421466                                                        'headers'       => array(
    15431467                                                            'Authorization' => 'Basic ' . base64_encode( $username.':'.$password ),
     
    15721496                                                                $options->setIsRemoteEnabled(true);
    15731497                                                                $dompdf->setOptions($options);
    1574 
    15751498                                                                $dompdf->loadHtml($homepage);
    1576 
    15771499                                                                // Render the HTML as PDF
    15781500                                                                $dompdf->render();
    1579 
    15801501                                                                $upload_dir = wp_upload_dir()['basedir'];
    15811502
     
    15871508                                                                $post_name = str_replace('#', '', $post_name);
    15881509                                                                $post_name = strtolower($post_name);
    1589 
    15901510                                                                $output = $dompdf->output();
    15911511                                                                file_put_contents($upload_dir . '/email-invoices/' . $post_name . '.pdf', $output);
    1592 
    15931512                                                                $attachments = $upload_dir . '/email-invoices/' . $post_name . '.pdf';
    1594 
    15951513                                                                $post_issued = 'issued';
    1596                                                               /*  if (empty($user_data)) {
    1597                                                                     $post_issued = 'not_issued';
    1598                                                                     $receipt_log_value .= __('Order Client name is required!', 'primer');
    1599                                                                 } */
    1600 
    16011514                                                                update_post_meta($post_id, 'receipt_status', $post_issued);
    16021515                                                                update_post_meta($id_of_order, 'receipt_status', $post_issued);
     
    16041517                                                                add_post_meta($post_id, 'receipt_client_id', $user_id);
    16051518                                                                add_post_meta($post_id, 'receipt_price', $order_total_price . ' ' . $currency_symbol);
    1606 
    1607                                                                 $headers = 'From: ' . $primer_smtp_options['from_email_field'] ? $primer_smtp_options['from_email_field'] : 'Primer ' . get_bloginfo('admin_email');
    16081519                                                                if (!empty($primer_smtp_options['email_subject'])) {
    16091520                                                                    $primer_smtp_subject = $primer_smtp_options['email_subject'];
     
    16251536
    16261537                                                                $order_log_id = get_post_meta($id_of_order, 'log_id_for_order', true);
    1627 
    16281538                                                                if ($order_log_id) {
    1629 
    16301539                                                                    update_post_meta($post_id, 'log_id_for_order', $order_log_id);
    1631 
    16321540                                                                    $invoice_date = get_the_date('F j, Y', $post_id);
    1633 
    16341541                                                                    update_post_meta($order_log_id, 'receipt_log_invoice_id', $post_id);
    16351542                                                                    update_post_meta($order_log_id, 'receipt_log_invoice_date', $invoice_date);
     
    16391546                                                                        $get_issue_status = 'issued';
    16401547                                                                    }
    1641 
    16421548                                                                    update_post_meta($order_log_id, 'receipt_log_status', $get_issue_status);
    16431549                                                                    update_post_meta($order_log_id, 'receipt_log_error', $receipt_log_value);
    16441550                                                                }
    1645 
    16461551                                                                $email_logs = '';
    16471552
    16481553                                                                if (!empty($primer_automatically_send_file) && $primer_automatically_send_file === 'yes') {
    16491554
    1650                                                                     $mailResult = false;
    16511555                                                                    if (!empty($primer_smtp_options['email_from_name'])) {
    16521556                                                                        $from_name_email = $primer_smtp_options['email_from_name'];
     
    16541558                                                                        $from_name_email = '';
    16551559                                                                    }
    1656                                                                    // $mailResultSMTP = $primer_smtp->primer_mail_sender($user_order_email, $from_name_email, $primer_smtp_subject, $primer_smtp_message, $attachments);
    16571560                                                                    if($primer_smtp_type == 'wordpress_default'){
    16581561                                                                        $headers = array('Content-Type: text/html; charset=UTF-8');
     
    16901593                                                            $response_data = '<div class="notice notice-success"><p>' . __('Orders converted', 'primer') . '</p></div>';
    16911594                                                        } else {
    1692                                                             $mydata_options['last_request'] = $orders;
     1595                                                            $mydata_options['last_request'] = $order_ids;
    16931596                                                            update_option('primer_mydata', $mydata_options);
    16941597                                                            update_post_meta($id_of_order, 'receipt_status', 'not_issued');
     
    17001603                                                        $response_data .= '<div class="notice notice-error"><p>' . __('Conversion failed! Because AADE return null uid,auth code,mark.Please contact technical support.', 'primer') . '</p></div>';
    17011604                                                        $receipt_log_value_array[] = __('HTML Response is empty', 'primer');
    1702                                                         $mydata_options['last_request'] = $orders;
     1605                                                        $mydata_options['last_request'] = $order_ids;
    17031606                                                        update_post_meta($id_of_order, 'receipt_status', 'not_issued');
    17041607                                                        update_post_meta($id_of_order, 'transmission_failure_check', 4);
     
    17971700                                                        update_post_meta($post_id, 'order_id_to_receipt', $id_of_order);
    17981701                                                        update_post_meta($id_of_order, 'order_id_from_receipt', $post_id);
    1799 
    18001702                                                        add_post_meta($post_id, 'receipt_client', $user_data);
    18011703                                                        add_post_meta($post_id, 'receipt_client_id', $user_id);
    18021704                                                        add_post_meta($post_id, 'receipt_price', $order_total_price . ' ' . $currency_symbol);
    1803 
    18041705                                                        update_post_meta($post_id, '_primer_receipt_number', $number);
    18051706                                                        update_post_meta($post_id, '_primer_receipt_series', $serie);
     
    18761777                                                        $post_ids[] = $post_id;
    18771778                                                    }
    1878 
    1879                                                     $html_body_args = array();
    18801779                                                    $html_url = $url_slug . '/v2/invoice/html';
    1881                                                     $html_post_fields= array();
     1780                                                    $html_post_fields = array();
    18821781                                                    if ($invoice_mark !== null) {
    18831782                                                        $html_post_fields['mark'] = $invoice_mark;
     
    18861785                                                    $html_post_fields['type'] = 'ZIP';
    18871786                                                    $photo_id = '';
    1888 
    18891787                                                    $use_upload_logo = $mydata_options['primer_use_logo'] ? $mydata_options['primer_use_logo'] : '';
    18901788
     
    18921790                                                        $photo_id_arg = explode(':', $mydata_options['image_api_id']);
    18931791                                                        if (count($photo_id_arg) > 1) {
    1894                                                             $response_key = $photo_id_arg[0];
    18951792                                                            $response_value = $photo_id_arg[1];
    1896                                                             $response_key = str_replace('"', '', $response_key);
    18971793                                                            $response_value = str_replace('"', '', $response_value);
    18981794                                                            $photo_id = ltrim($response_value);
     
    19021798
    19031799                                                    $primer_options = new Primer_Options();
    1904 
    19051800                                                    $post_ids_str = '';
    19061801                                                    if (!empty($post_id)) {
    19071802                                                        $post_ids_str = $total_vat_number . $invoice_mark;
    19081803                                                    }
    1909 
    19101804                                                    $post_arr_id = explode(" ", $post_id);
    19111805                                                    $use_url_params = '?type_logo=id';
     
    19261820                                                            $primer_options->rmdir_recursive($upload_dir . '/exported_html_files/tmp_files');
    19271821                                                        }
    1928 
    1929                                                         $zip_response = ($create_zip == 'created') ? $upload_url . '/' . $post_ids_str . '_html.zip' : false;
    1930 
    1931                                                     }
    1932 
    1933                                                     if ($zip_response !== false) {
    1934                                                         $html_body_args['invoiceFile'] = curl_file_create(WP_CONTENT_DIR . '/uploads/exported_html_files/' . $post_ids_str . '_html.zip', 'application/zip', $post_ids_str . '_html.zip');
    19351822                                                    }
    19361823                                                    if ($mydata_options['primer_use_api_smtp'] == 'on') {
     
    19381825                                                        $html_post_fields['email'] = $user_order_email;
    19391826                                                    }
    1940                                                     update_post_meta($id_of_order, 'html_body_post_fields', json_encode($html_body_args));
    19411827                                                    $upload_dir = wp_upload_dir()['basedir'];
    1942                                                     $file_path = $upload_dir.'/exported_html_files/'.$post_ids_str.'_html.zip';
     1828                                                    $file_path = $upload_dir . '/exported_html_files/' . $post_ids_str . '_html.zip';
    19431829                                                    $boundary = '2fJWy9lO6qM^tq4tH3I8rP$V';
    19441830                                                    $payload = '';
    1945                                                     foreach ( $html_post_fields as $name => $value ) {
     1831                                                    foreach ($html_post_fields as $name => $value) {
    19461832                                                        $payload .= '--' . $boundary;
    19471833                                                        $payload .= "\r\n";
     
    19501836                                                        $payload .= "\r\n";
    19511837                                                    }
    1952                                                     if ( $file_path ) {
     1838                                                    if ($file_path) {
    19531839                                                        $payload .= '--' . $boundary;
    19541840                                                        $payload .= "\r\n";
    1955                                                         $payload .= 'Content-Disposition: form-data; name="invoiceFile"; filename="' . basename( $file_path ) . '"' . "\r\n";
     1841                                                        $payload .= 'Content-Disposition: form-data; name="invoiceFile"; filename="' . basename($file_path) . '"' . "\r\n";
    19561842                                                        $payload .= "\r\n";
    1957                                                         $payload .= file_get_contents( $file_path );
     1843                                                        $payload .= file_get_contents($file_path);
    19581844                                                        $payload .= "\r\n";
    19591845                                                    }
    19601846                                                    $payload .= '--' . $boundary . '--';
    19611847                                                    $args = array(
    1962                                                         'method'        => 'POST',
    1963                                                         'timeout'       => 30,
    1964                                                         'headers'       => array(
    1965                                                             'Authorization' => 'Basic ' . base64_encode( $username.':'.$password ),
     1848                                                        'method' => 'POST',
     1849                                                        'headers' => array(
     1850                                                            'Authorization' => 'Basic ' . base64_encode($username . ':' . $password),
    19661851                                                            'Content-Type' => 'multipart/form-data; boundary=' . $boundary,
    1967                                                             'User-Agent'=> 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:96.0) Gecko/20100101 Firefox/96.0'
     1852                                                            'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:96.0) Gecko/20100101 Firefox/96.0'
    19681853                                                        ),
    1969                                                         'sslverify'     => false,
     1854                                                        'sslverify' => false,
    19701855                                                        'body' => $payload
    19711856                                                    );
    19721857                                                    update_post_meta($id_of_order, 'html_body_post_fields', json_encode($html_post_fields));
    1973                                                     $request_html = wp_remote_post($html_url,$args);
     1858                                                    $request_html = wp_remote_post($html_url, $args);
     1859                                                    if(!is_wp_error($request_html)){
    19741860                                                    $response_with_html = wp_remote_retrieve_body($request_html);
    19751861                                                    $info_html = wp_remote_retrieve_response_code($request_html);
    1976                                                     if (!empty($info_html) && !is_wp_error($request_html)) {
     1862                                                    if (!empty($info_html)) {
    19771863                                                        if ($info_html == '200' || ($response_code == 512 || $code_position !== false) || ($response_code == 512 && $info_html == 400)) {
    19781864                                                            $post_url = get_the_permalink($post_id);
     
    19841870                                                                ),
    19851871                                                            );
    1986 
    19871872                                                            $homepage = file_get_contents($post_url, false, stream_context_create($arrContextOptions));
    19881873                                                            // instantiate and use the dompdf class
     
    19931878                                                            $dompdf->setOptions($options);
    19941879                                                            $dompdf->loadHtml($homepage);
    1995 
    19961880                                                            // Render the HTML as PDF
    19971881                                                            $dompdf->render();
    1998 
    19991882                                                            $upload_dir = wp_upload_dir()['basedir'];
    20001883
     
    20061889                                                            $post_name = str_replace('#', '', $post_name);
    20071890                                                            $post_name = strtolower($post_name);
    2008 
    20091891                                                            $output = $dompdf->output();
    20101892                                                            file_put_contents($upload_dir . '/email-invoices/' . $post_name . '.pdf', $output);
    2011 
    20121893                                                            $attachments = $upload_dir . '/email-invoices/' . $post_name . '.pdf';
    2013 
    2014 
    20151894                                                            $post_issued = 'issued';
    2016                                                           /*  if (empty($user_data) || ($response_code == 512 || $code_position !== false)) {
    2017                                                                 $post_issued = 'not_issued';
    2018                                                                 $receipt_log_value .= __('Order Client name is required!', 'primer');
    2019                                                             } */
    2020 
    20211895                                                            update_post_meta($post_id, 'receipt_status', $post_issued);
    20221896                                                            update_post_meta($id_of_order, 'receipt_status', $post_issued);
     
    20241898                                                            add_post_meta($post_id, 'receipt_client_id', $user_id);
    20251899                                                            add_post_meta($post_id, 'receipt_price', $order_total_price . ' ' . $currency_symbol);
    2026 
    20271900                                                            $primer_smtp_options = get_option('primer_emails');
    20281901
    2029                                                             $headers = 'From: ' . $primer_smtp_options['from_email_field'] ? $primer_smtp_options['from_email_field'] : 'Primer ' . get_bloginfo('admin_email');
    20301902                                                            if (!empty($primer_smtp_options['email_subject'])) {
    20311903                                                                $primer_smtp_subject = $primer_smtp_options['email_subject'];
     
    20451917                                                                $primer_automatically_send_file = 'yes';
    20461918                                                            }
    2047 
    20481919                                                            $order_log_id = get_post_meta($id_of_order, 'log_id_for_order', true);
    2049 
    20501920                                                            if ($order_log_id) {
    2051 
    20521921                                                                update_post_meta($post_id, 'log_id_for_order', $order_log_id);
    2053 
    20541922                                                                $invoice_date = get_the_date('F j, Y', $post_id);
    2055 
    20561923                                                                update_post_meta($order_log_id, 'receipt_log_invoice_id', $post_id);
    20571924                                                                update_post_meta($order_log_id, 'receipt_log_invoice_date', $invoice_date);
     
    20621929                                                                    $get_issue_status = 'issued';
    20631930                                                                }
    2064 
    20651931                                                                update_post_meta($order_log_id, 'receipt_log_status', $get_issue_status);
    20661932                                                                update_post_meta($order_log_id, 'receipt_log_error', $receipt_log_value);
     
    20681934
    20691935                                                            $email_logs = '';
    2070 
    20711936                                                            if (!empty($primer_automatically_send_file) && $primer_automatically_send_file === 'yes') {
    2072 
    2073                                                                 $mailResult = false;
    20741937                                                                $primer_smtp = PrimerSMTP::get_instance();
    20751938                                                                if (!empty($primer_smtp_options['email_from_name'])) {
     
    20781941                                                                    $from_name_email = '';
    20791942                                                                }
    2080                                                                 //$mailResultSMTP = $primer_smtp->primer_mail_sender($user_order_email, $from_name_email, $primer_smtp_subject, $primer_smtp_message, $attachments);
    2081                                                                 if($primer_smtp_type == 'wordpress_default'){
     1943                                                                if ($primer_smtp_type == 'wordpress_default') {
    20821944                                                                    $headers = array('Content-Type: text/html; charset=UTF-8');
    2083                                                                     $mailResultSMTP = wp_mail($user_order_email,$primer_smtp_subject,$primer_smtp_message,$headers,$attachments);
    2084                                                                 }else{
    2085                                                                     $mailResultSMTP = $primer_smtp->primer_mail_sender($user_order_email,$from_name_email, $primer_smtp_subject, $primer_smtp_message, $attachments);
     1945                                                                    $mailResultSMTP = wp_mail($user_order_email, $primer_smtp_subject, $primer_smtp_message, $headers, $attachments);
     1946                                                                } else {
     1947                                                                    $mailResultSMTP = $primer_smtp->primer_mail_sender($user_order_email, $from_name_email, $primer_smtp_subject, $primer_smtp_message, $attachments);
    20861948                                                                }
    20871949                                                                if (!$primer_smtp->credentials_configured() && $primer_smtp_type != 'wordpress_default') {
     
    20891951                                                                }
    20901952
    2091                                                                 if (!empty($mailResultSMTP['error']) && (! $primer_smtp->credentials_configured() && $primer_smtp_type != 'wordpress_default')) {
    2092                                                                     $response_data .= '<div class="notice notice-error"><p>' . $GLOBALS['phpmailer']->ErrorInfo . '</p></div>';
     1953                                                                if (!empty($mailResultSMTP['error']) && (!$primer_smtp->credentials_configured() && $primer_smtp_type != 'wordpress_default')) {
    20931954                                                                    update_post_meta($order_log_id, 'receipt_log_automation_email', 'not_sent');
    20941955                                                                    $email_logs .= $GLOBALS['phpmailer']->ErrorInfo . "\n";
     
    21151976                                                                update_post_meta($id_of_order, 'transmission_failure_check', 2);
    21161977                                                                $mydata_options['timeout_check_48'] = 0;
    2117                                                                 update_post_meta($id_of_order, 'failed_48','no');
     1978                                                                update_post_meta($id_of_order, 'failed_48', 'no');
    21181979                                                            }
    21191980
    21201981                                                            $response_data = '<div class="notice notice-success"><p>' . __("Orders converted", "primer") . '</p></div>';
    21211982                                                        } else {
    2122                                                             $mydata_options['last_request'] = $orders;
     1983                                                            $mydata_options['last_request'] = $order_ids;
    21231984                                                            update_post_meta($id_of_order, 'receipt_status', 'not_issued');
    21241985                                                            update_post_meta($id_of_order, 'transmission_failure_check', 4);
     
    21301991                                                            update_post_meta($id_of_order, 'html_body_post_fields_save', 'save');
    21311992                                                            $receipt_log_value_array[] = $response_with_html;
    2132                                                             $response_data .= '<div class="notice notice-error is-dismissible"> <p><strong>' . $response_with_html . '</strong></p></div>';
    21331993                                                            break;
    21341994                                                        }
    21351995                                                    } else {
    2136                                                         $mydata_options['last_request'] = $orders;
     1996                                                        $mydata_options['last_request'] = $order_ids;
    21371997                                                        update_post_meta($id_of_order, 'receipt_status', 'not_issued');
    21381998                                                        update_post_meta($id_of_order, 'transmission_failure_check', 4);
     
    21402000                                                            $mydata_options['last_request_url'] = $url_slug;
    21412001                                                        }
     2002                                                        update_option('primer_mydata', $mydata_options);
    21422003                                                        $receipt_log_value_array[] = __('HTML Response is empty', 'primer');
    21432004                                                        break;
    21442005                                                    }
    21452006                                                } else {
    2146                                                     $mydata_options['last_request'] = $orders;
     2007                                                    $mydata_options['last_request'] = $order_ids;
     2008                                                    update_post_meta($id_of_order, 'receipt_status', 'not_issued');
     2009                                                    update_post_meta($id_of_order, 'transmission_failure_check', 4);
     2010                                                    if (!empty($url_slug)) {
     2011                                                        $mydata_options['last_request_url'] = $url_slug;
     2012                                                    }
     2013                                                    update_option('primer_mydata', $mydata_options);
     2014                                                    $receipt_log_value_array[] = $request_html->get_error_message();
     2015                                                    break;
     2016                                                }
     2017                                                } else {
     2018                                                    $mydata_options['last_request'] = $order_ids;
    21472019                                                    if (!empty($url_slug)) {
    21482020                                                        $mydata_options['last_request_url'] = $url_slug;
     
    21552027                                            }
    21562028                                        } else {
    2157                                             $receipt_log_value .= __('API not sent.', 'primer');
    21582029                                            $receipt_log_value_array[] = __('API not sent.', 'primer');
    21592030                                            update_post_meta($receipt_log_id, 'receipt_log_automation_error', $receipt_log_value_array);
    2160                                             $response_data .= '<div class="notice notice-error"><p>' . __('API not sent.', 'primer') . '</p></div>';
    21612031                                        }
    21622032                                    } else {
    2163                                         $receipt_log_value .= __('API not sent.', 'primer');
    21642033                                        $receipt_log_value_array[] = __('API not sent.', 'primer');
    21652034                                        update_post_meta($receipt_log_id, 'receipt_log_error', $receipt_log_value_array);
    2166                                         $response_data .= '<div class="notice notice-error"><p>' . __('API not sent.', 'primer') . '</p></div>';
    21672035                                    }
    21682036                                    if (!empty($receipt_log_value_array)) {
     
    21942062                    }
    21952063
    2196                     $LOG .= "primer_send_success_log " . print_r($primer_send_success_log, 1) . "\n";
    2197                     $LOG .= "primer_send_fail_log " . print_r($primer_send_fail_log, 1) . "\n";
    2198                     $LOG .= "log_ids  " . print_r($log_ids, 1) . "\n";
    2199 
    22002064                    $this->export_csv_log($log_ids, $primer_send_success_log, $primer_send_fail_log);
    22012065
    22022066                }
    2203 
    2204                 $f = fopen(__DIR__ . '/res.txt', 'w+');
    2205                 fputs($f, print_r($LOG, 1) . "\n");
    2206                 fclose($f);
    2207 
    22082067            }
    22092068            }
     
    32993158                                        $photo_id_arg = explode(':', $mydata_options['image_api_id']);
    33003159                                        if (count($photo_id_arg) > 1) {
    3301                                             $response_key = $photo_id_arg[0];
    33023160                                            $response_value = $photo_id_arg[1];
    3303                                             $response_key = str_replace('"', '', $response_key);
    33043161                                            $response_value = str_replace('"', '', $response_value);
    33053162                                            $photo_id = ltrim($response_value);
     
    33663223                                    $args = array(
    33673224                                        'method'        => 'POST',
    3368                                         'timeout'       => 30,
    33693225                                        'headers'       => array(
    33703226                                            'Authorization' => 'Basic ' . base64_encode( $username.':'.$password ),
     
    34663322
    34673323                                            if (!empty($primer_automatically_send_file) && $primer_automatically_send_file === 'yes') {
    3468                                                 $mailResult = false;
    34693324                                                $primer_smtp = PrimerSMTP::get_instance();
    34703325                                                if (!empty($primer_smtp_options['email_from_name'])) {
     
    34733328                                                    $from_name_email = '';
    34743329                                                }
    3475                                                // $mailResultSMTP = $primer_smtp->primer_mail_sender($user_order_email, $from_name_email, $primer_smtp_subject, $primer_smtp_message, $attachments);
    34763330                                                if($primer_smtp_type == 'wordpress_default'){
    34773331                                                    $headers = array('Content-Type: text/html; charset=UTF-8');
     
    46014455                                    $photo_id_arg = explode(':', $mydata_options['image_api_id']);
    46024456                                    if (count($photo_id_arg) > 1) {
    4603                                         $response_key = $photo_id_arg[0];
    46044457                                        $response_value = $photo_id_arg[1];
    4605                                         $response_key = str_replace('"', '', $response_key);
    46064458                                        $response_value = str_replace('"', '', $response_value);
    46074459                                        $photo_id = ltrim($response_value);
     
    46654517                                $payload .= '--' . $boundary . '--';
    46664518                                $args = array(
    4667                                     'timeout' => 30,
     4519                                    'timeout' => 10,
    46684520                                    'method' => 'POST',
    46694521                                    'headers' => array(
     
    47714623                                        $email_logs = '';
    47724624                                        if (!empty($primer_automatically_send_file) && $primer_automatically_send_file === 'yes') {
    4773                                             $mailResult = false;
    47744625                                            $primer_smtp = PrimerSMTP::get_instance();
    47754626                                            if (!empty($primer_smtp_options['email_from_name'])) {
  • primer-mydata/trunk/includes/class-primer.php

    r2812297 r2822848  
    134134
    135135        require_once PRIMER_PATH . 'includes/class-primer-cron.php';
    136 
    137136        require_once PRIMER_PATH . 'includes/class-primer-settings.php';
    138137        require_once PRIMER_PATH . 'includes/vendor/cmb2/init.php';
    139 
    140138        require_once PRIMER_PATH . 'includes/receipt/class-primer-invoice.php';
    141 
    142139        require_once PRIMER_PATH . 'includes/vendor/conditional/cmb2-conditionals.php';
    143 //      require_once PRIMER_PATH . 'includes/vendor/conditional/example-functions.php';
    144 
    145140        require_once PRIMER_PATH . 'includes/vendor/phpqrcode/qrlib.php';
    146      //   require_once PRIMER_PATH . 'includes/vendor/chillerlan/php-qrcode/src/qrcode.php';
    147141        require_once PRIMER_PATH . 'includes/vendor/dompdf/autoload.inc.php';
    148 
    149142        require_once PRIMER_PATH . 'includes/template-tags/primer-tags-receipt.php';
    150 
    151143        require_once PRIMER_PATH . 'includes/template-tags/primer-tags-display-modules.php';
    152 
    153 //      require_once SLICED_PATH . 'admin/includes/primer-admin-notices.php';
    154 //      require_once SLICED_PATH . 'admin/includes/primer-admin-notifications.php';
    155144
    156145        /**
     
    205194        $this->loader->add_action( 'init', $plugin_admin, 'register_new_terms', 1 );
    206195        $this->loader->add_action( 'init', $plugin_admin, 'primer_create_tax_rates', 1 );
    207         $this->loader->add_action( 'init', $plugin_admin, 'settings_check' );
    208196        $this->loader->add_action( 'init', $plugin_admin, 'fix_wpml_error');
    209197        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'fix_wpml_error', 3 );
  • primer-mydata/trunk/includes/template-tags/primer-tags-receipt.php

    r2812297 r2822848  
    5353    }
    5454endif;
    55 /*
    56 if ( ! function_exists('primer_get_next_receipt_number') ) :
    57     function primer_get_next_receipt_number() {
    58         $output = Primer_Invoice::get_next_receipt_number();
    59         return apply_filters( 'primer_get_next_receipt_number', $output );
    60     }
    61 
    62 endif; */
  • primer-mydata/trunk/primer.php

    r2821718 r2822848  
    1818 * Plugin URI:        primer.gr/plugin/
    1919 * Description:      Issue receipts and invoices with woocommerce.
    20  * Version:           2.0.5
     20 * Version:           2.0.6
    2121 * Author:            Primer Software
    2222 * Author URI:        primer.gr
     
    182182 * Rename this for your plugin and update it as you release new versions.
    183183 */
    184 define( 'PRIMER_VERSION', '2.0.5' );
     184define( 'PRIMER_VERSION', '2.0.6' );
    185185
    186186define( 'PRIMER_NAME', 'Primer MyData' );
  • primer-mydata/trunk/public/partials/primer-receipt-display.php

    r2816194 r2822848  
    601601                        <?php if($i == $last_page){ ?>
    602602                        <div class="per_vat_totals_container">
    603                             <!-- <p class="card-title">Σύνολα ανα ΦΠΑ</p> -->
    604603                            <table class="totals_per_vat">
    605604                                <?php primer_display_issuer_tax_total(); ?>
     
    608607                        <?php } ?>
    609608                        <?php primer_display_issuer_comments(); ?>
    610                 <!--        <div class="cont_signs">
    611                             <?php //if(get_transmission_failure() != 1 || get_credit_receipt_failed() == 'yes') {
    612                               //  primer_get_generated_qr();
    613                          //   }?>
    614                         </div> -->
    615609                    <td class="qrcodeimg_container">
    616610                        <div class="cont_signs">
Note: See TracChangeset for help on using the changeset viewer.