@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return $this; |
103 | 103 | } |
104 | 104 | |
105 | - public function getConfigs(bool $decode = false): string|array |
|
105 | + public function getConfigs(bool $decode = false): string | array |
|
106 | 106 | { |
107 | 107 | // Ensure we're decoding a string, even if it was temporarily an array internally |
108 | 108 | $configString = is_array($this->configs) ? json_encode($this->configs) : $this->configs; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | return $this->setConfigs($configs); |
117 | 117 | } |
118 | 118 | |
119 | - public function setConfigs(string|array|object $configs): self |
|
119 | + public function setConfigs(string | array | object $configs): self |
|
120 | 120 | { |
121 | 121 | if (is_string($configs)) |
122 | 122 | $configs = json_decode($configs, true); |
@@ -118,8 +118,9 @@ |
||
118 | 118 | |
119 | 119 | public function setConfigs(string|array|object $configs): self |
120 | 120 | { |
121 | - if (is_string($configs)) |
|
122 | - $configs = json_decode($configs, true); |
|
121 | + if (is_string($configs)) { |
|
122 | + $configs = json_decode($configs, true); |
|
123 | + } |
|
123 | 124 | |
124 | 125 | $this->configs = json_encode($configs); |
125 | 126 | return $this; |
@@ -19,12 +19,13 @@ |
||
19 | 19 | |
20 | 20 | public function getFileUrl(People $people): ?array |
21 | 21 | { |
22 | - if ($people->getImage() instanceof File) |
|
23 | - return [ |
|
22 | + if ($people->getImage() instanceof File) { |
|
23 | + return [ |
|
24 | 24 | 'id' => $people->getImage()->getId(), |
25 | 25 | 'domain' => $this->domainService->getMainDomain(), |
26 | 26 | 'url' => '/files/' . $people->getImage()->getId() . '/download' |
27 | 27 | ]; |
28 | + } |
|
28 | 29 | |
29 | 30 | return null; |
30 | 31 | } |
@@ -10,33 +10,33 @@ |
||
10 | 10 | class FileService |
11 | 11 | { |
12 | 12 | |
13 | - public function __construct( |
|
13 | + public function __construct( |
|
14 | 14 | private EntityManagerInterface $manager, |
15 | 15 | private DomainService $domainService |
16 | 16 | |
17 | - ) {} |
|
17 | + ) {} |
|
18 | 18 | |
19 | 19 | |
20 | - public function getFileUrl(People $people): ?array |
|
21 | - { |
|
20 | + public function getFileUrl(People $people): ?array |
|
21 | + { |
|
22 | 22 | if ($people->getImage() instanceof File) |
23 | - return [ |
|
23 | + return [ |
|
24 | 24 | 'id' => $people->getImage()->getId(), |
25 | 25 | 'domain' => $this->domainService->getMainDomain(), |
26 | 26 | 'url' => '/files/' . $people->getImage()->getId() . '/download' |
27 | - ]; |
|
27 | + ]; |
|
28 | 28 | |
29 | 29 | return null; |
30 | - } |
|
30 | + } |
|
31 | 31 | |
32 | - public function addFile(People $people, string $content, string $context, string $fileName, string $fileType, string $extension): File |
|
33 | - { |
|
32 | + public function addFile(People $people, string $content, string $context, string $fileName, string $fileType, string $extension): File |
|
33 | + { |
|
34 | 34 | return $this->manager->getRepository(File::class)->addFile($people, $content, $context, $fileName, $fileType, $extension); |
35 | - } |
|
35 | + } |
|
36 | 36 | |
37 | - public function removeFile(File $file) |
|
38 | - { |
|
37 | + public function removeFile(File $file) |
|
38 | + { |
|
39 | 39 | $this->manager->remove($file); |
40 | 40 | $this->manager->flush(); |
41 | - } |
|
41 | + } |
|
42 | 42 | } |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
56 | 56 | #[Groups([ |
57 | 57 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
58 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
58 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
59 | 59 | ])] |
60 | 60 | private $id; |
61 | 61 | |
62 | 62 | #[ORM\Column(name: 'status', type: 'string', nullable: false)] |
63 | 63 | #[Groups([ |
64 | 64 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
65 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
65 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
66 | 66 | ])] |
67 | 67 | #[Assert\NotBlank] |
68 | 68 | #[Assert\Type(type: 'string')] |
@@ -71,42 +71,42 @@ discard block |
||
71 | 71 | #[ORM\Column(name: 'real_status', type: 'string', nullable: false)] |
72 | 72 | #[Groups([ |
73 | 73 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
74 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
74 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
75 | 75 | ])] |
76 | 76 | private $realStatus; |
77 | 77 | |
78 | 78 | #[ORM\Column(name: 'visibility', type: 'string', nullable: false)] |
79 | 79 | #[Groups([ |
80 | 80 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
81 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
81 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
82 | 82 | ])] |
83 | 83 | private $visibility = 1; |
84 | 84 | |
85 | 85 | #[ORM\Column(name: 'notify', type: 'boolean', nullable: false)] |
86 | 86 | #[Groups([ |
87 | 87 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
88 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
88 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
89 | 89 | ])] |
90 | 90 | private $notify = 1; |
91 | 91 | |
92 | 92 | #[ORM\Column(name: 'system', type: 'boolean', nullable: false)] |
93 | 93 | #[Groups([ |
94 | 94 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
95 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
95 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
96 | 96 | ])] |
97 | 97 | private $system = 0; |
98 | 98 | |
99 | 99 | #[ORM\Column(name: 'color', type: 'string', nullable: false)] |
100 | 100 | #[Groups([ |
101 | 101 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
102 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
102 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
103 | 103 | ])] |
104 | 104 | private $color = ''; |
105 | 105 | |
106 | 106 | #[ORM\Column(name: 'context', type: 'string', nullable: false)] |
107 | 107 | #[Groups([ |
108 | 108 | 'contract:read', 'task:read', 'display_queue:read', 'display:read', 'order_product_queue:read', 'order:read', 'order_details:read', 'order:write', |
109 | - 'invoice:read', 'invoice_details:read', 'status:read','spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
109 | + 'invoice:read', 'invoice_details:read', 'status:read', 'spool_item:read', 'spool:read', 'spool:write', 'status:write', 'order_detail_status:read', 'logistic:read', 'queue:read', 'queue_people_queue:read' |
|
110 | 110 | ])] |
111 | 111 | private $context; |
112 | 112 |
@@ -70,31 +70,31 @@ |
||
70 | 70 | #[Entity(repositoryClass: FileRepository::class)] |
71 | 71 | class File |
72 | 72 | { |
73 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'contract:read', 'model:read', 'people:read'])] |
|
73 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'contract:read', 'model:read', 'people:read'])] |
|
74 | 74 | #[Column(type: 'integer', nullable: false)] |
75 | 75 | #[Id] |
76 | 76 | #[GeneratedValue(strategy: 'IDENTITY')] |
77 | 77 | private int $id = 0; |
78 | 78 | |
79 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
79 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
80 | 80 | #[NotBlank] |
81 | 81 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['fileType' => 'exact'])] |
82 | 82 | #[Column(type: 'string', length: 255, nullable: false)] |
83 | 83 | private string $fileType; |
84 | 84 | |
85 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
85 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
86 | 86 | #[NotBlank] |
87 | 87 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['fileName' => 'exact'])] |
88 | 88 | #[Column(type: 'string', length: 255, nullable: false)] |
89 | 89 | private string $fileName; |
90 | 90 | |
91 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
91 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
92 | 92 | #[NotBlank] |
93 | 93 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['context' => 'exact'])] |
94 | 94 | #[Column(type: 'string', length: 255, nullable: false)] |
95 | 95 | private string $context; |
96 | 96 | |
97 | - #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
97 | + #[Groups(['file:read', 'spool:read', 'category:read', 'product_category:read', 'order_product:read', 'product_file:read', 'product:read', 'spool_item:read', 'file_item:read', 'file:write', 'contract:read', 'model:read', 'people:read'])] |
|
98 | 98 | #[NotBlank] |
99 | 99 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['extension' => 'exact'])] |
100 | 100 | #[Column(type: 'string', length: 255, nullable: false)] |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | public function discoveryStatus($realStatus, $name, $context): Status |
19 | 19 | { |
20 | - $status = $this->manager->getRepository(Status::class)->findOneBy([ |
|
20 | + $status = $this->manager->getRepository(Status::class)->findOneBy([ |
|
21 | 21 | 'realStatus' => $realStatus, |
22 | 22 | 'status' => $name, |
23 | 23 | 'context' => $context, |
@@ -39,7 +39,7 @@ |
||
39 | 39 | #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
40 | 40 | #[ORM\Id] |
41 | 41 | #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
42 | - #[Groups(['spool_item:read', 'spool:read',])] |
|
42 | + #[Groups(['spool_item:read', 'spool:read', ])] |
|
43 | 43 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
44 | 44 | |
45 | 45 | private $id; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function addLine($prefix = '', $suffix = '', $delimiter = ' ') |
27 | 27 | { |
28 | 28 | $initialSpace = str_repeat(" ", $this->initialSpace); |
29 | - $count = $this->totalChars - $this->initialSpace - strlen($prefix) - strlen($suffix); |
|
29 | + $count = $this->totalChars - $this->initialSpace - strlen($prefix) - strlen($suffix); |
|
30 | 30 | if ($count > 0) |
31 | 31 | $delimiter = str_repeat($delimiter, $count); |
32 | 32 | $this->text .= $initialSpace . $prefix . $delimiter . $suffix . "\n"; |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | public function generatePrintData(Device $device, People $provider): Spool |
45 | 45 | { |
46 | 46 | $printer = null; |
47 | - $device_config = $this->deviceService->discoveryDeviceConfig($device, $provider)->getConfigs(true); |
|
47 | + $device_config = $this->deviceService->discoveryDeviceConfig($device, $provider)->getConfigs(true); |
|
48 | 48 | if (isset($device_config['printer'])) |
49 | 49 | $printer = $this->deviceService->discoveryDevice($device_config['printer']); |
50 | 50 | |
51 | - $content = [ |
|
51 | + $content = [ |
|
52 | 52 | "operation" => "PRINT_TEXT", |
53 | 53 | "styles" => [[]], |
54 | 54 | "value" => [$this->text] |
@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | { |
28 | 28 | $initialSpace = str_repeat(" ", $this->initialSpace); |
29 | 29 | $count = $this->totalChars - $this->initialSpace - strlen($prefix) - strlen($suffix); |
30 | - if ($count > 0) |
|
31 | - $delimiter = str_repeat($delimiter, $count); |
|
30 | + if ($count > 0) { |
|
31 | + $delimiter = str_repeat($delimiter, $count); |
|
32 | + } |
|
32 | 33 | $this->text .= $initialSpace . $prefix . $delimiter . $suffix . "\n"; |
33 | 34 | } |
34 | 35 | |
@@ -45,8 +46,9 @@ discard block |
||
45 | 46 | { |
46 | 47 | $printer = null; |
47 | 48 | $device_config = $this->deviceService->discoveryDeviceConfig($device, $provider)->getConfigs(true); |
48 | - if (isset($device_config['printer'])) |
|
49 | - $printer = $this->deviceService->discoveryDevice($device_config['printer']); |
|
49 | + if (isset($device_config['printer'])) { |
|
50 | + $printer = $this->deviceService->discoveryDevice($device_config['printer']); |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $content = [ |
52 | 54 | "operation" => "PRINT_TEXT", |
@@ -56,8 +58,9 @@ discard block |
||
56 | 58 | |
57 | 59 | $printData = $this->addToSpool($printer ?: $device, json_encode($content)); |
58 | 60 | |
59 | - if ($printer != $device) |
|
60 | - $x = ''; |
|
61 | + if ($printer != $device) { |
|
62 | + $x = ''; |
|
63 | + } |
|
61 | 64 | |
62 | 65 | return $printData; |
63 | 66 | } |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $devices = []; |
23 | 23 | foreach ($device_configs as $device_config) { |
24 | 24 | $configs = $device_config->getConfigs(true); |
25 | - if (isset($configs['pos-gateway']) && $configs['pos-gateway'] == 'cielo') |
|
26 | - $devices[] = $device_config->getDevice(); |
|
25 | + if (isset($configs['pos-gateway']) && $configs['pos-gateway'] == 'cielo') { |
|
26 | + $devices[] = $device_config->getDevice(); |
|
27 | + } |
|
27 | 28 | } |
28 | 29 | return $devices; |
29 | 30 | } |
@@ -64,8 +65,9 @@ discard block |
||
64 | 65 | $device = $this->discoveryDevice($deviceId); |
65 | 66 | |
66 | 67 | $device_config = $this->discoveryDeviceConfig($device, $people); |
67 | - foreach ($configs as $key => $config) |
|
68 | - $device_config->addConfig($key, $config); |
|
68 | + foreach ($configs as $key => $config) { |
|
69 | + $device_config->addConfig($key, $config); |
|
70 | + } |
|
69 | 71 | |
70 | 72 | $this->manager->persist($device_config); |
71 | 73 | $this->manager->flush(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $devices; |
29 | 29 | } |
30 | 30 | |
31 | - public function findDevices(array|string $devices) |
|
31 | + public function findDevices(array | string $devices) |
|
32 | 32 | { |
33 | 33 | return $this->manager->getRepository(Device::class)->findBy([ |
34 | 34 | 'device' => $devices |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | { |
71 | 71 | $device = $this->discoveryDevice($deviceId); |
72 | 72 | |
73 | - $device_config = $this->discoveryDeviceConfig($device, $people); |
|
73 | + $device_config = $this->discoveryDeviceConfig($device, $people); |
|
74 | 74 | foreach ($configs as $key => $config) |
75 | - $device_config->addConfig($key, $config); |
|
75 | + $device_config->addConfig($key, $config); |
|
76 | 76 | |
77 | 77 | $this->manager->persist($device_config); |
78 | 78 | $this->manager->flush(); |
@@ -9,25 +9,25 @@ |
||
9 | 9 | |
10 | 10 | class LoggerService |
11 | 11 | { |
12 | - private static $loggers = []; |
|
13 | - private string $logsDir; |
|
12 | + private static $loggers = []; |
|
13 | + private string $logsDir; |
|
14 | 14 | |
15 | - public function __construct(ParameterBagInterface $parameterBag) |
|
16 | - { |
|
15 | + public function __construct(ParameterBagInterface $parameterBag) |
|
16 | + { |
|
17 | 17 | $this->logsDir = $parameterBag->get('kernel.logs_dir'); |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - public function getLogger(string $name): LoggerInterface |
|
21 | - { |
|
20 | + public function getLogger(string $name): LoggerInterface |
|
21 | + { |
|
22 | 22 | if (!isset(self::$loggers[$name])) { |
23 | - $logger = new Logger($name); |
|
24 | - $logger->pushHandler(new StreamHandler( |
|
23 | + $logger = new Logger($name); |
|
24 | + $logger->pushHandler(new StreamHandler( |
|
25 | 25 | $this->logsDir . '/' . $name . '.log', |
26 | 26 | Logger::INFO |
27 | - )); |
|
28 | - self::$loggers[$name] = $logger; |
|
27 | + )); |
|
28 | + self::$loggers[$name] = $logger; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | return self::$loggers[$name]; |
32 | - } |
|
32 | + } |
|
33 | 33 | } |