feat: Add CronJob functionality and integrate with existing services

- Implemented CronJobProcessor for managing scheduled jobs and processing job queues.
- Created CronJobRepository for database interactions related to cron jobs.
- Defined CronJobType for job types, statuses, and backoff calculations.
- Added ApiloLogger for logging actions related to API interactions.
- Enhanced UpdateController to check for updates and display update logs.
- Updated FormAction to include a preview action for forms.
- Modified ApiRouter to handle new dependencies for OrderAdminService and ProductsApiController.
- Extended DictionariesApiController to manage attributes and producers.
- Enhanced ProductsApiController with variant management and image upload functionality.
- Updated ShopBasketController and ShopProductController to sort attributes and handle custom fields.
- Added configuration for cron jobs in config.php.
- Initialized apilo-sync-queue.json for managing sync tasks.
This commit is contained in:
2026-02-27 14:54:05 +01:00
parent 3ecbe628dc
commit 31fd0442b2
33 changed files with 2714 additions and 200 deletions

View File

@@ -323,7 +323,9 @@ class TransportRepository
$transports[] = $tr;
}
if ( \Shared\Helpers\Helpers::normalize_decimal( \Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon ) ) >= \Shared\Helpers\Helpers::normalize_decimal( $settings['free_delivery'] ) )
$products_summary = (float)\Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon );
if ( \Shared\Helpers\Helpers::normalize_decimal( $products_summary ) >= \Shared\Helpers\Helpers::normalize_decimal( $settings['free_delivery'] ) )
{
for ( $i = 0; $i < count( $transports ); $i++ ) {
if ( $transports[$i]['delivery_free'] == 1 ) {
@@ -332,7 +334,39 @@ class TransportRepository
}
}
return $transports;
// Ukryj transporty, dla których nie ma żadnej dostępnej formy płatności
$paymentMethodRepo = new \Domain\PaymentMethod\PaymentMethodRepository( $this->db );
$filtered = [];
foreach ( $transports as $tr )
{
$paymentMethods = $paymentMethodRepo->paymentMethodsByTransport( $tr['id'] );
$order_total = $products_summary + (float)$tr['cost'];
$has_available_pm = false;
foreach ( $paymentMethods as $pm )
{
$min = isset( $pm['min_order_amount'] ) ? (float)$pm['min_order_amount'] : null;
$max = isset( $pm['max_order_amount'] ) ? (float)$pm['max_order_amount'] : null;
$available = true;
if ( $min !== null && $min > 0 && $order_total < $min ) $available = false;
if ( $max !== null && $max > 0 && $order_total > $max ) $available = false;
if ( $available )
{
$has_available_pm = true;
break;
}
}
if ( $has_available_pm )
{
$filtered[] = $tr;
}
}
return $filtered;
}
/**