This commit is contained in:
Thomas Peterson 2024-07-26 13:46:31 +02:00
parent 36229bd2bc
commit ae6713a490
15 changed files with 134 additions and 95 deletions

View File

@ -2,14 +2,17 @@
namespace Plugin\Custom\PSC\Saxoprint_API_R1\Api; namespace Plugin\Custom\PSC\Saxoprint_API_R1\Api;
use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\System\SettingsBundle\Document\LogEntry;
use PSC\System\SettingsBundle\Service\Log;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Plugin\Custom\PSC\Saxoprint_API_R1\Form\Group\Saxoprint;
use Symfony\Component\Mime\Part\Multipart\FormDataPart; use Symfony\Component\Mime\Part\Multipart\FormDataPart;
use Symfony\Contracts\Cache\CacheInterface; use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\HttpClientInterface;
class Base class Base
{ {
protected $baseUrlTest = 'https://sri1.staging.saxoprint.com/api/v3/'; protected $baseUrlTest = 'https://sri1.staging.saxoprint.com/api/v3/';
protected $baseUrlLive = 'https://sri.saxoprint.com/api/v3/'; protected $baseUrlLive = 'https://sri.saxoprint.com/api/v3/';
@ -22,10 +25,16 @@ class Base
protected bool $test = false; protected bool $test = false;
protected \PSC\Shop\EntityBundle\Document\Shop $shop; protected \PSC\Shop\EntityBundle\Document\Shop $shop;
protected \PSC\Shop\EntityBundle\Entity\Shop $shopEntity;
public function __construct(private readonly HttpClientInterface $client, private readonly CacheInterface $cache)
public function setShopEntity(\PSC\Shop\EntityBundle\Entity\Shop $shop): void
{
$this->shopEntity = $shop;
}
public function __construct(private readonly HttpClientInterface $client, private readonly CacheInterface $cache, protected readonly Log $logService)
{ {
} }
@ -43,6 +52,8 @@ class Base
, ,
'json' => $data, 'json' => $data,
]); ]);
$this->logService->createLogEntry($this->shopEntity, new Contact(), LogEntry::INFO, Saxoprint::class, "saxoprint", "SaxoPrint PrintShop Response", ['content' => $response->getContent(), 'status' => $response->getStatusCode()]);
$content = $response->toArray(); $content = $response->toArray();
return $content; return $content;
@ -114,6 +125,7 @@ class Base
'body' => $data, 'body' => $data,
]); ]);
$this->logService->createLogEntry($this->shopEntity, new Contact(), LogEntry::INFO, Saxoprint::class, "saxoprint", "SaxoPrint Upload Response", ['content' => $response->getContent(), 'status' => $response->getStatusCode()]);
return $response; return $response;
} }
public function postUploadConfirm($url, $data) public function postUploadConfirm($url, $data)
@ -126,7 +138,7 @@ class Base
'headers' => $this->buildHeaders(), 'headers' => $this->buildHeaders(),
'body' => $data, 'body' => $data,
]); ]);
$this->logService->createLogEntry($this->shopEntity, new Contact(), LogEntry::INFO, Saxoprint::class, "saxoprint", "SaxoPrint UploadConfirm Response", ['content' => $response->getContent(), 'status' => $response->getStatusCode()]);
return $response; return $response;
} }
@ -195,9 +207,9 @@ class Base
return $this->cache; return $this->cache;
} }
protected function buildQuery(Array $data): string protected function buildQuery(array $data): string
{ {
return base64_encode(json_encode($data)); return base64_encode(json_encode($data));
} }
} }

View File

