add Logging

This commit is contained in:
Marko 2024-08-02 09:46:16 +02:00
parent b279dd058f
commit b5f1ba6f87
No known key found for this signature in database
20 changed files with 110 additions and 116 deletions

View File

@ -61,7 +61,9 @@ class HiltesExportCommand extends Command
foreach ($orders as $order) { foreach ($orders as $order) {
if ($order->getStatus() > 0) continue; if ($order->getStatus() > 0) {
continue;
}
$tA = $order->getData();#json_decode($order->getData()); $tA = $order->getData();#json_decode($order->getData());
$tA['orderdate'] = "2023-08-30T12:05:24.000Z"; $tA['orderdate'] = "2023-08-30T12:05:24.000Z";
@ -180,4 +182,4 @@ class HiltesExportCommand extends Command
return Command::SUCCESS; return Command::SUCCESS;
} }
} }

View File

@ -17,6 +17,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use function Sentry\captureCheckIn; use function Sentry\captureCheckIn;
#[AsCommand( #[AsCommand(
@ -35,8 +36,7 @@ class HiltesImportCommand extends Command
StockRepository $stockRepository, StockRepository $stockRepository,
WarehouseRepository $warehouseRepository, WarehouseRepository $warehouseRepository,
LoggerInterface $logger LoggerInterface $logger
) ) {
{
$this->productRepository = $productRepository; $this->productRepository = $productRepository;
$this->stockRepository = $stockRepository; $this->stockRepository = $stockRepository;
$this->warehouseRepository = $warehouseRepository; $this->warehouseRepository = $warehouseRepository;
@ -125,4 +125,4 @@ class HiltesImportCommand extends Command
//POST: $dirs = /app/public //POST: $dirs = /app/public
return implode('/', $dirs); return implode('/', $dirs);
} }
} }

View File

@ -32,8 +32,7 @@ class JtlExportCommand extends Command
StockRepository $stockRepository, StockRepository $stockRepository,
WarehouseRepository $warehouseRepository, WarehouseRepository $warehouseRepository,
LoggerInterface $logger LoggerInterface $logger
) ) {
{
$this->productRepository = $productRepository; $this->productRepository = $productRepository;
$this->stockRepository = $stockRepository; $this->stockRepository = $stockRepository;
$this->warehouseRepository = $warehouseRepository; $this->warehouseRepository = $warehouseRepository;
@ -85,4 +84,4 @@ class JtlExportCommand extends Command
return implode('/', $dirs); return implode('/', $dirs);
} }
} }

View File

