first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
/**
* Categories data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Categories\DataStore;
use Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore as OrdersDataStore;
/**
* Class P24_Categories_Data_Store.
*/
class P24_Categories_Data_Store extends DataStore {
/**
* Return the database query with parameters used for Categories report: time span and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( OrdersDataStore::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Coupons data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Coupons\DataStore;
/**
* Class P24_Coupons_Data_Store.
*/
class P24_Coupons_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Products report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* Coupons stats data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats\DataStore;
/**
* Class P24_Coupons_Stats_Data_Store.
*/
class P24_Coupons_Stats_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Products Stats report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function update_sql_query_params( $query_args ) {
parent::update_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->interval_query->add_sql_clause( 'join', $metadata_join );
$this->total_query->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Customers data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore;
use Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore as OrdersDataStore;
/**
* Class P24_Customers_Data_Store.
*/
class P24_Customers_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Customers report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$query_statement = $this->subquery->get_query_statement();
$order_table = OrdersDataStore::get_db_table_name();
if ( false === strpos( $query_statement, $order_table ) ) {
return;
}
$metadata_alias = 'p24_postmeta';
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( $order_table );
$this->subquery->add_sql_clause( 'left_join', $metadata_join );
$this->subquery->add_sql_clause(
'where',
"AND {$metadata_alias}.meta_key = '_order_currency'"
);
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Customers stats data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Customers\Stats\DataStore;
use Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore as OrdersDataStore;
/**
* Class P24_Customers_Stats_Data_Store.
*/
class P24_Customers_Stats_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Customers report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( OrdersDataStore::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Orders data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore;
/**
* Class P24_Orders_Data_Store.
*/
class P24_Orders_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for orders report: coupons and products filters.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Orders stats data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore;
/**
* Class P24_Orders_Stats_Data_Store.
*/
class P24_Orders_Stats_Data_Store extends DataStore {
/**
* Updates the totals and intervals database queries with parameters used for Orders report: categories, coupons and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function orders_stats_sql_filter( $query_args ) {
parent::orders_stats_sql_filter( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->total_query->add_sql_clause( 'join', $metadata_join );
$this->interval_query->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* Products data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Products\DataStore;
use Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore as OrdersDataStore;
/**
* Class P24_Products_Data_Store.
*/
class P24_Products_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Products report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( OrdersDataStore::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Products data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Products\Stats\DataStore;
use Automattic\WooCommerce\Admin\API\Reports\Orders\DataStore as OrdersDataStore;
/**
* Class P24_Products_Stats_Data_Store.
*/
class P24_Products_Stats_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Products Stats report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function update_sql_query_params( $query_args ) {
parent::update_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( OrdersDataStore::get_db_table_name() );
$this->interval_query->add_sql_clause( 'join', $metadata_join );
$this->total_query->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Taxes data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Taxes\DataStore;
/**
* Class P24_Taxes_Data_Store.
*/
class P24_Taxes_Data_Store extends DataStore {
/**
* Updates the totals and intervals database queries with parameters used for Orders report: categories, coupons and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* Taxes stats data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats\DataStore;
/**
* Class P24_Taxes_Stats_Data_Store.
*/
class P24_Taxes_Stats_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Taxes Stats report
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function update_sql_query_params( $query_args ) {
parent::update_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->total_query->add_sql_clause( 'join', $metadata_join );
$this->interval_query->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Variations data store.
*
* @package Przelewy24
*/
use Automattic\WooCommerce\Admin\API\Reports\Variations\DataStore;
/**
* Class P24_Variations_Data_Store.
*/
class P24_Variations_Data_Store extends DataStore {
/**
* Updates the database query with parameters used for Products report: categories and order status.
*
* @param array $query_args Query arguments supplied by the user.
*/
protected function add_sql_query_params( $query_args ) {
parent::add_sql_query_params( $query_args );
$metadata_join = P24_Multi_Currency::get_currency_filter_for_reports( self::get_db_table_name() );
$this->subquery->add_sql_clause( 'join', $metadata_join );
}
/**
* Get cache key.
*
* @param array $params Parameters.
*
* @return string
*/
protected function get_cache_key( $params ) {
return parent::get_cache_key( $params ) . '_' . P24_Multi_Currency::get_admin_reports_currency();
}
}