diff --git a/app/Export/CSV/InvoiceExport.php b/app/Export/CSV/InvoiceExport.php index 758da070f2..74671995bb 100644 --- a/app/Export/CSV/InvoiceExport.php +++ b/app/Export/CSV/InvoiceExport.php @@ -134,26 +134,26 @@ class InvoiceExport extends BaseExport /** @var \App\Models\Invoice $invoice */ // Invoice level taxes - if (!empty($invoice->tax_name1) && !empty($invoice->tax_rate1)) { + if (strlen($invoice->tax_name1 ?? '') > 1 && $invoice->tax_rate1 > 0) { $taxes[] = trim($invoice->tax_name1) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($invoice->tax_rate1), $invoice->client) . '%'; } - if (!empty($invoice->tax_name2) && !empty($invoice->tax_rate2)) { + if (strlen($invoice->tax_name2 ?? '') > 1 && $invoice->tax_rate2 > 0) { $taxes[] = trim($invoice->tax_name2) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($invoice->tax_rate2), $invoice->client) . '%'; } - if (!empty($invoice->tax_name3) && !empty($invoice->tax_rate3)) { + if (strlen($invoice->tax_name3 ?? '') > 1 && $invoice->tax_rate3 > 0) { $taxes[] = trim($invoice->tax_name3) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($invoice->tax_rate3), $invoice->client) . '%'; } // Line item taxes $line_taxes = collect($invoice->line_items)->flatMap(function ($item) use ($invoice) { $taxes = []; - if (!empty($item->tax_name1) && !empty($item->tax_rate1)) { + if (strlen($item->tax_name1 ?? '') > 1 && $item->tax_rate1 > 0) { $taxes[] = trim($item->tax_name1) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($item->tax_rate1), $invoice->client) . '%'; } - if (!empty($item->tax_name2) && !empty($item->tax_rate2)) { + if (strlen($item->tax_name2 ?? '') > 1 && $item->tax_rate2 > 0) { $taxes[] = trim($item->tax_name2) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($item->tax_rate2), $invoice->client) . '%'; } - if (!empty($item->tax_name3) && !empty($item->tax_rate3)) { + if (strlen($item->tax_name3 ?? '') > 1 && $item->tax_rate3 > 0) { $taxes[] = trim($item->tax_name3) . ' ' . \App\Utils\Number::formatValueNoTrailingZeroes(floatval($item->tax_rate3), $invoice->client) . '%'; } return $taxes; @@ -216,7 +216,7 @@ class InvoiceExport extends BaseExport } foreach ($taxes as $tax) { - $entity[$tax['name']] += $tax['total']; + $entity[$tax['name']] = ($entity[$tax['name']] ?? 0) + $tax['total']; } } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 90cf60d3eb..d9e6f71c84 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -453,7 +453,7 @@ class LoginController extends BaseController } // If this is a result user/email combo - lets add their OAuth details details - if ($email && $existing_login_user = MultiDB::hasUser(['email' => $email])) { + if ($email && $existing_login_user = MultiDB::hasUser(['email' => $email, 'oauth_provider_id' => 'microsoft'])) { if (!$existing_login_user->account) { return response()->json(['message' => 'User exists, but not attached to any companies! Orphaned user!'], 400); } @@ -562,7 +562,7 @@ class LoginController extends BaseController } //If this is a result user/email combo - lets add their OAuth details details - if ($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user)])) { + if ($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user), 'oauth_provider_id' => 'google'])) { if (!$existing_login_user->account) { return response()->json(['message' => 'User exists, but not attached to any companies! Orphaned user!'], 400); } @@ -575,7 +575,7 @@ class LoginController extends BaseController if ($user) { //check the user doesn't already exist in some form - if ($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user)])) { + if ($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user), 'oauth_provider_id' => 'google'])) { if (!$existing_login_user->account) { return response()->json(['message' => 'User exists, but not attached to any companies! Orphaned user!'], 400); } diff --git a/app/Jobs/Cron/RecurringExpensesCron.php b/app/Jobs/Cron/RecurringExpensesCron.php index fc4a1148fa..d767ee9b44 100644 --- a/app/Jobs/Cron/RecurringExpensesCron.php +++ b/app/Jobs/Cron/RecurringExpensesCron.php @@ -113,7 +113,6 @@ class RecurringExpensesCron if ((int)$expense->company->settings->currency_id != $expense->currency_id) { $exchange_rate = new CurrencyApi(); - $expense->exchange_rate = $exchange_rate->exchangeRate($expense->currency_id, (int)$expense->company->settings->currency_id, Carbon::parse($expense->date)); } else { $expense->exchange_rate = 1; diff --git a/lang/en/texts.php b/lang/en/texts.php index f76371a706..27dae74230 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -5581,6 +5581,7 @@ $lang = array( 'send_emails_permission' => 'Allow user to send emails', 'cancel_trial' => 'Cancel Trial', 'cancel_trial_description' => 'This will cancel your trial and remove all paid features from your account.', + 'existing_gateway' => 'Gateway already exists', ); return $lang; diff --git a/resources/views/templates/entity/td15.html b/resources/views/templates/entity/td15.html new file mode 100644 index 0000000000..60fe8bb437 --- /dev/null +++ b/resources/views/templates/entity/td15.html @@ -0,0 +1,483 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+
 
+
+
+
+
+ +
+
+
+
+

$entity_label

+
+
+
+
+
+
+ + {% if invoices is defined and invoices is not empty %} + {% set invoice = invoices|first %} + {% if invoice.line_items|filter(item => item.type_id == 1)|length > 0 %} + + + + + + + + + + + + + + + {%set product_sub_total = 0%} + {% for item in invoice.line_items|filter(item => item.type_id == 1) %} + + + + + + + + {% set product_sub_total = product_sub_total + item.line_total_raw %} + {% endfor %} + + + + + + + + + + +
Heading for product table
$item_label #$description_label$product.unit_cost_label$quantity_label$product.line_total_label
{{ item.product_key }}{{ item.notes }}{{ item.cost }}{{ item.quantity }}{{ item.line_total }}
$subtotal_label{{product_sub_total}}
+ {% endif %} + {% endif %} +
+ + + {% if invoices is defined and invoices is not empty %} + + {% set invoice = invoices|first %} + {% if invoice.line_items|filter(item => item.type_id == 1)|length > 0 %} + + + + + + + + + + + + + + + {%set product_sub_total = 0%} + {% for item in invoice.line_items|filter(item => item.type_id == 2) %} + + + + + + + + {% set product_sub_total = product_sub_total + item.line_total_raw %} + {% endfor %} + + + + + + + + + +
Working Hours
$task.service_label #$description_label$task.hours_label$task.rate_label$task.line_total_label
{{ item.product_key }}{{ item.notes }}{{ item.cost }}{{ item.quantity }}{{ item.line_total }}
$subtotal_label{{product_sub_total}}
+ + {% endif %} + {% endif %} +
+ +
+
+
$status_logo
+
+ +
+ + + + $entity_images + + + + +
+ \ No newline at end of file