This commit is contained in:
Thomas Peterson 2026-03-11 14:14:12 +01:00
parent acae4b4843
commit 60148d9c9e
19 changed files with 1120 additions and 233 deletions

View File

@ -114,6 +114,12 @@ class Orderpos
private $uploadFinish; private $uploadFinish;
#[ORM\OneToMany(targetEntity: 'Upload', mappedBy: 'orderPos')] #[ORM\OneToMany(targetEntity: 'Upload', mappedBy: 'orderPos')]
protected $uploads; protected $uploads;
/**
* null = ausstehend, 1 = freigegeben, -1 = abgelehnt
*/
#[ORM\Column(name: 'external_approval_status', type: 'integer', nullable: true)]
private ?int $externalApprovalStatus = null;
/** /**
* @var Product * @var Product
*/ */
@ -1030,4 +1036,14 @@ class Orderpos
{ {
$this->uploads = $uploads; $this->uploads = $uploads;
} }
public function getExternalApprovalStatus(): ?int
{
return $this->externalApprovalStatus;
}
public function setExternalApprovalStatus(?int $status): void
{
$this->externalApprovalStatus = $status;
}
} }

View File

@ -666,6 +666,14 @@ class Product
#[ORM\Column(name: 'confirmOne', type: 'boolean')] #[ORM\Column(name: 'confirmOne', type: 'boolean')]
protected $confirmOne; protected $confirmOne;
/**
* Externe Freigabe erforderlich
*
* @var boolean
*/
#[ORM\Column(name: 'confirmExternal', type: 'boolean', options: ['default' => false])]
protected $confirmExternal = false;
/** /**
* Lager aktiviert Produkt * Lager aktiviert Produkt
* *
@ -2650,6 +2658,16 @@ class Product
$this->confirm = $confirm; $this->confirm = $confirm;
} }
public function isConfirmExternal(): bool
{
return (bool) $this->confirmExternal;
}
public function setConfirmExternal(bool $confirmExternal): void
{
$this->confirmExternal = $confirmExternal;
}
/** /**
* @return int * @return int
*/ */

View File

@ -0,0 +1,75 @@
<?php
namespace PSC\Shop\OrderBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use PSC\Shop\EntityBundle\Entity\Orderpos;
use PSC\Shop\EntityBundle\Entity\Upload;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\Routing\Attribute\Route;
#[Route(path: '/external-approval')]
class ExternalApprovalController extends AbstractController
{
#[Route(path: '/{uuid}', name: 'psc_shop_order_external_approval_show', methods: ['GET', 'POST'])]
public function show(string $uuid, Request $request, EntityManagerInterface $em): Response
{
/** @var Orderpos|null $orderpos */
$orderpos = $em->getRepository(Orderpos::class)->findOneBy(['uuid' => $uuid]);
if (!$orderpos) {
throw $this->createNotFoundException('Position nicht gefunden.');
}
if ($request->isMethod('POST')) {
$action = $request->request->get('action');
if ($action === 'approve') {
$orderpos->setExternalApprovalStatus(1);
} elseif ($action === 'reject') {
$orderpos->setExternalApprovalStatus(-1);
}
$em->flush();
return $this->redirectToRoute('psc_shop_order_external_approval_show', ['uuid' => $uuid]);
}
return $this->render('@PSCShopOrder/external_approval/show.html.twig', [
'orderpos' => $orderpos,
]);
}
#[Route(path: '/{uuid}/download/{uploadUuid}', name: 'psc_shop_order_external_approval_download', methods: ['GET'])]
public function download(string $uuid, string $uploadUuid, EntityManagerInterface $em): Response
{
/** @var Orderpos|null $orderpos */
$orderpos = $em->getRepository(Orderpos::class)->findOneBy(['uuid' => $uuid]);
if (!$orderpos) {
throw $this->createNotFoundException();
}
/** @var Upload|null $upload */
$upload = $em->getRepository(Upload::class)->findOneBy(['uuid' => $uploadUuid]);
if (!$upload || $upload->getOrderPos()->getUuid() !== $uuid) {
throw $this->createNotFoundException();
}
$absolutePath = $this->getParameter('kernel.project_dir') . '/../old/public/' . $upload->getPath();
if (!file_exists($absolutePath)) {
throw $this->createNotFoundException('Datei nicht gefunden.');
}
$response = new BinaryFileResponse($absolutePath);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $upload->getName());
return $response;
}
}

View File

@ -3,6 +3,12 @@ psc_shop_order_backend:
type: attribute type: attribute
prefix: /backend/order prefix: /backend/order
psc_shop_order:
resource: "@PSCShopOrderBundle/Controller"
type: attribute
prefix: /order
psc_shop_order_api: psc_shop_order_api:
resource: "@PSCShopOrderBundle/Api" resource: "@PSCShopOrderBundle/Api"

View File

