start working on archive
This commit is contained in:
parent
4d3220bb4f
commit
9fd8825a17
27
hesabixCore/src/Controller/ArchiveController.php
Normal file
27
hesabixCore/src/Controller/ArchiveController.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Service\Access;
|
||||||
|
use App\Service\Log;
|
||||||
|
use App\Service\Provider;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
class ArchiveController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/api/archive/info', name: 'app_archive_info')]
|
||||||
|
public function app_archive_info(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||||
|
{
|
||||||
|
$acc = $access->hasRole('archiveInfo');
|
||||||
|
if(!$acc)
|
||||||
|
throw $this->createAccessDeniedException();
|
||||||
|
return $this->json([
|
||||||
|
'size' => $acc['bid']->getArchiveSize()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -386,6 +386,9 @@ class BusinessController extends AbstractController
|
||||||
'plugCCAdmin'=>true,
|
'plugCCAdmin'=>true,
|
||||||
'wallet'=>true,
|
'wallet'=>true,
|
||||||
'owner'=> true,
|
'owner'=> true,
|
||||||
|
'archiveUpload'=>true,
|
||||||
|
'archiveMod'=>true,
|
||||||
|
'archiveDelete'=>true,
|
||||||
'active'=> $perm->getUser()->isActive()
|
'active'=> $perm->getUser()->isActive()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -416,6 +419,9 @@ class BusinessController extends AbstractController
|
||||||
'plugCCAdmin'=>$perm->isPlugCCAdmin(),
|
'plugCCAdmin'=>$perm->isPlugCCAdmin(),
|
||||||
'wallet'=>$perm->isWallet(),
|
'wallet'=>$perm->isWallet(),
|
||||||
'owner'=> false,
|
'owner'=> false,
|
||||||
|
'archiveUpload'=>$perm->isArchiveUpload(),
|
||||||
|
'archiveMod'=>$perm->isArchiveMod(),
|
||||||
|
'archiveDelete'=>$perm->isArchiveDelete(),
|
||||||
'active'=> $perm->getUser()->isActive()
|
'active'=> $perm->getUser()->isActive()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -474,6 +480,9 @@ class BusinessController extends AbstractController
|
||||||
$perm->setPlugNoghreSell($params['plugNoghreSell']);
|
$perm->setPlugNoghreSell($params['plugNoghreSell']);
|
||||||
$perm->setPlugCCAdmin($params['plugCCAdmin']);
|
$perm->setPlugCCAdmin($params['plugCCAdmin']);
|
||||||
$perm->setLog($params['log']);
|
$perm->setLog($params['log']);
|
||||||
|
$perm->setArchiveMod($params['archiveMod']);
|
||||||
|
$perm->setArchiveDelete($params['archiveDelete']);
|
||||||
|
$perm->setArchiveUpload($params['archiveUpload']);
|
||||||
$entityManager->persist($perm);
|
$entityManager->persist($perm);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
$log->insert('تنظیمات پایه','ویرایش دسترسیهای کاربر با پست الکترونیکی ' . $user->getEmail() ,$this->getUser(),$business);
|
$log->insert('تنظیمات پایه','ویرایش دسترسیهای کاربر با پست الکترونیکی ' . $user->getEmail() ,$this->getUser(),$business);
|
||||||
|
|
187
hesabixCore/src/Entity/ArchiveFile.php
Normal file
187
hesabixCore/src/Entity/ArchiveFile.php
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\ArchiveFileRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: ArchiveFileRepository::class)]
|
||||||
|
class ArchiveFile
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'archiveFiles')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Business $bid = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $dateSubmit = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $dateMod = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'archiveFiles')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?User $Submitter = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $filename = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $cat = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $fileType = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $public = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $des = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private ?string $relatedDocType = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $relatedDocCode = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBid(): ?Business
|
||||||
|
{
|
||||||
|
return $this->bid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBid(?Business $bid): static
|
||||||
|
{
|
||||||
|
$this->bid = $bid;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateSubmit(): ?string
|
||||||
|
{
|
||||||
|
return $this->dateSubmit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateSubmit(string $dateSubmit): static
|
||||||
|
{
|
||||||
|
$this->dateSubmit = $dateSubmit;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateMod(): ?string
|
||||||
|
{
|
||||||
|
return $this->dateMod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDateMod(?string $dateMod): static
|
||||||
|
{
|
||||||
|
$this->dateMod = $dateMod;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubmitter(): ?User
|
||||||
|
{
|
||||||
|
return $this->Submitter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSubmitter(?User $Submitter): static
|
||||||
|
{
|
||||||
|
$this->Submitter = $Submitter;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFilename(): ?string
|
||||||
|
{
|
||||||
|
return $this->filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFilename(string $filename): static
|
||||||
|
{
|
||||||
|
$this->filename = $filename;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCat(): ?string
|
||||||
|
{
|
||||||
|
return $this->cat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCat(string $cat): static
|
||||||
|
{
|
||||||
|
$this->cat = $cat;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFileType(): ?string
|
||||||
|
{
|
||||||
|
return $this->fileType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFileType(string $fileType): static
|
||||||
|
{
|
||||||
|
$this->fileType = $fileType;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isPublic(): ?bool
|
||||||
|
{
|
||||||
|
return $this->public;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPublic(?bool $public): static
|
||||||
|
{
|
||||||
|
$this->public = $public;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDes(): ?string
|
||||||
|
{
|
||||||
|
return $this->des;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDes(?string $des): static
|
||||||
|
{
|
||||||
|
$this->des = $des;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRelatedDocType(): ?string
|
||||||
|
{
|
||||||
|
return $this->relatedDocType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRelatedDocType(string $relatedDocType): static
|
||||||
|
{
|
||||||
|
$this->relatedDocType = $relatedDocType;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRelatedDocCode(): ?string
|
||||||
|
{
|
||||||
|
return $this->relatedDocCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRelatedDocCode(?string $relatedDocCode): static
|
||||||
|
{
|
||||||
|
$this->relatedDocCode = $relatedDocCode;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -187,6 +187,12 @@ class Business
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
private ?string $storeroomCode = '1000';
|
private ?string $storeroomCode = '1000';
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
private ?string $archiveSize = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: ArchiveFile::class, orphanRemoval: true)]
|
||||||
|
private Collection $archiveFiles;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->logs = new ArrayCollection();
|
$this->logs = new ArrayCollection();
|
||||||
|
@ -208,6 +214,7 @@ class Business
|
||||||
$this->walletTransactions = new ArrayCollection();
|
$this->walletTransactions = new ArrayCollection();
|
||||||
$this->storeroomTickets = new ArrayCollection();
|
$this->storeroomTickets = new ArrayCollection();
|
||||||
$this->storeroomItems = new ArrayCollection();
|
$this->storeroomItems = new ArrayCollection();
|
||||||
|
$this->archiveFiles = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -1204,4 +1211,46 @@ class Business
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getArchiveSize(): ?string
|
||||||
|
{
|
||||||
|
return $this->archiveSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setArchiveSize(?string $archiveSize): static
|
||||||
|
{
|
||||||
|
$this->archiveSize = $archiveSize;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, ArchiveFile>
|
||||||
|
*/
|
||||||
|
public function getArchiveFiles(): Collection
|
||||||
|
{
|
||||||
|
return $this->archiveFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addArchiveFile(ArchiveFile $archiveFile): static
|
||||||
|
{
|
||||||
|
if (!$this->archiveFiles->contains($archiveFile)) {
|
||||||
|
$this->archiveFiles->add($archiveFile);
|
||||||
|
$archiveFile->setBid($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeArchiveFile(ArchiveFile $archiveFile): static
|
||||||
|
{
|
||||||
|
if ($this->archiveFiles->removeElement($archiveFile)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($archiveFile->getBid() === $this) {
|
||||||
|
$archiveFile->setBid(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,15 @@ class Permission
|
||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?bool $wallet = null;
|
private ?bool $wallet = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $archiveUpload = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $archiveMod = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: true)]
|
||||||
|
private ?bool $archiveDelete = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
@ -379,4 +388,40 @@ class Permission
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isArchiveUpload(): ?bool
|
||||||
|
{
|
||||||
|
return $this->archiveUpload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setArchiveUpload(?bool $archiveUpload): static
|
||||||
|
{
|
||||||
|
$this->archiveUpload = $archiveUpload;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isArchiveMod(): ?bool
|
||||||
|
{
|
||||||
|
return $this->archiveMod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setArchiveMod(?bool $archiveMod): static
|
||||||
|
{
|
||||||
|
$this->archiveMod = $archiveMod;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isArchiveDelete(): ?bool
|
||||||
|
{
|
||||||
|
return $this->archiveDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setArchiveDelete(?bool $archiveDelete): static
|
||||||
|
{
|
||||||
|
$this->archiveDelete = $archiveDelete;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: StoreroomTicket::class, orphanRemoval: true)]
|
#[ORM\OneToMany(mappedBy: 'submitter', targetEntity: StoreroomTicket::class, orphanRemoval: true)]
|
||||||
private Collection $storeroomTickets;
|
private Collection $storeroomTickets;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'Submitter', targetEntity: ArchiveFile::class, orphanRemoval: true)]
|
||||||
|
private Collection $archiveFiles;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->userTokens = new ArrayCollection();
|
$this->userTokens = new ArrayCollection();
|
||||||
|
@ -109,6 +112,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
$this->sMSPays = new ArrayCollection();
|
$this->sMSPays = new ArrayCollection();
|
||||||
$this->walletTransactions = new ArrayCollection();
|
$this->walletTransactions = new ArrayCollection();
|
||||||
$this->storeroomTickets = new ArrayCollection();
|
$this->storeroomTickets = new ArrayCollection();
|
||||||
|
$this->archiveFiles = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
@ -702,4 +706,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, ArchiveFile>
|
||||||
|
*/
|
||||||
|
public function getArchiveFiles(): Collection
|
||||||
|
{
|
||||||
|
return $this->archiveFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addArchiveFile(ArchiveFile $archiveFile): static
|
||||||
|
{
|
||||||
|
if (!$this->archiveFiles->contains($archiveFile)) {
|
||||||
|
$this->archiveFiles->add($archiveFile);
|
||||||
|
$archiveFile->setSubmitter($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeArchiveFile(ArchiveFile $archiveFile): static
|
||||||
|
{
|
||||||
|
if ($this->archiveFiles->removeElement($archiveFile)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($archiveFile->getSubmitter() === $this) {
|
||||||
|
$archiveFile->setSubmitter(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
48
hesabixCore/src/Repository/ArchiveFileRepository.php
Normal file
48
hesabixCore/src/Repository/ArchiveFileRepository.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\ArchiveFile;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends ServiceEntityRepository<ArchiveFile>
|
||||||
|
*
|
||||||
|
* @method ArchiveFile|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method ArchiveFile|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method ArchiveFile[] findAll()
|
||||||
|
* @method ArchiveFile[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class ArchiveFileRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, ArchiveFile::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return ArchiveFile[] Returns an array of ArchiveFile objects
|
||||||
|
// */
|
||||||
|
// public function findByExampleField($value): array
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('a')
|
||||||
|
// ->andWhere('a.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->orderBy('a.id', 'ASC')
|
||||||
|
// ->setMaxResults(10)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function findOneBySomeField($value): ?ArchiveFile
|
||||||
|
// {
|
||||||
|
// return $this->createQueryBuilder('a')
|
||||||
|
// ->andWhere('a.exampleField = :val')
|
||||||
|
// ->setParameter('val', $value)
|
||||||
|
// ->getQuery()
|
||||||
|
// ->getOneOrNullResult()
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
}
|
Loading…
Reference in a new issue