Plugin Directory

Changeset 2944541


Ignore:
Timestamp:
07/28/2023 09:39:51 AM (3 years ago)
Author:
primersoftware
Message:

Update

Location:
primer-mydata
Files:
2624 added
8 edited

Legend:

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

    r2942478 r2944541  
    55Tested up to: 6.3.0
    66Requires PHP: 7.4
    7 Stable tag: 4.0.4
     7Stable tag: 4.0.5
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    133133= 4.0.4 - 2023-07-20 =
    134134* Minor Bug Fixes
     135= 4.0.5 - 2023-07-28 =
     136* Minor Bug Fixes
  • primer-mydata/trunk/admin/includes/my_data_json.php

    r2940775 r2944541  
    412412                $quantity = $item_data->get_quantity();
    413413                $product_name = $item_data->get_name();
    414                 $product_code = $item_data->get_product_id();
     414                $product_code = $item_data->get_id();
    415415                $sum += $quantity;
    416416                if (!empty($get_coupon) || $order->get_total_discount() > 0) {
     
    557557                    }
    558558                    if ($subtotal_item_tax == "0.00") {
    559                         $invoice_data['invoice'][0]['invoiceDetails'][$item_count]['vatExemptionCategory'] = $order_vat_exemption_category;
     559                            $invoice_data['invoice'][0]['invoiceDetails'][$item_count]['vatExemptionCategory'] = $order_vat_exemption_category;
    560560                    }
    561561                } else {
     
    615615            //implementation of shipping in json
    616616            if ($shipping_total > 0) {
    617                 $shipping_tax_rate = round($order->get_shipping_tax() / $order->get_total_shipping(), 2) * 100;
     617                $shipping_tax_rate = strval(ceil((100 * $order->get_shipping_tax()) / ($order->get_shipping_total())));
    618618                $vatCategory_shipping = '';
    619619                switch ($shipping_tax_rate) {
  • primer-mydata/trunk/admin/includes/primer-admin-options.php

    r2937024 r2944541  
    5959        add_action('wp_ajax_primer_user_picture_upload', array(&$this, 'primer_user_picture_upload'));
    6060        add_action('cmb2_render_email_wildcards', array($this, 'cmb2_render_email_wildcards_field_callback'), 10, 5);
    61         add_action('admin_print_scripts', array($this, 'enqueue_primer_admin_scripts'));
    62         add_action('admin_enqueue_scripts', array($this, 'enqueue_primer_admin_scripts'));
    6361        add_action('wp_ajax_primer_export_receipt_to_html', 'primer_export_receipt_to_html');
    6462        add_action('wp_ajax_nopriv_primer_export_receipt_to_html', 'primer_export_receipt_to_html');
     
    6664    }
    6765
    68     /**
    69      * Register our setting tabs to WP
    70      * @since  0.1.0
    71      */
    72     public function enqueue_primer_admin_scripts() {
    73         wp_enqueue_script('primer-admin', plugin_dir_url(__FILE__) . 'admin/js/primer-admin.js', array('jquery'), '1.0.0', true);
    74     }
    7566    public function init() {
    7667        $option_tabs = self::primer_option_fields();
     
    36133604                                            $homepage = file_get_contents($post_url, false, stream_context_create($arrContextOptions));
    36143605                                            // instantiate and use the dompdf class
     3606                                            $modified_homepage =  $homepage;
     3607                                            $log_id = get_post_meta($id_of_order, 'log_id_for_order', true);
     3608                                            $json = get_post_meta($log_id,'json_send_to_api',true);
     3609                                            $data = json_decode($json, true);
     3610                                            $varExemptionCategory = array();
     3611                                            foreach ($data['invoice'][0]['invoiceDetails'] as $invoiceDetails) {
     3612                                                if ( $invoiceDetails['vatExemptionCategory'] != null){
     3613                                                    $varExemptionCategory[] = $invoiceDetails['vatExemptionCategory'];
     3614                                                }
     3615                                            }
     3616                                            $varExemptionCategory = array_unique($varExemptionCategory);
     3617                                            $varExemptionCategory = array_values($varExemptionCategory);
     3618                                            $count = count($varExemptionCategory);
     3619                                            include 'vat_exemption.php';
     3620                                            if ( get_post_meta($id_of_order, '_billing_country', true) == "GR") {
     3621                                                if ( $count>0 ) {
     3622                                                    $exception_vat = '<div><span class="skin bold">ΑΠΑΛΛΑΓΗ ΑΠΟ ΤΟ Φ.Π.Α :</span></div>';
     3623                                                    for ($i = 0; $i < $count; $i++){
     3624                                                        $exception_vat .= '<div>'.$Vat_exemption_categories[$varExemptionCategory[$i]].'</div>';
     3625                                                    }
     3626                                                } else {
     3627                                                    $exception_vat = '';
     3628                                                }
     3629                                                $modified_homepage = str_replace('<div class="cont_notation"><span class="skin bold">ΠΑΡΑΤΗΡΗΣΕΙΣ:</span>', '<div class="cont_notation">' . $exception_vat . '<span class="skin bold">ΠΑΡΑΤΗΡΗΣΕΙΣ:</span>', $modified_homepage);
     3630                                            }
     3631                                            else {
     3632                                                if ( $count>0 ) {
     3633                                                    $exception_vat = '<div><span class="skin bold">EXEMPTION FROM VAT :</span></div>';
     3634                                                    for ($i = 0; $i < $count; $i++) {
     3635                                                        $exception_vat .= '<div>' . $Vat_exemption_categories_en[$varExemptionCategory[$i]] . '</div>';
     3636                                                    }
     3637                                                } else {
     3638                                                    $exception_vat = '';
     3639                                                }
     3640                                                $modified_homepage = str_replace('<div class="cont_notation"><span class="skin bold">COMMENTS:</span>', '<div class="cont_notation">' . $exception_vat . '<span class="skin bold">COMMENTS:</span>', $modified_homepage);
     3641                                            }
     3642                                            if ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") )  {
     3643                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     3644                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
     3645                                            }
     3646                                            elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
     3647                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     3648                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
     3649                                            }
     3650                                            elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") ) {
     3651                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     3652                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
     3653                                            }
     3654                                            elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR") ) {
     3655                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     3656                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
     3657                                            }
     3658                                            if ( get_post_meta($id_of_order, '_billing_country', true) != "GR") {
     3659                                                $modified_homepage = str_replace('<tr><p class="table_titles">CUSTOMER INFORMATION</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles" style="white-space: nowrap; text-align: center;">CUSTOMER INFORMATION</p></td></tr><tr>',$modified_homepage);
     3660                                                $modified_homepage = str_replace('<tr><p class="table_titles">OTHER INFORMATION</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles">OTHER INFORMATION</p></td></tr><tr>',$modified_homepage);
     3661                                            } else {
     3662                                                $modified_homepage = str_replace('<tr><p class="table_titles">ΣΤΟΙΧΕΙΑ ΠΕΛΑΤΗ</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles" style="white-space: nowrap; text-align: center;">ΣΤΟΙΧΕΙΑ ΠΕΛΑΤΗ</p></td></tr><tr>',$modified_homepage);
     3663                                                $modified_homepage = str_replace('<tr><p class="table_titles">ΛΟΙΠΑ ΣΤΟΙΧΕΙΑ</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles">ΛΟΙΠΑ ΣΤΟΙΧΕΙΑ</p></td></tr><tr>',$modified_homepage);
     3664                                            }
     3665                                            $modified_homepage = str_replace('body { font-family: DejaVu Sans, sans-serif; }', '', $modified_homepage);
     3666                                            $modified_homepage = str_replace('<body>', '<body style="font-family: \'DejaVu Sans\', sans-serif;">', $modified_homepage);
    36153667                                            $dompdf = new Dompdf();
    36163668                                            $options= $dompdf->getOptions();
     
    36183670                                            $options->setIsRemoteEnabled(true);
    36193671                                            $dompdf->setOptions($options);
    3620                                             $dompdf->loadHtml($homepage);
     3672                                            $dompdf->loadHtml($modified_homepage);
    36213673                                            // Render the HTML as PDF
    36223674                                            $dompdf->render();
     
    36523704                                            if (!empty($primer_smtp_options['quote_available_content'])) {
    36533705                                                $primer_smtp_message = $primer_smtp_options['quote_available_content'];
     3706                                                $client_first_name = get_post_meta($order_id, '_billing_first_name', true);
     3707                                                $client_last_name = get_post_meta($order_id, '_billing_last_name', true);
     3708                                                $client_email = get_post_meta($order_id, '_billing_email', true);
     3709                                                $streetAddress = get_post_meta($order_id, '_billing_address_1', true);
     3710                                                $townCity = get_post_meta($order_id, '_billing_city', true);
     3711                                                $phone = get_post_meta($order_id, '_billing_phone' , true);
     3712                                                $primer_smtp_message = str_replace('{ClientFirstName}', $client_first_name, $primer_smtp_message);
     3713                                                $primer_smtp_message = str_replace('{ClientLastName}', $client_last_name, $primer_smtp_message);
     3714                                                $primer_smtp_message = str_replace('{ClientEmail}', $client_email, $primer_smtp_message);
     3715                                                $primer_smtp_message = str_replace('{StreetAddress}', $streetAddress, $primer_smtp_message);
     3716                                                $primer_smtp_message = str_replace('{TownCity}', $townCity, $primer_smtp_message);
     3717                                                $primer_smtp_message = str_replace('{Phone}', $phone, $primer_smtp_message);
    36543718                                            } else {
    36553719                                                $primer_smtp_message = __('Test email message', 'primer');
  • primer-mydata/trunk/admin/includes/primer-admin-table.php

    r2939391 r2944541  
    627627                $receipt_log_value_array[] = __('Php option allow_url_fopen is disabled! Please communicate with your hosting provider in order to activate it.', 'primer');
    628628                $receipt_log_value .= __('Php option allow_url_fopen is disabled! Please communicate with your hosting provider in order to activate it.', 'primer');
     629                break ;
     630            }
     631            if ( get_post_meta($id_of_order, 'receipt_status', true) == 'issued' ) {
     632                $response_data .= '<div class="primer_popup popup_error"><div><h3>'.__('This order has already been issued. Please refresh the page.', 'primer') .'</h3><br><br><br><br><br></div>';
     633                $response_data .= '<button class="popup_ok button button-primary">OK</button></div>';
     634                $receipt_log_value_array[] = __('This order has already been issued by the automation. Press refresh.', 'primer');
     635                $receipt_log_value .= __('This order has already been issued by the automation. Press refresh.', 'primer');
    629636                break ;
    630637            }
     
    886893                                    }
    887894                                    if ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") )  {
    888                                         $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    889                                         $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $homepage);
     895                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     896                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
    890897                                    }
    891                                     elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt' && get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
    892                                         $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    893                                         $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 100px">', $homepage);
     898                                    elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
     899                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     900                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
    894901                                    }
    895902                                    elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") ) {
    896                                         $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    897                                         $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 154px">', $homepage);
     903                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     904                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
    898905                                    }
    899906                                    elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR") ) {
    900                                         $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    901                                         $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $homepage);
     907                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     908                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
    902909                                    }
    903910                                    if ( get_post_meta($id_of_order, '_billing_country', true) != "GR") {
  • primer-mydata/trunk/includes/class-primer-cron.php

    r2939391 r2944541  
    222222                                    break ;
    223223                                }
     224                                if ( get_post_meta($id_of_order, 'receipt_status', true) == 'issued' ) {
     225                                    continue ;
     226                                }
    224227                                $order_country = $order->get_billing_country();
    225228                                if(empty($order_country)){
     
    499502                                                            }
    500503                                                            if ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") )  {
    501                                                                 $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    502                                                                 $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $homepage);
     504                                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     505                                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
    503506                                                            }
    504                                                             elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt' && get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
    505                                                                 $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    506                                                                 $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 100px">', $homepage);
     507                                                            elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
     508                                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     509                                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
    507510                                                            }
    508511                                                            elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") ) {
    509                                                                 $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    510                                                                 $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 154px">', $homepage);
     512                                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     513                                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
    511514                                                            }
    512515                                                            elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR") ) {
    513                                                                 $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $homepage);
    514                                                                 $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $homepage);
     516                                                                $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     517                                                                $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
    515518                                                            }
    516519                                                            if ( get_post_meta($id_of_order, '_billing_country', true) != "GR") {
     
    10211024                                    );
    10221025                                    $homepage = file_get_contents($post_url, false, stream_context_create($arrContextOptions));
     1026                                    $modified_homepage =  $homepage;
     1027                                    $log_id = get_post_meta($id_of_order, 'log_id_for_order', true);
     1028                                    $json = get_post_meta($log_id,'json_send_to_api',true);
     1029                                    $data = json_decode($json, true);
     1030                                    $varExemptionCategory = array();
     1031                                    foreach ($data['invoice'][0]['invoiceDetails'] as $invoiceDetails) {
     1032                                        if ( $invoiceDetails['vatExemptionCategory'] != null){
     1033                                            $varExemptionCategory[] = $invoiceDetails['vatExemptionCategory'];
     1034                                        }
     1035                                    }
     1036                                    $varExemptionCategory = array_unique($varExemptionCategory);
     1037                                    $varExemptionCategory = array_values($varExemptionCategory);
     1038                                    $count = count($varExemptionCategory);
     1039                                    include 'vat_exemption.php';
     1040                                    if ( get_post_meta($id_of_order, '_billing_country', true) == "GR") {
     1041                                        if ( $count>0 ) {
     1042                                            $exception_vat = '<div><span class="skin bold">ΑΠΑΛΛΑΓΗ ΑΠΟ ΤΟ Φ.Π.Α :</span></div>';
     1043                                            for ($i = 0; $i < $count; $i++){
     1044                                                $exception_vat .= '<div>'.$Vat_exemption_categories[$varExemptionCategory[$i]].'</div>';
     1045                                            }
     1046                                        } else {
     1047                                            $exception_vat = '';
     1048                                        }
     1049                                        $modified_homepage = str_replace('<div class="cont_notation"><span class="skin bold">ΠΑΡΑΤΗΡΗΣΕΙΣ:</span>', '<div class="cont_notation">' . $exception_vat . '<span class="skin bold">ΠΑΡΑΤΗΡΗΣΕΙΣ:</span>', $modified_homepage);
     1050                                    }
     1051                                    else {
     1052                                        if ( $count>0 ) {
     1053                                            $exception_vat = '<div><span class="skin bold">EXEMPTION FROM VAT :</span></div>';
     1054                                            for ($i = 0; $i < $count; $i++) {
     1055                                                $exception_vat .= '<div>' . $Vat_exemption_categories_en[$varExemptionCategory[$i]] . '</div>';
     1056                                            }
     1057                                        } else {
     1058                                            $exception_vat = '';
     1059                                        }
     1060                                        $modified_homepage = str_replace('<div class="cont_notation"><span class="skin bold">COMMENTS:</span>', '<div class="cont_notation">' . $exception_vat . '<span class="skin bold">COMMENTS:</span>', $modified_homepage);
     1061                                    }
     1062                                    if ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") )  {
     1063                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     1064                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
     1065                                    }
     1066                                    elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
     1067                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     1068                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
     1069                                    }
     1070                                    elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") ) {
     1071                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     1072                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
     1073                                    }
     1074                                    elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR") ) {
     1075                                        $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     1076                                        $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
     1077                                    }
     1078                                    if ( get_post_meta($id_of_order, '_billing_country', true) != "GR") {
     1079                                        $modified_homepage = str_replace('<tr><p class="table_titles">CUSTOMER INFORMATION</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles" style="white-space: nowrap; text-align: center;">CUSTOMER INFORMATION</p></td></tr><tr>',$modified_homepage);
     1080                                        $modified_homepage = str_replace('<tr><p class="table_titles">OTHER INFORMATION</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles">OTHER INFORMATION</p></td></tr><tr>',$modified_homepage);
     1081                                    } else {
     1082                                        $modified_homepage = str_replace('<tr><p class="table_titles">ΣΤΟΙΧΕΙΑ ΠΕΛΑΤΗ</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles" style="white-space: nowrap; text-align: center;">ΣΤΟΙΧΕΙΑ ΠΕΛΑΤΗ</p></td></tr><tr>',$modified_homepage);
     1083                                        $modified_homepage = str_replace('<tr><p class="table_titles">ΛΟΙΠΑ ΣΤΟΙΧΕΙΑ</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles">ΛΟΙΠΑ ΣΤΟΙΧΕΙΑ</p></td></tr><tr>',$modified_homepage);
     1084                                    }
     1085                                    $modified_homepage = str_replace('body { font-family: DejaVu Sans, sans-serif; }', '', $modified_homepage);
     1086                                    $modified_homepage = str_replace('<body>', '<body style="font-family: \'DejaVu Sans\', sans-serif;">', $modified_homepage);
    10231087                                    $dompdf = new Dompdf();
    10241088                                    $options = $dompdf->getOptions();
     
    10261090                                    $options->setIsRemoteEnabled(true);
    10271091                                    $dompdf->setOptions($options);
    1028                                     $dompdf->loadHtml($homepage);
     1092                                    $dompdf->loadHtml($modified_homepage);
    10291093                                    // Render the HTML as PDF
    10301094                                    $dompdf->render();
     
    10561120                                    if (!empty($primer_smtp_options['quote_available_content'])) {
    10571121                                        $primer_smtp_message = $primer_smtp_options['quote_available_content'];
     1122                                        $client_first_name = get_post_meta($order_id, '_billing_first_name', true);
     1123                                        $client_last_name = get_post_meta($order_id, '_billing_last_name', true);
     1124                                        $client_email = get_post_meta($order_id, '_billing_email', true);
     1125                                        $streetAddress = get_post_meta($order_id, '_billing_address_1', true);
     1126                                        $townCity = get_post_meta($order_id, '_billing_city', true);
     1127                                        $phone = get_post_meta($order_id, '_billing_phone' , true);
     1128                                        $primer_smtp_message = str_replace('{ClientFirstName}', $client_first_name, $primer_smtp_message);
     1129                                        $primer_smtp_message = str_replace('{ClientLastName}', $client_last_name, $primer_smtp_message);
     1130                                        $primer_smtp_message = str_replace('{ClientEmail}', $client_email, $primer_smtp_message);
     1131                                        $primer_smtp_message = str_replace('{StreetAddress}', $streetAddress, $primer_smtp_message);
     1132                                        $primer_smtp_message = str_replace('{TownCity}', $townCity, $primer_smtp_message);
     1133                                        $primer_smtp_message = str_replace('{Phone}', $phone, $primer_smtp_message);
    10581134                                    } else {
    10591135                                        $primer_smtp_message = __('Test email message', 'primer');
     
    14721548                                        $homepage = file_get_contents($post_url, false, stream_context_create($arrContextOptions));
    14731549                                        // instantiate and use the dompdf class
     1550                                        $modified_homepage =  $homepage;
     1551                                        $log_id = get_post_meta($id_of_order, 'log_id_for_order', true);
     1552                                        $json = get_post_meta($log_id,'json_send_to_api',true);
     1553                                        $data = json_decode($json, true);
     1554                                        $varExemptionCategory = array();
     1555                                        foreach ($data['invoice'][0]['invoiceDetails'] as $invoiceDetails) {
     1556                                            if ( $invoiceDetails['vatExemptionCategory'] != null){
     1557                                                $varExemptionCategory[] = $invoiceDetails['vatExemptionCategory'];
     1558                                            }
     1559                                        }
     1560                                        $varExemptionCategory = array_unique($varExemptionCategory);
     1561                                        $varExemptionCategory = array_values($varExemptionCategory);
     1562                                        $count = count($varExemptionCategory);
     1563                                        include 'vat_exemption.php';
     1564                                        if ( get_post_meta($id_of_order, '_billing_country', true) == "GR") {
     1565                                            if ( $count>0 ) {
     1566                                                $exception_vat = '<div><span class="skin bold">ΑΠΑΛΛΑΓΗ ΑΠΟ ΤΟ Φ.Π.Α :</span></div>';
     1567                                                for ($i = 0; $i < $count; $i++){
     1568                                                    $exception_vat .= '<div>'.$Vat_exemption_categories[$varExemptionCategory[$i]].'</div>';
     1569                                                }
     1570                                            } else {
     1571                                                $exception_vat = '';
     1572                                            }
     1573                                            $modified_homepage = str_replace('<div class="cont_notation"><span class="skin bold">ΠΑΡΑΤΗΡΗΣΕΙΣ:</span>', '<div class="cont_notation">' . $exception_vat . '<span class="skin bold">ΠΑΡΑΤΗΡΗΣΕΙΣ:</span>', $modified_homepage);
     1574                                        }
     1575                                        else {
     1576                                            if ( $count>0 ) {
     1577                                                $exception_vat = '<div><span class="skin bold">EXEMPTION FROM VAT :</span></div>';
     1578                                                for ($i = 0; $i < $count; $i++) {
     1579                                                    $exception_vat .= '<div>' . $Vat_exemption_categories_en[$varExemptionCategory[$i]] . '</div>';
     1580                                                }
     1581                                            } else {
     1582                                                $exception_vat = '';
     1583                                            }
     1584                                            $modified_homepage = str_replace('<div class="cont_notation"><span class="skin bold">COMMENTS:</span>', '<div class="cont_notation">' . $exception_vat . '<span class="skin bold">COMMENTS:</span>', $modified_homepage);
     1585                                        }
     1586                                        if ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") )  {
     1587                                            $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     1588                                            $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
     1589                                        }
     1590                                        elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) == 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR")) {
     1591                                            $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 120px">', $modified_homepage);
     1592                                            $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 120px">', $modified_homepage);
     1593                                        }
     1594                                        elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) == "GR") ) {
     1595                                            $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     1596                                            $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
     1597                                        }
     1598                                        elseif ( (get_post_meta($id_of_order, '_billing_invoice_type', true) != 'receipt') && (get_post_meta($id_of_order, '_billing_country', true) != "GR") ) {
     1599                                            $modified_homepage = str_replace('<div class="information left">', '<div class="information left" style="height: 160px">', $modified_homepage);
     1600                                            $modified_homepage = str_replace('<div class="information right">', '<div class="information right" style="height: 160px">', $modified_homepage);
     1601                                        }
     1602                                        if ( get_post_meta($id_of_order, '_billing_country', true) != "GR") {
     1603                                            $modified_homepage = str_replace('<tr><p class="table_titles">CUSTOMER INFORMATION</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles" style="white-space: nowrap; text-align: center;">CUSTOMER INFORMATION</p></td></tr><tr>',$modified_homepage);
     1604                                            $modified_homepage = str_replace('<tr><p class="table_titles">OTHER INFORMATION</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles">OTHER INFORMATION</p></td></tr><tr>',$modified_homepage);
     1605                                        } else {
     1606                                            $modified_homepage = str_replace('<tr><p class="table_titles">ΣΤΟΙΧΕΙΑ ΠΕΛΑΤΗ</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles" style="white-space: nowrap; text-align: center;">ΣΤΟΙΧΕΙΑ ΠΕΛΑΤΗ</p></td></tr><tr>',$modified_homepage);
     1607                                            $modified_homepage = str_replace('<tr><p class="table_titles">ΛΟΙΠΑ ΣΤΟΙΧΕΙΑ</p>', '<tr><td colspan="2" style="text-align: center;"><p class="table_titles">ΛΟΙΠΑ ΣΤΟΙΧΕΙΑ</p></td></tr><tr>',$modified_homepage);
     1608                                        }
     1609                                        $modified_homepage = str_replace('body { font-family: DejaVu Sans, sans-serif; }', '', $modified_homepage);
     1610                                        $modified_homepage = str_replace('<body>', '<body style="font-family: \'DejaVu Sans\', sans-serif;">', $modified_homepage);
    14741611                                        $dompdf = new Dompdf();
    14751612                                        $options = $dompdf->getOptions();
     
    14771614                                        $options->setIsRemoteEnabled(true);
    14781615                                        $dompdf->setOptions($options);
    1479                                         $dompdf->loadHtml($homepage);
     1616                                        $dompdf->loadHtml($modified_homepage);
    14801617                                        // Render the HTML as PDF
    14811618                                        $dompdf->render();
     
    15121649                                        if (!empty($primer_smtp_options['quote_available_content'])) {
    15131650                                            $primer_smtp_message = $primer_smtp_options['quote_available_content'];
     1651                                            $primer_smtp_message = $primer_smtp_options['quote_available_content'];
     1652                                            $client_first_name = get_post_meta($order_id, '_billing_first_name', true);
     1653                                            $client_last_name = get_post_meta($order_id, '_billing_last_name', true);
     1654                                            $client_email = get_post_meta($order_id, '_billing_email', true);
     1655                                            $streetAddress = get_post_meta($order_id, '_billing_address_1', true);
     1656                                            $townCity = get_post_meta($order_id, '_billing_city', true);
     1657                                            $phone = get_post_meta($order_id, '_billing_phone' , true);
     1658                                            $primer_smtp_message = str_replace('{ClientFirstName}', $client_first_name, $primer_smtp_message);
     1659                                            $primer_smtp_message = str_replace('{ClientLastName}', $client_last_name, $primer_smtp_message);
     1660                                            $primer_smtp_message = str_replace('{ClientEmail}', $client_email, $primer_smtp_message);
     1661                                            $primer_smtp_message = str_replace('{StreetAddress}', $streetAddress, $primer_smtp_message);
     1662                                            $primer_smtp_message = str_replace('{TownCity}', $townCity, $primer_smtp_message);
     1663                                            $primer_smtp_message = str_replace('{Phone}', $phone, $primer_smtp_message);
    15141664                                        } else {
    15151665                                            $primer_smtp_message = __('Test email message', 'primer');
     
    17101860        $invoice_series_number = isset($_POST['export_select_invoice_series_number']) ? sanitize_text_field($_POST['export_select_invoice_series_number']) : $primer_export_options['export_select_invoice_series_number'];
    17111861        $export_invoice_type = isset($_POST['export_select_invoice_type']) ? sanitize_text_field($_POST['export_select_invoice_type']) : $primer_export_options['export_select_invoice_type'];
    1712         $export_type = isset($_POST['export_type']) ? sanitize_text_field($_POST['export_type']) : 'csv';
     1862        $export_type = isset($_POST['export_type']) ? sanitize_text_field($_POST['export_type']) : 'xlsx';
    17131863        $primer_leave_blank_row = isset($_POST['export_leave_blank_row']) ? sanitize_text_field($_POST['export_leave_blank_row']) : '';
    17141864        $primer_export_from = isset($_POST['mydata_export_from']) ? sanitize_text_field($_POST['mydata_export_from']) : '';
     
    24062556                $sheet->setCellValue('A' . $i, 'ΣΥΝΟΛΑ');
    24072557                $i++;
     2558                $emptySumHeaders = ['Client Name', 'Client Company', 'Client VAT', 'Client Activity', 'Client Address', 'Client Phone number', 'Client Email',
     2559                                    'Client Webpage', 'Product name', 'Product Quantity', 'Invoice Number', 'Series of the Invoice', 'Invoice Date', 'Invoice Type'];
     2560
    24082561                foreach ($header_row as $header_key => $header_value) {
    24092562                    if (isset($data_items[$header_key])) {
     
    24142567                        }
    24152568                        $last_row = $i - 1;
    2416                         $sheet->setCellValue($header_key . $i, '=SUM(' . $header_key . ''.$sum_start.':' . $header_key . $last_row . ')');
     2569
     2570                        if ( (in_array($header_value, $emptySumHeaders)) )  {
     2571                            $sheet->setCellValue($header_key . $last_row + 1, '');
     2572                        } else {
     2573                            $sheet->setCellValue($header_key . $i, '=SUM(' . $header_key . ''.$sum_start.':' . $header_key . $last_row . ')');
     2574                        }
    24172575                    }
    24182576                }
  • primer-mydata/trunk/primer.php

    r2940775 r2944541  
    1818 * Plugin URI:        primer.gr/plugin/
    1919 * Description:      Issue receipts and invoices with woocommerce.
    20  * Version:           4.0.4
     20 * Version:           4.0.5
    2121 * Author:            Primer Software
    2222 * Author URI:        primer.gr
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'PRIMER_VERSION', '4.0.4');
     38define( 'PRIMER_VERSION', '4.0.5');
    3939define( 'PRIMER_NAME', 'Primer MyData' );
    4040
  • primer-mydata/trunk/public/partials/invoicetemplate_defaultA4.php

    r2937024 r2944541  
    497497                                            if (isset($_GET['primer_use_logo'])) {
    498498                                                if ($_GET['primer_use_logo'] == 'on') { ?>
    499                                                     <img src="<?php echo $img_src; ?>" alt=""  class="logo_img">
     499                                                    <img src="<?php echo htmlspecialchars($img_src); ?>" alt=""  class="logo_img">
    500500                                                <?php }
    501501                                            } ?>
  • primer-mydata/trunk/public/partials/primer-receipt-display.php

    r2937024 r2944541  
    610610                    var leftInfoHeight = document.querySelector('.information.left').clientHeight;
    611611                    var rightInfoHeight = document.querySelector('.information.right').clientHeight;
    612                     console.log('aristera prin ' + leftInfoHeight);
    613                     console.log('deksia prin ' + rightInfoHeight)
    614612                    if  (leftInfoHeight > rightInfoHeight) {
    615613                        rightInfo.style.height = leftInfoHeight + 'px';
     
    619617                    }
    620618
    621                     console.log('aristera meta ' + leftInfo.style.height);
    622                     console.log('deksia meta ' + rightInfo.style.height)
    623619                    });
    624620                </script>
Note: See TracChangeset for help on using the changeset viewer.