2
This commit is contained in:
parent
3d8cca58dd
commit
52fae1a695
@ -17,7 +17,8 @@ exports.FetchStream = FetchStream;
|
|||||||
exports.CookieJar = CookieJar;
|
exports.CookieJar = CookieJar;
|
||||||
exports.fetchUrl = fetchUrl;
|
exports.fetchUrl = fetchUrl;
|
||||||
|
|
||||||
function FetchStream(url, options) {
|
function FetchStream(url, options)
|
||||||
|
{
|
||||||
Stream.call(this);
|
Stream.call(this);
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@ -382,7 +383,8 @@ FetchStream.prototype._runStream = function (url_data, url) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function fetchUrl(url, options, callback) {
|
function fetchUrl(url, options, callback)
|
||||||
|
{
|
||||||
if (!callback && typeof options === 'function') {
|
if (!callback && typeof options === 'function') {
|
||||||
callback = options;
|
callback = options;
|
||||||
options = undefined;
|
options = undefined;
|
||||||
@ -453,7 +455,8 @@ function fetchUrl(url, options, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseContentType(str) {
|
function _parseContentType(str)
|
||||||
|
{
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -476,7 +479,8 @@ function _parseContentType(str) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function _findHTMLCharset(htmlbuffer) {
|
function _findHTMLCharset(htmlbuffer)
|
||||||
|
{
|
||||||
|
|
||||||
var body = htmlbuffer.toString('ascii'),
|
var body = htmlbuffer.toString('ascii'),
|
||||||
input, meta, charset;
|
input, meta, charset;
|
||||||
|
@ -1,22 +1,26 @@
|
|||||||
var initParameters = {};
|
var initParameters = {};
|
||||||
var entrypoint = null;
|
var entrypoint = null;
|
||||||
|
|
||||||
function onEditQuery(newQuery) {
|
function onEditQuery(newQuery)
|
||||||
|
{
|
||||||
initParameters.query = newQuery;
|
initParameters.query = newQuery;
|
||||||
updateURL();
|
updateURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEditVariables(newVariables) {
|
function onEditVariables(newVariables)
|
||||||
|
{
|
||||||
initParameters.variables = newVariables;
|
initParameters.variables = newVariables;
|
||||||
updateURL();
|
updateURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEditOperationName(newOperationName) {
|
function onEditOperationName(newOperationName)
|
||||||
|
{
|
||||||
initParameters.operationName = newOperationName;
|
initParameters.operationName = newOperationName;
|
||||||
updateURL();
|
updateURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateURL() {
|
function updateURL()
|
||||||
|
{
|
||||||
var newSearch = '?' + Object.keys(initParameters).filter(function (key) {
|
var newSearch = '?' + Object.keys(initParameters).filter(function (key) {
|
||||||
return Boolean(initParameters[key]);
|
return Boolean(initParameters[key]);
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
@ -25,7 +29,8 @@ function updateURL() {
|
|||||||
history.replaceState(null, null, newSearch);
|
history.replaceState(null, null, newSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
function graphQLFetcher(graphQLParams) {
|
function graphQLFetcher(graphQLParams)
|
||||||
|
{
|
||||||
return fetch(entrypoint, {
|
return fetch(entrypoint, {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -5,14 +5,18 @@ window.onload = function() {
|
|||||||
|
|
||||||
new MutationObserver(function (mutations, self) {
|
new MutationObserver(function (mutations, self) {
|
||||||
const op = document.getElementById(`operations-${data.shortName}-${data.operationId}`);
|
const op = document.getElementById(`operations-${data.shortName}-${data.operationId}`);
|
||||||
if (!op) return;
|
if (!op) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self.disconnect();
|
self.disconnect();
|
||||||
|
|
||||||
op.querySelector('.opblock-summary').click();
|
op.querySelector('.opblock-summary').click();
|
||||||
const tryOutObserver = new MutationObserver(function (mutations, self) {
|
const tryOutObserver = new MutationObserver(function (mutations, self) {
|
||||||
const tryOut = op.querySelector('.try-out__btn');
|
const tryOut = op.querySelector('.try-out__btn');
|
||||||
if (!tryOut) return;
|
if (!tryOut) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self.disconnect();
|
self.disconnect();
|
||||||
|
|
||||||
@ -71,10 +75,12 @@ window.onload = function() {
|
|||||||
// Adapted from https://github.com/vitalyq/react-trigger-change/blob/master/lib/change.js
|
// Adapted from https://github.com/vitalyq/react-trigger-change/blob/master/lib/change.js
|
||||||
// Copyright (c) 2017 Vitaly Kuznetsov
|
// Copyright (c) 2017 Vitaly Kuznetsov
|
||||||
// MIT License
|
// MIT License
|
||||||
function reactTriggerChange(node) {
|
function reactTriggerChange(node)
|
||||||
|
{
|
||||||
// Do not try to delete non-configurable properties.
|
// Do not try to delete non-configurable properties.
|
||||||
// Value and checked properties on DOM elements are non-configurable in PhantomJS.
|
// Value and checked properties on DOM elements are non-configurable in PhantomJS.
|
||||||
function deletePropertySafe(elem, prop) {
|
function deletePropertySafe(elem, prop)
|
||||||
|
{
|
||||||
const desc = Object.getOwnPropertyDescriptor(elem, prop);
|
const desc = Object.getOwnPropertyDescriptor(elem, prop);
|
||||||
if (desc && desc.configurable) {
|
if (desc && desc.configurable) {
|
||||||
delete elem[prop];
|
delete elem[prop];
|
||||||
@ -129,9 +135,12 @@ window.onload = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function manageWebbyDisplay() {
|
function manageWebbyDisplay()
|
||||||
|
{
|
||||||
const webby = document.getElementsByClassName('webby')[0];
|
const webby = document.getElementsByClassName('webby')[0];
|
||||||
if (!webby) return;
|
if (!webby) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const web = document.getElementsByClassName('web')[0];
|
const web = document.getElementsByClassName('web')[0];
|
||||||
webby.classList.add('calm');
|
webby.classList.add('calm');
|
||||||
|
@ -25,7 +25,6 @@ use Vin\ShopwareSdk\Data\Filter\EqualsAnyFilter;
|
|||||||
use Vin\ShopwareSdk\Data\Filter\EqualsFilter;
|
use Vin\ShopwareSdk\Data\Filter\EqualsFilter;
|
||||||
use Vin\ShopwareSdk\Factory\RepositoryFactory;
|
use Vin\ShopwareSdk\Factory\RepositoryFactory;
|
||||||
|
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
name: 'sw:get-orders',
|
name: 'sw:get-orders',
|
||||||
description: 'Holt alle offenen Bestellungen von SW ab',
|
description: 'Holt alle offenen Bestellungen von SW ab',
|
||||||
@ -99,7 +98,8 @@ class SwGetOrdersCommand extends Command
|
|||||||
/**
|
/**
|
||||||
* @return \Vin\ShopwareSdk\Data\AccessToken|void
|
* @return \Vin\ShopwareSdk\Data\AccessToken|void
|
||||||
*/
|
*/
|
||||||
private function shopwareAuth(){
|
private function shopwareAuth()
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$grantType = new ClientCredentialsGrantType($_ENV['SHOPWARE_API_ID'], $_ENV['SHOPWARE_API_KEY']);
|
$grantType = new ClientCredentialsGrantType($_ENV['SHOPWARE_API_ID'], $_ENV['SHOPWARE_API_KEY']);
|
||||||
@ -116,7 +116,6 @@ class SwGetOrdersCommand extends Command
|
|||||||
private function getOrdersDataFromSW(): void
|
private function getOrdersDataFromSW(): void
|
||||||
{
|
{
|
||||||
foreach ($this->orderData as $value) {
|
foreach ($this->orderData as $value) {
|
||||||
|
|
||||||
// Bei Shopware API anmelden
|
// Bei Shopware API anmelden
|
||||||
$context = new Context($_ENV['SHOPWARE_API_URL'], $this->shopwareAuth());
|
$context = new Context($_ENV['SHOPWARE_API_URL'], $this->shopwareAuth());
|
||||||
|
|
||||||
@ -134,12 +133,10 @@ class SwGetOrdersCommand extends Command
|
|||||||
$orders = $orderRepository->search($criteria, $context);
|
$orders = $orderRepository->search($criteria, $context);
|
||||||
|
|
||||||
$value->setData((array)$orders->getEntities());
|
$value->setData((array)$orders->getEntities());
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,7 +148,4 @@ class SwGetOrdersCommand extends Command
|
|||||||
$orderData->setStatus = 1;
|
$orderData->setStatus = 1;
|
||||||
$this->ordersRepository->add($orderData, true);
|
$this->ordersRepository->add($orderData, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use App\Repository\OrdersRepository;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use ApiPlatform\Core\Annotation\ApiResource;
|
use ApiPlatform\Core\Annotation\ApiResource;
|
||||||
|
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: OrdersRepository::class)]
|
#[ORM\Entity(repositoryClass: OrdersRepository::class)]
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
itemOperations: ["GET"],
|
itemOperations: ["GET"],
|
||||||
|
@ -44,7 +44,5 @@ final class OrdersSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
|
|
||||||
$this->logger->info('hier');
|
$this->logger->info('hier');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends ServiceEntityRepository<Orders>
|
* @extends ServiceEntityRepository<Orders>
|
||||||
*
|
*
|
||||||
@ -47,7 +46,6 @@ class OrdersRepository extends ServiceEntityRepository
|
|||||||
if (!$order) {
|
if (!$order) {
|
||||||
throw $this->createNotFoundException('Order not found: '.$entity->getId());
|
throw $this->createNotFoundException('Order not found: '.$entity->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove(Orders $entity, bool $flush = false): void
|
public function remove(Orders $entity, bool $flush = false): void
|
||||||
|
Loading…
Reference in New Issue
Block a user