progress in package manager and bug fix in captcha generator
This commit is contained in:
parent
21a5c35b0a
commit
0af7edac97
|
@ -18,6 +18,7 @@ use App\Entity\PlugNoghreOrder;
|
||||||
use App\Entity\Salary;
|
use App\Entity\Salary;
|
||||||
use App\Entity\StoreroomTicket;
|
use App\Entity\StoreroomTicket;
|
||||||
use App\Service\Access;
|
use App\Service\Access;
|
||||||
|
use App\Service\AccountingPermissionService;
|
||||||
use App\Service\Explore;
|
use App\Service\Explore;
|
||||||
use App\Service\Jdate;
|
use App\Service\Jdate;
|
||||||
use App\Service\JsonResp;
|
use App\Service\JsonResp;
|
||||||
|
@ -271,7 +272,7 @@ class HesabdariController extends AbstractController
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
||||||
public function app_accounting_insert(Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
public function app_accounting_insert(AccountingPermissionService $accountingPermissionService, Provider $provider, Request $request, Access $access, Log $log, EntityManagerInterface $entityManager, Jdate $jdate): JsonResponse
|
||||||
{
|
{
|
||||||
$params = [];
|
$params = [];
|
||||||
if ($content = $request->getContent()) {
|
if ($content = $request->getContent()) {
|
||||||
|
@ -279,6 +280,7 @@ class HesabdariController extends AbstractController
|
||||||
}
|
}
|
||||||
if (!array_key_exists('type', $params))
|
if (!array_key_exists('type', $params))
|
||||||
$this->createNotFoundException();
|
$this->createNotFoundException();
|
||||||
|
|
||||||
$roll = '';
|
$roll = '';
|
||||||
if ($params['type'] == 'person_receive' || $params['type'] == 'person_send')
|
if ($params['type'] == 'person_receive' || $params['type'] == 'person_send')
|
||||||
$roll = 'person';
|
$roll = 'person';
|
||||||
|
@ -295,6 +297,13 @@ class HesabdariController extends AbstractController
|
||||||
if (!$acc)
|
if (!$acc)
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
|
$pkgcntr = $accountingPermissionService->canRegisterAccountingDoc($acc['bid']);
|
||||||
|
if ($pkgcntr['code'] == 4) {
|
||||||
|
return $this->json([
|
||||||
|
'result' => 4,
|
||||||
|
'msg' => $pkgcntr['message']
|
||||||
|
]);
|
||||||
|
}
|
||||||
if (!array_key_exists('rows', $params) || count($params['rows']) < 2)
|
if (!array_key_exists('rows', $params) || count($params['rows']) < 2)
|
||||||
throw $this->createNotFoundException('rows is to short');
|
throw $this->createNotFoundException('rows is to short');
|
||||||
if (!array_key_exists('date', $params) || !array_key_exists('des', $params))
|
if (!array_key_exists('date', $params) || !array_key_exists('des', $params))
|
||||||
|
|
|
@ -20,7 +20,7 @@ class AccountingPermissionService
|
||||||
private function getAccountingDocPrice(): int
|
private function getAccountingDocPrice(): int
|
||||||
{
|
{
|
||||||
$rootSystem = 'system_settings';
|
$rootSystem = 'system_settings';
|
||||||
return (int) $this->registryMGR->get($rootSystem, 'accountingDocPrice');
|
return (int) $this->registryMGR->get($rootSystem, 'accounting_doc_price');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,6 @@ class AccountingPermissionService
|
||||||
// ۳. چک کردن اعتبار موجود (smsCharge) و کسر هزینه
|
// ۳. چک کردن اعتبار موجود (smsCharge) و کسر هزینه
|
||||||
$accountingDocPrice = $this->getAccountingDocPrice();
|
$accountingDocPrice = $this->getAccountingDocPrice();
|
||||||
$smsCharge = (int) $business->getSmsCharge();
|
$smsCharge = (int) $business->getSmsCharge();
|
||||||
|
|
||||||
if ($smsCharge >= $accountingDocPrice) {
|
if ($smsCharge >= $accountingDocPrice) {
|
||||||
// کسر هزینه از اعتبار
|
// کسر هزینه از اعتبار
|
||||||
$business->setSmsCharge((string) ($smsCharge - $accountingDocPrice));
|
$business->setSmsCharge((string) ($smsCharge - $accountingDocPrice));
|
||||||
|
|
|
@ -76,6 +76,7 @@ class CaptchaService
|
||||||
$response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
$response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
||||||
$response->headers->set('Pragma', 'no-cache');
|
$response->headers->set('Pragma', 'no-cache');
|
||||||
$response->headers->set('Expires', '0');
|
$response->headers->set('Expires', '0');
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isCaptchaRequired(string $attemptKey): bool
|
public function isCaptchaRequired(string $attemptKey): bool
|
||||||
|
|
Loading…
Reference in a new issue