@ -2,7 +2,10 @@
namespace Plugin\Custom\PSC\Saxoprint_API_R1\Api; namespace Plugin\Custom\PSC\Saxoprint_API_R1\Api;
use PSC\Shop\EntityBundle\Entity\Contact;
use PSC\System\SettingsBundle\Document\LogEntry;
use PSC\System\SettingsBundle\Service\Shop; use PSC\System\SettingsBundle\Service\Shop;
use Plugin\Custom\PSC\Saxoprint_API_R1\Form\Group\Saxoprint;
class PostPrintJob extends Base class PostPrintJob extends Base
{ {
@ -14,6 +17,7 @@ class PostPrintJob extends Base
public function call() public function call()
{ {
$this->logService->createLogEntry($this->shopEntity, new Contact(), LogEntry::INFO, Saxoprint::class, "saxoprint", "SaxoPrint PostJob Data", $this->buildData());
return $this->post('printjob', $this->buildData()); return $this->post('printjob', $this->buildData());
} }
@ -35,11 +39,10 @@ class PostPrintJob extends Base
$productGroup = $this->position->getAdditionalInfo('saxoprint')['saxoprintProductId']; $productGroup = $this->position->getAdditionalInfo('saxoprint')['saxoprintProductId'];
$auflage = 0; $auflage = 0;
foreach($infos as $row) foreach($infos as $row) {
{ if($row['name'] == "" || $row['name'] == 'property[auflage]' || $row['name'] == 'auflage') {
if($row['name'] == "" || $row['name'] == 'property[auflage]' || $row['name'] == 'auflage') { $auflage = (int)$row['value'];
$auflage = (int)$row['value']; continue;
continue;
} }
if($row['name'] == 'property[6]' || $row['name'] == '6') { if($row['name'] == 'property[6]' || $row['name'] == '6') {
$productGroup = intval($row['value']); $productGroup = intval($row['value']);
@ -51,7 +54,7 @@ class PostPrintJob extends Base
} }
/** /**
* @var \TP_Basket_Item $objPosition * @var \TP_Basket_Item $objPosition
*/ */
$objPosition = unserialize(($this->position->getData())); $objPosition = unserialize(($this->position->getData()));
@ -60,12 +63,12 @@ class PostPrintJob extends Base
'ResellerAddress' => [ 'ResellerAddress' => [
'Salutation' => 'None', 'Salutation' => 'None',
'CompanyName' => $this->order->getSenderAddress()->getCompany(), 'CompanyName' => $this->order->getSenderAddress()->getCompany(),
'FirstName' => $this->order->getSenderAddress()->getFirstname()?: '', 'FirstName' => $this->order->getSenderAddress()->getFirstname() ?: '',
'LastName' => $this->order->getSenderAddress()->getLastname()?: '', 'LastName' => $this->order->getSenderAddress()->getLastname() ?: '',
'Street' => $this->order->getSenderAddress()->getStreet() . ' ' . $this->order->getSenderAddress()->getHouseNumber(), 'Street' => $this->order->getSenderAddress()->getStreet() . ' ' . $this->order->getSenderAddress()->getHouseNumber(),
'Zipcode' => $this->order->getSenderAddress()->getZip(), 'Zipcode' => $this->order->getSenderAddress()->getZip(),
'City' => $this->order->getSenderAddress()->getCity(), 'City' => $this->order->getSenderAddress()->getCity(),
'TelephoneNumber' => (string)$this->order->getSenderAddress()->getPhone()?: '0000000', 'TelephoneNumber' => (string)$this->order->getSenderAddress()->getPhone() ?: '0000000',
'CountryCodeISO' => 'DE', 'CountryCodeISO' => 'DE',
], ],
'DeliveryAddresses' => [[ 'DeliveryAddresses' => [[
@ -79,7 +82,7 @@ class PostPrintJob extends Base
'LastName' => $this->order->getDeliveryAddress()->getLastname(), 'LastName' => $this->order->getDeliveryAddress()->getLastname(),
'FirstName' => $this->order->getDeliveryAddress()->getFirstname(), 'FirstName' => $this->order->getDeliveryAddress()->getFirstname(),
'City' => $this->order->getDeliveryAddress()->getCity(), 'City' => $this->order->getDeliveryAddress()->getCity(),
'TelephoneNumber' => $this->order->getDeliveryAddress()->getPhone()?: '0000000', 'TelephoneNumber' => $this->order->getDeliveryAddress()->getPhone() ?: '0000000',
'CountryCodeISO' => 'DE', 'CountryCodeISO' => 'DE',
] ]
]], ]],

View File

@ -8,7 +8,6 @@ use Symfony\Component\Mime\Part\DataPart;
class PostUpload extends Base class PostUpload extends Base
{ {
private \PSC\Shop\OrderBundle\Model\Order\Position $position; private \PSC\Shop\OrderBundle\Model\Order\Position $position;
private \PSC\Shop\OrderBundle\Model\Base $order; private \PSC\Shop\OrderBundle\Model\Base $order;
@ -20,6 +19,7 @@ class PostUpload extends Base
public function call() public function call()
{ {
$return = false;
if(count($this->position->getUploads()) > 0) { if(count($this->position->getUploads()) > 0) {
$temp = []; $temp = [];
@ -31,6 +31,7 @@ class PostUpload extends Base
'/' . $this->position->getExternalOrderNumber() . '/link', '/' . $this->position->getExternalOrderNumber() . '/link',
$this->buildDataLink($temp) $this->buildDataLink($temp)
); );
$return = true;
} }
if($this->position->getProduct()->getUploadProvidedFile() && $this->position->getProduct()->getUploadProvidedFile()->getUrl() != "") { if($this->position->getProduct()->getUploadProvidedFile() && $this->position->getProduct()->getUploadProvidedFile()->getUrl() != "") {
@ -38,6 +39,7 @@ class PostUpload extends Base
'/' . $this->position->getExternalOrderNumber() . '/link', '/' . $this->position->getExternalOrderNumber() . '/link',
$this->buildDataLink(['https://' . $this->domain . $this->position->getProduct()->getUploadProvidedFile()->getUrl()]) $this->buildDataLink(['https://' . $this->domain . $this->position->getProduct()->getUploadProvidedFile()->getUrl()])
); );
$return = true;
} }
$outfile = '/data/www/old/market/steplayouter/basket/' . $this->order->getUid() . '/' . $this->position->getPos() . '/'.$this->order->getAlias() . '_' . $this->position->getPos().'.pdf'; $outfile = '/data/www/old/market/steplayouter/basket/' . $this->order->getUid() . '/' . $this->position->getPos() . '/'.$this->order->getAlias() . '_' . $this->position->getPos().'.pdf';
@ -47,8 +49,10 @@ class PostUpload extends Base
'/' . $this->position->getExternalOrderNumber() . '/link', '/' . $this->position->getExternalOrderNumber() . '/link',
$this->buildDataLink(['https://' . $this->domain . '/apps/market/steplayouter/basket/' . $this->order->getUid() . '/' . $this->position->getPos() . '/'.$this->order->getAlias() . '_' . $this->position->getPos().'.pdf']) $this->buildDataLink(['https://' . $this->domain . '/apps/market/steplayouter/basket/' . $this->order->getUid() . '/' . $this->position->getPos() . '/'.$this->order->getAlias() . '_' . $this->position->getPos().'.pdf'])
); );
$return = true;
} }
return $return;
} }
private function buildDataLink(array $links) private function buildDataLink(array $links)

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Plugin\Custom\PSC\Saxoprint_API_R1\Queue; namespace Plugin\Custom\PSC\Saxoprint_API_R1\Queue;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
@ -41,15 +42,16 @@ class Confirm implements QueueInterface, ConfigurableElementInterface
*/ */
private Manager $_eventManager; private Manager $_eventManager;
function __construct(FormFactoryInterface $formFactory, public function __construct(
EntityManagerInterface $entityManager, FormFactoryInterface $formFactory,
DocumentManager $doctrine_mongodb, EntityManagerInterface $entityManager,
Status $statusService, DocumentManager $doctrine_mongodb,
PostConfirm $postConfirm, Status $statusService,
Shop $shopService, PostConfirm $postConfirm,
Order $orderService, Shop $shopService,
Manager $eventManager) Order $orderService,
{ Manager $eventManager
) {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_doctrine_mongodb = $doctrine_mongodb; $this->_doctrine_mongodb = $doctrine_mongodb;
@ -123,7 +125,8 @@ class Confirm implements QueueInterface, ConfigurableElementInterface
* @return bool * @return bool
* @internal param Queue $doc * @internal param Queue $doc
*/ */
public function execute(EventInterface $event, Queue $queue) { public function execute(EventInterface $event, Queue $queue)
{
/** @var \Plugin\Custom\PSC\Saxoprint_API_R1\Document\Export $settings */ /** @var \Plugin\Custom\PSC\Saxoprint_API_R1\Document\Export $settings */
$settings = $queue->getQueueDocument(); $settings = $queue->getQueueDocument();
@ -135,6 +138,7 @@ class Confirm implements QueueInterface, ConfigurableElementInterface
$order = $this->_orderService->getCurrentOrder(); $order = $this->_orderService->getCurrentOrder();
$this->_postConfirm->setShopEntity($this->_shopService->getShopByUid($order->getShop()->getId()));
$this->_postConfirm->setShop($this->_shopService->getMongoShopByUid($order->getShop()->getId())); $this->_postConfirm->setShop($this->_shopService->getMongoShopByUid($order->getShop()->getId()));
$this->_postConfirm->setPosition($position); $this->_postConfirm->setPosition($position);
$this->_postConfirm->setOrder($order); $this->_postConfirm->setOrder($order);

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Plugin\Custom\PSC\Saxoprint_API_R1\Queue; namespace Plugin\Custom\PSC\Saxoprint_API_R1\Queue;
use DirectoryIterator; use DirectoryIterator;
@ -58,15 +59,16 @@ class Export implements QueueInterface, ConfigurableElementInterface
*/ */
private Manager $_eventManager; private Manager $_eventManager;
function __construct(FormFactoryInterface $formFactory, public function __construct(
EntityManagerInterface $entityManager, FormFactoryInterface $formFactory,
DocumentManager $doctrine_mongodb, EntityManagerInterface $entityManager,
Status $statusService, DocumentManager $doctrine_mongodb,
PostPrintJob $postPrintJob, Status $statusService,
Shop $shopService, PostPrintJob $postPrintJob,
Order $orderService, Shop $shopService,
Manager $eventManager) Order $orderService,
{ Manager $eventManager
) {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_doctrine_mongodb = $doctrine_mongodb; $this->_doctrine_mongodb = $doctrine_mongodb;
@ -140,7 +142,8 @@ class Export implements QueueInterface, ConfigurableElementInterface
* @return bool * @return bool
* @internal param Queue $doc * @internal param Queue $doc
*/ */
public function execute(EventInterface $event, Queue $queue) { public function execute(EventInterface $event, Queue $queue)
{
/** @var \Plugin\Custom\PSC\Saxoprint_API_R1\Document\Export $settings */ /** @var \Plugin\Custom\PSC\Saxoprint_API_R1\Document\Export $settings */
$settings = $queue->getQueueDocument(); $settings = $queue->getQueueDocument();
@ -153,6 +156,7 @@ class Export implements QueueInterface, ConfigurableElementInterface
$order = $this->_orderService->getCurrentOrder(); $order = $this->_orderService->getCurrentOrder();
$this->_postPrintJob->setShop($this->_shopService->getMongoShopByUid($order->getShop()->getId())); $this->_postPrintJob->setShop($this->_shopService->getMongoShopByUid($order->getShop()->getId()));
$this->_postPrintJob->setShopEntity($this->_shopService->getShopByUid($order->getShop()->getId()));
$this->_postPrintJob->setPosition($position); $this->_postPrintJob->setPosition($position);
$this->_postPrintJob->setOrder($order); $this->_postPrintJob->setOrder($order);
@ -160,7 +164,7 @@ class Export implements QueueInterface, ConfigurableElementInterface
if($result && isset($result['Ordernumber'])) { if($result && isset($result['Ordernumber'])) {
$position->setExternalOrderNumber($result['Ordernumber']); $position->setExternalOrderNumber($result['Ordernumber']);
$position->setStatus($settings->getStatusSuccess()); $position->setStatus($settings->getStatusSuccess());
}else{ } else {
$position->setStatus($settings->getStatusError()); $position->setStatus($settings->getStatusError());
} }
$this->_orderService->storeOrder($order); $this->_orderService->storeOrder($order);

View File

@ -1,4 +1,5 @@
<?php <?php
namespace Plugin\Custom\PSC\Saxoprint_API_R1\Queue; namespace Plugin\Custom\PSC\Saxoprint_API_R1\Queue;
use DirectoryIterator; use DirectoryIterator;
@ -60,15 +61,16 @@ class Upload implements QueueInterface, ConfigurableElementInterface
*/ */
private Manager $_eventManager; private Manager $_eventManager;
function __construct(FormFactoryInterface $formFactory, public function __construct(
EntityManagerInterface $entityManager, FormFactoryInterface $formFactory,
DocumentManager $doctrine_mongodb, EntityManagerInterface $entityManager,
Status $statusService, DocumentManager $doctrine_mongodb,
PostUpload $postUpload, Status $statusService,
Shop $shopService, PostUpload $postUpload,
Order $orderService, Shop $shopService,
Manager $eventManager) Order $orderService,
{ Manager $eventManager
) {
$this->_formFactory = $formFactory; $this->_formFactory = $formFactory;
$this->_entityManager = $entityManager; $this->_entityManager = $entityManager;
$this->_doctrine_mongodb = $doctrine_mongodb; $this->_doctrine_mongodb = $doctrine_mongodb;
@ -142,7 +144,8 @@ class Upload implements QueueInterface, ConfigurableElementInterface
* @return bool * @return bool
* @internal param Queue $doc * @internal param Queue $doc
*/ */
public function execute(EventInterface $event, Queue $queue) { public function execute(EventInterface $event, Queue $queue)
{
/** @var \Plugin\Custom\PSC\Saxoprint_API_R1\Document\Export $settings */ /** @var \Plugin\Custom\PSC\Saxoprint_API_R1\Document\Export $settings */
$settings = $queue->getQueueDocument(); $settings = $queue->getQueueDocument();
@ -161,17 +164,20 @@ class Upload implements QueueInterface, ConfigurableElementInterface
$domains = $this->_entityManager $domains = $this->_entityManager
->getRepository(Domain::class)->createQueryBuilder('domain') ->getRepository(Domain::class)->createQueryBuilder('domain')
->andWhere('domain.shop = :shop_id') ->andWhere('domain.shop = :shop_id')
->setParameter("shop_id",$order->getShop()->getId())->getQuery()->execute(); ->setParameter("shop_id", $order->getShop()->getId())->getQuery()->execute();
if (count($domains) > 0) { if (count($domains) > 0) {
$domain = array_pop($domains)->getHost(); $domain = array_pop($domains)->getHost();
}else{ } else {
$domain = false; $domain = false;
} }
$this->_postUpload->setShopEntity($this->_shopService->getShopByUid($order->getShop()->getId()));
$this->_postUpload->setDomain($domain); $this->_postUpload->setDomain($domain);
$this->_postUpload->call(); $return = $this->_postUpload->call();
if(!$return) {
return false;
}
$position->setStatus($settings->getStatusSuccess()); $position->setStatus($settings->getStatusSuccess());
$this->_orderService->storeOrder($order); $this->_orderService->storeOrder($order);

View File

@ -2,7 +2,6 @@
class market_article class market_article
{ {
public $id = "6"; public $id = "6";
public $articlegroups; public $articlegroups;
public $private; public $private;
@ -151,7 +150,7 @@ class market_article
} elseif(count($upload) == 1 && ($view->view->upload_possible[0] == 'provided' || $view->view->upload_possible[0] == 'center' || $view->view->upload_possible[0] == 'mail' || $view->view->upload_possible[0] == 'post')) { } elseif(count($upload) == 1 && ($view->view->upload_possible[0] == 'provided' || $view->view->upload_possible[0] == 'center' || $view->view->upload_possible[0] == 'mail' || $view->view->upload_possible[0] == 'post')) {
$_POST['upload_mode'] = $view->view->upload_possible[0]; $_POST['upload_mode'] = $view->view->upload_possible[0];
$view->getRequest()->setParam('upload_mode', $view->view->upload_possible[0]); $view->getRequest()->setParam('upload_mode', $view->view->upload_possible[0]);
}else { } else {
$_POST['upload_mode'] = 'none'; $_POST['upload_mode'] = 'none';
$view->getRequest()->setParam('upload_mode', 'none'); $view->getRequest()->setParam('upload_mode', 'none');
} }
@ -603,7 +602,10 @@ class market_article
->where('c.uuid = ?', array((string)$layouterPreviewId)) ->where('c.uuid = ?', array((string)$layouterPreviewId))
->fetchOne(); ->fetchOne();
$design = json_decode($layoutData->design, true); $design = json_decode($layoutData->design, true);
return '<img src="' . $design['previews'][0]['url'] .'" class="layouter_10" />'; if(isset($design['previews'][$site - 1])) {
return '<img src="' . $design['previews'][$site - 1] .'" class="layouter_10" />';
}
return '';
} elseif ($articleSess->getLayouterModus() == 101) { } elseif ($articleSess->getLayouterModus() == 101) {
$layoutData = Doctrine_Query::create() $layoutData = Doctrine_Query::create()
->from('LayouterDesignData c') ->from('LayouterDesignData c')

View File

@ -37,6 +37,9 @@ user.login.elements.password_re.options.validators.1.options = "password"
; firstname element ; firstname element
user.rech.legend = "Rechnungsadresse" user.rech.legend = "Rechnungsadresse"
user.rech.elements.is_company.type = "checkbox"
user.rech.elements.is_company.options.label = "Gewerblich?"
user.rech.elements.self_anrede.type = "select" user.rech.elements.self_anrede.type = "select"
user.rech.elements.self_anrede.options.label = "Anrede" user.rech.elements.self_anrede.options.label = "Anrede"
user.rech.elements.self_anrede.options.required = false user.rech.elements.self_anrede.options.required = false
@ -143,4 +146,4 @@ user.submit.elements.submit.options.label = "Jetzt registrieren"
user.liefersubmit.elements.submit.type = "submit" user.liefersubmit.elements.submit.type = "submit"
user.liefersubmit.elements.submit.options.class = "green" user.liefersubmit.elements.submit.options.class = "green"
user.liefersubmit.elements.submit.options.name = "st" user.liefersubmit.elements.submit.options.name = "st"
user.liefersubmit.elements.submit.options.label = "Use Delivery" user.liefersubmit.elements.submit.options.label = "Use Delivery"

View File

@ -135,18 +135,10 @@ a.editAddress.btn.btn-info.btn-xs {
<?php endif; ?> <?php endif; ?>
<input id="delivery" type="hidden" name="delivery" value="custom" /> <input id="delivery" type="hidden" name="delivery" value="<?php echo $this->delivery ?>" />
<input id="sender" type="hidden" name="sender" value="<?php echo $this->sender ?>" /> <input id="sender" type="hidden" name="sender" value="<?php echo $this->sender ?>" />
<input id="invoice" type="hidden" name="invoice" value="<?php echo $this->invoice ?>" /> <input id="invoice" type="hidden" name="invoice" value="<?php echo $this->invoice ?>" />
<input type="text" name="delivery_firstname" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['firstname'] ?>"/>
<input type="text" name="delivery_lastname" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['lastname'] ?>"/>
<input type="text" name="delivery_street" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['street'] ?>"/>
<input type="text" name="delivery_houseNumber" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['houseNumber'] ?>"/>
<input type="text" name="delivery_zip" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['zip'] ?>"/>
<input type="text" name="delivery_city" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['city'] ?>"/>
<input type="text" name="delivery_email" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['email'] ?>"/>
<input type="text" name="delivery_company" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['company'] ?>"/>
<input type="text" name="delivery_company2" value="<?php echo TP_Basket::getBasket()->getDeliveryAddress()['company2'] ?>"/>
<div class="col-xs-12"><input id="review_next" type="submit" value="<?php echo $this->translate('Weiter') ?>" class="btn btn-success btn-lg pull-right" style="margin-right: 15px;" /></div> <div class="col-xs-12"><input id="review_next" type="submit" value="<?php echo $this->translate('Weiter') ?>" class="btn btn-success btn-lg pull-right" style="margin-right: 15px;" /></div>
@ -303,20 +295,20 @@ a.editAddress.btn.btn-info.btn-xs {
<div class="row"> <div class="row">
<?php <?php
$this->form->removeElement('submit'); $this->form->removeElement('submit');
EasyBib_Form_Decorator::setFormDecorator($this->form, \EasyBib_Form_Decorator::BOOTSTRAP, 'submit'); EasyBib_Form_Decorator::setFormDecorator($this->form, \EasyBib_Form_Decorator::BOOTSTRAP, 'submit');
?> ?>
<form id="register" enctype="application/x-www-form-urlencoded" action="" method="post" role="form" style="padding:0 2em"> <form id="register" enctype="application/x-www-form-urlencoded" action="" method="post" role="form" style="padding:0 2em">
<div class="col-sm-6"> <div class="col-sm-6">
<?php <?php
$i = 0; $i = 0;
foreach ($this->form->getElements() as $element) : ?> foreach ($this->form->getElements() as $element) : ?>
<?php if ($i == 7) : ?></div> <?php if ($i == 7) : ?></div>
<div class="col-sm-6"><?php endif; ?> <div class="col-sm-6"><?php endif; ?>
<?php echo str_replace(array('control-group', 'control-label', 'class="controls"'), array('form-group', 'form-label', 'class="form-controls"'), $element->render()); ?> <?php echo str_replace(array('control-group', 'control-label', 'class="controls"'), array('form-group', 'form-label', 'class="form-controls"'), $element->render()); ?>
<?php <?php
$i++; $i++;
endforeach; ?> endforeach; ?>
</div> </div>
</form> </form>
<br class="clearfix"> <br class="clearfix">
@ -346,22 +338,22 @@ a.editAddress.btn.btn-info.btn-xs {
<div class="row"> <div class="row">
<?php <?php
$this->editform->removeElement('update'); $this->editform->removeElement('update');
EasyBib_Form_Decorator::setFormDecorator($this->editform, \EasyBib_Form_Decorator::BOOTSTRAP, 'update'); EasyBib_Form_Decorator::setFormDecorator($this->editform, \EasyBib_Form_Decorator::BOOTSTRAP, 'update');
?> ?>
<input type="hidden" value="" name="editaddressuuid" id="editaddressuuid" /> <input type="hidden" value="" name="editaddressuuid" id="editaddressuuid" />
<form id="updateaddress" name="updateaddress" enctype="application/x-www-form-urlencoded" class="form-horizontal" action="" method="post" role="form" style="padding:0 2em"> <form id="updateaddress" name="updateaddress" enctype="application/x-www-form-urlencoded" class="form-horizontal" action="" method="post" role="form" style="padding:0 2em">
<div class="col-sm-6"> <div class="col-sm-6">
<?php <?php
$i = 0; $i = 0;
foreach ($this->editform->getElements() as $element) : ?> foreach ($this->editform->getElements() as $element) : ?>
<?php if ($i == 7) : ?></div> <?php if ($i == 7) : ?></div>
<div class="col-sm-6"><?php endif; ?> <div class="col-sm-6"><?php endif; ?>
<?php echo str_replace(array('control-group', 'control-label', 'class="controls"'), array('form-group', 'form-label', 'class="form-controls"'), $element->render()); ?> <?php echo str_replace(array('control-group', 'control-label', 'class="controls"'), array('form-group', 'form-label', 'class="form-controls"'), $element->render()); ?>
<?php <?php
$i++; $i++;
endforeach; ?> endforeach; ?>
</div> </div>

View File

@ -3283,7 +3283,9 @@ class BasketController extends TP_Controller_Action
} }
$basket->setDeliveryIsSame(true); $basket->setDeliveryIsSame(true);
//$basket->setSender(0); $basket->setDeliveryUstid($this->view->sender_address->ustid);
$basket->setDeliveryPLZ($this->view->sender_address->zip);
//$basket->setSender(0);
$this->redirectSpeak('/basket/finish'); $this->redirectSpeak('/basket/finish');
} elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's' } elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's'
&& $this->getRequest()->getParam('sender') != '' && $this->getRequest()->getParam('invoice') != '' && $this->getRequest()->getParam('sender') != '' && $this->getRequest()->getParam('invoice') != ''
@ -3293,10 +3295,14 @@ class BasketController extends TP_Controller_Action
$basket->setDelivery($this->getRequest()->getParam('delivery')); $basket->setDelivery($this->getRequest()->getParam('delivery'));
$basket->setInvoice($this->getRequest()->getParam('invoice')); $basket->setInvoice($this->getRequest()->getParam('invoice'));
$basket->setSender($this->getRequest()->getParam('sender')); $basket->setSender($this->getRequest()->getParam('sender'));
$basket->setDeliveryUstid($this->view->delivery_address->ustid);
$basket->setDeliveryPLZ($this->view->delivery_address->zip);
$this->redirectSpeak('/basket/finish'); $this->redirectSpeak('/basket/finish');
} elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's') { } elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's') {
$basket->setDeliveryIsSame(false); $basket->setDeliveryIsSame(false);
$basket->setDelivery($this->getRequest()->getParam('delivery')); $basket->setDelivery($this->getRequest()->getParam('delivery'));
$basket->setDeliveryUstid($this->view->delivery_address->ustid);
$basket->setDeliveryPLZ($this->view->delivery_address->zip);
$this->redirectSpeak('/basket/finish'); $this->redirectSpeak('/basket/finish');
} }
@ -4549,7 +4555,6 @@ class BasketController extends TP_Controller_Action
$this->view->gutschein = $gutscheincode; $this->view->gutschein = $gutscheincode;
} }
$basket->setWithTax(TP_Country::getTaxForCountry($basket->getDeliveryCountry(), $basket->getDeliveryUstId())); $basket->setWithTax(TP_Country::getTaxForCountry($basket->getDeliveryCountry(), $basket->getDeliveryUstId()));
$this->view->withTax = $basket->isWithTax(); $this->view->withTax = $basket->isWithTax();

View File

@ -3023,7 +3023,10 @@ class UserController extends TP_Controller_Action
} }
if ($this->_request->isPost()) { if ($this->_request->isPost()) {
if($form->getSubForm('rech')->getElement('is_company')->isChecked()) {
$form->get('rech')->get('self_department')->setRequired(true);
$form->get('rech')->get('ustid')->setRequired(true);
}
$externalValidation = true; $externalValidation = true;
if($this->shop->getPluginSettings(module: 'friendlycaptcha', name: 'secret')) { if($this->shop->getPluginSettings(module: 'friendlycaptcha', name: 'secret')) {
$externalValidation = false; $externalValidation = false;

View File

@ -1,8 +1,9 @@
<?php <?php
class TP_Country { class TP_Country
{
public static function getCountrysAsArray() { public static function getCountrysAsArray(): array
{
$shop = Zend_Registry::get('shop'); $shop = Zend_Registry::get('shop');
$statusCollection = TP_Mongo::getInstance()->Country; $statusCollection = TP_Mongo::getInstance()->Country;
@ -17,9 +18,9 @@ class TP_Country {
} }
public static function getTaxForCountry($code, $ustid) public static function getTaxForCountry($code, $ustid): bool
{ {
if($code === NULL || $code == '') { if($code === null || $code == '') {
return true; return true;
} }
$shop = Zend_Registry::get('shop'); $shop = Zend_Registry::get('shop');
@ -27,16 +28,16 @@ class TP_Country {
$country = $statusCollection->findOne(array('shop' => (string)$shop['id'], 'code' => $code)); $country = $statusCollection->findOne(array('shop' => (string)$shop['id'], 'code' => $code));
if($country === NULL) { if($country === null) {
return true; return true;
} }
if($ustid == NULL || $ustid == "") { if($ustid == null || $ustid == "") {
return $country['withTaxWithoutUstNr']; return $country['withTaxWithoutUstNr'];
}else{ } else {
return $country['withTaxWithUstNr']; return $country['withTaxWithUstNr'];
} }
} }
} }

View File

@ -166,7 +166,7 @@ class TP_Image {
if($resize == "-resize 0x0") { if($resize == "-resize 0x0") {
exec("convert -density 140 '".$image->path."[0]' -quality 75 -background white -alpha remove -colorspace sRGB ". PUBLIC_PATH.'/temp/thumb/'.$shop['uid'].'/'.$image->id.'_'.$mode.'.png'); exec("convert -density 140 '".$image->path."[0]' -quality 75 -background white -alpha remove -colorspace sRGB ". PUBLIC_PATH.'/temp/thumb/'.$shop['uid'].'/'.$image->id.'_'.$mode.'.png');
}else{ }else{
var_dump("convert -density 140 '".$image->path."[0]' ".$resize." -quality 75 -background white -alpha remove -colorspace sRGB ". PUBLIC_PATH.'/temp/thumb/'.$shop['uid'].'/'.$image->id.'_'.$mode.'.png'); exec("convert -density 140 '".$image->path."[0]' ".$resize." -quality 75 -background white -alpha remove -colorspace sRGB ". PUBLIC_PATH.'/temp/thumb/'.$shop['uid'].'/'.$image->id.'_'.$mode.'.png');
} }
return '/temp/thumb/'.$shop['uid'].'/'.$image->id.'_'.$mode.'.png'; return '/temp/thumb/'.$shop['uid'].'/'.$image->id.'_'.$mode.'.png';
}elseif($finfo == 'image/png') { }elseif($finfo == 'image/png') {

View File

@ -446,7 +446,7 @@ class Zend_Barcode_Renderer_Image extends Zend_Barcode_Renderer_RendererAbstract
require_once 'Zend/Barcode/Renderer/Exception.php'; require_once 'Zend/Barcode/Renderer/Exception.php';
throw new Zend_Barcode_Renderer_Exception( throw new Zend_Barcode_Renderer_Exception(
'A font was provided, but this instance of PHP does not have TTF (FreeType) support' 'A font was provided, but this instance of PHP does not have TTF (FreeType) support'
); );
} }
$box = imagettfbbox($size, 0, $font, $text); $box = imagettfbbox($size, 0, $font, $text);

View File

@ -46,7 +46,7 @@ class Zend_Form_Element_Captcha extends Zend_Form_Element_Xhtml
/** /**
* Captcha plugin type constant * Captcha plugin type constant
*/ */
const CAPTCHA = 'CAPTCHA'; public const CAPTCHA = 'CAPTCHA';
/** /**
* Captcha adapter * Captcha adapter
@ -90,7 +90,7 @@ class Zend_Form_Element_Captcha extends Zend_Form_Element_Xhtml
$name = $this->getPluginLoader(self::CAPTCHA)->load($name); $name = $this->getPluginLoader(self::CAPTCHA)->load($name);
if (empty($options)) { if (empty($options)) {
$instance = new $name; $instance = new $name();
} else { } else {
$r = new ReflectionClass($name); $r = new ReflectionClass($name);
if ($r->hasMethod('__construct')) { if ($r->hasMethod('__construct')) {
@ -234,7 +234,7 @@ class Zend_Form_Element_Captcha extends Zend_Form_Element_Xhtml
switch ($type) { switch ($type) {
case null: case null:
$loader = $this->getPluginLoader(self::CAPTCHA); $loader = $this->getPluginLoader(self::CAPTCHA);
$nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; $nsSeparator = (false !== strpos($prefix, '\\')) ? '\\' : '_';
$cPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Captcha'; $cPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Captcha';
$cPath = rtrim($path, '/\\') . '/Captcha'; $cPath = rtrim($path, '/\\') . '/Captcha';
$loader->addPrefixPath($cPrefix, $cPath); $loader->addPrefixPath($cPrefix, $cPath);