From 1970b320e104e434273ca990694a1eb71a2d2017 Mon Sep 17 00:00:00 2001 From: FOSSBilling Bot <121974958+fossbilling-bot@users.noreply.github.com> Date: Tue, 19 Sep 2023 07:22:00 -0700 Subject: [PATCH] Apply PHP Code Styling & Quality Changes (#1617) --- src/modules/Client/Service.php | 2 +- src/modules/Email/Service.php | 8 +++++--- src/modules/Kb/Service.php | 2 +- src/modules/Order/Service.php | 2 +- src/modules/Servicedomain/Service.php | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/modules/Client/Service.php b/src/modules/Client/Service.php index 724205d89..913f6f892 100644 --- a/src/modules/Client/Service.php +++ b/src/modules/Client/Service.php @@ -170,7 +170,7 @@ class Service implements InjectionAwareInterface if (!empty($where)) { $sql .= ' WHERE ' . implode(' AND ', $where); } - $sql = $sql . ' ORDER BY c.created_at desc'; + $sql .= ' ORDER BY c.created_at desc'; return [$sql, $params]; } diff --git a/src/modules/Email/Service.php b/src/modules/Email/Service.php index eac1c9c31..fdddbd1b0 100644 --- a/src/modules/Email/Service.php +++ b/src/modules/Email/Service.php @@ -220,9 +220,10 @@ class Service implements \FOSSBilling\InjectionAwareInterface { // Add the email to the queue $email = $this->_queue($to, $from, $subject, $content, $to_name, $from_name, $client_id, $admin_id); - if($send_now){ + if ($send_now) { $this->_sendFromQueue($email, $throw_exceptions); } + return true; } @@ -629,9 +630,10 @@ class Service implements \FOSSBilling\InjectionAwareInterface $this->di['db']->trash($queue); } - if($throw_exceptions){ + if ($throw_exceptions) { // If the error message is long, truncate it and inform the user the rest is in the error log. - $truncated = (strlen($message) > 350) ? __trans('Error message truncated due to length, please check the error log for the complete message: ') . substr($message,0,350).'...' : $message; + $truncated = (strlen($message) > 350) ? __trans('Error message truncated due to length, please check the error log for the complete message: ') . substr($message, 0, 350) . '...' : $message; + throw new \Box_Exception($truncated); } } diff --git a/src/modules/Kb/Service.php b/src/modules/Kb/Service.php index 4e4ec3816..9fb550c98 100644 --- a/src/modules/Kb/Service.php +++ b/src/modules/Kb/Service.php @@ -208,7 +208,7 @@ class Service $sql = $sql . ' WHERE ' . implode(' AND ', $where); } - $sql = $sql . ' GROUP BY kac.id ORDER BY kac.id DESC'; + $sql .= ' GROUP BY kac.id ORDER BY kac.id DESC'; return [$sql, $bindings]; } diff --git a/src/modules/Order/Service.php b/src/modules/Order/Service.php index 4272f59ed..65aed621f 100644 --- a/src/modules/Order/Service.php +++ b/src/modules/Order/Service.php @@ -798,7 +798,7 @@ class Service implements InjectionAwareInterface public function stockSale(\Model_Product $product, $qty) { if ($product->stock_control) { - $product->quantity_in_stock = $product->quantity_in_stock - $qty; + $product->quantity_in_stock -= $qty; $product->updated_at = date('Y-m-d H:i:s'); $this->di['db']->store($product); } diff --git a/src/modules/Servicedomain/Service.php b/src/modules/Servicedomain/Service.php index cd2eaeaf2..27f09617e 100644 --- a/src/modules/Servicedomain/Service.php +++ b/src/modules/Servicedomain/Service.php @@ -825,7 +825,7 @@ class Service implements \FOSSBilling\InjectionAwareInterface $query = $query . ' WHERE ' . implode(' AND ', $where); } - $query = $query . ' ORDER BY id ASC'; + $query .= ' ORDER BY id ASC'; return [$query, $bindings]; }