mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Merge branch 'matrixproducts' into cleanup
# Conflicts: # www/dist/.vite/manifest.json # www/dist/modules/MatrixProduct-PtaGHDSi.js
This commit is contained in:
commit
6b5527ee79
@ -16,6 +16,7 @@ class ArticleService
|
|||||||
function CopyArticle(int $id, bool $purchasePrices, bool $sellingPrices, bool $files, bool $properties,
|
function CopyArticle(int $id, bool $purchasePrices, bool $sellingPrices, bool $files, bool $properties,
|
||||||
bool $instructions, bool $partLists, bool $customFields, string $newArticleNumber = '')
|
bool $instructions, bool $partLists, bool $customFields, string $newArticleNumber = '')
|
||||||
{
|
{
|
||||||
|
$newArticleNumber = $this->app->DB->real_escape_string($newArticleNumber);
|
||||||
$this->app->DB->MysqlCopyRow('artikel','id',$id);
|
$this->app->DB->MysqlCopyRow('artikel','id',$id);
|
||||||
|
|
||||||
$idnew = $this->app->DB->GetInsertID();
|
$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 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"))
|
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");
|
$this->app->DB->Update("UPDATE artikel SET variante = 1, variante_von = '$id' WHERE id = '$idnew' LIMIT 1");
|
||||||
|
|
||||||
|
@ -130,13 +130,25 @@ final class MatrixProductService
|
|||||||
foreach ($optionArr as $option) {
|
foreach ($optionArr as $option) {
|
||||||
$groupId = $this->gateway->GetArticleGroupIdByName($articleId, $option['groupname']);
|
$groupId = $this->gateway->GetArticleGroupIdByName($articleId, $option['groupname']);
|
||||||
if (!$groupId) {
|
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);
|
$group = $this->gateway->InsertArticleGroup($obj);
|
||||||
$groupId = $group->id;
|
$groupId = $group->id;
|
||||||
}
|
}
|
||||||
$optionId = $this->gateway->GetArticleOptionIdByName($articleId, $groupId, $option['name']);
|
$optionId = $this->gateway->GetArticleOptionIdByName($articleId, $groupId, $option['name']);
|
||||||
if (!$optionId) {
|
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'],
|
||||||
|
articleNumberSuffix: $option['articlenumber_suffix'],
|
||||||
|
globalOptionId: $option['id'],
|
||||||
|
articleId: $articleId);
|
||||||
$this->gateway->InsertArticleOption($obj);
|
$this->gateway->InsertArticleOption($obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import Button from "primevue/button";
|
|||||||
import Dialog from "primevue/dialog";
|
import Dialog from "primevue/dialog";
|
||||||
import MultiSelect from "primevue/multiselect";
|
import MultiSelect from "primevue/multiselect";
|
||||||
import Fluid from "primevue/fluid";
|
import Fluid from "primevue/fluid";
|
||||||
|
import InputText from "primevue/inputtext";
|
||||||
import {onMounted, ref} from "vue";
|
import {onMounted, ref} from "vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {AlertErrorHandler} from "@res/js/ajaxErrorHandler";
|
import {AlertErrorHandler} from "@res/js/ajaxErrorHandler";
|
||||||
@ -41,6 +42,8 @@ async function save() {
|
|||||||
<Dialog visible modal header="Variante" style="width: 500px" @update:visible="emit('close')">
|
<Dialog visible modal header="Variante" style="width: 500px" @update:visible="emit('close')">
|
||||||
<Fluid>
|
<Fluid>
|
||||||
<div class="grid gap-1" style="grid-template-columns: 25% 75%;" autofocus>
|
<div class="grid gap-1" style="grid-template-columns: 25% 75%;" autofocus>
|
||||||
|
<label>Trennzeichen:</label>
|
||||||
|
<InputText v-model="model.separator" maxlength="2" />
|
||||||
<template v-for="group in model.groups">
|
<template v-for="group in model.groups">
|
||||||
<label>{{ group.name }}</label>
|
<label>{{ group.name }}</label>
|
||||||
<MultiSelect v-model="group.selected" :options="group.options" option-label="name" option-value="value"/>
|
<MultiSelect v-model="group.selected" :options="group.options" option-label="name" option-value="value"/>
|
||||||
|
4
www/dist/.vite/manifest.json
vendored
4
www/dist/.vite/manifest.json
vendored
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"classes/Modules/MatrixProduct/www/js/entry.js": {
|
"classes/Modules/MatrixProduct/www/js/entry.js": {
|
||||||
"file": "modules/MatrixProduct-BMHFRDZ6.js",
|
"file": "modules/MatrixProduct-PtaGHDSi.js",
|
||||||
"name": "modules/MatrixProduct",
|
"name": "modules/MatrixProduct",
|
||||||
"src": "classes/Modules/MatrixProduct/www/js/entry.js",
|
"src": "classes/Modules/MatrixProduct/www/js/entry.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"css": [
|
"css": [
|
||||||
"assets/MatrixProduct-DCtGag1V.css"
|
"assets/MatrixProduct-DbDUAZJF.css"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
2218
www/dist/modules/MatrixProduct-PtaGHDSi.js
vendored
Normal file
2218
www/dist/modules/MatrixProduct-PtaGHDSi.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -363,9 +363,10 @@ class Matrixprodukt
|
|||||||
$result[$option->groupId]['options'][] = ['value' => $option->id, 'name' => $option->name];
|
$result[$option->groupId]['options'][] = ['value' => $option->id, 'name' => $option->name];
|
||||||
$result[$option->groupId]['selected'][] = $option->id;
|
$result[$option->groupId]['selected'][] = $option->id;
|
||||||
}
|
}
|
||||||
return new JsonResponse(['groups' => $result ?? []]);
|
return new JsonResponse(['groups' => $result ?? [], 'separator' => '_']);
|
||||||
} else {
|
} else {
|
||||||
$json = $this->request->getJson();
|
$json = $this->request->getJson();
|
||||||
|
$separator = substr($json->separator ?? '_', 0, 2);
|
||||||
$list = [[]];
|
$list = [[]];
|
||||||
foreach ($json->groups as $group) {
|
foreach ($json->groups as $group) {
|
||||||
if (empty($group->selected))
|
if (empty($group->selected))
|
||||||
@ -373,18 +374,18 @@ class Matrixprodukt
|
|||||||
$newList = [];
|
$newList = [];
|
||||||
foreach ($list as $old) {
|
foreach ($list as $old) {
|
||||||
foreach ($group->selected as $option) {
|
foreach ($group->selected as $option) {
|
||||||
$newList[] = array_merge($old, [$option]);
|
$newList[] = array_merge($old, [(int)$option]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$list = $newList;
|
$list = $newList;
|
||||||
}
|
}
|
||||||
$oldnumber = $this->app->DB->Select("SELECT nummer FROM artikel WHERE id = $json->articleId");
|
$oldnumber = $this->app->DB->Select("SELECT nummer FROM artikel WHERE id = (int)$json->articleId");
|
||||||
$created = [];
|
$created = [];
|
||||||
foreach ($list as $optionSet) {
|
foreach ($list as $optionSet) {
|
||||||
$variantId = $this->service->GetVariantIdByOptionSet($optionSet);
|
$variantId = $this->service->GetVariantIdByOptionSet($optionSet);
|
||||||
if ($variantId)
|
if ($variantId)
|
||||||
continue;
|
continue;
|
||||||
$number = $oldnumber.'_'.$this->service->GetSuffixStringForOptionSet($optionSet);
|
$number = $oldnumber.$separator.$this->service->GetSuffixStringForOptionSet($optionSet);
|
||||||
$newId = $this->articleService->CopyArticle($json->articleId, true, true, true, true, true, true, true, $number);
|
$newId = $this->articleService->CopyArticle($json->articleId, true, true, true, true, true, true, true, $number);
|
||||||
$this->service->SaveVariant($json->articleId, $newId, $optionSet);
|
$this->service->SaveVariant($json->articleId, $newId, $optionSet);
|
||||||
$created[] = $number;
|
$created[] = $number;
|
||||||
|
Loading…
Reference in New Issue
Block a user