From 57cb41afb818c5c7958107f8265641482cdd4862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Tue, 17 Jan 2023 21:45:45 +0100 Subject: [PATCH] Mapovani id produktu --- .gitlab-ci.yml | 2 +- cf2022.conf | 5 +++-- lib/CF2022/Controller/Orders.pm | 2 ++ lib/CF2022/Helpers/Core.pm | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6e9c39..72e63bc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ image: docker:20.10.9 variables: DOCKER_TLS_CERTDIR: "/certs" - IMAGE_VER: 0.10.0 + IMAGE_VER: 0.11.0 services: - docker:20.10.9-dind diff --git a/cf2022.conf b/cf2022.conf index 5d51031..52d5eec 100644 --- a/cf2022.conf +++ b/cf2022.conf @@ -9,7 +9,8 @@ pretix_event => 'cf2022', pretix_qid_sso => 29, # identifikator otazky SSO UID pretix_qid_region => 8, # identifikator otazky Kraj - pretix_product_member => 1, # produkt pro cleny - pretix_product_regp => 2, # produkt pro regp +# pretix_product_member => 1, # produkt pro cleny +# pretix_product_regp => 2, # produkt pro regp mail_domain => 'pirati.cz', + products_map => {split /\D+/, $ENV{CFG_PRODUCTS_MAP}}, } diff --git a/lib/CF2022/Controller/Orders.pm b/lib/CF2022/Controller/Orders.pm index b7fb11c..c9a0c6f 100644 --- a/lib/CF2022/Controller/Orders.pm +++ b/lib/CF2022/Controller/Orders.pm @@ -99,6 +99,8 @@ sub create ($c ) { } } + $product->{id} = $c->mapped_product_id($product->{id}); + push @products, $product; } diff --git a/lib/CF2022/Helpers/Core.pm b/lib/CF2022/Helpers/Core.pm index b5d5ff4..30a6584 100644 --- a/lib/CF2022/Helpers/Core.pm +++ b/lib/CF2022/Helpers/Core.pm @@ -70,6 +70,9 @@ sub register ($class, $self, $conf) { return $data; }); + $self->helper(mapped_product_id => sub ($c, $id) { + return $c->cfg->{products_map}{$id} // $id; + }); } 1; -- GitLab