diff --git a/VERSION.txt b/VERSION.txt index d042caea5ec9..77c57b8949a1 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.8.16 \ No newline at end of file +5.8.17 \ No newline at end of file diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 7b450eaacdf7..0980ed8507f3 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -493,7 +493,10 @@ class CompanySettings extends BaseSettings public $payment_email_all_contacts = false; + public $show_pdfhtml_on_mobile = true; + public static $casts = [ + 'show_pdfhtml_on_mobile' => 'bool', 'payment_email_all_contacts' => 'bool', 'statement_design_id' => 'string', 'delivery_note_design_id' => 'string', diff --git a/app/Http/Controllers/ClientPortal/SubscriptionPlanSwitchController.php b/app/Http/Controllers/ClientPortal/SubscriptionPlanSwitchController.php index b616ee161746..d44666ad6704 100644 --- a/app/Http/Controllers/ClientPortal/SubscriptionPlanSwitchController.php +++ b/app/Http/Controllers/ClientPortal/SubscriptionPlanSwitchController.php @@ -54,6 +54,6 @@ class SubscriptionPlanSwitchController extends Controller public function not_availabe() { - abort(404, 'ewwo'); + abort(404, 'Not Available'); } } diff --git a/app/Livewire/PdfSlot.php b/app/Livewire/PdfSlot.php index b0a89d33877c..709b14940dca 100644 --- a/app/Livewire/PdfSlot.php +++ b/app/Livewire/PdfSlot.php @@ -57,6 +57,8 @@ class PdfSlot extends Component private $entity_calc; + public $html_entity_option = true; + public function mount() { MultiDB::setDb($this->db); @@ -128,7 +130,8 @@ class PdfSlot extends Component $this->entity_calc = $this->entity->calc(); $this->settings = $this->entity->client ? $this->entity->client->getMergedSettings() : $this->entity->company->settings; - + $this->html_entity_option = $this->entity->client ? $this->entity->client->getSetting('show_pdfhtml_on_mobile') : $this->entity->company->getSetting('show_pdfhtml_on_mobile'); + $this->show_cost = in_array('$product.unit_cost', $this->settings->pdf_variables->product_columns); $this->show_line_total = in_array('$product.line_total', $this->settings->pdf_variables->product_columns); $this->show_quantity = in_array('$product.quantity', $this->settings->pdf_variables->product_columns); diff --git a/app/Livewire/SubscriptionPlanSwitch.php b/app/Livewire/SubscriptionPlanSwitch.php index be3fbb42fbee..a4518efe8453 100644 --- a/app/Livewire/SubscriptionPlanSwitch.php +++ b/app/Livewire/SubscriptionPlanSwitch.php @@ -155,7 +155,6 @@ class SubscriptionPlanSwitch extends Component $this->dispatch('redirectRoute', ['route' => $response]); - // return redirect($response); } public function render() diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index 72d98237fbb4..a15fa0cb4a63 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -100,8 +100,8 @@ class PaymentMigrationRepository extends BaseRepository $payment->deleted_at = $data['deleted_at'] ?: null; - if ($payment->currency_id == 0) { - $payment->currency_id = $payment->company->settings->currency_id; + if (!$payment->currency_id || $payment->currency_id == 0 || $payment->currency_id == '') { + $payment->currency_id = $payment->client->settings->currency_id ?? $payment->company->settings->currency_id; } /*Ensure payment number generated*/ diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index 44eecbc6c016..fe0f2381259c 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -11,25 +11,29 @@ namespace App\Services\Client; +use App\Utils\Number; use App\Models\Client; use App\Models\Credit; use App\Models\Invoice; use App\Models\Payment; use App\Services\Email\Email; -use App\Services\Email\EmailObject; -use App\Utils\Number; use App\Utils\Traits\MakesDates; -use Illuminate\Mail\Mailables\Address; use Illuminate\Support\Facades\DB; +use App\Services\Email\EmailObject; +use App\Utils\Traits\GeneratesCounter; +use Illuminate\Mail\Mailables\Address; +use Illuminate\Database\QueryException; class ClientService { - use MakesDates; + use MakesDates, GeneratesCounter; private string $client_start_date; private string $client_end_date; + private bool $completed = true; + public function __construct(private Client $client) { } @@ -145,6 +149,31 @@ class ClientService return $this; } + public function applyNumber(): self + { + $x = 1; + + if(isset($this->client->number)) + return $this; + + do { + try { + $this->client->number = $this->getNextClientNumber($this->client); + $this->client->saveQuietly(); + + $this->completed = false; + } catch (QueryException $e) { + $x++; + + if ($x > 10) { + $this->completed = false; + } + } + } while ($this->completed); + + return $this; + } + public function updatePaymentBalance() { $amount = Payment::query()->where('client_id', $this->client->id) diff --git a/config/ninja.php b/config/ninja.php index f4ed7ccc5613..7c169b6d45e0 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.8.16'), - 'app_tag' => env('APP_TAG', '5.8.16'), + 'app_version' => env('APP_VERSION', '5.8.17'), + 'app_tag' => env('APP_TAG', '5.8.17'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), diff --git a/resources/views/portal/ninja2020/components/livewire/pdf-slot.blade.php b/resources/views/portal/ninja2020/components/livewire/pdf-slot.blade.php index 22e7e792c85e..5159e3314c1e 100644 --- a/resources/views/portal/ninja2020/components/livewire/pdf-slot.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/pdf-slot.blade.php @@ -21,7 +21,11 @@ @endif + @if($html_entity_option) + @endif + + \ No newline at end of file