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) {
if ($order->getStatus() > 0) continue;
if ($order->getStatus() > 0) {
continue;
}
$tA = $order->getData();#json_decode($order->getData());
$tA['orderdate'] = "2023-08-30T12:05:24.000Z";
@ -180,4 +182,4 @@ class HiltesExportCommand extends Command
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\Style\SymfonyStyle;
use Symfony\Component\HttpKernel\KernelInterface;
use function Sentry\captureCheckIn;
#[AsCommand(
@ -35,8 +36,7 @@ class HiltesImportCommand extends Command
StockRepository $stockRepository,
WarehouseRepository $warehouseRepository,
LoggerInterface $logger
)
{
) {
$this->productRepository = $productRepository;
$this->stockRepository = $stockRepository;
$this->warehouseRepository = $warehouseRepository;
@ -125,4 +125,4 @@ class HiltesImportCommand extends Command
//POST: $dirs = /app/public
return implode('/', $dirs);
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,4 +40,4 @@ class ExportHiltesSubscriber implements EventSubscriberInterface
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\KernelEvents;
class SlackNotifySubscriber implements EventSubscriberInterface
{
/**
@ -126,4 +125,4 @@ class SlackNotifySubscriber implements EventSubscriberInterface
return $warehouse;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,6 @@ use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPasspor
class ApiKeyAuthenticator extends AbstractAuthenticator
{
/**
* Called on every request to decide if this authenticator should be
* 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);
}
}
}