diff --git a/hesabixCore/config/services.yaml b/hesabixCore/config/services.yaml
index 48b778a..5e830b2 100644
--- a/hesabixCore/config/services.yaml
+++ b/hesabixCore/config/services.yaml
@@ -42,6 +42,7 @@ services:
twigFunctions:
class: App\Service\twigFunctions
arguments: [ "@doctrine.orm.entity_manager" ]
- Access:
- class: App\Service\Access
- arguments: [ "@doctrine.orm.entity_manager","@Symfony.Component.Security.Core.Authentication.Token.Storage.TokenStorageInterface","@Symfony.Component.HttpFoundation.RequestStack" ]
\ No newline at end of file
+
+ registryMGR:
+ class: App\Service\registryMGR
+ arguments: [ "@doctrine.orm.entity_manager"]
\ No newline at end of file
diff --git a/hesabixCore/src/Controller/AdminController.php b/hesabixCore/src/Controller/AdminController.php
index 6e257ef..cfec9ca 100644
--- a/hesabixCore/src/Controller/AdminController.php
+++ b/hesabixCore/src/Controller/AdminController.php
@@ -8,6 +8,7 @@ use App\Entity\ChangeReport;
use App\Entity\Commodity;
use App\Entity\HesabdariDoc;
use App\Entity\Person;
+use App\Entity\Registry;
use App\Entity\Settings;
use App\Entity\StoreroomTicket;
use App\Entity\User;
@@ -15,6 +16,7 @@ use App\Entity\WalletTransaction;
use App\Service\Jdate;
use App\Service\Notification;
use App\Service\Provider;
+use App\Service\registryMGR;
use App\Service\SMS;
use Doctrine\ORM\EntityManagerInterface;
use Exception;
@@ -192,6 +194,22 @@ class AdminController extends AbstractController
throw $this->createNotFoundException();
}
+ #[Route('/api/admin/sms/plan/info', name: 'admin_sms_plan_info')]
+ public function admin_sms_plan_info(registryMGR $registryMGR,Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
+ {
+
+ $resp = [];
+ $resp['walletpay'] = $registryMGR->get('sms','walletPay');
+ $resp['changePassword'] = $registryMGR->get('sms','changePassword');
+ $resp['f2a'] = $registryMGR->get('sms','f2a');
+ $resp['ticketReplay'] = $registryMGR->get('sms','ticketReplay');
+ $resp['ticketRec'] = $registryMGR->get('sms','ticketRec');
+ $resp['fromNum'] = $registryMGR->get('sms','fromNum');
+ $resp['sharefaktor'] = $registryMGR->get('sms','sharefaktor');
+ $resp['plan'] = $registryMGR->get('sms','plan');
+ return $this->json($resp);
+ }
+
#[Route('/api/admin/settings/system/info', name: 'admin_settings_system_info')]
public function admin_settings_system_info(Jdate $jdate,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
{
@@ -209,7 +227,7 @@ class AdminController extends AbstractController
#[Route('/api/admin/settings/system/info/save', name: 'admin_settings_system_info_save')]
- public function admin_settings_system_info_save(EntityManagerInterface $entityManager,Request $request): Response
+ public function admin_settings_system_info_save(Registry $registry, EntityManagerInterface $entityManager,Request $request): Response
{
$params = [];
if ($content = $request->getContent()) {
diff --git a/hesabixCore/src/Entity/Registry.php b/hesabixCore/src/Entity/Registry.php
new file mode 100644
index 0000000..7d8db42
--- /dev/null
+++ b/hesabixCore/src/Entity/Registry.php
@@ -0,0 +1,65 @@
+id;
+ }
+
+ public function getRoot(): ?string
+ {
+ return $this->root;
+ }
+
+ public function setRoot(?string $root): static
+ {
+ $this->root = $root;
+
+ return $this;
+ }
+
+ public function getName(): ?string
+ {
+ return $this->name;
+ }
+
+ public function setName(string $name): static
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ public function getValueOfKey(): ?string
+ {
+ return $this->valueOfKey;
+ }
+
+ public function setValueOfKey(string $valueOfKey): static
+ {
+ $this->valueOfKey = $valueOfKey;
+
+ return $this;
+ }
+}
diff --git a/hesabixCore/src/Entity/Settings.php b/hesabixCore/src/Entity/Settings.php
index e5e9e9f..98993f7 100644
--- a/hesabixCore/src/Entity/Settings.php
+++ b/hesabixCore/src/Entity/Settings.php
@@ -50,6 +50,9 @@ class Settings
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $footer = null;
+ #[ORM\Column(length: 50, nullable: true)]
+ private ?string $activeSmsPanel = null;
+
public function getId(): ?int
{
return $this->id;
@@ -198,4 +201,16 @@ class Settings
return $this;
}
+
+ public function getActiveSmsPanel(): ?string
+ {
+ return $this->activeSmsPanel;
+ }
+
+ public function setActiveSmsPanel(?string $activeSmsPanel): static
+ {
+ $this->activeSmsPanel = $activeSmsPanel;
+
+ return $this;
+ }
}
diff --git a/hesabixCore/src/Repository/RegistryRepository.php b/hesabixCore/src/Repository/RegistryRepository.php
new file mode 100644
index 0000000..0d0eb6e
--- /dev/null
+++ b/hesabixCore/src/Repository/RegistryRepository.php
@@ -0,0 +1,48 @@
+
+ *
+ * @method Registry|null find($id, $lockMode = null, $lockVersion = null)
+ * @method Registry|null findOneBy(array $criteria, array $orderBy = null)
+ * @method Registry[] findAll()
+ * @method Registry[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
+ */
+class RegistryRepository extends ServiceEntityRepository
+{
+ public function __construct(ManagerRegistry $registry)
+ {
+ parent::__construct($registry, Registry::class);
+ }
+
+// /**
+// * @return Registry[] Returns an array of Registry objects
+// */
+// public function findByExampleField($value): array
+// {
+// return $this->createQueryBuilder('r')
+// ->andWhere('r.exampleField = :val')
+// ->setParameter('val', $value)
+// ->orderBy('r.id', 'ASC')
+// ->setMaxResults(10)
+// ->getQuery()
+// ->getResult()
+// ;
+// }
+
+// public function findOneBySomeField($value): ?Registry
+// {
+// return $this->createQueryBuilder('r')
+// ->andWhere('r.exampleField = :val')
+// ->setParameter('val', $value)
+// ->getQuery()
+// ->getOneOrNullResult()
+// ;
+// }
+}
diff --git a/hesabixCore/src/Service/SMS.php b/hesabixCore/src/Service/SMS.php
index 91e21fb..b2a2540 100644
--- a/hesabixCore/src/Service/SMS.php
+++ b/hesabixCore/src/Service/SMS.php
@@ -1,6 +1,7 @@
settings->getPayamakUsername();
- $password = $this->settings->getPayamakPassword();
- $api = new MelipayamakApi($username,$password);
- $sms = $api->sms('soap');
- $response = $sms->sendByBaseNumber($params,$to,$bodyID);
- $json = json_decode($response);
- echo $json->Value; //RecId or Error Number
- }catch(\Exception $e){
- //echo $e->getMessage();
+ $settings = $this->entityManager->getRepository(Settings::class)->findAll()[0];
+ if($settings->getActiveSmsPanel() == 'melipayamak'){
+ try{
+ $username = $this->settings->getPayamakUsername();
+ $password = $this->settings->getPayamakPassword();
+ $api = new MelipayamakApi($username,$password);
+ $sms = $api->sms('soap');
+ $response = $sms->sendByBaseNumber($params,$to,$bodyID);
+ $json = json_decode($response);
+ echo $json->Value; //RecId or Error Number
+ }catch(\Exception $e){
+ //echo $e->getMessage();
+ }
+
}
+ elseif($settings->getActiveSmsPanel() == 'idePayam'){
+ ini_set("soap.wsdl_cache_enabled", "0");
+ $patternID = $this->entityManager->getRepository(Registry::class)->findOneBy([
+ 'root'=>'sms',
+ 'name'=>$bodyID
+ ]);
+ $fromNum = $this->entityManager->getRepository(Registry::class)->findOneBy([
+ 'root'=>'sms',
+ 'name'=>'fromNum'
+ ]);
+ //create next
+ $pt = [];
+ foreach($params as $param){
+ $pt['{' + array_search($param,$params) + '}'] = $param;
+ }
+ $soap = new \SoapClient("http://185.112.33.61/wbs/send.php?wsdl");
+ $soap->token = $this->settings->getMelipayamakToken();
+ $soap->fromNum = $fromNum->getValueOfKey();
+ $soap->toNum = array($to);
+ $soap->patternID = $patternID->getValueOfKey();
+ $soap->Content = json_encode($pt,JSON_UNESCAPED_UNICODE);
+ $soap->Type = 0;
+ $array = $soap->SendSMSByPattern($soap->fromNum, $soap->toNum, $soap->Content, $soap->patternID, $soap->Type, $soap->token);
+
+ }
+
+
}
public function sendByBalance(array $params,$bodyID,$to,Business $business,User $user,$balance = 500): int
diff --git a/hesabixCore/src/Service/registryMGR.php b/hesabixCore/src/Service/registryMGR.php
new file mode 100644
index 0000000..43bc59a
--- /dev/null
+++ b/hesabixCore/src/Service/registryMGR.php
@@ -0,0 +1,48 @@
+em = $entityManager;
+ }
+ public function update(string $root,string $key ,string $v): bool
+ {
+ $item = $this->em->getRepository(Registry::class)->findOneBy([
+ 'root'=>$root,
+ 'name'=>$key
+ ]);
+ if(! $item){
+ $item = new Registry();
+ }
+ $item->setRoot($root);
+ $item->setName($key);
+ $item->setValueOfKey($v);
+ $this->em->persist($item);
+ $this->em->flush();
+ return true;
+ }
+
+ public function get(string $root,string $key){
+ $item = $this->em->getRepository(Registry::class)->findOneBy([
+ 'root'=>$root,
+ 'name'=>$key
+ ]);
+ if(! $item){
+ $item = new Registry();
+ $item->setRoot($root);
+ $item->setName($key);
+ $item->setValueOfKey('');
+ $this->em->persist($item);
+ $this->em->flush();
+ }
+ return $item->getValueOfKey();
+ }
+}
\ No newline at end of file
diff --git a/hesabixCore/templates/app/base.html.twig b/hesabixCore/templates/app/base.html.twig
index a1bfae2..d35a3d5 100644
--- a/hesabixCore/templates/app/base.html.twig
+++ b/hesabixCore/templates/app/base.html.twig
@@ -4,7 +4,7 @@
-
+
{% block title %}{% endblock %}
@@ -51,7 +51,7 @@
- (مدیریت) حسابیکس
+ (مدیریت) حسابکس
diff --git a/hesabixCore/templates/base-new.html.twig b/hesabixCore/templates/base-new.html.twig
index 31d090c..bd406a1 100644
--- a/hesabixCore/templates/base-new.html.twig
+++ b/hesabixCore/templates/base-new.html.twig
@@ -4,10 +4,10 @@
-
+
- حسابیکس - {% block title %}{% endblock %}
+ حسابکس - {% block title %}{% endblock %}
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
@@ -40,15 +40,15 @@