diff --git a/hesabixArchive/140250100017055461-3-65620760609ee.jpg b/hesabixArchive/140250100017055461-3-65620760609ee.jpg deleted file mode 100644 index d7a5d61..0000000 Binary files a/hesabixArchive/140250100017055461-3-65620760609ee.jpg and /dev/null differ diff --git a/hesabixArchive/Screenshot-from-2023-10-20-03-45-29-65632f7490cc4.png b/hesabixArchive/Screenshot-from-2023-10-20-03-45-29-65632f7490cc4.png new file mode 100644 index 0000000..9dd5448 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-10-20-03-45-29-65632f7490cc4.png differ diff --git a/hesabixArchive/Screenshot-from-2023-10-20-03-46-15-6562f36b96b78.png b/hesabixArchive/Screenshot-from-2023-10-20-03-46-15-6562f36b96b78.png deleted file mode 100644 index cd7eea5..0000000 Binary files a/hesabixArchive/Screenshot-from-2023-10-20-03-46-15-6562f36b96b78.png and /dev/null differ diff --git a/hesabixArchive/Screenshot-from-2023-11-02-10-32-45-6562f39a1f474.png b/hesabixArchive/Screenshot-from-2023-11-02-10-32-45-6562f39a1f474.png deleted file mode 100644 index ff24ab6..0000000 Binary files a/hesabixArchive/Screenshot-from-2023-11-02-10-32-45-6562f39a1f474.png and /dev/null differ diff --git a/hesabixArchive/Screenshot-from-2023-11-02-10-33-06-65632f7a752ab.png b/hesabixArchive/Screenshot-from-2023-11-02-10-33-06-65632f7a752ab.png new file mode 100644 index 0000000..4693f83 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-11-02-10-33-06-65632f7a752ab.png differ diff --git a/hesabixArchive/Screenshot-from-2023-11-02-10-33-50-65632f7798ce1.png b/hesabixArchive/Screenshot-from-2023-11-02-10-33-50-65632f7798ce1.png new file mode 100644 index 0000000..4f922a6 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-11-02-10-33-50-65632f7798ce1.png differ diff --git a/hesabixArchive/Screenshot-from-2023-11-02-10-33-50-6563321f44790.png b/hesabixArchive/Screenshot-from-2023-11-02-10-33-50-6563321f44790.png new file mode 100644 index 0000000..4f922a6 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-11-02-10-33-50-6563321f44790.png differ diff --git a/hesabixArchive/Screenshot-from-2023-11-10-04-37-45-6562f3f481d22.png b/hesabixArchive/Screenshot-from-2023-11-10-04-37-45-6562f3f481d22.png deleted file mode 100644 index d45e61d..0000000 Binary files a/hesabixArchive/Screenshot-from-2023-11-10-04-37-45-6562f3f481d22.png and /dev/null differ diff --git a/hesabixArchive/Screenshot-from-2023-11-20-02-21-17-656331d68bb95.png b/hesabixArchive/Screenshot-from-2023-11-20-02-21-17-656331d68bb95.png new file mode 100644 index 0000000..0c6bb34 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-11-20-02-21-17-656331d68bb95.png differ diff --git a/hesabixArchive/Screenshot-from-2023-11-20-02-21-17-6563378e08f3e.png b/hesabixArchive/Screenshot-from-2023-11-20-02-21-17-6563378e08f3e.png new file mode 100644 index 0000000..0c6bb34 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-11-20-02-21-17-6563378e08f3e.png differ diff --git a/hesabixArchive/Screenshot-from-2023-11-20-02-23-45-6563365a016bc.png b/hesabixArchive/Screenshot-from-2023-11-20-02-23-45-6563365a016bc.png new file mode 100644 index 0000000..8829062 Binary files /dev/null and b/hesabixArchive/Screenshot-from-2023-11-20-02-23-45-6563365a016bc.png differ diff --git a/hesabixArchive/temp/Screenshot-from-2023-11-20-02-23-45-656336df8292b.png b/hesabixArchive/temp/Screenshot-from-2023-11-20-02-23-45-656336df8292b.png new file mode 100644 index 0000000..8829062 Binary files /dev/null and b/hesabixArchive/temp/Screenshot-from-2023-11-20-02-23-45-656336df8292b.png differ diff --git a/hesabixCore/src/Controller/ArchiveController.php b/hesabixCore/src/Controller/ArchiveController.php index 72b2af6..3528c63 100644 --- a/hesabixCore/src/Controller/ArchiveController.php +++ b/hesabixCore/src/Controller/ArchiveController.php @@ -204,6 +204,7 @@ class ArchiveController extends AbstractController $resp = []; foreach ($files as $file){ $temp = []; + $temp['id']=$file->getId(); $temp['filename']=$file->getFilename(); $temp['fileType']=$file->getFileType(); $temp['submitter']=$file->getSubmitter()->getFullName(); @@ -240,28 +241,26 @@ class ArchiveController extends AbstractController if (!$acc) throw $this->createAccessDeniedException(); $info = $this->getArchiveInfo($entityManager,$acc); - if($info['remain'] > 0){ - $uploadedFile = $request->files->get('image'); - if ($uploadedFile) { - $originalFilename = pathinfo($uploadedFile->getClientOriginalName(), PATHINFO_FILENAME); - // this is needed to safely include the file name as part of the URL - $safeFilename = $slugger->slug($originalFilename); - $newFilename = $safeFilename.'-'.uniqid().'.'.$uploadedFile->guessExtension(); + $uploadedFile = $request->files->get('image'); + if ($uploadedFile) { + $originalFilename = pathinfo($uploadedFile->getClientOriginalName(), PATHINFO_FILENAME); + // this is needed to safely include the file name as part of the URL + $safeFilename = $slugger->slug($originalFilename); + $newFilename = $safeFilename.'-'.uniqid().'.'.$uploadedFile->guessExtension(); - // Move the file to the directory where brochures are stored - try { - $uploadedFile->move( - $this->getParameter('archiveTempMediaDir'), - $newFilename - );} catch (FileException $e) { - // ... handle exception if something happens during file upload - } - - // updates the 'brochureFilename' property to store the PDF file name - // instead of its contents - //$product->setBrochureFilename($newFilename); - return $this->json(['name'=>$newFilename]); + // Move the file to the directory where brochures are stored + try { + $uploadedFile->move( + $this->getParameter('archiveTempMediaDir'), + $newFilename + );} catch (FileException $e) { + // ... handle exception if something happens during file upload } + + // updates the 'brochureFilename' property to store the PDF file name + // instead of its contents + //$product->setBrochureFilename($newFilename); + return $this->json(['name'=>$newFilename]); } } #[Route('/api/archive/file/save', name: 'app_archive_file_save')] @@ -272,6 +271,10 @@ class ArchiveController extends AbstractController throw $this->createAccessDeniedException(); foreach ($request->get('added_media') as $item){ if (file_exists(__DIR__ . '/../../../hesabixArchive/temp/'.$item) ){ + $size = ceil(filesize(__DIR__ . '/../../../hesabixArchive/temp/'.$item)/(1024*1024)); + $info = $this->getArchiveInfo($entityManager,$acc); + if($info['size'] < ($info['used'] + $size)) + return $this->json(['result'=>'nem']); $file = new ArchiveFile(); $file->setBid($acc['bid']); $file->setDateSubmit(time()); @@ -287,9 +290,10 @@ class ArchiveController extends AbstractController rename(__DIR__ . '/../../../hesabixArchive/temp/'.$item,__DIR__ . '/../../../hesabixArchive/'.$item); $file->setRelatedDocType($request->get('doctype')); $file->setRelatedDocCode($request->get('docid')); - $entityManager->persist($file); $entityManager->flush(); + $log->insert('آرشیو','فایل با نام ' . $file->getFilename() . ' افزوده شد.',$this->getUser(),$acc['bid']); + } } diff --git a/hesabixCore/src/Controller/CommodityController.php b/hesabixCore/src/Controller/CommodityController.php index f59a12b..2201062 100644 --- a/hesabixCore/src/Controller/CommodityController.php +++ b/hesabixCore/src/Controller/CommodityController.php @@ -25,9 +25,21 @@ class CommodityController extends AbstractController { if(!$access->hasRole('commodity')) throw $this->createAccessDeniedException(); - $items = $entityManager->getRepository(Commodity::class)->findBy([ - 'bid'=>$request->headers->get('activeBid') - ]); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + if(array_key_exists('speedAccess',$params)){ + $items = $entityManager->getRepository(Commodity::class)->findBy([ + 'bid'=>$request->headers->get('activeBid'), + 'speedAccess'=>true + ]); + } + else{ + $items = $entityManager->getRepository(Commodity::class)->findBy([ + 'bid'=>$request->headers->get('activeBid') + ]); + } $res = []; foreach ($items as $item){ $temp = []; @@ -36,6 +48,7 @@ class CommodityController extends AbstractController $temp['unit'] = $item->getUnit()->getName(); $temp['des'] = $item->getDes(); $temp['priceBuy'] = $item->getPriceBuy(); + $temp['speedAccess'] = $item->isSpeedAccess(); $temp['priceSell'] = $item->getPriceSell(); $temp['code'] = $item->getCode(); $temp['cat'] = null; @@ -83,7 +96,7 @@ class CommodityController extends AbstractController 'code'=>$code ]); $data->setUnit($data->getUnit()->getName()); - $res = $provider->Entity2ArrayJustIncludes($data,['isCommodityCountCheck','getName','getUnit','getPriceBuy','getPriceSell','getCat','getOrderPoint','getdes','getId','getDayLoading','isKhadamat','getCode','getMinOrderCount','getLabel'],1); + $res = $provider->Entity2ArrayJustIncludes($data,['isSpeedAccess','isCommodityCountCheck','getName','getUnit','getPriceBuy','getPriceSell','getCat','getOrderPoint','getdes','getId','getDayLoading','isKhadamat','getCode','getMinOrderCount','getLabel'],1); $res['cat'] = $data->getCat()->getId(); return $this->json($res); } @@ -135,6 +148,7 @@ class CommodityController extends AbstractController $data->setCommodityCountCheck($params['commodityCountCheck']); } $data->setMinOrderCount($params['minOrderCount']); + $data->setSpeedAccess($params['speedAccess']); $data->setDayLoading($params['dayLoading']); $data->setOrderPoint($params['orderPoint']); //set cat diff --git a/hesabixCore/src/Controller/PersonsController.php b/hesabixCore/src/Controller/PersonsController.php index a6eee57..e7b5881 100644 --- a/hesabixCore/src/Controller/PersonsController.php +++ b/hesabixCore/src/Controller/PersonsController.php @@ -90,6 +90,8 @@ class PersonsController extends AbstractController $person->setBirthday($params['birthday']); if(array_key_exists('tel',$params)) $person->setTel($params['tel']); + if(array_key_exists('speedAccess',$params)) + $person->setSpeedAccess($params['speedAccess']); if(array_key_exists('address',$params)) $person->setAddress($params['address']); if(array_key_exists('des',$params)) diff --git a/hesabixCore/src/Entity/Commodity.php b/hesabixCore/src/Entity/Commodity.php index e8041e4..d423d36 100644 --- a/hesabixCore/src/Entity/Commodity.php +++ b/hesabixCore/src/Entity/Commodity.php @@ -70,6 +70,9 @@ class Commodity #[ORM\Column(length: 255, nullable: true)] private ?string $dayLoading = null; + #[ORM\Column(nullable: true)] + private ?bool $speedAccess = null; + public function __construct() { $this->setPriceBuy(0); @@ -329,4 +332,16 @@ class Commodity return $this; } + + public function isSpeedAccess(): ?bool + { + return $this->speedAccess; + } + + public function setSpeedAccess(?bool $speedAccess): static + { + $this->speedAccess = $speedAccess; + + return $this; + } } diff --git a/hesabixCore/src/Entity/Person.php b/hesabixCore/src/Entity/Person.php index ed38591..3608707 100644 --- a/hesabixCore/src/Entity/Person.php +++ b/hesabixCore/src/Entity/Person.php @@ -113,6 +113,9 @@ class Person #[ORM\OneToMany(mappedBy: 'person', targetEntity: Shareholder::class, orphanRemoval: true)] private Collection $shareholders; + #[ORM\Column(nullable: true)] + private ?bool $speedAccess = null; + public function __construct() { $this->hesabdariRows = new ArrayCollection(); @@ -576,4 +579,16 @@ class Person return $this; } + + public function isSpeedAccess(): ?bool + { + return $this->speedAccess; + } + + public function setSpeedAccess(?bool $speedAccess): static + { + $this->speedAccess = $speedAccess; + + return $this; + } } diff --git a/hesabixCore/src/Service/twigFunctions.php b/hesabixCore/src/Service/twigFunctions.php index 6385879..086f2cd 100644 --- a/hesabixCore/src/Service/twigFunctions.php +++ b/hesabixCore/src/Service/twigFunctions.php @@ -15,7 +15,7 @@ class twigFunctions { private EntityManagerInterface $em; - protected Request $request; + protected $request; protected RequestStack $requestStack; function __construct(