From aad77a350d343da9368afb234c86984f93b43938 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Fri, 25 Oct 2024 12:23:19 +0200 Subject: [PATCH] Small fixes and selectable separator when creating variants --- .../Article/Service/ArticleService.php | 3 +- .../MatrixProduct/MatrixProductService.php | 17 ++++- .../MatrixProduct/www/js/CreateMissing.vue | 3 + www/dist/.vite/manifest.json | 2 +- ...-BFgn1wkj.js => MatrixProduct-PtaGHDSi.js} | 68 +++++++++---------- www/pages/matrixprodukt.php | 9 +-- 6 files changed, 60 insertions(+), 42 deletions(-) rename www/dist/modules/{MatrixProduct-BFgn1wkj.js => MatrixProduct-PtaGHDSi.js} (73%) diff --git a/classes/Modules/Article/Service/ArticleService.php b/classes/Modules/Article/Service/ArticleService.php index 11b13b54..5e204c5a 100644 --- a/classes/Modules/Article/Service/ArticleService.php +++ b/classes/Modules/Article/Service/ArticleService.php @@ -16,6 +16,7 @@ class ArticleService function CopyArticle(int $id, bool $purchasePrices, bool $sellingPrices, bool $files, bool $properties, bool $instructions, bool $partLists, bool $customFields, string $newArticleNumber = '') { + $newArticleNumber = $this->app->DB->real_escape_string($newArticleNumber); $this->app->DB->MysqlCopyRow('artikel','id',$id); $idnew = $this->app->DB->GetInsertID(); @@ -26,7 +27,7 @@ class ArticleService $this->app->DB->Update("UPDATE artikel SET steuersatz = '$steuersatz' WHERE id = '$idnew' LIMIT 1"); } - $this->app->DB->Update("UPDATE artikel SET nummer='$newArticleNumber' WHERE id='$idnew' LIMIT 1"); + $this->app->DB->Update("UPDATE artikel SET nummer='$newArticleNumber', matrixprodukt = 0 WHERE id='$idnew' LIMIT 1"); if($this->app->DB->Select("SELECT variante_kopie FROM artikel WHERE id = '$id' LIMIT 1")) $this->app->DB->Update("UPDATE artikel SET variante = 1, variante_von = '$id' WHERE id = '$idnew' LIMIT 1"); diff --git a/classes/Modules/MatrixProduct/MatrixProductService.php b/classes/Modules/MatrixProduct/MatrixProductService.php index 96933a0a..74c0d9a6 100644 --- a/classes/Modules/MatrixProduct/MatrixProductService.php +++ b/classes/Modules/MatrixProduct/MatrixProductService.php @@ -130,13 +130,26 @@ final class MatrixProductService foreach ($optionArr as $option) { $groupId = $this->gateway->GetArticleGroupIdByName($articleId, $option['groupname']); if (!$groupId) { - $obj = new Group($option['groupname'], nameExternal: $option['groupnameext'], projectId: $option['groupprojekt'], required: $option['grouprequired'], articleId: $articleId); + $obj = new Group( + name: $option['groupname'], + nameExternal: $option['groupnameext'], + projectId: $option['groupprojekt'], + required: $option['grouprequired'], + articleId: $articleId); $group = $this->gateway->InsertArticleGroup($obj); $groupId = $group->id; } $optionId = $this->gateway->GetArticleOptionIdByName($articleId, $groupId, $option['name']); if (!$optionId) { - $obj = new Option($option['name'], $groupId, nameExternal: $option['name_ext'], sort: $option['sort'], globalOptionId: $option['id'], articleId: $articleId); + $obj = new Option( + name: $option['name'], + groupId: $groupId, + nameExternal: $option['name_ext'], + sort: $option['sort'], + articleNumber: $option['articlenumber'], + articleNumberSuffix: $option['articlenumber_suffix'], + globalOptionId: $option['id'], + articleId: $articleId); $this->gateway->InsertArticleOption($obj); } } diff --git a/classes/Modules/MatrixProduct/www/js/CreateMissing.vue b/classes/Modules/MatrixProduct/www/js/CreateMissing.vue index 3e4f2697..87da5f7d 100644 --- a/classes/Modules/MatrixProduct/www/js/CreateMissing.vue +++ b/classes/Modules/MatrixProduct/www/js/CreateMissing.vue @@ -9,6 +9,7 @@ import Button from "primevue/button"; import Dialog from "primevue/dialog"; import MultiSelect from "primevue/multiselect"; import Fluid from "primevue/fluid"; +import InputText from "primevue/inputtext"; import {onMounted, ref} from "vue"; import axios from "axios"; import {AlertErrorHandler} from "@res/js/ajaxErrorHandler"; @@ -41,6 +42,8 @@ async function save() {
+ +