@ -9,7 +9,6 @@ use DateTimeInterface;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/* /*
* Bestellungen Status: * Bestellungen Status:
* 1 = Bestellung eingegangen * 1 = Bestellung eingegangen
@ -108,4 +107,4 @@ class Order
return $this; return $this;
} }
} }

View File

@ -60,4 +60,4 @@ class Product
return $this; return $this;
} }
} }

View File

@ -126,4 +126,4 @@ class Stock
return $this; return $this;
} }
} }

View File

@ -93,4 +93,4 @@ class Warehouse
return $this; return $this;
} }
} }

View File

@ -40,4 +40,4 @@ class ExportHiltesSubscriber implements EventSubscriberInterface
KernelEvents::VIEW => ['onPatchOrder', EventPriorities::POST_WRITE] KernelEvents::VIEW => ['onPatchOrder', EventPriorities::POST_WRITE]
]; ];
} }
} }

View File

@ -15,7 +15,6 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ViewEvent; use Symfony\Component\HttpKernel\Event\ViewEvent;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
class SlackNotifySubscriber implements EventSubscriberInterface class SlackNotifySubscriber implements EventSubscriberInterface
{ {
/** /**
@ -126,4 +125,4 @@ class SlackNotifySubscriber implements EventSubscriberInterface
return $warehouse; return $warehouse;
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Helper; namespace App\Helper;
use Exception; use Exception;
class Ftp class Ftp
@ -130,4 +129,4 @@ class Ftp
{ {
$this->remoteDir = $remoteDir; $this->remoteDir = $remoteDir;
} }
} }

View File

@ -9,7 +9,6 @@ use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
class Hiltes class Hiltes
{ {
// init file system // init file system
@ -37,7 +36,7 @@ class Hiltes
* @param string $data * @param string $data
* @return void * @return void
*/ */
public function export(string $data) : void public function export(string $data): void
{ {
try { try {
$new_file_path = $this->current_dir_path . "/hiltes/c2h/" . $this->createFileName(); $new_file_path = $this->current_dir_path . "/hiltes/c2h/" . $this->createFileName();
@ -114,8 +113,8 @@ class Hiltes
$tSalNr = array(); $tSalNr = array();
foreach ($tA['positions'] as $v) { foreach ($tA['positions'] as $v) {
if ($v['type'] == 'versandposition' || $v['sku'] == '') { if ($v['type'] == 'versandposition' || $v['sku'] == '') {
// $SalesNumber = '000001'; // $SalesNumber = '000001';
// $SalesGoodsGroupNumber = 9350; // $SalesGoodsGroupNumber = 9350;
// Versandkosten werden nicht übermittelt // Versandkosten werden nicht übermittelt
continue; continue;
@ -234,7 +233,7 @@ class Hiltes
$payload = json_encode($param); $payload = json_encode($param);
if ($auth) { if ($auth) {
$this->logger->info('Send Order ' . $url . ' ' . $payload); $this->logger->info('Send Order ' . $url . ' ' . $payload);
} }
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', $authorization)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', $authorization));
@ -258,7 +257,7 @@ class Hiltes
* @param mixed $data The data to be converted to JSON. * @param mixed $data The data to be converted to JSON.
* @return array The JSON object. * @return array The JSON object.
*/ */
public function createJson($data) : array public function createJson($data): array
{ {
$arr = array( $arr = array(
'File' => array( 'File' => array(
@ -375,7 +374,7 @@ class Hiltes
try { try {
//Status 3 für erfolgreich exportiert //Status 3 für erfolgreich exportiert
$order->setStatus(3); $order->setStatus(3);
// $order->setHiltes($t); // $order->setHiltes($t);
$this->orderRepository->update($order, true); $this->orderRepository->update($order, true);
} catch (\Exception $exception) { } catch (\Exception $exception) {
@ -402,4 +401,4 @@ class Hiltes
} }
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Helper; namespace App\Helper;
use App\Entity\Product; use App\Entity\Product;
use App\Entity\Stock; use App\Entity\Stock;
use App\Entity\Warehouse; use App\Entity\Warehouse;
@ -323,4 +322,4 @@ class HiltesImport
return false; return false;
} }
} }

View File

@ -12,7 +12,6 @@ use Exception;
use League\Csv\Writer; use League\Csv\Writer;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
class Jtl class Jtl
{ {
private $productRepository; private $productRepository;
@ -45,8 +44,8 @@ class Jtl
WarehouseRepository $warehouseRepository, WarehouseRepository $warehouseRepository,
StockRepository $stockRepository, StockRepository $stockRepository,
LoggerInterface $logger, LoggerInterface $logger,
string $rootPath) string $rootPath
{ ) {
$this->productRepository = $productRepository; $this->productRepository = $productRepository;
$this->warehouseRepository = $warehouseRepository; $this->warehouseRepository = $warehouseRepository;
$this->stockRepository = $stockRepository; $this->stockRepository = $stockRepository;
@ -128,4 +127,4 @@ class Jtl
$this->logger->error($e->getMessage()); $this->logger->error($e->getMessage());
} }
} }
} }

View File

@ -39,28 +39,28 @@ class HlsCountryRepository extends ServiceEntityRepository
} }
} }
// /** // /**
// * @return HlsCountry[] Returns an array of HlsCountry objects // * @return HlsCountry[] Returns an array of HlsCountry objects
// */ // */
// public function findByExampleField($value): array // public function findByExampleField($value): array
// { // {
// return $this->createQueryBuilder('h') // return $this->createQueryBuilder('h')
// ->andWhere('h.exampleField = :val') // ->andWhere('h.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->orderBy('h.id', 'ASC') // ->orderBy('h.id', 'ASC')
// ->setMaxResults(10) // ->setMaxResults(10)
// ->getQuery() // ->getQuery()
// ->getResult() // ->getResult()
// ; // ;
// } // }
// public function findOneBySomeField($value): ?HlsCountry // public function findOneBySomeField($value): ?HlsCountry
// { // {
// return $this->createQueryBuilder('h') // return $this->createQueryBuilder('h')
// ->andWhere('h.exampleField = :val') // ->andWhere('h.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->getQuery() // ->getQuery()
// ->getOneOrNullResult() // ->getOneOrNullResult()
// ; // ;
// } // }
} }

