Clean up for Filters

This commit is contained in:
David Bomba 2023-01-12 13:52:06 +11:00
parent c4058c502e
commit afad1245c9
7 changed files with 2 additions and 9 deletions

View File

@ -193,9 +193,7 @@ class ClientFilters extends QueryFilters
->where('clients.company_id', '=', $company_id)
->where('client_contacts.is_primary', '=', true)
->where('client_contacts.deleted_at', '=', null)
//->whereRaw('(clients.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices
->select(
// DB::raw('COALESCE(clients.currency_id, companies.currency_id) currency_id'),
DB::raw('COALESCE(clients.country_id, companies.country_id) country_id'),
DB::raw("CONCAT(COALESCE(client_contacts.first_name, ''), ' ', COALESCE(client_contacts.last_name, '')) contact"),
'clients.id',

View File

@ -105,7 +105,6 @@ class DesignFilters extends QueryFilters
$query = DB::table('designs')
->join('companies', 'companies.id', '=', 'designs.company_id')
->where('designs.company_id', '=', $company_id)
//->whereRaw('(designs.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices
->select(
'designs.id',
'designs.name',

View File

@ -205,9 +205,7 @@ class ExpenseFilters extends QueryFilters
$query = DB::table('expenses')
->join('companies', 'companies.id', '=', 'expenses.company_id')
->where('expenses.company_id', '=', $company_id)
//->whereRaw('(expenses.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices
->select(
// DB::raw('COALESCE(expenses.currency_id, companies.currency_id) currency_id'),
DB::raw('COALESCE(expenses.country_id, companies.country_id) country_id'),
DB::raw("CONCAT(COALESCE(expense_contacts.first_name, ''), ' ', COALESCE(expense_contacts.last_name, '')) contact"),
'expenses.id',

View File

@ -104,7 +104,6 @@ class TokenFilters extends QueryFilters
$query = DB::table('company_tokens')
->join('companies', 'companies.id', '=', 'company_tokens.company_id')
->where('company_tokens.company_id', '=', $company_id)
//->whereRaw('(designs.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices
->select(
'company_tokens.id',
'company_tokens.name',

View File

@ -118,7 +118,6 @@ class VendorFilters extends QueryFilters
->where('vendors.company_id', '=', $company_id)
->where('vendor_contacts.is_primary', '=', true)
->where('vendor_contacts.deleted_at', '=', null)
//->whereRaw('(vendors.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices
->select(
// DB::raw('COALESCE(vendors.currency_id, companies.currency_id) currency_id'),
DB::raw('COALESCE(vendors.country_id, companies.country_id) country_id'),

View File

@ -105,7 +105,6 @@ class WebhookFilters extends QueryFilters
$query = DB::table('webhooks')
->join('companies', 'companies.id', '=', 'webhooks.company_id')
->where('webhooks.company_id', '=', $company_id)
//->whereRaw('(designs.name != "" or contacts.first_name != "" or contacts.last_name != "" or contacts.email != "")') // filter out buy now invoices
->select(
'webhooks.id',
'webhooks.target_url',

View File

@ -31,6 +31,7 @@ class SubscriptionPlanSwitchController extends Controller
*/
public function index(ShowPlanSwitchRequest $request, RecurringInvoice $recurring_invoice, Subscription $target)
{
$amount = $recurring_invoice->subscription
->service()
->calculateUpgradePriceV2($recurring_invoice, $target);
@ -44,7 +45,6 @@ class SubscriptionPlanSwitchController extends Controller
render('subscriptions.denied');
}
$amount = max(0,$amount);
return render('subscriptions.switch', [
@ -53,5 +53,6 @@ class SubscriptionPlanSwitchController extends Controller
'target' => $target,
'amount' => $amount,
]);
}
}