From 55350beaa5f3bcb3babd0e69d1dcf401785b5fb1 Mon Sep 17 00:00:00 2001 From: babak alizadeh Date: Thu, 11 Jul 2024 21:15:45 +0330 Subject: [PATCH] add notes to sell and buy invoice --- .../src/Controller/AdminController.php | 28 +++- .../src/Controller/BusinessController.php | 48 ++++++- .../src/Controller/HesabdariController.php | 2 + hesabixCore/src/Controller/LogController.php | 30 ++++ .../src/Controller/NotesController.php | 136 ++++++++++++++++++ .../Plugins/PlugRepserviceController.php | 6 +- hesabixCore/src/Entity/Business.php | 34 +++++ hesabixCore/src/Entity/HesabdariDoc.php | 34 +++++ hesabixCore/src/Entity/Log.php | 15 ++ hesabixCore/src/Entity/Note.php | 113 +++++++++++++++ .../src/Entity/PlugRepserviceOrder.php | 40 ++++++ hesabixCore/src/Entity/User.php | 34 +++++ hesabixCore/src/Repository/NoteRepository.php | 48 +++++++ hesabixCore/src/Service/Log.php | 4 +- hesabixCore/templates/notes/index.html.twig | 20 +++ 15 files changed, 587 insertions(+), 5 deletions(-) create mode 100644 hesabixCore/src/Controller/NotesController.php create mode 100644 hesabixCore/src/Entity/Note.php create mode 100644 hesabixCore/src/Repository/NoteRepository.php create mode 100644 hesabixCore/templates/notes/index.html.twig diff --git a/hesabixCore/src/Controller/AdminController.php b/hesabixCore/src/Controller/AdminController.php index b37133b..ef86e72 100644 --- a/hesabixCore/src/Controller/AdminController.php +++ b/hesabixCore/src/Controller/AdminController.php @@ -219,7 +219,9 @@ class AdminController extends AbstractController 'get' => $registryMGR->get('sms', 'plugRepserviceStateGet'), 'getback' => $registryMGR->get('sms', 'plugRepserviceStateGetback'), 'repired' => $registryMGR->get('sms', 'plugRepserviceStateRepaired'), - 'unrepaired' => $registryMGR->get('sms', 'plugRepserviceStateUnrepired') + 'unrepaired' => $registryMGR->get('sms', 'plugRepserviceStateUnrepired'), + 'creating' => $registryMGR->get('sms', 'plugRepserviceStateCreating'), + 'created' => $registryMGR->get('sms', 'plugRepserviceStateCreated') ]; return $this->json($resp); } @@ -267,6 +269,10 @@ class AdminController extends AbstractController $registryMGR->update('sms', 'plugRepserviceStateUnrepired', $params['plugRepservice']['unrepaired']); if (array_key_exists('getback', $params['plugRepservice'])) $registryMGR->update('sms', 'plugRepserviceStateGetback', $params['plugRepservice']['getback']); + if (array_key_exists('creating', $params['plugRepservice'])) + $registryMGR->update('sms', 'plugRepserviceStateCreating', $params['plugRepservice']['creating']); + if (array_key_exists('created', $params['plugRepservice'])) + $registryMGR->update('sms', 'plugRepserviceStateCreated', $params['plugRepservice']['created']); } @@ -494,4 +500,24 @@ class AdminController extends AbstractController 'filename' => 'Hesabix-' . $time . '.sql', ]); } + #[Route('/api/admin/logs/last', name: 'api_admin_logs_last')] + public function api_admin_logs_last(Jdate $jdate, EntityManagerInterface $entityManager): JsonResponse + { + $logs = $entityManager->getRepository(\App\Entity\Log::class)->findBy([], ['id' => 'DESC'], 250); + $temps = []; + foreach ($logs as $log) { + $temp = []; + if ($log->getUser()) + $temp['user'] = $log->getUser()->getFullName(); + else + $temp['user'] = ''; + $temp['des'] = $log->getDes(); + $temp['part'] = $log->getPart(); + $temp['bid'] = $log->getBid()->getName(); + $temp['date'] = $jdate->jdate('Y/n/d H:i', $log->getDateSubmit()); + $temp['ipaddress'] = $log->getIpaddress(); + $temps[] = $temp; + } + return $this->json(array_reverse($temps)); + } } diff --git a/hesabixCore/src/Controller/BusinessController.php b/hesabixCore/src/Controller/BusinessController.php index 4bef51c..066f565 100644 --- a/hesabixCore/src/Controller/BusinessController.php +++ b/hesabixCore/src/Controller/BusinessController.php @@ -654,6 +654,48 @@ class BusinessController extends AbstractController } } } + + $sends = $entityManager->getRepository(HesabdariDoc::class)->findBy([ + 'bid' => $buss, + 'year' => $year, + 'type' => 'person_send', + ]); + $sendsTotal = 0; + $sendsToday = 0; + foreach ($sends as $item) { + $canAdd = false; + foreach ($item->getHesabdariRows() as $row) { + if ($row->getPerson()) + $canAdd = true; + } + if ($canAdd) { + $sendsTotal += $item->getAmount(); + if($item->getDate() == $dateNow){ + $sendsToday += $item->getAmount(); + } + } + } + + $recs = $entityManager->getRepository(HesabdariDoc::class)->findBy([ + 'bid' => $buss, + 'year' => $year, + 'type' => 'person_receive', + ]); + $recsTotal = 0; + $recsToday = 0; + foreach ($recs as $item) { + $canAdd = false; + foreach ($item->getHesabdariRows() as $row) { + if ($row->getPerson()) + $canAdd = true; + } + if ($canAdd) { + $recsTotal += $item->getAmount(); + if($item->getDate() == $dateNow){ + $recsToday += $item->getAmount(); + } + } + } $response = [ 'personCount' => count($persons), 'bankCount' => count($banks), @@ -665,7 +707,11 @@ class BusinessController extends AbstractController 'buys_total' => $buysTotal, 'buys_today' => $buysToday, 'sells_total' => $sellsTotal, - 'sells_today' => $sellsToday + 'sells_today' => $sellsToday, + 'sends_total' => $sendsTotal, + 'sends_today' => $sendsToday, + 'recs_total' => $recsTotal, + 'recs_today' => $recsToday, ]; return $this->json($response); } diff --git a/hesabixCore/src/Controller/HesabdariController.php b/hesabixCore/src/Controller/HesabdariController.php index a431922..eab6c97 100644 --- a/hesabixCore/src/Controller/HesabdariController.php +++ b/hesabixCore/src/Controller/HesabdariController.php @@ -523,6 +523,7 @@ class HesabdariController extends AbstractController $entityManager->flush(); } $code = $doc->getCode(); + foreach($doc->getNotes() as $note){ $entityManager->remove($note);} $entityManager->remove($doc); $entityManager->flush(); $log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid')); @@ -618,6 +619,7 @@ class HesabdariController extends AbstractController $entityManager->flush(); } $code = $doc->getCode(); + foreach($doc->getNotes() as $note){ $entityManager->remove($note);} $entityManager->remove($doc); $entityManager->flush(); $log->insert('حسابداری', 'سند حسابداری شماره ' . $code . ' حذف شد.', $this->getUser(), $request->headers->get('activeBid')); diff --git a/hesabixCore/src/Controller/LogController.php b/hesabixCore/src/Controller/LogController.php index 9b2386b..8f8c452 100644 --- a/hesabixCore/src/Controller/LogController.php +++ b/hesabixCore/src/Controller/LogController.php @@ -5,6 +5,7 @@ namespace App\Controller; use App\Entity\Business; use App\Entity\HesabdariDoc; use App\Entity\Log as EntityLog; +use App\Entity\PlugRepserviceOrder; use App\Service\Access; use App\Service\Jdate; use App\Service\Log; @@ -82,4 +83,33 @@ class LogController extends AbstractController } return $this->json($temps); } + + #[Route('/api/plug/repservice/order/logs/{id}', name: 'api_business_repservice_order_logs')] + public function api_business_repservice_order_logs(Access $access,String $id, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse + { + $acc = $access->hasRole('plugRepservice'); + if(!$acc) + throw $this->createAccessDeniedException(); + $order = $entityManager->getRepository(PlugRepserviceOrder::class)->findOneBy(['bid'=>$acc['bid'], 'code'=>$id]); + if(!$order) + throw $this->createNotFoundException(); + if($order->getBid()->getId() != $acc['bid']->getId()) + throw $this->createAccessDeniedException(); + + $logs = $entityManager->getRepository(\App\Entity\Log::class)->findBy(['bid'=>$acc['bid'],'repserviceOrder'=>$order],['id'=>'DESC']); + + $temps = []; + foreach ($logs as $log){ + $temp = []; + if($log->getUser()) + $temp['user'] = $log->getUser()->getFullName(); + else + $temp['user'] = ''; + $temp['des'] = $log->getDes(); + $temp['part'] = $log->getPart(); + $temp['date'] = $jdate->jdate('Y/n/d H:i',$log->getDateSubmit()); + $temps[] = $temp; + } + return $this->json($temps); + } } diff --git a/hesabixCore/src/Controller/NotesController.php b/hesabixCore/src/Controller/NotesController.php new file mode 100644 index 0000000..05c11d0 --- /dev/null +++ b/hesabixCore/src/Controller/NotesController.php @@ -0,0 +1,136 @@ +hasRole('join'); + if (!$acc) + throw $this->createAccessDeniedException(); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + if($params['code'] != 0){ + $doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ + 'bid' => $acc['bid'], + 'code' => $params['code'], + + ]); + if(!$doc) return $this->json($extractor->notFound()); + } + $items = $entityManager->getRepository(Note::class)->findBy([ + 'bid' => $acc['bid'], + 'type' => $params['type'], + 'doc' => $doc + ]); + $result = []; + foreach ($items as $item) { + $result[] = [ + 'id'=>$item->getId(), + 'des'=>$item->getDes(), + 'submitter'=>$item->getSubmitter()->getFullName(), + 'date' => $jdate->jdate('Y/n/d',$item->getDate()) + ]; + } + return $this->json($result); + } + + #[Route('/api/notes/count', name: 'api_notes_count')] + public function api_notes_count(Extractor $extractor,Request $request, Access $access, Jdate $jdate, EntityManagerInterface $entityManager, Log $log): JsonResponse + { + $acc = $access->hasRole('join'); + if (!$acc) + throw $this->createAccessDeniedException(); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + if($params['code'] != 0){ + $doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ + 'bid' => $acc['bid'], + 'code' => $params['code'], + + ]); + if(!$doc) return $this->json($extractor->notFound()); + } + $items = $entityManager->getRepository(Note::class)->findBy([ + 'bid' => $acc['bid'], + 'type' => $params['type'], + 'doc' => $doc + ]); + return $this->json(count($items)); + } + + #[Route('/api/notes/add', name: 'api_notes_add')] + public function api_notes_add(Request $request, Access $access, Extractor $extractor, EntityManagerInterface $entityManager, Log $log): JsonResponse + { + $acc = $access->hasRole('join'); + if (!$acc) + throw $this->createAccessDeniedException(); + $params = []; + if ($content = $request->getContent()) { + $params = json_decode($content, true); + } + $doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([ + 'bid' => $acc['bid'], + 'code' => $params['code'], + + ]); + if(!$doc) return $this->json($extractor->notFound()); + $note = new Note(); + $note->setDoc($doc); + $note->setBid($acc['bid']); + $note->setSubmitter($this->getUser()); + $note->setType($params['type']); + $note->setDes($params['des']); + $note->setDate(time()); + $entityManager->persist($note); + $entityManager->flush(); + $log->insert( + 'حسابداری', + ' افزودن یاداشت به فاکتور‌ شماره ' . $doc->getCode(), + $this->getUser(), + $acc['bid']->getId(), + $doc + ); + return $this->json(['result' => 1]); + } + #[Route('/api/notes/remove/{id}', name: 'api_notes_remove')] + public function api_notes_remove(string $id, Access $access, EntityManagerInterface $entityManager, Log $log): JsonResponse + { + $acc = $access->hasRole('join'); + if (!$acc) + throw $this->createAccessDeniedException(); + $item = $entityManager->getRepository(Note::class)->findOneBy([ + 'bid' => $acc['bid'], + 'submitter' => $this->getUser(), + 'id' => $id + ]); + $entityManager->remove($item); + $entityManager->flush(); + + $log->insert( + 'حسابداری', + ' حذف یاداشت از فاکتور‌ شماره ' . $item->getDoc()->getCode(), + $this->getUser(), + $acc['bid']->getId(), + $item->getDoc() + ); + return $this->json(['result' => 1]); + } +} diff --git a/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php b/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php index af73523..ec14f2f 100644 --- a/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php +++ b/hesabixCore/src/Controller/Plugins/PlugRepserviceController.php @@ -104,7 +104,7 @@ class PlugRepserviceController extends AbstractController $order->setState($entityManagerInterface->getRepository(PlugRepserviceOrderState::class)->findOneBy(['code' => 'get'])); $entityManagerInterface->persist($order); $entityManagerInterface->flush(); - $log->insert('افزونه تعمیرکاران', ' رسید دریافت کالا با نام ' . $person->getNikename() . ' افزوده/ویرایش شد.', $this->getUser(), $acc['bid']->getId()); + $log->insert('افزونه تعمیرکاران', ' رسید دریافت کالا با نام ' . $person->getNikename() . ' افزوده/ویرایش شد.', $this->getUser(), $acc['bid']->getId(),null,$order); if (array_key_exists('sms', $params)) { if ($params['sms'] == true) { @@ -174,13 +174,15 @@ class PlugRepserviceController extends AbstractController } $entityManagerInterface->persist($order); $entityManagerInterface->flush(); - $log->insert('افزونه تعمیرکاران', ' وضعیت کالا با کد ' . $order->getCode() . ' به ' . $state->getLabel() . ' تغییر یافت. ', $this->getUser(), $acc['bid']->getId()); + $log->insert('افزونه تعمیرکاران', ' وضعیت کالا با کد ' . $order->getCode() . ' به ' . $state->getLabel() . ' تغییر یافت. ', $this->getUser(), $acc['bid']->getId(),null,$order); if (array_key_exists('sms', $params)) { //get state sms code if($params['state']['code'] == 'get') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGet'); elseif($params['state']['code'] == 'repaired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateRepaired'); elseif($params['state']['code'] == 'unrepired') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateUnrepired'); + elseif($params['state']['code'] == 'creating') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateCreating'); + elseif($params['state']['code'] == 'created') $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateCreated'); else $smsPattern = $registryMGR->get('sms', 'plugRepserviceStateGetback'); if ($params['sms'] == true) { //going to send sms diff --git a/hesabixCore/src/Entity/Business.php b/hesabixCore/src/Entity/Business.php index cd93da9..ee0e2b2 100644 --- a/hesabixCore/src/Entity/Business.php +++ b/hesabixCore/src/Entity/Business.php @@ -225,6 +225,9 @@ class Business #[ORM\Column(length: 255, nullable: true)] private ?string $avatar = null; + #[ORM\OneToMany(mappedBy: 'bid', targetEntity: Note::class, orphanRemoval: true)] + private Collection $notes; + public function __construct() { $this->logs = new ArrayCollection(); @@ -256,6 +259,7 @@ class Business $this->plugRepserviceOrders = new ArrayCollection(); $this->printers = new ArrayCollection(); $this->printTemplates = new ArrayCollection(); + $this->notes = new ArrayCollection(); } public function getId(): ?int @@ -1588,4 +1592,34 @@ class Business return $this; } + + /** + * @return Collection + */ + public function getNotes(): Collection + { + return $this->notes; + } + + public function addNote(Note $note): static + { + if (!$this->notes->contains($note)) { + $this->notes->add($note); + $note->setBid($this); + } + + return $this; + } + + public function removeNote(Note $note): static + { + if ($this->notes->removeElement($note)) { + // set the owning side to null (unless already changed) + if ($note->getBid() === $this) { + $note->setBid(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Entity/HesabdariDoc.php b/hesabixCore/src/Entity/HesabdariDoc.php index 0362ef3..dff6b88 100644 --- a/hesabixCore/src/Entity/HesabdariDoc.php +++ b/hesabixCore/src/Entity/HesabdariDoc.php @@ -98,6 +98,9 @@ class HesabdariDoc #[ORM\ManyToOne(inversedBy: 'hesabdariDocs')] private ?InvoiceType $InvoiceLabel = null; + #[ORM\OneToMany(mappedBy: 'doc', targetEntity: Note::class)] + private Collection $notes; + public function __construct() { $this->hesabdariRows = new ArrayCollection(); @@ -105,6 +108,7 @@ class HesabdariDoc $this->relatedDocs = new ArrayCollection(); $this->storeroomTickets = new ArrayCollection(); $this->logs = new ArrayCollection(); + $this->notes = new ArrayCollection(); } public function getId(): ?int @@ -471,4 +475,34 @@ class HesabdariDoc return $this; } + + /** + * @return Collection + */ + public function getNotes(): Collection + { + return $this->notes; + } + + public function addNote(Note $note): static + { + if (!$this->notes->contains($note)) { + $this->notes->add($note); + $note->setDoc($this); + } + + return $this; + } + + public function removeNote(Note $note): static + { + if ($this->notes->removeElement($note)) { + // set the owning side to null (unless already changed) + if ($note->getDoc() === $this) { + $note->setDoc(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Entity/Log.php b/hesabixCore/src/Entity/Log.php index 343966b..5e3f984 100644 --- a/hesabixCore/src/Entity/Log.php +++ b/hesabixCore/src/Entity/Log.php @@ -34,6 +34,9 @@ class Log #[ORM\ManyToOne(inversedBy: 'logs')] private ?HesabdariDoc $doc = null; + #[ORM\ManyToOne(inversedBy: 'logs')] + private ?PlugRepserviceOrder $repserviceOrder = null; + public function getId(): ?int { return $this->id; @@ -122,4 +125,16 @@ class Log return $this; } + + public function getRepserviceOrder(): ?PlugRepserviceOrder + { + return $this->repserviceOrder; + } + + public function setRepserviceOrder(?PlugRepserviceOrder $repserviceOrder): static + { + $this->repserviceOrder = $repserviceOrder; + + return $this; + } } diff --git a/hesabixCore/src/Entity/Note.php b/hesabixCore/src/Entity/Note.php new file mode 100644 index 0000000..7ef947c --- /dev/null +++ b/hesabixCore/src/Entity/Note.php @@ -0,0 +1,113 @@ +id; + } + + public function getSubmitter(): ?User + { + return $this->submitter; + } + + public function setSubmitter(?User $submitter): static + { + $this->submitter = $submitter; + + return $this; + } + + public function getDes(): ?string + { + return $this->des; + } + + public function setDes(string $des): static + { + $this->des = $des; + + return $this; + } + + public function getDate(): ?string + { + return $this->date; + } + + public function setDate(string $date): static + { + $this->date = $date; + + return $this; + } + + public function getBid(): ?Business + { + return $this->bid; + } + + public function setBid(?Business $bid): static + { + $this->bid = $bid; + + return $this; + } + + public function getDoc(): ?HesabdariDoc + { + return $this->doc; + } + + public function setDoc(?HesabdariDoc $doc): static + { + $this->doc = $doc; + + return $this; + } + + public function getType(): ?string + { + return $this->type; + } + + public function setType(?string $type): static + { + $this->type = $type; + + return $this; + } +} diff --git a/hesabixCore/src/Entity/PlugRepserviceOrder.php b/hesabixCore/src/Entity/PlugRepserviceOrder.php index e1eae3d..b16f331 100644 --- a/hesabixCore/src/Entity/PlugRepserviceOrder.php +++ b/hesabixCore/src/Entity/PlugRepserviceOrder.php @@ -3,6 +3,8 @@ namespace App\Entity; use App\Repository\PlugRepserviceOrderRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: PlugRepserviceOrderRepository::class)] @@ -66,6 +68,14 @@ class PlugRepserviceOrder #[ORM\Column(length: 50, nullable: true)] private ?string $dateOut = null; + #[ORM\OneToMany(mappedBy: 'repserviceOrder', targetEntity: Log::class)] + private Collection $logs; + + public function __construct() + { + $this->logs = new ArrayCollection(); + } + public function getId(): ?int { return $this->id; @@ -262,4 +272,34 @@ class PlugRepserviceOrder return $this; } + + /** + * @return Collection + */ + public function getLogs(): Collection + { + return $this->logs; + } + + public function addLog(Log $log): static + { + if (!$this->logs->contains($log)) { + $this->logs->add($log); + $log->setRepserviceOrder($this); + } + + return $this; + } + + public function removeLog(Log $log): static + { + if ($this->logs->removeElement($log)) { + // set the owning side to null (unless already changed) + if ($log->getRepserviceOrder() === $this) { + $log->setRepserviceOrder(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Entity/User.php b/hesabixCore/src/Entity/User.php index b12a143..7a0c749 100644 --- a/hesabixCore/src/Entity/User.php +++ b/hesabixCore/src/Entity/User.php @@ -110,6 +110,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface #[ORM\OneToMany(mappedBy: 'submitter', targetEntity: PlugRepserviceOrder::class, orphanRemoval: true)] private Collection $plugRepserviceOrders; + #[ORM\OneToMany(mappedBy: 'submitter', targetEntity: Note::class, orphanRemoval: true)] + private Collection $notes; + public function __construct() { $this->userTokens = new ArrayCollection(); @@ -133,6 +136,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $this->cheques = new ArrayCollection(); $this->mostDes = new ArrayCollection(); $this->plugRepserviceOrders = new ArrayCollection(); + $this->notes = new ArrayCollection(); } public function getId(): ?int @@ -906,4 +910,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface return $this; } + + /** + * @return Collection + */ + public function getNotes(): Collection + { + return $this->notes; + } + + public function addNote(Note $note): static + { + if (!$this->notes->contains($note)) { + $this->notes->add($note); + $note->setSubmitter($this); + } + + return $this; + } + + public function removeNote(Note $note): static + { + if ($this->notes->removeElement($note)) { + // set the owning side to null (unless already changed) + if ($note->getSubmitter() === $this) { + $note->setSubmitter(null); + } + } + + return $this; + } } diff --git a/hesabixCore/src/Repository/NoteRepository.php b/hesabixCore/src/Repository/NoteRepository.php new file mode 100644 index 0000000..09b95f5 --- /dev/null +++ b/hesabixCore/src/Repository/NoteRepository.php @@ -0,0 +1,48 @@ + + * + * @method Note|null find($id, $lockMode = null, $lockVersion = null) + * @method Note|null findOneBy(array $criteria, array $orderBy = null) + * @method Note[] findAll() + * @method Note[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class NoteRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Note::class); + } + +// /** +// * @return Note[] Returns an array of Note objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('n.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Note +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/hesabixCore/src/Service/Log.php b/hesabixCore/src/Service/Log.php index af235af..165e51f 100644 --- a/hesabixCore/src/Service/Log.php +++ b/hesabixCore/src/Service/Log.php @@ -4,6 +4,7 @@ namespace App\Service; use App\Entity\Business; use App\Entity\HesabdariDoc; +use App\Entity\PlugRepserviceOrder; use App\Entity\User; use App\Module\RemoteAddress; use Doctrine\ORM\EntityManagerInterface; @@ -19,7 +20,7 @@ class Log $this->remoteAddress = new RemoteAddress(); } - public function insert(string $part,string $des, User | null $user = null, Business | string | null $bid = null , HesabdariDoc | null $hesabdariDoc = null): void + public function insert(string $part,string $des, User | null $user = null, Business | string | null $bid = null , HesabdariDoc | null $hesabdariDoc = null, PlugRepserviceOrder | null $plugRepserviceOrder = null): void { if(is_string($bid)) $bid = $this->em->getRepository(Business::class)->find($bid); @@ -30,6 +31,7 @@ class Log $log->setUser($user); $log->setBid($bid); $log->setDoc($hesabdariDoc); + $log->setRepserviceOrder($plugRepserviceOrder); $log->setIpaddress($this->remoteAddress->getIpAddress()); $this->em->persist($log); $this->em->flush(); diff --git a/hesabixCore/templates/notes/index.html.twig b/hesabixCore/templates/notes/index.html.twig new file mode 100644 index 0000000..6ac030a --- /dev/null +++ b/hesabixCore/templates/notes/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello NotesController!{% endblock %} + +{% block body %} + + +
+

Hello {{ controller_name }}! ✅

+ + This friendly message is coming from: + +
+{% endblock %}