Skip to content

Commit

Permalink
Merge pull request #9344 from turbo124/v5-develop
Browse files Browse the repository at this point in the history
v5.8.32
  • Loading branch information
turbo124 committed Mar 1, 2024
2 parents b8f75e4 + 82117f8 commit 6e2fefc
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
@@ -1 +1 @@
5.8.31
5.8.32
6 changes: 5 additions & 1 deletion app/Filters/DocumentFilters.php
Expand Up @@ -57,7 +57,11 @@ public function client_id(string $client_id = ''): Builder
\App\Models\Credit::class,
\App\Models\Expense::class,
\App\Models\Payment::class,
\App\Models\Task::class], function ($q2) use ($client_id) {
\App\Models\Task::class,
\App\Models\RecurringExpense::class,
\App\Models\RecurringInvoice::class,
\App\Models\Project::class,
], function ($q2) use ($client_id) {
$q2->where('client_id', $this->decodePrimaryKey($client_id));
})->orWhereHasMorph('documentable', [\App\Models\Client::class], function ($q3) use ($client_id) {
$q3->where('id', $this->decodePrimaryKey($client_id));
Expand Down
6 changes: 3 additions & 3 deletions app/Helpers/Invoice/InvoiceSum.php
Expand Up @@ -122,23 +122,23 @@ private function calculateCustomValues(): self

private function calculateInvoiceTaxes(): self
{
if (is_string($this->invoice->tax_name1) && strlen($this->invoice->tax_name1) > 2) {
if (is_string($this->invoice->tax_name1) && strlen($this->invoice->tax_name1) >= 2) {
$tax = $this->taxer($this->total, $this->invoice->tax_rate1);
$tax += $this->getSurchargeTaxTotalForKey($this->invoice->tax_name1, $this->invoice->tax_rate1);

$this->total_taxes += $tax;
$this->total_tax_map[] = ['name' => $this->invoice->tax_name1.' '.floatval($this->invoice->tax_rate1).'%', 'total' => $tax];
}

if (is_string($this->invoice->tax_name2) && strlen($this->invoice->tax_name2) > 2) {
if (is_string($this->invoice->tax_name2) && strlen($this->invoice->tax_name2) >= 2) {
$tax = $this->taxer($this->total, $this->invoice->tax_rate2);
$tax += $this->getSurchargeTaxTotalForKey($this->invoice->tax_name2, $this->invoice->tax_rate2);

$this->total_taxes += $tax;
$this->total_tax_map[] = ['name' => $this->invoice->tax_name2.' '.floatval($this->invoice->tax_rate2).'%', 'total' => $tax];
}

if (is_string($this->invoice->tax_name3) && strlen($this->invoice->tax_name3) > 2) {
if (is_string($this->invoice->tax_name3) && strlen($this->invoice->tax_name3) >= 2) {
$tax = $this->taxer($this->total, $this->invoice->tax_rate3);
$tax += $this->getSurchargeTaxTotalForKey($this->invoice->tax_name3, $this->invoice->tax_rate3);

Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/ClientController.php
Expand Up @@ -49,6 +49,9 @@
use App\Http\Requests\Client\ReactivateClientEmailRequest;
use App\Models\Expense;
use App\Models\Payment;
use App\Models\Project;
use App\Models\RecurringExpense;
use App\Models\RecurringInvoice;
use App\Models\Task;
use App\Transformers\DocumentTransformer;

Expand Down Expand Up @@ -421,7 +424,7 @@ public function documents(ClientDocumentsRequest $request, Client $client)

$documents = Document::query()
->company()
->whereHasMorph('documentable', [Invoice::class, Quote::class, Credit::class, Expense::class, Payment::class, Task::class], function ($query) use ($client) {
->whereHasMorph('documentable', [Invoice::class, Quote::class, Credit::class, Expense::class, Payment::class, Task::class, RecurringInvoice::class, RecurringExpense::class, Project::class], function ($query) use ($client) {
$query->where('client_id', $client->id);
})
->orWhereHasMorph('documentable', [Client::class], function ($query) use ($client) {
Expand Down
20 changes: 11 additions & 9 deletions app/Models/Document.php
Expand Up @@ -214,15 +214,17 @@ public function link()
$link = '';

match($this->documentable_type) {
'App\Models\Vendor' => $link = "vendors/{$entity_id}",
'App\Models\Project' => $link = "projects/{$entity_id}",
'invoices' => $link = "invoices/{$entity_id}/edit",
'App\Models\Quote' => $link = "quotes/{$entity_id}/edit",
'App\Models\Credit' => $link = "credits/{$entity_id}/edit",
'App\Models\Expense' => $link = "expenses/{$entity_id}/edit",
'App\Models\Payment' => $link = "payments/{$entity_id}/edit",
'App\Models\Task' => $link = "tasks/{$entity_id}/edit",
'App\Models\Client' => $link = "clients/{$entity_id}",
'App\Models\Vendor' => $link = "/vendors/{$entity_id}",
'App\Models\Project' => $link = "/projects/{$entity_id}",
'invoices' => $link = "/invoices/{$entity_id}/edit",
'App\Models\Quote' => $link = "/quotes/{$entity_id}/edit",
'App\Models\Credit' => $link = "/credits/{$entity_id}/edit",
'App\Models\Expense' => $link = "/expenses/{$entity_id}/edit",
'App\Models\Payment' => $link = "/payments/{$entity_id}/edit",
'App\Models\Task' => $link = "/tasks/{$entity_id}/edit",
'App\Models\Client' => $link = "/clients/{$entity_id}",
'App\Models\RecurringExpense' => $link = "/recurring_expenses/{$entity_id}/edit",
'App\Models\RecurringInvoice' => $link = "/recurring_invoices/{$entity_id}/edit",
default => $link = '',
};

Expand Down
4 changes: 2 additions & 2 deletions config/ninja.php
Expand Up @@ -17,8 +17,8 @@
'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.31'),
'app_tag' => env('APP_TAG', '5.8.31'),
'app_version' => env('APP_VERSION', '5.8.32'),
'app_tag' => env('APP_TAG', '5.8.32'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),
Expand Down
1 change: 1 addition & 0 deletions lang/en/texts.php
Expand Up @@ -5241,6 +5241,7 @@
'test_email_sent' => 'Successfully sent email',
'gateway_type' => 'Gateway Type',
'save_template_body' => 'Would you like to save this import mapping as a template for future use?',
'save_as_template' => 'Save Template Mapping'
);

return $lang;
4 changes: 4 additions & 0 deletions lang/fr_CA/texts.php
Expand Up @@ -5234,6 +5234,10 @@
'user_sales' => 'Ventes de l\'utilisateur',
'iframe_url' => 'URL de l\'iFrame',
'user_unsubscribed' => 'Utilisateur désabonné des courriels :link',
'use_available_payments' => 'Utilisez les paiements disponibles',
'test_email_sent' => 'Le courriel a été envoyé',
'gateway_type' => 'Type de passerelle',
'save_template_body' => 'Souhaitez-vous enregistrer cette correspondance d\'importation en tant que modèle pour une utilisation future ?',
);

return $lang;

0 comments on commit 6e2fefc

Please sign in to comment.