This commit is contained in:
Thomas Peterson 2024-12-17 15:56:11 +01:00
parent 748ff5802f
commit ec3bff09b2
12 changed files with 135 additions and 71 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,26 +1,12 @@
<?php <?php
/**
* PrintshopCreator Suite
*
* PHP Version 5.3
*
* @author Thomas Peterson <info@thomas-peterson.de>
* @copyright 2012-2013 PrintshopCreator GmbH
* @license Private
* @link http://www.printshopcreator.de
*/
namespace PSC\Shop\ContactBundle\Controller\Backend; namespace PSC\Shop\ContactBundle\Controller\Backend;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use PSC\Shop\ContactBundle\Document\Address\History as PSCHistory; use PSC\Shop\ContactBundle\Document\Address\History as PSCHistory;
use PSC\Shop\ContactBundle\Form\Backend\General\ContactAddressType; use PSC\Shop\ContactBundle\Form\Backend\General\ContactAddressType;
use PSC\Shop\ContactBundle\Form\Backend\General\ContactType;
use PSC\Shop\ContactBundle\Form\Backend\General\AnonymType;
use PSC\Shop\ContactBundle\PSCShopContactBundle; use PSC\Shop\ContactBundle\PSCShopContactBundle;
use PSC\Shop\EntityBundle\Document\Shop;
use PSC\Shop\EntityBundle\Entity\Contact; use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\Shop\EntityBundle\Entity\ContactAddress; use PSC\Shop\EntityBundle\Entity\ContactAddress;
use PSC\Shop\OrderBundle\Form\Backend\Upload\DeleteType; use PSC\Shop\OrderBundle\Form\Backend\Upload\DeleteType;
@ -28,21 +14,11 @@ use PSC\System\SettingsBundle\Document\LogEntry;
use PSC\System\SettingsBundle\Service\History; use PSC\System\SettingsBundle\Service\History;
use PSC\System\SettingsBundle\Service\Log; use PSC\System\SettingsBundle\Service\Log;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/**
* DetailController fürs Backend
*
* @package PSC\Shop\Contact\Backend
* @subpackage Controller
*/
class AddressDetailController extends AbstractController class AddressDetailController extends AbstractController
{ {
/** /**
@ -81,32 +57,36 @@ class AddressDetailController extends AbstractController
$contactAddress = $entityManager $contactAddress = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\ContactAddress') ->getRepository('PSC\Shop\EntityBundle\Entity\ContactAddress')
->findOneBy(array('uuid' => $uuid)); ->findOneBy(array('uuid' => $uuid));
/** @var \PSC\Shop\EntityBundle\Document\ContactAddress $contactDoc */ /** @var \PSC\Shop\EntityBundle\Document\ContactAddress $contactDoc */
$contactAddressDoc = $documentManager $contactAddressDoc = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\ContactAddress') ->getRepository('PSC\Shop\EntityBundle\Document\ContactAddress')
->findOneBy(array('uid' => (string)$contactAddress->getUid())); ->findOneBy(array('uid' => (string)$contactAddress->getUid()));
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
/** @var Contact $contact */ /** @var Contact $contact */
$contact = $contactAddress->getContact(); $contact = $contactAddress->getContact();
/** @var \PSC\Shop\EntityBundle\Document\Contact $contactDoc */ /** @var \PSC\Shop\EntityBundle\Document\Contact $contactDoc */
$contactDoc = $documentManager $contactDoc = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\Contact') ->getRepository('PSC\Shop\EntityBundle\Document\Contact')
->findOneBy(array('uid' => (string)$contact->getId())); ->findOneBy(array('uid' => (string)$contact->getId()));
if (!$request->isMethod('POST') && $contactAddressDoc) { if (!$request->isMethod('POST') && $contactAddressDoc) {
$contactAddress->setKundenNr($contactAddressDoc->getKundenNr()); $contactAddress->setKundenNr($contactAddressDoc->getKundenNr());
$contactAddress->setHomepage($contactAddressDoc->getHomepage()); $contactAddress->setHomepage($contactAddressDoc->getHomepage());
$contactAddress->setSteuerId($contactAddressDoc->getSteuerId());
$contactAddress->setLId($contactAddressDoc->getLId());
} elseif (!$contactAddressDoc) { } elseif (!$contactAddressDoc) {
if (!$contactDoc) { if (!$contactDoc) {
$contactDoc = new \PSC\Shop\EntityBundle\Document\Contact(); $contactDoc = new \PSC\Shop\EntityBundle\Document\Contact();
$contactDoc->setKundenNr(""); $contactDoc->setKundenNr("");
$contactDoc->setUid($contact->getid()); $contactDoc->setUid($contact->getId());
$documentManager->persist($contactDoc); $documentManager->persist($contactDoc);
} }
$contactAddressDoc = new \PSC\Shop\EntityBundle\Document\ContactAddress(); $contactAddressDoc = new \PSC\Shop\EntityBundle\Document\ContactAddress();
$contactAddressDoc->setKundenNr($contactDoc->getKundenNr()); $contactAddressDoc->setKundenNr($contactDoc->getKundenNr());
$contactAddressDoc->setUid($contactAddress->getUid()); $contactAddressDoc->setUid($contactAddress->getUid());
$contactAddressDoc->setSteuerId($contactAddress->getSteuerId());
$contactAddressDoc->setLId($contactAddress->getLId());
$documentManager->persist($contactAddressDoc); $documentManager->persist($contactAddressDoc);
$documentManager->flush(); $documentManager->flush();
$contactAddress->setKundenNr($contactDoc->getKundenNr()); $contactAddress->setKundenNr($contactDoc->getKundenNr());
@ -117,6 +97,8 @@ class AddressDetailController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$contactAddressDoc->setKundenNr($contactAddress->getKundenNr()); $contactAddressDoc->setKundenNr($contactAddress->getKundenNr());
$contactAddressDoc->setHomepage($contactAddress->getHomepage()); $contactAddressDoc->setHomepage($contactAddress->getHomepage());
$contactAddressDoc->setSteuerId($contactAddress->getSteuerId());
$contactAddressDoc->setLId($contactAddress->getLId());
$this->historyService->createHistoryEntry(new PSCHistory((string)$contactAddress->getUid()), $contactAddress, $contactAddressDoc); $this->historyService->createHistoryEntry(new PSCHistory((string)$contactAddress->getUid()), $contactAddress, $contactAddressDoc);
$entityManager->persist($contactAddress); $entityManager->persist($contactAddress);
$entityManager->flush(); $entityManager->flush();
@ -161,15 +143,15 @@ class AddressDetailController extends AbstractController
$contact = $entityManager $contact = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\Contact') ->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
->findOneBy(array('uuid' => $contactUUID)); ->findOneBy(array('uuid' => $contactUUID));
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
/** @var ContactAddress $contactAddress */ /** @var ContactAddress $contactAddress */
$contactAddress = new ContactAddress(); $contactAddress = new ContactAddress();
$contactAddress->setInstallId($contact->getInstallId()); $contactAddress->setInstallId($contact->getInstallId());
$contactAddress->setContact($contact); $contactAddress->setContact($contact);
/** @var \PSC\Shop\EntityBundle\Document\ContactAddress $contactDoc */ /** @var \PSC\Shop\EntityBundle\Document\ContactAddress $contactDoc */
$contactAddressDoc = new \PSC\Shop\EntityBundle\Document\ContactAddress(); $contactAddressDoc = new \PSC\Shop\EntityBundle\Document\ContactAddress();
/** @var \PSC\Shop\EntityBundle\Document\Contact $contactDoc */ /** @var \PSC\Shop\EntityBundle\Document\Contact $contactDoc */
$contactDoc = $documentManager $contactDoc = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\Contact') ->getRepository('PSC\Shop\EntityBundle\Document\Contact')
->findOneBy(array('uid' => (string)$contact->getId())); ->findOneBy(array('uid' => (string)$contact->getId()));
@ -180,6 +162,8 @@ class AddressDetailController extends AbstractController
$entityManager->flush(); $entityManager->flush();
$contactAddressDoc->setKundenNr($contactAddress->getKundenNr()); $contactAddressDoc->setKundenNr($contactAddress->getKundenNr());
$contactAddressDoc->setHomepage($contactAddress->getHomepage()); $contactAddressDoc->setHomepage($contactAddress->getHomepage());
$contactAddressDoc->setSteuerId($contactAddress->getSteuerId());
$contactAddressDoc->setLId($contactAddress->getLId());
$contactAddressDoc->setUid($contactAddress->getUid()); $contactAddressDoc->setUid($contactAddress->getUid());
$documentManager->persist($contactAddressDoc); $documentManager->persist($contactAddressDoc);
$documentManager->flush(); $documentManager->flush();
@ -222,11 +206,11 @@ class AddressDetailController extends AbstractController
$contactAddress = $entityManager $contactAddress = $entityManager
->getRepository('PSC\Shop\EntityBundle\Entity\ContactAddress') ->getRepository('PSC\Shop\EntityBundle\Entity\ContactAddress')
->findOneBy(array('uuid' => $uuid)); ->findOneBy(array('uuid' => $uuid));
/** @var \PSC\Shop\EntityBundle\Document\ContactAddress $contactDoc */ /** @var \PSC\Shop\EntityBundle\Document\ContactAddress $contactDoc */
$contactAddressDoc = $documentManager $contactAddressDoc = $documentManager
->getRepository('PSC\Shop\EntityBundle\Document\ContactAddress') ->getRepository('PSC\Shop\EntityBundle\Document\ContactAddress')
->findOneBy(array('uid' => (string)$contactAddress->getUid())); ->findOneBy(array('uid' => (string)$contactAddress->getUid()));
/** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */ /** @var \PSC\Shop\EntityBundle\Entity\Shop $selectedShop */
$selectedShop = $shopService->getSelectedShop(); $selectedShop = $shopService->getSelectedShop();
$form = $this->createForm(DeleteType::class); $form = $this->createForm(DeleteType::class);
$form->handleRequest($request); $form->handleRequest($request);

View File

@ -51,6 +51,8 @@ class ContactAddressType extends AbstractType
->add('country', CountryType::class, ['preferred_choices' => ['DE', 'CH', 'AT'], 'required' => false, 'label' => 'country']) ->add('country', CountryType::class, ['preferred_choices' => ['DE', 'CH', 'AT'], 'required' => false, 'label' => 'country'])
->add('fax', TextType::class, ['required' => false, 'label' => 'faxnumber']) ->add('fax', TextType::class, ['required' => false, 'label' => 'faxnumber'])
->add('ustid', TextType::class, ['required' => false, 'label' => 'vatid']) ->add('ustid', TextType::class, ['required' => false, 'label' => 'vatid'])
->add('steuerid', TextType::class, ['required' => false, 'label' => 'steuerid'])
->add('lid', TextType::class, ['required' => false, 'label' => 'lid'])
->add('zusatz1', TextType::class, ['required' => false, 'label' => 'additiveone']) ->add('zusatz1', TextType::class, ['required' => false, 'label' => 'additiveone'])
->add('zusatz2', TextType::class, ['required' => false, 'label' => 'additivetwo']) ->add('zusatz2', TextType::class, ['required' => false, 'label' => 'additivetwo'])
->add('pos', TextType::class, ['required' => false, 'label' => 'sort']) ->add('pos', TextType::class, ['required' => false, 'label' => 'sort'])

View File

@ -1,6 +1,8 @@
general: Allgemein general: Allgemein
art: Art art: Art
add: anlegen add: anlegen
steuerid: Steuer Nr
lid: Leitweg Id
detail: bearbeiten detail: bearbeiten
customeraddress: Kunde customeraddress: Kunde
Company: Firma Company: Firma

View File

@ -233,9 +233,30 @@
{{ form_errors(form.ustid) }} {{ form_errors(form.ustid) }}
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.steuerid) }}
</label>
<div class="col-md-9">
{{ form_widget(form.steuerid) }}
</div>
{{ form_errors(form.steuerid) }}
</div>
</div>
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.lid) }}
</label>
<div class="col-md-9">
{{ form_widget(form.lid) }}
</div>
{{ form_errors(form.lid) }}
</div>
</div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -234,7 +234,30 @@
{{ form_errors(form.ustid) }} {{ form_errors(form.ustid) }}
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.steuerid) }}
</label>
<div class="col-md-9">
{{ form_widget(form.steuerid) }}
</div>
{{ form_errors(form.steuerid) }}
</div>
</div>
<div class="col-md-6">
<div class="row mb-3">
<label class="col-md-3 form-control-label">
{{ form_label(form.lid) }}
</label>
<div class="col-md-9">
{{ form_widget(form.lid) }}
</div>
{{ form_errors(form.lid) }}
</div>
</div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -20,29 +20,39 @@ use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
#[Document] #[Document]
class ContactAddress class ContactAddress
{ {
/**
* @var string $id
*/
#[Id] #[Id]
protected $id; protected $id;
/**
* @var string $uid
*/
#[Field(type: 'string')] #[Field(type: 'string')]
protected $uid; protected $uid;
/**
* @var string $kundenNr;
*/
#[Field(type: 'string')] #[Field(type: 'string')]
protected $kundenNr; protected $kundenNr;
/**
* @var string $homepage;
*/
#[Field(type: 'string')] #[Field(type: 'string')]
protected $homepage; protected $homepage;
/** #[Field(type: 'string')]
* @return string protected $steuerid;
*/ #[Field(type: 'string')]
protected $lid;
public function getLId(): string
{
return (string)$this->lid;
}
public function setLId(string $var): void
{
$this->lid = $var;
}
public function getSteuerId(): string
{
return (string)$this->steuerid;
}
public function setSteuerId(string $var): void
{
$this->steuerid = $var;
}
public function getHomepage() public function getHomepage()
{ {
return $this->homepage; return $this->homepage;

View File

@ -14,6 +14,8 @@ class ContactAddress
{ {
protected $kundenNr = ''; protected $kundenNr = '';
protected $homepage = ''; protected $homepage = '';
protected $lid = '';
protected $steuerid = '';
/** /**
* @var integer * @var integer
*/ */
@ -771,4 +773,24 @@ class ContactAddress
{ {
$this->pos = $pos; $this->pos = $pos;
} }
public function getSteuerId(): string
{
return (string)$this->steuerid;
}
public function setSteuerId(string $var): void
{
$this->steuerid = $var;
}
public function getLId(): string
{
return (string)$this->lid;
}
public function setLId(string $var): void
{
$this->lid = $var;
}
} }

View File

@ -3,19 +3,14 @@
namespace PSC\System\SettingsBundle\Service; namespace PSC\System\SettingsBundle\Service;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\Shop\EntityBundle\Entity\Shop as BaseShop;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
/**
* Shop
*
* @author Thomas Peterson
*/
class Instance class Instance
{ {
protected $mongoManager; public function __construct(private DocumentManager $mongoManager, private TokenStorageInterface $tokenStorage, private Shop $shopService)
public function __construct(DocumentManager $mongoManager)
{ {
$this->mongoManager = $mongoManager;
} }
/** /**
@ -39,4 +34,15 @@ class Instance
return $instance; return $instance;
} }
public function getUser(): Contact
{
return $this->tokenStorage->getToken()->getUser();
}
public function getShop(): BaseShop
{
return $this->shopService->getSelectedShop();
}
} }

View File

@ -155,9 +155,6 @@ class Printing
'ShippingCoast' 'ShippingCoast'
); );
} }
dump($orderModel);
dump($document);
die();
return $document->getContent(); return $document->getContent();
} }

View File

@ -89,7 +89,7 @@
{% endblock %} {% endblock %}
{% if instanceService.getInstance().supporttoken %} {% if instanceService.getInstance().supporttoken %}
<script> <script>
$.post("{{ instanceService.getInstance().formatedSupportUrl }}/apilogin?X-AUTH-TOKEN={{ instanceService.getInstance().supporttoken }}&to=bridge", function(msg){ $.post("{{ instanceService.getInstance().formatedSupportUrl }}/apilogin?shop_uuid={{ instanceService.getShop().uuid|url_encode }}&shop_name={{ instanceService.getShop().title|url_encode }}&user_uuid={{ instanceService.getUser().uuid|url_encode }}&user_name={{ instanceService.getUser().username|url_encode }}&X-AUTH-TOKEN={{ instanceService.getInstance().supporttoken }}&to=bridge", function(msg){
if(msg != "") { if(msg != "") {
$(".swarm").html(msg); $(".swarm").html(msg);
} }

View File

@ -23,7 +23,6 @@ class Position implements IPositionTransformer
$obj = new ProductSpecialObject(); $obj = new ProductSpecialObject();
$selectedShop = $posEntity->getOrder()->getShop(); $selectedShop = $posEntity->getOrder()->getShop();
if ($posEntity->hasCalcXml() || isset($posDoc->getSpecialProductTypeObject()['xml'])) { if ($posEntity->hasCalcXml() || isset($posDoc->getSpecialProductTypeObject()['xml'])) {
$paperContainer = new PaperContainer(); $paperContainer = new PaperContainer();
$paperContainer->parse(simplexml_load_string($selectedShop->getInstall()->getPaperContainer())); $paperContainer->parse(simplexml_load_string($selectedShop->getInstall()->getPaperContainer()));
@ -45,7 +44,6 @@ class Position implements IPositionTransformer
if ($posDoc) { if ($posDoc) {
$engine->setSavedCalcReferences($posDoc->getCalcReferences()); $engine->setSavedCalcReferences($posDoc->getCalcReferences());
} }
if (isset($posDoc->getSpecialProductTypeObject()['xml']) && $posDoc->getSpecialProductTypeObject()['xml'] != "") { if (isset($posDoc->getSpecialProductTypeObject()['xml']) && $posDoc->getSpecialProductTypeObject()['xml'] != "") {
$engine->setVariables($posDoc->getSpecialProductTypeObject()['params']); $engine->setVariables($posDoc->getSpecialProductTypeObject()['params']);
if (isset($posDoc->getSpecialProductTypeObject()['kalk_artikel'])) { if (isset($posDoc->getSpecialProductTypeObject()['kalk_artikel'])) {
@ -87,7 +85,6 @@ class Position implements IPositionTransformer
* @var \PSC\Shop\EntityBundle\Entity\Product $product * @var \PSC\Shop\EntityBundle\Entity\Product $product
*/ */
$product = $this->productRepository->findOneBy(['uuid' => $position->getProduct()->getUuid()]); $product = $this->productRepository->findOneBy(['uuid' => $position->getProduct()->getUuid()]);
if ($posDoc->getSpecialProductTypeObject()['xml'] == '') { if ($posDoc->getSpecialProductTypeObject()['xml'] == '') {
$sp = $posDoc->getSpecialProductTypeObject(); $sp = $posDoc->getSpecialProductTypeObject();
$sp['xml'] = $product->getCalcXml(); $sp['xml'] = $product->getCalcXml();