diff --git a/hesabixCore/src/Controller/HookController.php b/hesabixCore/src/Controller/HookController.php index 710e1e5..144a1ce 100644 --- a/hesabixCore/src/Controller/HookController.php +++ b/hesabixCore/src/Controller/HookController.php @@ -90,7 +90,26 @@ class HookController extends AbstractController $person = $personService->getPersonInfo($result['code'], $acc); $result['person'] = $person; - + + return $this->json($result); + } + + #[Route('/hooks/modify/commodity', name: 'app_modify_commodity')] + public function app_modify_commodity(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, $id = 0): JsonResponse + { + $acc = $access->hasRole('commodity'); + if (!$acc) + throw $this->createAccessDeniedException(); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + $commodityService = new \App\Cog\CommodityService($entityManager); + $result = $commodityService->addOrUpdateCommodity($params, $acc, $id); + if (isset($result['error'])) { + return $this->json($result, 400); + } + $log->insert('کالا و خدمات', 'کالا / خدمات با نام ' . $params['name'] . ' افزوده/ویرایش شد.', $this->getUser(), $request->headers->get('activeBid')); return $this->json($result); } @@ -107,6 +126,13 @@ class HookController extends AbstractController return $this->json($response); } + + + + + + + #[Route('hooks/setting/getCurrency', name: 'api_hooks_getcurrency')] public function api_hooks_getcurrency(Access $access, Log $log, Request $request, EntityManagerInterface $entityManager): JsonResponse { diff --git a/hesabixCore/src/Controller/Plugins/TaxSettingsController.php b/hesabixCore/src/Controller/Plugins/TaxSettingsController.php index 99e86f5..8e49d63 100644 --- a/hesabixCore/src/Controller/Plugins/TaxSettingsController.php +++ b/hesabixCore/src/Controller/Plugins/TaxSettingsController.php @@ -1,5 +1,10 @@ +/* + * Developed by Mohammad Rezai + * https://pirouz.xyz – 2025-07-28 + */ + +