From adc4ee269550fd22d946cb8ae04a41768cbdfaee Mon Sep 17 00:00:00 2001 From: solocla Date: Tue, 27 Oct 2026 12:23:56 +0100 Subject: [PATCH] fixed matrrici asales 3 --- public/userarea/sales_matrici.php | 2201 +---------------------------- 1 file changed, 1 insertion(+), 2200 deletions(-) diff --git a/public/userarea/sales_matrici.php b/public/userarea/sales_matrici.php index ed3c6510..819451cf 100644 --- a/public/userarea/sales_matrici.php +++ b/public/userarea/sales_matrici.php @@ -23,6 +23,7 @@ if (!userCan('sales.matrici.view')) { exit; } $canDeliveries = userCan('sales.deliveries.view'); +$canQuote = userCan('sales.quote.view'); /* ============================================================ * AJAX @@ -781,2206 +782,6 @@ if ($action === 'list' || $action === 'detail') { - -
- - - -
-
-
-
-
-
-
-
-
Matrici: prezzi e mescole
- Dati Mago4 -
-
- -
-
- -
- - - -
-
-
- -
- - - - - - - - -
-
-
- -
-
- -
-
-
- -
- - - - - - - -
-
-
- -
- - - - -
-
-
-
- - - -
-
-
Carico le righe d'ordine…
-
- - -
-
-
-
- -
- - - - - - - - - - - -getConnection(); - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - - // Permesso specifico: prezzi di vendita per matrice e cliente (dati riservati) - if (!userCan('sales.matrici.view')) { - if (isset($_GET['action'])) { - MagoSalesStats::jsonOut(['success' => false, 'message' => 'Non hai i permessi per questa pagina']); - } - while (ob_get_level()) ob_end_clean(); - http_response_code(403); - echo '

Accesso non consentito

Non hai i permessi per visualizzare questa pagina.

Torna alla Dashboard
'; - exit; - } - $canDeliveries = userCan('sales.deliveries.view'); - $canQuote = userCan('sales.quote.view'); - - /* ============================================================ - * AJAX - * ============================================================ */ - function mx_date($v, $def) - { - $v = (string)$v; - return preg_match('/^\d{4}-\d{2}-\d{2}$/', $v) ? $v : $def; - } - function mx_customers() - { - $c = trim((string)($_GET['c'] ?? '')); - return $c === '' ? [] : array_slice(array_values(array_filter(array_map('trim', explode(',', $c)))), 0, 200); - } - - $action = $_GET['action'] ?? ''; - - if ($action === 'filters') { - MagoSalesStats::jsonOut(MagoSalesStats::filterOptions($pdo)); - } - - if ($action === 'list' || $action === 'detail') { - try { - $from = mx_date($_GET['from'] ?? '', date('Y-m-d', strtotime('-365 days'))); - $to = mx_date($_GET['to'] ?? '', date('Y-m-d')); - if ($from < MagoMatriceStats::SINCE) $from = MagoMatriceStats::SINCE; - if ($to < $from) $to = $from; - if ($action === 'list') { - MagoSalesStats::jsonOut(MagoMatriceStats::buildList($pdo, $from, $to, mx_customers())); - } - MagoSalesStats::jsonOut(MagoMatriceStats::buildDetail($pdo, (string)($_GET['k'] ?? ''), $from, $to, mx_customers())); - } catch (Throwable $e) { - MagoSalesStats::jsonOut(['success' => false, 'message' => $e->getMessage()]); - } - } - ?> - - - - - - - - - Matrici: prezzi e mescole - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?> - - - - - - - - - - - - - - - - - -