mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
Added comments to clearify methods
This commit is contained in:
@@ -35,14 +35,20 @@ class CustomersController < ApplicationController
|
||||
|
||||
autocomplete :customer, :name, :full => true, :extra_data => [:id]
|
||||
|
||||
# getter method for a customer's vehicles
|
||||
# TODO: move into customer model
|
||||
def filter_vehicles_by_customer
|
||||
@filtered_vehicles = Vehicle.all.where(customer_id: params[:selected_customer])
|
||||
end
|
||||
|
||||
# getter method for a customer's invoices
|
||||
# TODO: move into customer model
|
||||
def filter_invoices_by_customer
|
||||
@filtered_invoices = QboInvoice.all.where(customer_id: params[:selected_customer])
|
||||
end
|
||||
|
||||
# getter method for a customer's estimates
|
||||
# TODO: move into customer model
|
||||
def filter_estimates_by_customer
|
||||
@filtered_estimates = QboEstimate.all.where(customer_id: params[:selected_customer])
|
||||
end
|
||||
@@ -57,10 +63,12 @@ class CustomersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# initialize a new customer
|
||||
def new
|
||||
@customer = Customer.new
|
||||
end
|
||||
|
||||
# create a new customer
|
||||
def create
|
||||
@customer = Customer.new(params[:customer])
|
||||
if @customer.save
|
||||
@@ -108,6 +116,7 @@ class CustomersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# delete a customer
|
||||
def destroy
|
||||
begin
|
||||
Customer.find_by_id(params[:id]).destroy
|
||||
@@ -118,7 +127,7 @@ class CustomersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# Customer view for an issue
|
||||
# displays an issue for a customer with a provided security CustomerToken
|
||||
def view
|
||||
|
||||
User.current = User.find_by lastname: 'Anonymous'
|
||||
@@ -153,14 +162,18 @@ class CustomersController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
# redmine permission - add customers
|
||||
def add_customer
|
||||
global_check_permission(:add_customers)
|
||||
end
|
||||
|
||||
# redmine permission - view customers
|
||||
def view_customer
|
||||
global_check_permission(:view_customers)
|
||||
end
|
||||
|
||||
# checks to see if there is only one item in an array
|
||||
# @return true if array only has one item
|
||||
def only_one_non_zero?( array )
|
||||
found_non_zero = false
|
||||
array.each do |val|
|
||||
|
||||
Reference in New Issue
Block a user