bug fix in shortlinks
This commit is contained in:
parent
cbb53524ae
commit
b23cfe61bd
|
@ -27,7 +27,7 @@ class ShortlinksController extends AbstractController
|
||||||
]);
|
]);
|
||||||
if (!$ticket)
|
if (!$ticket)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
if(!$ticket->isCanShare())
|
if (!$ticket->isCanShare())
|
||||||
throw $this->createAccessDeniedException();
|
throw $this->createAccessDeniedException();
|
||||||
|
|
||||||
$person = null;
|
$person = null;
|
||||||
|
@ -40,12 +40,12 @@ class ShortlinksController extends AbstractController
|
||||||
return $this->render('shortlinks/storeroom.html.twig', [
|
return $this->render('shortlinks/storeroom.html.twig', [
|
||||||
'bid' => $bus,
|
'bid' => $bus,
|
||||||
'doc' => $ticket,
|
'doc' => $ticket,
|
||||||
'person'=>$person
|
'person' => $person
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/sl/{type}/{bid}/{link}/{msg}', name: 'shortlinks_show')]
|
#[Route('/sl/{type}/{bid}/{link}/{msg}', name: 'shortlinks_show')]
|
||||||
public function shortlinks_show(string $bid, string $type, string $link, EntityManagerInterface $entityManager, string $msg = 'default'): Response
|
public function shortlinks_show(Provider $provider, string $bid, string $type, string $link, EntityManagerInterface $entityManager, string $msg = 'default'): Response
|
||||||
{
|
{
|
||||||
$bus = $entityManager->getRepository(Business::class)->find($bid);
|
$bus = $entityManager->getRepository(Business::class)->find($bid);
|
||||||
if (!$bus)
|
if (!$bus)
|
||||||
|
@ -55,7 +55,8 @@ class ShortlinksController extends AbstractController
|
||||||
if ($type == 'sell') {
|
if ($type == 'sell') {
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
'type' => 'sell',
|
'type' => 'sell',
|
||||||
'shortlink' => $link
|
'shortlink' => $link,
|
||||||
|
'bid' => $bus
|
||||||
]);
|
]);
|
||||||
if (!$doc) {
|
if (!$doc) {
|
||||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||||
|
|
|
@ -54,6 +54,12 @@ class HesabdariController extends AbstractController
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
throw $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
|
//add shortlink to doc
|
||||||
|
if (!$doc->getShortlink()) {
|
||||||
|
$doc->setShortlink($provider->RandomString(8));
|
||||||
|
$entityManager->persist($doc);
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$rowsObj = $entityManager->getRepository(HesabdariRow::class)->findBy(
|
$rowsObj = $entityManager->getRepository(HesabdariRow::class)->findBy(
|
||||||
['doc' => $doc]
|
['doc' => $doc]
|
||||||
|
|
|
@ -226,7 +226,7 @@ class PreinvoiceController extends AbstractController
|
||||||
$entityManager->persist($doc);
|
$entityManager->persist($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
if(!$doc->getShortlink()){
|
if(!$doc->getShortlink()){
|
||||||
$doc->setShortlink($doc->getId());
|
$doc->setShortlink($provider->RandomString(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
//add pair docs
|
//add pair docs
|
||||||
|
|
|
@ -189,8 +189,11 @@ class SMSController extends AbstractController
|
||||||
]);
|
]);
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
return $this->json(['result' => 3]);
|
return $this->json(['result' => 3]);
|
||||||
$shortLink = $doc->getId();
|
if(!$doc->getShortlink()){
|
||||||
if ($doc->getShortlink())
|
$doc->setShortlink($provider->RandomString(8));
|
||||||
|
$entityManager->persist($doc);
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
$shortLink = $doc->getShortlink();
|
$shortLink = $doc->getShortlink();
|
||||||
|
|
||||||
//find custommer
|
//find custommer
|
||||||
|
|
|
@ -249,7 +249,7 @@ class SellController extends AbstractController
|
||||||
$entityManager->persist($doc);
|
$entityManager->persist($doc);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
if (!$doc->getShortlink()) {
|
if (!$doc->getShortlink()) {
|
||||||
$doc->setShortlink($doc->getId());
|
$doc->setShortlink($provider->RandomString(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
//add pair docs
|
//add pair docs
|
||||||
|
@ -437,7 +437,11 @@ class SellController extends AbstractController
|
||||||
} else {
|
} else {
|
||||||
$temp['profit'] = $temp['profit'] + $item->getBs();
|
$temp['profit'] = $temp['profit'] + $item->getBs();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else if ($acc['bid']->getProfitCalctype() == 'simple') {
|
||||||
|
$temp['profit'] = $temp['profit'] + (($item->getCommodity()->getPriceSell() - $item->getCommodity()->getPriceBuy()) * $item->getCommdityCount());
|
||||||
|
}
|
||||||
|
else {
|
||||||
$lasts = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
$lasts = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||||
'commodity' => $item->getCommodity(),
|
'commodity' => $item->getCommodity(),
|
||||||
'bs' => 0
|
'bs' => 0
|
||||||
|
|
Loading…
Reference in a new issue