@ -0,0 +1,161 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Freigabe — Position {{ orderpos.uuid }}</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 min-h-screen flex items-start justify-center py-12 px-4">
<div class="w-full max-w-2xl space-y-6">
{# Header #}
<div class="text-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-12 h-12 mx-auto text-gray-500 mb-2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 0 1 21.75 8.25Z"/>
</svg>
<h1 class="text-2xl font-semibold text-gray-800">Externe Freigabe</h1>
<p class="text-sm text-gray-500 mt-1">Bestellposition #{{ orderpos.uuid }}</p>
</div>
{# Statusanzeige #}
<div class="rounded-lg border bg-white shadow-sm p-6">
{% if orderpos.externalApprovalStatus == 1 %}
<div class="flex items-center gap-3 p-4 rounded-lg bg-green-50 border border-green-200">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 text-green-600 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round"
d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/>
</svg>
<div>
<p class="font-semibold text-green-800">Freigegeben</p>
<p class="text-sm text-green-700">Diese Position wurde freigegeben.</p>
</div>
</div>
{% elseif orderpos.externalApprovalStatus == -1 %}
<div class="flex items-center gap-3 p-4 rounded-lg bg-red-50 border border-red-200">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 text-red-600 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round"
d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/>
</svg>
<div>
<p class="font-semibold text-red-800">Abgelehnt</p>
<p class="text-sm text-red-700">Diese Position wurde abgelehnt.</p>
</div>
</div>
{% else %}
<div class="flex items-center gap-3 p-4 rounded-lg bg-yellow-50 border border-yellow-200">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 text-yellow-600 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round"
d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/>
</svg>
<div>
<p class="font-semibold text-yellow-800">Ausstehend</p>
<p class="text-sm text-yellow-700">Diese Position wartet auf Ihre Freigabe.</p>
</div>
</div>
{% endif %}
</div>
{# Positionsdetails #}
<div class="rounded-lg border bg-white shadow-sm">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-base font-semibold text-gray-800">Positionsdetails</h2>
</div>
<div class="px-6 py-4 space-y-3 text-sm">
<div class="flex justify-between">
<span class="text-gray-500">Produkt</span>
<span class="font-medium text-gray-800">{{ orderpos.product.title }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">Menge</span>
<span class="font-medium text-gray-800">{{ orderpos.count }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">Preis (netto)</span>
<span class="font-medium text-gray-800">{{ orderpos.priceAllNetto|number_format(2, ',', '.') }} €</span>
</div>
{% if orderpos.order %}
<div class="flex justify-between">
<span class="text-gray-500">Auftragsnummer</span>
<span class="font-medium text-gray-800">{{ orderpos.order.alias }}</span>
</div>
{% endif %}
</div>
</div>
{# Uploads #}
{% if orderpos.uploads|length > 0 %}
<div class="rounded-lg border bg-white shadow-sm">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-base font-semibold text-gray-800">Druckdaten ({{ orderpos.uploads|length }})</h2>
</div>
<ul class="divide-y divide-gray-100">
{% for upload in orderpos.uploads %}
<li class="px-6 py-3 flex items-center justify-between gap-4">
<div class="flex items-center gap-3 min-w-0">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-5 h-5 text-gray-400 shrink-0">
<path stroke-linecap="round" stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"/>
</svg>
<span class="text-sm text-gray-800 truncate">{{ upload.name }}</span>
{% if upload.typ %}
<span class="text-xs text-gray-400 shrink-0">{{ upload.typ }}</span>
{% endif %}
</div>
<a href="{{ path('psc_shop_order_external_approval_download', {uuid: orderpos.uuid, uploadUuid: upload.uuid}) }}"
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium text-white bg-green-600 hover:bg-green-700 transition-colors shrink-0">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-4 h-4">
<path stroke-linecap="round" stroke-linejoin="round"
d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"/>
</svg>
Download
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{# Aktionen #}
{% if orderpos.externalApprovalStatus is null %}
<div class="rounded-lg border bg-white shadow-sm p-6">
<h2 class="text-base font-semibold text-gray-800 mb-4">Ihre Entscheidung</h2>
<div class="flex gap-4">
<form method="post" action="{{ path('psc_shop_order_external_approval_show', {uuid: orderpos.uuid}) }}" class="flex-1">
<input type="hidden" name="action" value="approve">
<button type="submit"
class="w-full inline-flex items-center justify-center gap-2 px-5 py-3 rounded-lg text-sm font-semibold text-white bg-green-600 hover:bg-green-700 transition-colors shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round"
d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/>
</svg>
Freigeben
</button>
</form>
<form method="post" action="{{ path('psc_shop_order_external_approval_show', {uuid: orderpos.uuid}) }}" class="flex-1">
<input type="hidden" name="action" value="reject">
<button type="submit"
class="w-full inline-flex items-center justify-center gap-2 px-5 py-3 rounded-lg text-sm font-semibold text-white bg-red-600 hover:bg-red-700 transition-colors shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round"
d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z"/>
</svg>
Ablehnen
</button>
</form>
</div>
</div>
{% endif %}
</div>
</body>
</html>

View File

@ -79,6 +79,7 @@ class PermissionType extends AbstractType
$builder $builder
->add('confirm', CheckboxType::class, ['required' => false, 'label' => 'Requiresapproval']) ->add('confirm', CheckboxType::class, ['required' => false, 'label' => 'Requiresapproval'])
->add('confirmOne', CheckboxType::class, ['required' => false, 'label' => 'Onlycontact']) ->add('confirmOne', CheckboxType::class, ['required' => false, 'label' => 'Onlycontact'])
->add('confirmExternal', CheckboxType::class, ['required' => false, 'label' => 'Requiresexternalapproval'])
->add('confirmAccount', EntityType::class, [ ->add('confirmAccount', EntityType::class, [
'class' => 'PSC\Shop\EntityBundle\Entity\Account', 'class' => 'PSC\Shop\EntityBundle\Entity\Account',
'choice_label' => 'title', 'choice_label' => 'title',

View File

@ -1,9 +1,10 @@
Company: Firma Company: Firma
save: Speichern save: Speichern
Persons: Person/en Persons: Personen
Onlycontact: Nur ein Kontakt muss freigeben Onlycontact: Ein Kontakt reicht zur Freigabe
nothingselected: Nichts ausgewählt nothingselected: Keine Auswahl
Requiresapproval: Freigabebedürftig Requiresapproval: Freigabe erforderlich
Requiresexternalapproval: Freigabe extern erforderlich
setting: Einstellungen setting: Einstellungen
Product: Produkt Product: Produkt
release: Freigabe release: Freigabe

View File

@ -1,67 +1,92 @@
{% extends 'backend_base.html.twig' %} {% extends 'backend_tailwind_base.html.twig' %}
{% import '@PSCBackendDashboard/tree/motivtheme.html.twig' as macros %} {% form_theme form 'tailwind_formtheme.html.twig' %}
{% trans_default_domain 'core_product_permission' %} {% trans_default_domain 'core_product_permission' %}
{% block body %}
<div class="header"> {% block header %}
<div class="row"> <div class="flex items-center justify-between w-full">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6"> <h1 class="text-psc text-2xl font-medium flex items-center gap-2">
<h3> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="h-8 w-8">
<i class="fa-fw fa fa-key"></i> <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 0 1 21.75 8.25Z" />
{{ 'Product'|trans }} <span>> </svg>
{{ 'release'|trans }} </span> {{ 'Product'|trans }}
<a target="_blank" href="/article/show/uuid/{{ product.uuid }}">{{ 'show'|trans }}</a> <span class="text-gray-400">/</span>
</h3> <span class="text-gray-500">{{ 'release'|trans }}</span>
</div> <a target="_blank" href="/article/show/uuid/{{ product.uuid }}"
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 text-end"> class="ml-2 text-sm font-normal text-psc-500 hover:underline">
<a href="{{ path("backend_production_product_edit", {uuid: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-arrow-left"></i> {{ 'back'|trans }}</a> {{ 'show'|trans }}
</div> </a>
</div> </h1>
<a href="{{ path('backend_production_product_edit', {uuid: product.uuid}) }}"
class="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 shadow-sm">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18" />
</svg>
{{ 'back'|trans }}
</a>
</div> </div>
<div class="body">
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="header">
<h5>{{ product.title }} - {{ 'setting'|trans }}</h5>
</div>
<div class="body">
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
{{ form_errors(form) }}
<div class="row mb-3">
<label class="col-md-2 form-control-label">{{ form_label(form.confirm) }}</label>
<div class="col-md-10">
{{ form_widget(form.confirm) }}
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 form-control-label">{{ form_label(form.confirmOne) }}</label>
<div class="col-md-10">
{{ form_widget(form.confirmOne) }}
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 form-control-label">{{ form_label(form.confirmAccount) }}</label>
<div class="col-md-10">
{{ form_widget(form.confirmAccount) }}
</div>
</div>
<div class="row mb-3">
<label class="col-md-2 form-control-label">{{ form_label(form.confirm_contacts) }}</label>
<div class="col-md-10">
{{ form_widget(form.confirm_contacts) }}
</div>
</div>
{{ form_end(form) }}
</div>
</div>
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% block body %}
<div class="rounded-sm border bg-white shadow-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-base font-semibold text-gray-800">{{ product.title }}{{ 'setting'|trans }}</h2>
</div>
<div class="px-6 py-6">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class="space-y-6 max-w-2xl">
<div class="flex items-start gap-3">
{{ form_widget(form.confirm, {attr: {class: 'mt-0.5 h-4 w-4 rounded border-gray-300 text-psc-600 focus:ring-psc-500'}}) }}
<div>
{{ form_label(form.confirm, null, {label_attr: {class: 'block text-sm font-medium text-gray-700 cursor-pointer'}}) }}
<p class="text-xs text-gray-500 mt-0.5">Bestellungen dieses Produkts müssen von einem Verantwortlichen freigegeben werden.</p>
{{ form_errors(form.confirm) }}
</div>
</div>
<div class="flex items-start gap-3">
{{ form_widget(form.confirmOne, {attr: {class: 'mt-0.5 h-4 w-4 rounded border-gray-300 text-psc-600 focus:ring-psc-500'}}) }}
<div>
{{ form_label(form.confirmOne, null, {label_attr: {class: 'block text-sm font-medium text-gray-700 cursor-pointer'}}) }}
<p class="text-xs text-gray-500 mt-0.5">Die Freigabe gilt als erteilt, sobald eine der ausgewählten Personen zugestimmt hat.</p>
{{ form_errors(form.confirmOne) }}
</div>
</div>
<div class="flex items-start gap-3">
{{ form_widget(form.confirmExternal, {attr: {class: 'mt-0.5 h-4 w-4 rounded border-gray-300 text-psc-600 focus:ring-psc-500'}}) }}
<div>
{{ form_label(form.confirmExternal, null, {label_attr: {class: 'block text-sm font-medium text-gray-700 cursor-pointer'}}) }}
<p class="text-xs text-gray-500 mt-0.5">Bestellungen dieses Produkts müssen von einer externen Person freigegeben werden.</p>
{{ form_errors(form.confirmExternal) }}
</div>
</div>
<div>
{{ form_label(form.confirmAccount, null, {label_attr: {class: 'block text-sm font-medium text-gray-700 mb-1'}}) }}
{{ form_widget(form.confirmAccount, {attr: {class: 'w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-psc-500 focus:border-transparent bg-white'}}) }}
{{ form_errors(form.confirmAccount) }}
</div>
<div>
{{ form_label(form.confirm_contacts, null, {label_attr: {class: 'block text-sm font-medium text-gray-700 mb-1'}}) }}
{{ form_widget(form.confirm_contacts, {attr: {class: 'w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-psc-500 focus:border-transparent bg-white', size: '8'}}) }}
{{ form_errors(form.confirm_contacts) }}
<p class="mt-1 text-xs text-gray-500">Strg (Windows) bzw. Cmd (Mac) gedrückt halten, um mehrere Personen auszuwählen.</p>
</div>
<div class="pt-2">
{% do form.save.setRendered() %}
<button type="submit" class="inline-flex items-center gap-2 px-5 py-2.5 text-sm font-medium text-white bg-psc-500 hover:bg-psc-600 rounded-md shadow-sm transition-colors">
{{ 'save'|trans }}
</button>
</div>
</div>
{{ form_end(form) }}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,111 @@
<?php
namespace PSC\Shop\QueueBundle\Event\Position;
use PSC\Shop\QueueBundle\Event\Event;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('events')]
class ApprovalExternalAccept extends Event
{
/** @var string */
protected $position;
/** @var string */
protected $order;
/** @var string */
protected $mail;
/** @var string */
protected $message;
public function getType()
{
return 'position_approval_external_accept';
}
public function getDescription()
{
return 'Position Freigabe akzeptiert (Extern)';
}
public function getData()
{
return array(
'position' => $this->position,
'message' => $this->message,
'order' => $this->order,
'mail' => $this->mail,
);
}
public function setData($data)
{
$this->mail = $data['mail'];
$this->position = $data['position'];
$this->message = $data['message'];
$this->order = $data['order'];
}
/**
* @return string
*/
public function getPosition(): string
{
return $this->position;
}
/**
* @param string $position
*/
public function setPosition(string $position): void
{
$this->position = $position;
}
/**
* @return string
*/
public function getOrder(): string
{
return $this->order;
}
/**
* @param string $order
*/
public function setOrder(string $order): void
{
$this->order = $order;
}
/**
* @return string
*/
public function getMail(): string
{
return $this->mail;
}
/**
* @param string $contact
*/
public function setMail(string $mail): void
{
$this->mail = $mail;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
/**
* @param string $message
*/
public function setMessage(string $message): void
{
$this->message = $message;
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace PSC\Shop\QueueBundle\Event\Position;
use PSC\Shop\QueueBundle\Event\Event;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('events')]
class ApprovalExternalDeclined extends Event
{
/** @var string */
protected $position;
/** @var string */
protected $order;
/** @var string */
protected $mail;
/** @var string */
protected $message;
public function getType()
{
return 'position_approval_external_declined';
}
public function getDescription()
{
return 'Position Freigabe abgelehnt (Extern)';
}
public function getData()
{
return array(
'position' => $this->position,
'message' => $this->message,
'order' => $this->order,
'mail' => $this->mail,
);
}
public function setData($data)
{
$this->mail = $data['mail'];
$this->position = $data['position'];
$this->message = $data['message'];
$this->order = $data['order'];
}
/**
* @return string
*/
public function getPosition(): string
{
return $this->position;
}
/**
* @param string $position
*/
public function setPosition(string $position): void
{
$this->position = $position;
}
/**
* @return string
*/
public function getOrder(): string
{
return $this->order;
}
/**
* @param string $order
*/
public function setOrder(string $order): void
{
$this->order = $order;
}
/**
* @return string
*/
public function getMail(): string
{
return $this->mail;
}
/**
* @param string $contact
*/
public function setMail(string $mail): void
{
$this->mail = $mail;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
/**
* @param string $message
*/
public function setMessage(string $message): void
{
$this->message = $message;
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace PSC\Shop\QueueBundle\Event\Position;
use PSC\Shop\QueueBundle\Event\Event;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
#[AutoconfigureTag('events')]
class ApprovalExternalRequest extends Event
{
/** @var string */
protected $position;
/** @var string */
protected $order;
public function getType()
{
return 'position_approval_external_request';
}
public function getDescription()
{
return 'Position Freigabe erforderlich (Extern)';
}
public function getData()
{
return array(
'position' => $this->position,
'order' => $this->order,
);
}
public function setData($data)
{
$this->position = $data['position'];
$this->order = $data['order'];
}
/**
* @return string
*/
public function getPosition(): string
{
return $this->position;
}
/**
* @param string $position
*/
public function setPosition(string $position): void
{
$this->position = $position;
}
/**
* @return string
*/
public function getOrder(): string
{
return $this->order;
}
/**
* @param string $order
*/
public function setOrder(string $order): void
{
$this->order = $order;
}
}

View File

@ -25,6 +25,9 @@ use PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Finish;
use PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Start; use PSC\Shop\QueueBundle\Event\Contact\Password\Reset\Start;
use PSC\Shop\QueueBundle\Event\EventInterface; use PSC\Shop\QueueBundle\Event\EventInterface;
use PSC\Shop\QueueBundle\Event\Order\Create; use PSC\Shop\QueueBundle\Event\Order\Create;
use PSC\Shop\QueueBundle\Event\Position\ApprovalExternalAccept;
use PSC\Shop\QueueBundle\Event\Position\ApprovalExternalDeclined;
use PSC\Shop\QueueBundle\Event\Position\ApprovalExternalRequest;
use PSC\Shop\QueueBundle\Event\Position\Contact\Approval\Accept; use PSC\Shop\QueueBundle\Event\Position\Contact\Approval\Accept;
use PSC\Shop\QueueBundle\Event\Position\Contact\Approval\Declined; use PSC\Shop\QueueBundle\Event\Position\Contact\Approval\Declined;
use PSC\Shop\QueueBundle\Event\Position\Contact\Approval\Request; use PSC\Shop\QueueBundle\Event\Position\Contact\Approval\Request;
@ -1167,6 +1170,120 @@ class Mail implements QueueInterface, ConfigurableElementInterface
return true; return true;
} }
if ($event instanceof ApprovalExternalRequest) {
$templateVars->loadOrder($event->getOrder());
$vars = $templateVars->getPosTwigVars($event->getPosition());
try {
$message = new Email()
->subject($subject->render($vars))
->from($from->render($vars))
->to(trim($to->render($vars)));
if ($text) {
$message->text($text->render($vars));
}
if ($bcc) {
$bccArray = explode(',', $bcc->render($vars));
foreach ($bccArray as $bc) {
if (trim($bc) != '') {
$message->addBcc(trim($bc));
}
}
}
if ($html) {
$message->html($html->render($vars));
}
if ($mailDoc->isSendInvoice()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::INVOICE);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendDelivery()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::DELIVERY);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendJobticket()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::JOBTICKET);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendLabel()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::LABEL);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendOffer()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::OFFER);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendOrder()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::ORDER);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendStorno()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::STORNO);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
foreach ($mailDoc->getFiles() as $file) {
if ($file['name'] != '' && $file['content'] != '') {
$fileContent = $this->_template->createTemplate($file['content']);
$fileName = $this->_template->createTemplate($file['name']);
$message->attach($fileContent->render($vars), $fileName->render($vars));
}
}
$this->_logService->createLogEntry(
$templateVars->getOrder()->getShop(),
new Contact(),
LogEntry::INFO,
PSCShopQueueBundle::class,
$queue->getName(),
'Request Mail send',
[
'message' => $message->getTextBody(),
'from' => $from->render($vars),
'to' => $to->render($vars),
'subject' => $subject->render($vars),
],
);
$this->_mailer->send($message);
die();
} catch (\Exception $e) {
$this->_logService->createLogEntry(
$templateVars->getOrder()->getShop(),
new Contact(),
LogEntry::ERROR,
PSCShopQueueBundle::class,
$queue->getName(),
'Request Mail error',
[
'error' => $e->getMessage(),
],
);
$this->_error = $e->getMessage();
return false;
}
return true;
}
if ($event instanceof Request) { if ($event instanceof Request) {
$templateVars->loadOrder($event->getOrder()); $templateVars->loadOrder($event->getOrder());
$vars = $templateVars->getPosTwigVars($event->getPosition()); $vars = $templateVars->getPosTwigVars($event->getPosition());
@ -1286,6 +1403,121 @@ class Mail implements QueueInterface, ConfigurableElementInterface
return true; return true;
} }
if ($event instanceof ApprovalExternalAccept || $event instanceof ApprovalExternalDeclined) {
$templateVars->loadOrder($event->getOrder());
$vars = $templateVars->getPosTwigVars($event->getPosition());
$vars['approvalMail'] = $event->getMail();
$vars['message'] = $event->getMessage();
try {
$message = new Email()
->subject($subject->render($vars))
->from($from->render($vars))
->to(trim($to->render($vars)));
if ($text) {
$message->text($text->render($vars));
}
if ($bcc) {
$bccArray = explode(',', $bcc->render($vars));
foreach ($bccArray as $bc) {
if (trim($bc) != '') {
$message->addBcc(trim($bc));
}
}
}
if ($html) {
$message->html($html->render($vars));
}
if ($mailDoc->isSendInvoice()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::INVOICE);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendDelivery()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::DELIVERY);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendJobticket()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::JOBTICKET);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendLabel()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::LABEL);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendOffer()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::OFFER);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendOrder()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::ORDER);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
if ($mailDoc->isSendStorno()) {
$content = $printing->generateOrder($templateVars->getOrder(), Printing::STORNO);
if ($content) {
$message->attach($content, $printing->getFileName(), 'application/pdf');
}
}
foreach ($mailDoc->getFiles() as $file) {
if ($file['name'] != '' && $file['content'] != '') {
$fileContent = $this->_template->createTemplate($file['content']);
$fileName = $this->_template->createTemplate($file['name']);
$message->attach($fileContent->render($vars), $fileName->render($vars));
}
}
$this->_logService->createLogEntry(
$templateVars->getOrder()->getShop(),
new Contact(),
LogEntry::INFO,
PSCShopQueueBundle::class,
$queue->getName(),
'Accept Declined Mail send',
[
'message' => $message->getTextBody(),
'from' => $from->render($vars),
'to' => $to->render($vars),
'subject' => $subject->render($vars),
],
);
$this->_mailer->send($message);
} catch (\Exception $e) {
$this->_logService->createLogEntry(
$templateVars->getOrder()->getShop(),
new Contact(),
LogEntry::ERROR,
PSCShopQueueBundle::class,
$queue->getName(),
'Accept Declined Mail error',
[
'error' => $e->getMessage(),
],
);
$this->_error = $e->getMessage();
return false;
}
return true;
}
if ($event instanceof Accept || $event instanceof Declined) { if ($event instanceof Accept || $event instanceof Declined) {
$templateVars->loadOrder($event->getOrder()); $templateVars->loadOrder($event->getOrder());
$vars = $templateVars->getPosTwigVars($event->getPosition()); $vars = $templateVars->getPosTwigVars($event->getPosition());

View File

@ -0,0 +1,11 @@
<?php
namespace PSC\System\UpdateBundle\Migrations;
class Version20260311100000 extends Base
{
public function migrateDatabase(): void
{
$this->entityManager->getConnection()->executeQuery("ALTER TABLE article ADD COLUMN IF NOT EXISTS confirmExternal TINYINT(1) NOT NULL DEFAULT 0;");
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace PSC\System\UpdateBundle\Migrations;
class Version20260311100001 extends Base
{
public function migrateDatabase(): void
{
$this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos ADD COLUMN IF NOT EXISTS external_approval_status INT(11) NULL DEFAULT NULL;");
}
}

View File

@ -22,8 +22,6 @@ class OrderListButton
return ( return (
'<a href="' '<a href="'
. $url . $url
. '#/'
. $order->getUuid()
. '" target="_blank" title="In Invoice bearbeiten"' . '" target="_blank" title="In Invoice bearbeiten"'
. ' class="inline-flex items-center justify-center gap-1 px-2.5 py-1.5 rounded-md text-xs font-medium text-white bg-orange-500 hover:bg-orange-600 transition-colors shadow-sm">' . ' class="inline-flex items-center justify-center gap-1 px-2.5 py-1.5 rounded-md text-xs font-medium text-white bg-orange-500 hover:bg-orange-600 transition-colors shadow-sm">'
. '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">' . '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">'

View File

@ -1330,6 +1330,10 @@ html {
width: 1.75rem; width: 1.75rem;
} }
.w-8{
width: 2rem;
}
.w-\[var\(--sidebar-width\)\]{ .w-\[var\(--sidebar-width\)\]{
width: var(--sidebar-width); width: var(--sidebar-width);
} }
@ -1371,6 +1375,10 @@ html {
min-width: 100%; min-width: 100%;
} }
.max-w-2xl{
max-width: 42rem;
}
.max-w-7xl{ .max-w-7xl{
max-width: 80rem; max-width: 80rem;
} }

View File

@ -49,8 +49,8 @@ class Article extends BaseArticle
protected $hintEnable = false; protected $hintEnable = false;
protected $customTabEnable = false; protected $customTabEnable = false;
protected null|string $aribaUnitOfMeasure = ''; protected ?string $aribaUnitOfMeasure = '';
protected null|string $aribaUNSPSC = ''; protected ?string $aribaUNSPSC = '';
protected $custom1; protected $custom1;
protected $custom2; protected $custom2;
@ -189,7 +189,7 @@ class Article extends BaseArticle
$this->a9_price_text_line1 = str_replace(',', '.', $this->a9_price_text_line1); $this->a9_price_text_line1 = str_replace(',', '.', $this->a9_price_text_line1);
$this->a4_abpreis = str_replace(',', '.', $this->a4_abpreis); $this->a4_abpreis = str_replace(',', '.', $this->a4_abpreis);
$this->preis = str_replace(',', '.', $this->preis); $this->preis = 0;
$this->versandwert = str_replace(',', '.', $this->versandwert); $this->versandwert = str_replace(',', '.', $this->versandwert);
TP_Util::clearCache(); TP_Util::clearCache();
@ -327,8 +327,8 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset($language[$overwriteLang], $language[$overwriteLang]['title']) && isset($language[$overwriteLang], $language[$overwriteLang]['title'])
$language[$overwriteLang]['title'] != '' && $language[$overwriteLang]['title'] != ''
) { ) {
return $language[$overwriteLang]['title']; return $language[$overwriteLang]['title'];
} else { } else {
@ -345,10 +345,10 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset( isset(
$language[Zend_Registry::get('locale')->getLanguage()], $language[Zend_Registry::get('locale')->getLanguage()],
$language[Zend_Registry::get('locale')->getLanguage()]['title'], $language[Zend_Registry::get('locale')->getLanguage()]['title'],
) && )
$language[Zend_Registry::get('locale')->getLanguage()]['title'] != '' && $language[Zend_Registry::get('locale')->getLanguage()]['title'] != ''
) { ) {
return $language[Zend_Registry::get('locale')->getLanguage()]['title']; return $language[Zend_Registry::get('locale')->getLanguage()]['title'];
} else { } else {
@ -369,8 +369,8 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset($language[$overwriteLang], $language[$overwriteLang]['info']) && isset($language[$overwriteLang], $language[$overwriteLang]['info'])
$language[$overwriteLang]['info'] != '' && $language[$overwriteLang]['info'] != ''
) { ) {
return $language[$overwriteLang]['info']; return $language[$overwriteLang]['info'];
} else { } else {
@ -387,10 +387,10 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset( isset(
$language[Zend_Registry::get('locale')->getLanguage()], $language[Zend_Registry::get('locale')->getLanguage()],
$language[Zend_Registry::get('locale')->getLanguage()]['info'], $language[Zend_Registry::get('locale')->getLanguage()]['info'],
) && )
$language[Zend_Registry::get('locale')->getLanguage()]['info'] != '' && $language[Zend_Registry::get('locale')->getLanguage()]['info'] != ''
) { ) {
return nl2br($language[Zend_Registry::get('locale')->getLanguage()]['info']); return nl2br($language[Zend_Registry::get('locale')->getLanguage()]['info']);
} else { } else {
@ -411,8 +411,8 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset($language[$overwriteLang], $language[$overwriteLang]['text_art']) && isset($language[$overwriteLang], $language[$overwriteLang]['text_art'])
$language[$overwriteLang]['text_art'] != '' && $language[$overwriteLang]['text_art'] != ''
) { ) {
return $language[$overwriteLang]['text_art']; return $language[$overwriteLang]['text_art'];
} else { } else {
@ -429,10 +429,10 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset( isset(
$language[Zend_Registry::get('locale')->getLanguage()], $language[Zend_Registry::get('locale')->getLanguage()],
$language[Zend_Registry::get('locale')->getLanguage()]['text_art'], $language[Zend_Registry::get('locale')->getLanguage()]['text_art'],
) && )
$language[Zend_Registry::get('locale')->getLanguage()]['text_art'] != '' && $language[Zend_Registry::get('locale')->getLanguage()]['text_art'] != ''
) { ) {
return nl2br($language[Zend_Registry::get('locale')->getLanguage()]['text_art']); return nl2br($language[Zend_Registry::get('locale')->getLanguage()]['text_art']);
} else { } else {
@ -464,8 +464,8 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset($language[$overwriteLang], $language[$overwriteLang]['einleitung']) && isset($language[$overwriteLang], $language[$overwriteLang]['einleitung'])
$language[$overwriteLang]['einleitung'] != '' && $language[$overwriteLang]['einleitung'] != ''
) { ) {
return $language[$overwriteLang]['einleitung']; return $language[$overwriteLang]['einleitung'];
} else { } else {
@ -482,10 +482,10 @@ class Article extends BaseArticle
$language = $this->getLangData(); $language = $this->getLangData();
if ( if (
isset( isset(
$language[Zend_Registry::get('locale')->getLanguage()], $language[Zend_Registry::get('locale')->getLanguage()],
$language[Zend_Registry::get('locale')->getLanguage()]['einleitung'], $language[Zend_Registry::get('locale')->getLanguage()]['einleitung'],
) && )
$language[Zend_Registry::get('locale')->getLanguage()]['einleitung'] != '' && $language[Zend_Registry::get('locale')->getLanguage()]['einleitung'] != ''
) { ) {
return nl2br($language[Zend_Registry::get('locale')->getLanguage()]['einleitung']); return nl2br($language[Zend_Registry::get('locale')->getLanguage()]['einleitung']);
} else { } else {
@ -594,17 +594,17 @@ class Article extends BaseArticle
); );
if (isset($keys[0])) { if (isset($keys[0])) {
if ( if (
($keys[0]['type'] == 'Radio' || $keys[0]['type'] == 'Select') && ($keys[0]['type'] == 'Radio' || $keys[0]['type'] == 'Select')
$keys[0]['mode'] != 'papierdb' && $keys[0]['mode'] != 'papierdb'
) { ) {
$value = $str->xpath( $value = $str->xpath(
"//artikel[name='" . "//artikel[name='"
$opt['kalk_artikel'] . . $opt['kalk_artikel']
"']/option[@id='" . . "']/option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$value . . $value
"']", . "']",
); );
if (isset($value[0])) { if (isset($value[0])) {
$options[] = [ $options[] = [
@ -628,13 +628,13 @@ class Article extends BaseArticle
$strr = []; $strr = [];
foreach ($value as $keyys) { foreach ($value as $keyys) {
$val = $str->xpath( $val = $str->xpath(
"//artikel[name='" . "//artikel[name='"
$opt['kalk_artikel'] . . $opt['kalk_artikel']
"']/option[@id='" . . "']/option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$keyys . . $keyys
"']", . "']",
); );
$strr[] = $val[0]['name']; $strr[] = $val[0]['name'];
} }
@ -651,7 +651,7 @@ class Article extends BaseArticle
if (isset($value[0])) { if (isset($value[0])) {
array_push( array_push(
$options, $options,
((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name']), (string) $keys[0]['name'] . ': ' . (string) $value[0]['name'],
); );
$optionsAr[(string) $keys[0]['name']] = (string) $value[0]['name']; $optionsAr[(string) $keys[0]['name']] = (string) $value[0]['name'];
$optionsArId[(string) $keys[0]['id']] = (string) $value[0]['name']; $optionsArId[(string) $keys[0]['id']] = (string) $value[0]['name'];
@ -667,25 +667,25 @@ class Article extends BaseArticle
->fetchOne(); ->fetchOne();
array_push( array_push(
$options, $options,
((string) $keys[0]['name']) . ': ' . $papierSingle->description_1, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1,
); );
$optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1; $optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1;
$optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1; $optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1;
} elseif ($keys[0]['type'] == 'Checkbox') { } elseif ($keys[0]['type'] == 'Checkbox') {
$strr = []; $strr = [];
foreach ($value as $keyys) { foreach ($value as $keyys) {
$val = $template->xpath("//option[@id='" . $val = $template->xpath("//option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$keyys . . $keyys
"']"); . "']");
$strr[] = $val[0]['name']; $strr[] = $val[0]['name'];
} }
$optionsAr[$keys[0]['name']] = implode(', ', $strr); $optionsAr[$keys[0]['name']] = implode(', ', $strr);
$optionsArId[(string) $keys[0]['id']] = implode(', ', $strr); $optionsArId[(string) $keys[0]['id']] = implode(', ', $strr);
array_push($options, ((string) $keys[0]['name']) . ': ' . implode(', ', $strr)); array_push($options, (string) $keys[0]['name'] . ': ' . implode(', ', $strr));
} elseif (strtolower($keys[0]['type']) != 'hidden') { } elseif (strtolower($keys[0]['type']) != 'hidden') {
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
$optionsAr[$keys[0]['name']] = $value; $optionsAr[$keys[0]['name']] = $value;
$optionsArId[(string) $keys[0]['id']] = $value; $optionsArId[(string) $keys[0]['id']] = $value;
} }
@ -743,7 +743,7 @@ class Article extends BaseArticle
$xmldes = simplexml_load_string('<?xml version="1.0"?>' . $this->a9_sizes); $xmldes = simplexml_load_string('<?xml version="1.0"?>' . $this->a9_sizes);
foreach ($xmldes->itm as $item) { foreach ($xmldes->itm as $item) {
if ((int) $params['s' . $item['id']]) { if ((int) $params['s' . $item['id']]) {
array_push($options, 'Größe ' . $item['size'] . ': ' . ((int) $params['s' . $item['id']])); array_push($options, 'Größe ' . $item['size'] . ': ' . (int) $params['s' . $item['id']]);
} }
} }
} }
@ -807,25 +807,22 @@ class Article extends BaseArticle
); );
if (isset($keys[0])) { if (isset($keys[0])) {
if ( if (
($keys[0]['type'] == 'Radio' || $keys[0]['type'] == 'Select') && ($keys[0]['type'] == 'Radio' || $keys[0]['type'] == 'Select')
$keys[0]['mode'] != 'papierdb' && $keys[0]['mode'] != 'papierdb'
) { ) {
$value = $str->xpath( $value = $str->xpath(
"//artikel[name='" . "//artikel[name='"
$opt['kalk_artikel'] . . $opt['kalk_artikel']
"']/option[@id='" . . "']/option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$value . . $value
"']", . "']",
); );
if (isset($value[0])) { if (isset($value[0])) {
$optionsAr[(string) $keys[0]['name']] = (string) $value[0]['name']; $optionsAr[(string) $keys[0]['name']] = (string) $value[0]['name'];
$optionsArId[(string) $keys[0]['id']] = (string) $value[0]['name']; $optionsArId[(string) $keys[0]['id']] = (string) $value[0]['name'];
array_push( array_push($options, (string) $keys[0]['name'] . ': ' . (string) $value[0]['name']);
$options,
((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name']),
);
} }
} elseif ($keys[0]['mode'] == 'papierdb') { } elseif ($keys[0]['mode'] == 'papierdb') {
$papierSingle = Doctrine_Query::create() $papierSingle = Doctrine_Query::create()
@ -833,24 +830,24 @@ class Article extends BaseArticle
->from('Papier p') ->from('Papier p')
->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id]) ->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id])
->fetchOne(); ->fetchOne();
array_push($options, ((string) $keys[0]['name']) . ': ' . $papierSingle->description_1); array_push($options, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1);
$optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1; $optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1;
$optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1; $optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1;
} elseif ($keys[0]['type'] == 'Checkbox') { } elseif ($keys[0]['type'] == 'Checkbox') {
$strr = []; $strr = [];
foreach ($value as $keyys) { foreach ($value as $keyys) {
$val = $str->xpath( $val = $str->xpath(
"//artikel[name='" . "//artikel[name='"
$opt['kalk_artikel'] . . $opt['kalk_artikel']
"']/option[@id='" . . "']/option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$keyys . . $keyys
"']", . "']",
); );
$strr[] = $val[0]['name']; $strr[] = $val[0]['name'];
} }
array_push($options, ((string) $keys[0]['name']) . ': ' . implode(', ', $strr)); array_push($options, (string) $keys[0]['name'] . ': ' . implode(', ', $strr));
$optionsAr[(string) $keys[0]['name']] = implode(', ', $strr); $optionsAr[(string) $keys[0]['name']] = implode(', ', $strr);
$optionsArId[(string) $keys[0]['id']] = implode(', ', $strr); $optionsArId[(string) $keys[0]['id']] = implode(', ', $strr);
} elseif (strtolower($keys[0]['type']) == 'template') { } elseif (strtolower($keys[0]['type']) == 'template') {
@ -861,7 +858,7 @@ class Article extends BaseArticle
if (isset($value[0])) { if (isset($value[0])) {
array_push( array_push(
$options, $options,
((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name']), (string) $keys[0]['name'] . ': ' . (string) $value[0]['name'],
); );
$optionsAr[(string) $keys[0]['name']] = (string) $value[0]['name']; $optionsAr[(string) $keys[0]['name']] = (string) $value[0]['name'];
$optionsArId[(string) $keys[0]['id']] = (string) $value[0]['name']; $optionsArId[(string) $keys[0]['id']] = (string) $value[0]['name'];
@ -877,39 +874,39 @@ class Article extends BaseArticle
->fetchOne(); ->fetchOne();
array_push( array_push(
$options, $options,
((string) $keys[0]['name']) . ': ' . $papierSingle->description_1, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1,
); );
$optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1; $optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1;
$optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1; $optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1;
} elseif ($keys[0]['type'] == 'Checkbox') { } elseif ($keys[0]['type'] == 'Checkbox') {
$strr = []; $strr = [];
foreach ($value as $keyys) { foreach ($value as $keyys) {
$val = $template->xpath("//option[@id='" . $val = $template->xpath("//option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$keyys . . $keyys
"']"); . "']");
$strr[] = $val[0]['name']; $strr[] = $val[0]['name'];
} }
$optionsAr[$keys[0]['name']] = implode(', ', $strr); $optionsAr[$keys[0]['name']] = implode(', ', $strr);
$optionsArId[(string) $keys[0]['id']] = implode(', ', $strr); $optionsArId[(string) $keys[0]['id']] = implode(', ', $strr);
array_push($options, ((string) $keys[0]['name']) . ': ' . implode(', ', $strr)); array_push($options, (string) $keys[0]['name'] . ': ' . implode(', ', $strr));
} elseif (strtolower($keys[0]['type']) != 'hidden') { } elseif (strtolower($keys[0]['type']) != 'hidden') {
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
$optionsAr[(string) $keys[0]['name']] = $value; $optionsAr[(string) $keys[0]['name']] = $value;
$optionsArId[(string) $keys[0]['id']] = $value; $optionsArId[(string) $keys[0]['id']] = $value;
} }
} elseif (strtolower($keys[0]['type']) != 'hidden') { } elseif (strtolower($keys[0]['type']) != 'hidden') {
$optionsAr[(string) $keys[0]['name']] = $value; $optionsAr[(string) $keys[0]['name']] = $value;
$optionsArId[(string) $keys[0]['id']] = $value; $optionsArId[(string) $keys[0]['id']] = $value;
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
} elseif (strtolower($keys[0]['type']) == 'hidden' && $key == 'papier') { } elseif (strtolower($keys[0]['type']) == 'hidden' && $key == 'papier') {
$papierSingle = Doctrine_Query::create() $papierSingle = Doctrine_Query::create()
->select() ->select()
->from('Papier p') ->from('Papier p')
->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id]) ->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id])
->fetchOne(); ->fetchOne();
array_push($options, ((string) $keys[0]['name']) . ': ' . $papierSingle->description_1); array_push($options, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1);
$optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1; $optionsAr[(string) $keys[0]['name']] = $papierSingle->description_1;
$optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1; $optionsArId[(string) $keys[0]['id']] = $papierSingle->description_1;
} }
@ -930,7 +927,7 @@ class Article extends BaseArticle
//array_push($options, (string) 'Upload: ' . $upload[$value]); //array_push($options, (string) 'Upload: ' . $upload[$value]);
} }
} else { } else {
array_push($options, ((string) $key) . ': ' . $value); array_push($options, (string) $key . ': ' . $value);
} }
} }
} }
@ -943,20 +940,20 @@ class Article extends BaseArticle
if (isset($keys[0])) { if (isset($keys[0])) {
if ($keys[0]['type'] == 'Select' && $keys[0]['mode'] != 'papierdb') { if ($keys[0]['type'] == 'Select' && $keys[0]['mode'] != 'papierdb') {
$value = $str->xpath("//option[@id='" . $key . "']/opt[@id='" . $value . "']"); $value = $str->xpath("//option[@id='" . $key . "']/opt[@id='" . $value . "']");
array_push($options, ((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name'])); array_push($options, (string) $keys[0]['name'] . ': ' . (string) $value[0]['name']);
} elseif ($keys[0]['type'] == 'Select' && $keys[0]['mode'] == 'papierdb') { } elseif ($keys[0]['type'] == 'Select' && $keys[0]['mode'] == 'papierdb') {
$papierSingle = Doctrine_Query::create() $papierSingle = Doctrine_Query::create()
->select() ->select()
->from('Papier p') ->from('Papier p')
->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id]) ->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id])
->fetchOne(); ->fetchOne();
array_push($options, ((string) $keys[0]['name']) . ': ' . $papierSingle->description_1); array_push($options, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1);
} else { } else {
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
} }
} }
} else { } else {
array_push($options, ((string) $key) . ': ' . $value); array_push($options, (string) $key . ': ' . $value);
} }
} }
} }
@ -1008,24 +1005,21 @@ class Article extends BaseArticle
if (isset($keys[0])) { if (isset($keys[0])) {
if ( if (
($keys[0]['type'] == 'Radio' || $keys[0]['type'] == 'Select') && ($keys[0]['type'] == 'Radio' || $keys[0]['type'] == 'Select')
$keys[0]['mode'] != 'papierdb' && $keys[0]['mode'] != 'papierdb'
) { ) {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
$value = $str->xpath( $value = $str->xpath(
"//artikel[name='" . "//artikel[name='"
$opt['kalk_artikel'] . . $opt['kalk_artikel']
"']/option[@id='" . . "']/option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$value . . $value
"']", . "']",
); );
if (isset($value[0])) { if (isset($value[0])) {
array_push( array_push($options, (string) $keys[0]['name'] . ': ' . (string) $value[0]['name']);
$options,
((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name']),
);
} }
} elseif ($keys[0]['mode'] == 'papierdb') { } elseif ($keys[0]['mode'] == 'papierdb') {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
@ -1034,23 +1028,23 @@ class Article extends BaseArticle
->from('Papier p') ->from('Papier p')
->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id]) ->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id])
->fetchOne(); ->fetchOne();
array_push($options, ((string) $keys[0]['name']) . ': ' . $papierSingle->description_2); array_push($options, (string) $keys[0]['name'] . ': ' . $papierSingle->description_2);
} elseif ($keys[0]['type'] == 'Checkbox') { } elseif ($keys[0]['type'] == 'Checkbox') {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
$strr = []; $strr = [];
foreach ($value as $keyys) { foreach ($value as $keyys) {
$val = $str->xpath( $val = $str->xpath(
"//artikel[name='" . "//artikel[name='"
$opt['kalk_artikel'] . . $opt['kalk_artikel']
"']/option[@id='" . . "']/option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$keyys . . $keyys
"']", . "']",
); );
$strr[] = $val[0]['name']; $strr[] = $val[0]['name'];
} }
array_push($options, ((string) $keys[0]['name']) . ': ' . implode(', ', $strr)); array_push($options, (string) $keys[0]['name'] . ': ' . implode(', ', $strr));
} elseif (strtolower($keys[0]['type']) == 'template') { } elseif (strtolower($keys[0]['type']) == 'template') {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
$keys = $template->xpath('//option[@id="' . $keys[0]['select'] . '"]'); $keys = $template->xpath('//option[@id="' . $keys[0]['select'] . '"]');
@ -1060,7 +1054,7 @@ class Article extends BaseArticle
if (isset($value[0])) { if (isset($value[0])) {
array_push( array_push(
$options, $options,
((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name']), (string) $keys[0]['name'] . ': ' . (string) $value[0]['name'],
); );
} }
} elseif ($keys[0]['mode'] == 'papierdb') { } elseif ($keys[0]['mode'] == 'papierdb') {
@ -1074,25 +1068,25 @@ class Article extends BaseArticle
->fetchOne(); ->fetchOne();
array_push( array_push(
$options, $options,
((string) $keys[0]['name']) . ': ' . $papierSingle->description_1, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1,
); );
} elseif ($keys[0]['type'] == 'Checkbox') { } elseif ($keys[0]['type'] == 'Checkbox') {
$strr = []; $strr = [];
foreach ($value as $keyys) { foreach ($value as $keyys) {
$val = $template->xpath("//option[@id='" . $val = $template->xpath("//option[@id='"
$key . . $key
"']/opt[@id='" . . "']/opt[@id='"
$keyys . . $keyys
"']"); . "']");
$strr[] = $val[0]['name']; $strr[] = $val[0]['name'];
} }
array_push($options, ((string) $keys[0]['name']) . ': ' . implode(', ', $strr)); array_push($options, (string) $keys[0]['name'] . ': ' . implode(', ', $strr));
} elseif (strtolower($keys[0]['type']) != 'hidden') { } elseif (strtolower($keys[0]['type']) != 'hidden') {
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
} }
} elseif (strtolower($keys[0]['type']) != 'hidden') { } elseif (strtolower($keys[0]['type']) != 'hidden') {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
} elseif (strtolower($keys[0]['type']) == 'hidden' && $key == 'papier') { } elseif (strtolower($keys[0]['type']) == 'hidden' && $key == 'papier') {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
$papierSingle = Doctrine_Query::create() $papierSingle = Doctrine_Query::create()
@ -1100,7 +1094,7 @@ class Article extends BaseArticle
->from('Papier p') ->from('Papier p')
->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id]) ->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id])
->fetchOne(); ->fetchOne();
array_push($options, ((string) $keys[0]['name']) . ': ' . $papierSingle->description_2); array_push($options, (string) $keys[0]['name'] . ': ' . $papierSingle->description_2);
} }
} elseif ($key == 'kalk_artikel') { } elseif ($key == 'kalk_artikel') {
$optionsAr[$key] = $value; $optionsAr[$key] = $value;
@ -1117,7 +1111,7 @@ class Article extends BaseArticle
//array_push($options, (string) 'Upload: ' . $upload[$value]); //array_push($options, (string) 'Upload: ' . $upload[$value]);
} }
} else { } else {
array_push($options, ((string) $key) . ': ' . $value); array_push($options, (string) $key . ': ' . $value);
} }
} }
} }
@ -1130,20 +1124,20 @@ class Article extends BaseArticle
if (isset($keys[0])) { if (isset($keys[0])) {
if ($keys[0]['type'] == 'Select' && $keys[0]['mode'] != 'papierdb') { if ($keys[0]['type'] == 'Select' && $keys[0]['mode'] != 'papierdb') {
$value = $str->xpath("//option[@id='" . $key . "']/opt[@id='" . $value . "']"); $value = $str->xpath("//option[@id='" . $key . "']/opt[@id='" . $value . "']");
array_push($options, ((string) $keys[0]['name']) . ': ' . ((string) $value[0]['name'])); array_push($options, (string) $keys[0]['name'] . ': ' . (string) $value[0]['name']);
} elseif ($keys[0]['type'] == 'Select' && $keys[0]['mode'] == 'papierdb') { } elseif ($keys[0]['type'] == 'Select' && $keys[0]['mode'] == 'papierdb') {
$papierSingle = Doctrine_Query::create() $papierSingle = Doctrine_Query::create()
->select() ->select()
->from('Papier p') ->from('Papier p')
->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id]) ->andWhere('p.art_nr = ? AND p.install_id = ?', [$value, $this->Install->id])
->fetchOne(); ->fetchOne();
array_push($options, ((string) $keys[0]['name']) . ': ' . $papierSingle->description_1); array_push($options, (string) $keys[0]['name'] . ': ' . $papierSingle->description_1);
} else { } else {
array_push($options, ((string) $keys[0]['name']) . ': ' . $value); array_push($options, (string) $keys[0]['name'] . ': ' . $value);
} }
} }
} else { } else {
array_push($options, ((string) $key) . ': ' . $value); array_push($options, (string) $key . ': ' . $value);
} }
} }
} }
@ -1160,23 +1154,23 @@ class Article extends BaseArticle
if ($mode->liveedit && $type == 'INPUT') { if ($mode->liveedit && $type == 'INPUT') {
return ( return (
'<span class="liveedit" mode="text"table="article" field="' . '<span class="liveedit" mode="text"table="article" field="'
$field . . $field
'" id="' . . '" id="'
$this->id . . $this->id
'">' . . '">'
$this->$field . . $this->$field
'</div>' . '</div>'
); );
} elseif ($mode->liveedit && $type == 'RTE') { } elseif ($mode->liveedit && $type == 'RTE') {
return ( return (
'<span class="liveedit" mode="wysiwyg" table="article" field="' . '<span class="liveedit" mode="wysiwyg" table="article" field="'
$field . . $field
'" id="' . . '" id="'
$this->id . . $this->id
'">' . . '">'
$this->$field . . $this->$field
'</div>' . '</div>'
); );
} }
@ -1300,7 +1294,7 @@ class Article extends BaseArticle
foreach ($xml as $article_xml) { foreach ($xml as $article_xml) {
$up = []; $up = [];
foreach ($article_xml->uploads->children() as $upload) { foreach ($article_xml->uploads->children() as $upload) {
if (isset($upload['select']) && $params[(string) $upload['select']] != ((string) $upload['value'])) { if (isset($upload['select']) && $params[(string) $upload['select']] != (string) $upload['value']) {
continue; continue;
} }
$up[] = [ $up[] = [
@ -1812,12 +1806,8 @@ class Article extends BaseArticle
copy( copy(
'/data/www/new/web/' . $obj['url'], '/data/www/new/web/' . $obj['url'],
'/data/www/old/market/basket/' . '/data/www/old/market/basket/' . $pos->orders_id . '/' . $pos->pos . '/'
$pos->orders_id . . pathinfo('/data/www/new/web/' . $obj['url'], PATHINFO_BASENAME),
'/' .
$pos->pos .
'/' .
pathinfo('/data/www/new/web/' . $obj['url'], PATHINFO_BASENAME),
); );
} }
} }
@ -1872,23 +1862,23 @@ class Article extends BaseArticle
$this->uploadProvidedDownload = $uploadProvidedDownload; $this->uploadProvidedDownload = $uploadProvidedDownload;
} }
public function setAribaUnitOfMeasure(null|string $aribaUnitOfMeasure): void public function setAribaUnitOfMeasure(?string $aribaUnitOfMeasure): void
{ {
$this->aribaUnitOfMeasure = $aribaUnitOfMeasure; $this->aribaUnitOfMeasure = $aribaUnitOfMeasure;
} }
public function getAribaUnitOfMeasure(): null|string public function getAribaUnitOfMeasure(): ?string
{ {
$this->loadData(); $this->loadData();
return $this->aribaUnitOfMeasure; return $this->aribaUnitOfMeasure;
} }
public function setAribaUNSPSC(null|string $aribaUNSPSC): void public function setAribaUNSPSC(?string $aribaUNSPSC): void
{ {
$this->aribaUNSPSC = $aribaUNSPSC; $this->aribaUNSPSC = $aribaUNSPSC;
} }
public function getAribaUNSPSC(): null|string public function getAribaUNSPSC(): ?string
{ {
$this->loadData(); $this->loadData();
return $this->aribaUNSPSC; return $this->aribaUNSPSC;

View File

@ -92,7 +92,12 @@ abstract class BaseArticle extends Doctrine_Record
public function setTableDefinition() public function setTableDefinition()
{ {
$this->setTableName('article'); $this->setTableName('article');
$this->hasColumn('id', 'integer', 8, array('primary' => true, 'autoincrement' => true, 'type' => 'integer', 'length' => '8')); $this->hasColumn('id', 'integer', 8, array(
'primary' => true,
'autoincrement' => true,
'type' => 'integer',
'length' => '8',
));
$this->hasColumn('uuid', 'string', 40, array('type' => 'string', 'length' => '40')); $this->hasColumn('uuid', 'string', 40, array('type' => 'string', 'length' => '40'));
$this->hasColumn('created', 'timestamp', null, array('type' => 'timestamp')); $this->hasColumn('created', 'timestamp', null, array('type' => 'timestamp'));
$this->hasColumn('updated', 'timestamp', null, array('type' => 'timestamp')); $this->hasColumn('updated', 'timestamp', null, array('type' => 'timestamp'));
@ -187,6 +192,7 @@ abstract class BaseArticle extends Doctrine_Record
$this->hasColumn('rate_count', 'integer', 8); $this->hasColumn('rate_count', 'integer', 8);
$this->hasColumn('confirm', 'boolean', 1); $this->hasColumn('confirm', 'boolean', 1);
$this->hasColumn('confirmExternal', 'boolean', 1);
$this->hasColumn('confirmone', 'boolean', 1); $this->hasColumn('confirmone', 'boolean', 1);
$this->hasColumn('confirmaccount_id', 'integer', 8); $this->hasColumn('confirmaccount_id', 'integer', 8);
@ -343,9 +349,17 @@ abstract class BaseArticle extends Doctrine_Record
$this->hasOne('Contact', array('local' => 'contact_id', 'foreign' => 'id')); $this->hasOne('Contact', array('local' => 'contact_id', 'foreign' => 'id'));
$this->hasMany('ArticleGroup', array('refClass' => 'ArticleGroupArticle', 'local' => 'article_id', 'foreign' => 'articlegroup_id')); $this->hasMany('ArticleGroup', array(
'refClass' => 'ArticleGroupArticle',
'local' => 'article_id',
'foreign' => 'articlegroup_id',
));
$this->hasMany('Contact as Con', array('refClass' => 'ArticleConfirmContact', 'local' => 'article_id', 'foreign' => 'contact_id')); $this->hasMany('Contact as Con', array(
'refClass' => 'ArticleConfirmContact',
'local' => 'article_id',
'foreign' => 'contact_id',
));
$this->hasMany('ArticleGroupArticle', array('local' => 'id', 'foreign' => 'article_id')); $this->hasMany('ArticleGroupArticle', array('local' => 'id', 'foreign' => 'article_id'));
@ -355,11 +369,23 @@ abstract class BaseArticle extends Doctrine_Record
$this->hasMany('ContactFavArticle', array('local' => 'uuid', 'foreign' => 'article_uuid')); $this->hasMany('ContactFavArticle', array('local' => 'uuid', 'foreign' => 'article_uuid'));
$this->hasMany('Article as Releated', array('refClass' => 'ArticleReleated', 'local' => 'article1', 'foreign' => 'article2')); $this->hasMany('Article as Releated', array(
'refClass' => 'ArticleReleated',
'local' => 'article1',
'foreign' => 'article2',
));
$this->hasMany('ArticleTheme', array('refClass' => 'ArticleThemeArticle', 'local' => 'article_id', 'foreign' => 'theme_id')); $this->hasMany('ArticleTheme', array(
'refClass' => 'ArticleThemeArticle',
'local' => 'article_id',
'foreign' => 'theme_id',
));
$this->hasMany('ArticleTheme as ArticleMarketTheme', array('refClass' => 'ArticleThemeMarketArticle', 'local' => 'article_id', 'foreign' => 'theme_id')); $this->hasMany('ArticleTheme as ArticleMarketTheme', array(
'refClass' => 'ArticleThemeMarketArticle',
'local' => 'article_id',
'foreign' => 'theme_id',
));
$this->hasMany('ArticleThemeArticle', array('local' => 'id', 'foreign' => 'article_id')); $this->hasMany('ArticleThemeArticle', array('local' => 'id', 'foreign' => 'article_id'));
@ -373,8 +399,10 @@ abstract class BaseArticle extends Doctrine_Record
$this->hasMany('ArticleReleated', array('local' => 'id', 'foreign' => 'article2')); $this->hasMany('ArticleReleated', array('local' => 'id', 'foreign' => 'article2'));
$this->hasMany('Article', array('refClass' => 'ArticleReleated', 'local' => 'article2', 'foreign' => 'article1')); $this->hasMany('Article', array(
'refClass' => 'ArticleReleated',
'local' => 'article2',
'foreign' => 'article1',
));
} }
} }

View File

@ -209,9 +209,7 @@ class BasketController extends TP_Controller_Action
$this->redirectSpeak('/basket/simple'); $this->redirectSpeak('/basket/simple');
} }
public function customAction() public function customAction() {}
{
}
public function simpleAction() public function simpleAction()
{ {
@ -5243,6 +5241,21 @@ class BasketController extends TP_Controller_Action
} }
$art->save(); $art->save();
} }
if ($article->confirmExternal) {
$art->status = 90;
$order->status = 90;
$dbMongo = TP_Mongo::getInstance();
$dbMongo->Job->insertOne(array(
'shop' => $this->shop->id,
'event' => 'position_approval_external_request',
'data' => [
'position' => $art->uuid,
'order' => $order->uuid,
],
'created' => new MongoDB\BSON\UTCDateTime(),
'updated' => new MongoDB\BSON\UTCDateTime(),
));
}
if ($article->confirm) { if ($article->confirm) {
if ($article->confirmone) { if ($article->confirmone) {
$art->status = 90; $art->status = 90;