View File

@ -59,30 +59,30 @@ class OrderRepository extends ServiceEntityRepository
} }
} }
// /** // /**
// * @return Order[] Returns an array of Order objects // * @return Order[] Returns an array of Order objects
// */ // */
// public function findByExampleField($value): array // public function findByExampleField($value): array
// { // {
// return $this->createQueryBuilder('o') // return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val') // ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->orderBy('o.id', 'ASC') // ->orderBy('o.id', 'ASC')
// ->setMaxResults(10) // ->setMaxResults(10)
// ->getQuery() // ->getQuery()
// ->getResult() // ->getResult()
// ; // ;
// } // }
// public function findOneBySomeField($value): ?Order // public function findOneBySomeField($value): ?Order
// { // {
// return $this->createQueryBuilder('o') // return $this->createQueryBuilder('o')
// ->andWhere('o.exampleField = :val') // ->andWhere('o.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->getQuery() // ->getQuery()
// ->getOneOrNullResult() // ->getOneOrNullResult()
// ; // ;
// } // }
/** /**
* @throws Exception * @throws Exception
*/ */
@ -90,4 +90,4 @@ class OrderRepository extends ServiceEntityRepository
{ {
throw new Exception($string); throw new Exception($string);
} }
} }

View File

@ -77,4 +77,4 @@ class ProductRepository extends ServiceEntityRepository
return $product_ids; return $product_ids;
} }
} }

View File

@ -39,28 +39,28 @@ class SettingsRepository extends ServiceEntityRepository
} }
} }
// /** // /**
// * @return Settings[] Returns an array of Settings objects // * @return Settings[] Returns an array of Settings objects
// */ // */
// public function findByExampleField($value): array // public function findByExampleField($value): array
// { // {
// return $this->createQueryBuilder('s') // return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val') // ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->orderBy('s.id', 'ASC') // ->orderBy('s.id', 'ASC')
// ->setMaxResults(10) // ->setMaxResults(10)
// ->getQuery() // ->getQuery()
// ->getResult() // ->getResult()
// ; // ;
// } // }
// public function findOneBySomeField($value): ?Settings // public function findOneBySomeField($value): ?Settings
// { // {
// return $this->createQueryBuilder('s') // return $this->createQueryBuilder('s')
// ->andWhere('s.exampleField = :val') // ->andWhere('s.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->getQuery() // ->getQuery()
// ->getOneOrNullResult() // ->getOneOrNullResult()
// ; // ;
// } // }
} }

View File

@ -75,4 +75,4 @@ class StockRepository extends ServiceEntityRepository
$this->getEntityManager()->flush(); $this->getEntityManager()->flush();
$this->batch = []; $this->batch = [];
} }
} }

View File

@ -55,13 +55,13 @@ class WarehouseRepository extends ServiceEntityRepository
->getResult(); ->getResult();
} }
// public function findOneBySomeField($value): ?Warehouse // public function findOneBySomeField($value): ?Warehouse
// { // {
// return $this->createQueryBuilder('w') // return $this->createQueryBuilder('w')
// ->andWhere('w.exampleField = :val') // ->andWhere('w.exampleField = :val')
// ->setParameter('val', $value) // ->setParameter('val', $value)
// ->getQuery() // ->getQuery()
// ->getOneOrNullResult() // ->getOneOrNullResult()
// ; // ;
// } // }
} }

View File

@ -15,7 +15,6 @@ use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPasspor
class ApiKeyAuthenticator extends AbstractAuthenticator class ApiKeyAuthenticator extends AbstractAuthenticator
{ {
/** /**
* Called on every request to decide if this authenticator should be * Called on every request to decide if this authenticator should be
* used for the request. Returning `false` will cause this authenticator * used for the request. Returning `false` will cause this authenticator
@ -61,4 +60,4 @@ class ApiKeyAuthenticator extends AbstractAuthenticator
return new JsonResponse($data, Response::HTTP_UNAUTHORIZED); return new JsonResponse($data, Response::HTTP_UNAUTHORIZED);
} }
} }