diff --git a/ANLEITUNG/index.html b/ANLEITUNG/index.html index 5847595..611caee 100644 --- a/ANLEITUNG/index.html +++ b/ANLEITUNG/index.html @@ -1,7 +1,7 @@
-Anpassung des Moduls VAT Processing for European Countries (Vat4EU) von lat9 für die deutsche Zen Cart Version 1.5.7
- (c) 2022 webchills
+ (c) 2022-2024 webchills
+
+ Changelog Version 3.2.0:
+2024-03-01 webchills
+Anpassungen für 1.5.7h und PHP 8.2.x
+
Changelog Version 3.1.3:
2022-09-02 webchills
@@ -99,7 +104,7 @@
Dieses Modul ist nur für die deutsche Zen Cart 1.5.7 Version geeignet und ändert einige Corefiles.
+
Dieses Modul ist nur für die deutsche Zen Cart 1.5.7g oder 1.5.7h Version geeignet und ändert einige Corefiles.
Erst in einem Testshop einspielen und nicht direkt in Ihrem Liveshop!
Für den Einbau dieses Moduls sollten Sie über folgende Werkzeuge verfügen:
@@ -200,8 +205,8 @@
Eine Anleitung dazu finden Sie in der Datei anleitung.txt im Ordner UID DATENUEBERNAHME AUS ALTEM MODUL.
WICHTIG:
-Bevor Sie diese Konvertierung durchführen installieren Sie zunächst ganz normal wie unter Neuinstallation beschrieben das Modul UID 3.1.2 für Zen Cart 1.5.7 deutsch in Ihrem bereits auf 1.5.7 aktualisierten Shop!
Sie haben also bereits einen funktionierenden auf 1.5.7 aktualisierten Shop mit dem neuen UID Modul 3.1.3.
+Bevor Sie diese Konvertierung durchführen installieren Sie zunächst ganz normal wie unter Neuinstallation beschrieben das Modul UID 3.2.0 für Zen Cart 1.5.7 deutsch in Ihrem bereits auf 1.5.7 aktualisierten Shop!
Sie haben also bereits einen funktionierenden auf 1.5.7 aktualisierten Shop mit dem neuen UID Modul 3.2.0.
Nur unter Kunden > Kunden sind keinerlei bestehende UIDs vorhanden.
Und die übernehmen Sie nun wie in der anleitung.txt beschrieben.
Prüfen Sie auch, ob in Ihrer Shopinstallation noch irgendwo Relikte des alten Moduls sind, folgende Dateien sollten keinesfalls mehr vorhanden sein, falls sie vorhanden sind vom Server löschen:
diff --git a/GEAENDERTE DATEIEN/includes/classes/class.rl_invoice3.php b/GEAENDERTE DATEIEN/includes/classes/class.rl_invoice3.php
index 036bc2f..32ccac3 100644
--- a/GEAENDERTE DATEIEN/includes/classes/class.rl_invoice3.php
+++ b/GEAENDERTE DATEIEN/includes/classes/class.rl_invoice3.php
@@ -2,11 +2,11 @@
/**
* @package pdf Rechnung
* @copyright Copyright 2005-2012 langheiter.com
- * @copyright Copyright 2003-2022 Zen Cart Development Team
+ * @copyright Copyright 2003-2024 Zen Cart Development Team
* Zen Cart German Version - www.zen-cart-pro.at
* @copyright Portions Copyright 2003 osCommerce
* @license https://www.zen-cart-pro.at/license/3_0.txt GNU General Public License V3.0
- * @version $Id: class.rl_invoice3.php for UID 2022-06-03 15:02:17Z webchills $
+ * @version $Id: class.rl_invoice3.php for UID 2024-01-20 09:02:17Z webchills $
*/
error_reporting(E_ERROR);
@@ -512,7 +512,7 @@ function getPDFFileName() {
return $this->pdfPath['path'] . $pdfName;
}
function getPDFAttachments($param = 'ALL') {
- $attachArray = array();
+ $attachArray = [];
$tmp = $this->getPDFFileName();
if (file_exists($tmp)) {
$ft = str_replace($this->pdfPath['path'], '', $tmp);
diff --git a/NEUE DATEIEN/DEINADMIN/includes/classes/observers/Vat4EuAdminObserver.php b/NEUE DATEIEN/DEINADMIN/includes/classes/observers/Vat4EuAdminObserver.php
index 414c446..34ea1c5 100644
--- a/NEUE DATEIEN/DEINADMIN/includes/classes/observers/Vat4EuAdminObserver.php
+++ b/NEUE DATEIEN/DEINADMIN/includes/classes/observers/Vat4EuAdminObserver.php
@@ -3,30 +3,33 @@
* @package UID
* Zen Cart German Specific
* based on VAT4EU plugin by Cindy Merkin a.k.a. lat9 (cindy@vinosdefrutastropicales.com)
- * Copyright (c) 2017-2022 Vinos de Frutas Tropicales
- * @copyright Copyright 2003-2022 Zen Cart Development Team
+ * Copyright (c) 2017-2024 Vinos de Frutas Tropicales
+ * @copyright Copyright 2003-2024 Zen Cart Development Team
* Zen Cart German Version - www.zen-cart-pro.at
* @copyright Portions Copyright 2003 osCommerce
* @license https://www.zen-cart-pro.at/license/3_0.txt GNU General Public License V3.0
- * @version $Id: Vat4EuAdminObserver.php 2022-06-05 07:38:16Z webchills $
+ * @version $Id: Vat4EuAdminObserver.php 2024-03-01 20:24:16Z webchills $
*/
if (!defined('IS_ADMIN_FLAG') || IS_ADMIN_FLAG !== true) {
die('Illegal Access');
}
-class Vat4EuAdminObserver extends base
+class Vat4EuAdminObserver extends base
{
- private
- $isEnabled = false,
- $vatValidated = false,
- $vatIsRefundable = false,
- $vatNumber = '',
- $vatNumberStatus = 0,
- $addressFormatCount = 0,
- $vatCountries = [],
- $debug = false,
- $oID = 0;
+ private $isEnabled = false;
+ private $vatValidated = false;
+ private $vatIsRefundable = false;
+ private $vatNumber = '';
+ private $vatNumberStatus = 0;
+ private $vatNumberMessage = '';
+ private $vatNumberError = false;
+ private $addressFormatCount = 0;
+ private $addressesToFormat;
+ private $vatCountries = [];
+ private $debug = false;
+ private $logfile = '';
+ private $oID = 0;
// -----
// On construction, this auto-loaded observer checks to see that the plugin is enabled and, if so:
@@ -58,26 +61,19 @@ public function __construct()
if (isset($_GET['oID'])) {
$this->oID = (int)$_GET['oID'];
}
- // -----
- // Note: Notifiers that are added by this plugin's file-set are marked with (*)
- //
+
$this->attach(
- $this,
+ $this,
[
- //- From admin/includes/classes/order.php
- 'ORDER_QUERY_ADMIN_COMPLETE', //- Reconstructing a previously-placed order
-
//- From /includes/classes/order.php
- 'NOTIFY_ORDER_AFTER_QUERY', //- Reconstructing a previously-placed order (Edit Orders)
+ 'NOTIFY_ORDER_AFTER_QUERY', //- Reconstructing a previously-placed order
//- From admin/customers.php
- 'NOTIFY_ADMIN_CUSTOMERS_LIST_ADDRESSES', //- Allows us to add the number/validation status to address list (*)
- 'NOTIFY_ADMIN_CUSTOMERS_UPDATE_VALIDATE', //- Allows us to check/validate any entered VAT Number (*)
- 'NOTIFY_ADMIN_CUSTOMERS_B4_ADDRESS_UPDATE', //- Gives us the chance to insert the VAT-related fields (*)
- 'NOTIFY_ADMIN_CUSTOMERS_CUSTOMER_EDIT', //- The point at which the VAT Number fields are inserted (*)
- 'NOTIFY_ADMIN_CUSTOMERS_LISTING_HEADER', //- The point at which we add columns to the listing heading (*)
- 'NOTIFY_ADMIN_CUSTOMERS_LISTING_NEW_FIELDS', //- The point at which we insert additional fields for the listing (*)
- 'NOTIFY_ADMIN_CUSTOMERS_LISTING_ELEMENT', //- The point at which we insert a customer record in the listing (*)
+ 'NOTIFY_ADMIN_CUSTOMERS_UPDATE_VALIDATE', //- Allows us to check/validate any entered VAT Number
+ 'NOTIFY_ADMIN_CUSTOMERS_B4_ADDRESS_UPDATE', //- Gives us the chance to insert the VAT-related fields
+ 'NOTIFY_ADMIN_CUSTOMERS_CUSTOMER_EDIT', //- The point at which the VAT Number fields are inserted
+ 'NOTIFY_ADMIN_CUSTOMERS_LISTING_HEADER', //- The point at which we add columns to the listing heading
+ 'NOTIFY_ADMIN_CUSTOMERS_LISTING_ELEMENT', //- The point at which we insert a customer record in the listing
//- From admin/edit_orders.php
'EDIT_ORDERS_PRE_UPDATE_ORDER', //- Allows us to update any VAT Number associated with the order
@@ -99,37 +95,12 @@ public function __construct()
public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
switch ($eventID) {
// -----
- // Issued by the admin-level order-class after completing its base reconstruction of a
+ // Issued by the common order-class after completing its base reconstruction of a
// previously-placed order. We'll tack any "VAT Number" recorded in the order
// into the class' to-be-returned array.
//
// Entry:
// $class ... A reference to an order-class object.
- // $p1 ...... An associative array, with the orders_id as a key
- //
- case 'ORDER_QUERY_ADMIN_COMPLETE':
- global $db;
-
- $vat_info = $db->Execute(
- "SELECT billing_vat_number, billing_vat_validated
- FROM " . TABLE_ORDERS . "
- WHERE orders_id = " . (int)$p1['orders_id'] . "
- LIMIT 1"
- );
- if (!$vat_info->EOF) {
- $this->vatNumber = $class->billing['billing_vat_number'] = $vat_info->fields['billing_vat_number'];
- $this->vatValidated = $class->billing['billing_vat_validated'] = $vat_info->fields['billing_vat_validated'];
- }
- break;
-
- // -----
- // Issued by the storefront order-class after completing its base reconstruction of a
- // previously-placed order. We'll tack any "VAT Number" recorded in the order
- // into the class' to-be-returned array. This version of the class is used by
- // Edit Orders.
- //
- // Entry:
- // $class ... A reference to an order-class object.
// $p2 ...... The orders_id associated with the order-object
//
case 'NOTIFY_ORDER_AFTER_QUERY':
@@ -142,23 +113,13 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
LIMIT 1"
);
if (!$vat_info->EOF) {
- $this->vatNumber = $class->billing['billing_vat_number'] = $vat_info->fields['billing_vat_number'];
- $this->vatValidated = $class->billing['billing_vat_validated'] = $vat_info->fields['billing_vat_validated'];
+ $class->billing['billing_vat_number'] = $vat_info->fields['billing_vat_number'];
+ $this->vatNumber = $vat_info->fields['billing_vat_number'];
+ $class->billing['billing_vat_validated'] = $vat_info->fields['billing_vat_validated'];
+ $this->vatValidated = $vat_info->fields['billing_vat_validated'];
}
break;
- // -----
- // Issued by Customers->Customers when a customer's address-list is being displayed. We'll gather
- // the VAT numbers and associated status for future calls to zen_address_format.
- //
- // On entry:
- //
- // $p1 ... (r/o) A copy of the to-be-issued SQL query to gather the addresses.
- //
- case 'NOTIFY_ADMIN_CUSTOMERS_LIST_ADDRESSES':
- $this->gatherCustomersAddressBookVatNumbers($p1);
- break;
-
// -----
// Issued by Customers->Customers at the end of its field validation, giving us the
// chance to validate the Vat-related fields.
@@ -168,8 +129,9 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
// $p2 ... (r/w) A reference to the $error variable, set to true if the VAT is not valid.
//
case 'NOTIFY_ADMIN_CUSTOMERS_UPDATE_VALIDATE':
- $this->vatNumberUpdateError = !$this->validateVatNumber();
- $p2 = $this->vatNumberUpdateError;
+ if ($this->validateVatNumber() === false) {
+ $p2 = true;
+ }
break;
// -----
@@ -206,7 +168,7 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
break;
// -----
- // Issued by Customers->Customers prior to listing generation, allows us to insert
+ // Issued by Customers :: Customers prior to listing generation, allows us to insert
// additional column heading(s).
//
// On entry:
@@ -218,7 +180,7 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
$heading_text = VAT4EU_CUSTOMERS_HEADING;
if (isset($_GET['list_order']) && strpos($_GET['list_order'], 'vatnum') === 0) {
$heading_text = '' . $heading_text . '';
- if ($_GET['list_order'] == 'vatnum-asc') {
+ if ($_GET['list_order'] === 'vatnum-asc') {
$asc_class = 'SortOrderHeader';
} else {
$desc_class = 'SortOrderHeader';
@@ -227,35 +189,26 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
$current_parms = zen_get_all_get_params(['list_order', 'page']);
$heading = [
'content' =>
- $heading_text . '
' . PHP_EOL .
- 'Asc ' . PHP_EOL .
- 'Desc' . PHP_EOL,
+ $heading_text .
+ '
' .
+ '
+ ' .
+ TEXT_ASC .
+ '
+ ' .
+ '
+ ' .
+ TEXT_DESC .
+ '
+ ',
'class' => 'center',
];
$p2[] = $heading;
break;
// -----
- // Issued by Customers->Customers prior to listing generation, allows us to "tack on"
- // the VAT-related fields.
- //
- // On entry:
- //
- // $p2 ... (r/w) A string containing the current fields to be gathered.
- // $p2 ... (r/w) A string containing the current customers' sort-order
- //
- case 'NOTIFY_ADMIN_CUSTOMERS_LISTING_NEW_FIELDS':
- $p2 .= ', a.entry_vat_number, a.entry_vat_validated';
- if (isset($_GET['list_order']) && strpos($_GET['list_order'], 'vatnum') === 0) {
- $p3 = 'a.entry_vat_validated ';
- $p3 .= ($_GET['list_order'] === 'vatnum-asc') ? 'ASC' : 'DESC';
- $p3 .= ', a.entry_vat_number DESC, c.customers_lastname, c.customers_firstname';
- }
- break;
-
- // -----
- // Issued by Customers->Customers during listing generation, allows us to insert
- // additional VAT-related columns.
+ // Issued by Customers :: Customers during listing generation, allows us to insert
+ // additional VAT-related columns for each customer.
//
// On entry:
//
@@ -263,10 +216,38 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
// $p2 ... (r/w) An array value to contain an updated table-column for the display.
//
case 'NOTIFY_ADMIN_CUSTOMERS_LISTING_ELEMENT':
- $vat_number = $p1['entry_vat_number'];
+ $default_address_id = $p1['customers_default_address_id'];
+ $vat_number = '';
+ foreach ($p1['addresses'] as $next_address) {
+ // -----
+ // Note: Using a 'loose' comparison since some fields are cast to int and
+ // some aren't.
+ //
+ if ($next_address['address']['address_book_id'] != $default_address_id) {
+ continue;
+ }
+
+ // -----
+ // zc200+ includes *all* fields from the address_book table in the
+ // address. If that entry is present, use the value from the address
+ // supplied.
+ //
+ if (isset($next_address['address']['entry_vat_number'])) {
+ $vat_number = $next_address['address']['entry_vat_number'];
+ $vat_validation_status = $next_address['address']['entry_vat_validated'];
+ break;
+ }
+ // -----
+ // Otherwise, pull the VAT number and its validation status from the database.
+ //
+ [$vat_number, $vat_validation_status] = $this->getVatInfoFromDb($default_address_id);
+ break;
+ }
+
$vat_validated = '';
- if ($vat_number != '') {
- $vat_validated = $this->showVatNumberStatus($p1['entry_vat_validated']);
+ $vat_number = (string)$vat_number;
+ if ($vat_number !== '') {
+ $vat_validated = $this->showVatNumberStatus($vat_validation_status);
}
$vat_column = [
'content' => $vat_validated . $vat_number,
@@ -306,10 +287,10 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
// $p2 ... (r/w) A reference to a string value that is updated to contain the VAT Number field.
//
case 'EDIT_ORDERS_ADDITIONAL_ADDRESS_ROWS':
- $vat_number = $p1->billing['billing_vat_number'];
- $vat_validated = $p1->billing['billing_vat_validated'];
+ $vat_number = (string)$p1->billing['billing_vat_number'];
+ $vat_validated = (int)$p1->billing['billing_vat_validated'];
$valid_indicator = '';
- if ($vat_number != '' && $vat_validated != VatValidation::VAT_VIES_OK && $vat_validated != VatValidation::VAT_ADMIN_OVERRIDE) {
+ if ($vat_number !== '' && $vat_validated !== VatValidation::VAT_VIES_OK && $vat_validated !== VatValidation::VAT_ADMIN_OVERRIDE) {
$valid_indicator = ' ' . VAT4EU_UNVERIFIED;
}
$hidden_fields = zen_draw_hidden_field('current_vat_number', $vat_number) . zen_draw_hidden_field('current_vat_validated', $vat_validated);
@@ -326,7 +307,7 @@ public function update(&$class, $eventID, $p1, &$p2, &$p3, &$p4, &$p5) {
'