Skip to content

Commit

Permalink
Merge pull request #179 from dhanasingh/dev
Browse files Browse the repository at this point in the history
v3.6
  • Loading branch information
Arun-TAK authored May 10, 2019
2 parents 6b1b1da + 442c7c5 commit 14dc647
Show file tree
Hide file tree
Showing 94 changed files with 2,339 additions and 988 deletions.
32 changes: 23 additions & 9 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This Plugin has the following modules:
3) PayRoll
Setup Payroll data
Generate Salary
Report Salary Register
Report Salary Slip
Report Salary Register
Report Salary Slip
4) Billing
Setup Billable Projects
Generate Invoices
Expand All @@ -24,12 +24,12 @@ This Plugin has the following modules:
5) Accounting
Create Ledgers
Post Financial Transaction
Report Balance Sheet
Report Profit & Loss A/c Report
Report Balance Sheet
Report Profit & Loss A/c Report
6) CRM
Create Lead,Opportunity, Activity and Contacts
Report Lead Conversion
Report Sales Activity
Report Lead Conversion
Report Sales Activity
7) Purchasing
Create RFQ, Quote, Purchase Order,
Create Supplier Invoice and Supplier Payments
Expand Down Expand Up @@ -71,9 +71,23 @@ If an apache passenger module is used then make sure the following settings are
b) RailsAppSpawnerIdleTime 0
c) PassengerPreStart http://rails-app-url/

Release Notes for 3.5.1

- Minor code changes.
Release Notes for 3.6

Features:
- Payroll module-Edit box in user setting for all individual employees
- Save and Continue for Accounting Transaction
- Accounting Transaction Remember Previous values
- Main Location
- Billable Projects in Project / Account
- Notify Users to take the Survey
- CSV Report on Payroll list page
- Preview salary
- Payroll Bank Report
- Entity Surveys

Bug Fixing:
- Move Permissions to Settings tab
- Double entry on preview bill

Customization:

Expand Down
11 changes: 8 additions & 3 deletions app/controllers/wkaccount_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

class WkaccountController < WkcrmController

include WkaccountprojectHelper
before_action :require_login

def index
Expand All @@ -29,13 +29,14 @@ def index
if !params[:location_id].blank?
entries = entries.where(:location_id => params[:location_id].to_i)
end
entries = entries.order(:name)
formPagination(entries)
end

def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@account_entries = entries.order(:name).limit(@limit).offset(@offset)
@account_entries = entries.limit(@limit).offset(@offset)
end

def setLimitAndOffset
Expand All @@ -54,9 +55,13 @@ def setLimitAndOffset
end
end

def edit
def edit

@accountEntry = nil
unless params[:account_id].blank?
set_filter_session
@accountproject = formPagination(accountProjctList)

@accountEntry = WkAccount.find(params[:account_id])
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/wkaccounting_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def check_perm_and_redirect
end

def check_ac_admin_and_redirect
unless isModuleAdmin('wktime_accounting_admin')
unless validateERPPermission("A_ACC_PRVLG")
render_403
return false
end
end

def check_permission
ret = false
return isModuleAdmin('wktime_accounting_group') || isModuleAdmin('wktime_accounting_admin')
return validateERPPermission("B_ACC_PRVLG") || validateERPPermission("A_ACC_PRVLG")
end
end
108 changes: 55 additions & 53 deletions app/controllers/wkaccountproject_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,17 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

class WkaccountprojectController < WkbillingController
class WkaccountprojectController < WkbaseController

before_action :require_login
before_action :account_project_permission
before_action :check_account_proj_module_permission

include WkaccountprojectHelper

def index
@accountproject = nil
sqlwhere = ""
set_filter_session
filter_type = session[:accountproject][:polymorphic_filter]
contact_id = session[:accountproject][:contact_id]
account_id = session[:accountproject][:account_id]
projectId = session[:accountproject][:project_id]

if filter_type == '2' && !contact_id.blank?
sqlwhere = sqlwhere + " and " unless sqlwhere.blank?
sqlwhere = sqlwhere + " parent_id = '#{contact_id}' and parent_type = 'WkCrmContact' "
elsif filter_type == '2' && contact_id.blank?
sqlwhere = sqlwhere + " and " unless sqlwhere.blank?
sqlwhere = sqlwhere + " parent_type = 'WkCrmContact' "
end

if filter_type == '3' && !account_id.blank?
sqlwhere = sqlwhere + " and " unless sqlwhere.blank?
sqlwhere = sqlwhere + " parent_id = '#{account_id}' and parent_type = 'WkAccount' "
elsif filter_type == '3' && account_id.blank?
sqlwhere = sqlwhere + " and " unless sqlwhere.blank?
sqlwhere = sqlwhere + " parent_type = 'WkAccount' "
end

unless projectId.blank?
sqlwhere = sqlwhere + " and " unless sqlwhere.blank?
sqlwhere = sqlwhere + " project_id = '#{projectId}' "
end

if filter_type == '1' && projectId.blank? #accountId.blank? && projectId.blank?
entries = WkAccountProject.all
else
entries = WkAccountProject.where(sqlwhere)
end
formPagination(entries)
def index
set_filter_session
formPagination(accountProjctList)
end

def edit
Expand All @@ -79,8 +49,6 @@ def update
arrId = []
wkaccountproject = saveBillableProjects(params[:accountProjectId], params[:project_id], params[:related_parent], params[:related_to], params[:applytax], params[:itemized_bill], params[:billing_type])



unless wkaccountproject.id.blank?

if wkaccountproject.apply_tax
Expand Down Expand Up @@ -127,9 +95,9 @@ def update
end
WkBillingSchedule.where(:account_project_id => wkaccountproject.id).where.not(:id => arrId).delete_all()
end
projectEntry = Project.find(params[:project_id])
if errorMsg.nil?
redirect_to :action => 'index' , :tab => 'wkaccountproject'
redirect_to :project_id => projectEntry.identifier, :controller => controller_name, :action => 'index'
flash[:notice] = l(:notice_successful_update)
else
flash[:error] = errorMsg
Expand All @@ -138,23 +106,13 @@ def update
end

def destroy
projectEntry = Project.find(params[:project_id])
WkAccountProject.find(params[:account_project_id].to_i).destroy

flash[:notice] = l(:notice_successful_delete)
redirect_back_or_default :action => 'index', :tab => params[:tab]
redirect_back_or_default :project_id => projectEntry.identifier, :action => 'index'
end

def set_filter_session
if params[:searchlist].blank? && session[:accountproject].nil?
session[:accountproject] = {:contact_id => params[:contact_id], :account_id => params[:account_id], :project_id => params[:project_id], :polymorphic_filter => params[:polymorphic_filter] }
elsif params[:searchlist] =='accountproject'
session[:accountproject][:contact_id] = params[:contact_id]
session[:accountproject][:project_id] = params[:project_id]
session[:accountproject][:account_id] = params[:account_id]
session[:accountproject][:polymorphic_filter] = params[:polymorphic_filter]
end

end

def setLimitAndOffset
if api_request?
Expand All @@ -178,4 +136,48 @@ def formPagination(entries)
@accountproject = entries.limit(@limit).offset(@offset)
end

def account_project_permission
project_id = params[:project_id]
params[:project_id] = (Project.all).first.identifier if params[:project_id].blank?
contact_id = params[:contact_id].blank? ? nil : WkCrmContact.where(:id => params[:contact_id])
contact_id = (contact_id.first).id unless contact_id.blank?
account_id = params[:account_id].blank? ? nil : WkAccount.where(:id => params[:account_id])
account_id = (account_id.first).id unless account_id.blank?

if !showCRMModule
render_403
return false
elsif project_id.blank? && contact_id.blank? && account_id.blank?
render_404
return false
elsif !params[:project_id].blank?
find_project_by_project_id
end
end

def check_account_proj_module_permission
if params[:contact_id].blank? && params[:account_id].blank? && !params[:project_id].blank? && !User.current.allowed_to?(:view_accounts, @project)
render_403
return false
end
end

def getOrderContactType
'C'
end

def additionalContactType
true
end

def getOrderAccountType
'A'
end

def getAccountDDLbl
l(:label_account)
end

def getAdditionalDD
end
end
2 changes: 1 addition & 1 deletion app/controllers/wkbilling_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def check_perm_and_redirect
end

def check_permission
return isModuleAdmin('wktime_billing_groups')
return validateERPPermission("M_BILL")
end

def getOrderAccountType
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/wkcontact_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class WkcontactController < WkcrmController
unloadable
include WkaccountprojectHelper

def index
set_filter_session
Expand Down Expand Up @@ -35,6 +36,8 @@ def index
def edit
@conEditEntry = nil
unless params[:contact_id].blank?
set_filter_session
@accountproject = formPagination(accountProjctList)
@conEditEntry = WkCrmContact.where(:id => params[:contact_id].to_i)
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/wkcrm_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ def check_perm_and_redirect
end

def check_crm_admin_and_redirect
unless isModuleAdmin('wktime_crm_admin')
unless validateERPPermission("A_CRM_PRVLG")
render_403
return false
end
end

def check_permission
ret = false
return isModuleAdmin('wktime_crm_group') || isModuleAdmin('wktime_crm_admin')
return validateERPPermission("B_CRM_PRVLG") || validateERPPermission("A_CRM_PRVLG")
end

def getContactController
Expand All @@ -77,7 +77,7 @@ def getContactType
end

def deletePermission
isModuleAdmin('wktime_crm_admin')
validateERPPermission("A_CRM_PRVLG")
end

def additionalContactType
Expand Down
11 changes: 10 additions & 1 deletion app/controllers/wkgltransaction_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def edit
end

def update
set_transaction_session
errorMsg = nil
wkgltransaction = nil
wktxnDetail = nil
Expand Down Expand Up @@ -142,7 +143,8 @@ def update
#errorMsg = l(:label_transaction) + " " + l('activerecord.errors.messages.invalid')
end
if errorMsg.blank?
redirect_to :controller => 'wkgltransaction',:action => 'index' , :tab => 'wkgltransaction'
action_name = params[:gltransaction_save_continue].blank? ? "index" : "edit"
redirect_to :controller => 'wkgltransaction', :action => action_name, :tab => 'wkgltransaction'
$temptxnDetail = nil
$tempTransaction = nil
flash[:notice] = l(:notice_successful_update)
Expand Down Expand Up @@ -352,5 +354,12 @@ def setLimitAndOffset
@offset = @entry_pages.offset
end
end

def set_transaction_session
session[:wkgltransaction][:start_date] = params[:date]
session[:wkgltransaction][:txn_type] = params[:txn_type]
session[:wkgltransaction][:ledger_id1] = params[:txn_particular1]
session[:wkgltransaction][:ledger_id2] = params[:txn_particular2]
end

end
9 changes: 9 additions & 0 deletions app/controllers/wkgrouppermission_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class WkgrouppermissionController < ApplicationController
unloadable
include WktimeHelper
before_action :check_permission_tab_and_redirect, :only => [:index, :edit, :update]

def index
@groups = nil
Expand Down Expand Up @@ -60,5 +62,12 @@ def update
redirect_to :controller => 'wkgrouppermission',:action => 'index' , :tab => 'wkgrouppermission', :group_id => params[:group_id].to_i
flash[:notice] = l(:notice_successful_update)
end

def check_permission_tab_and_redirect
unless (User.current.id == 1) || validateERPPermission("ADM_ERP")
render_403
return false
end
end

end
1 change: 1 addition & 0 deletions app/controllers/wklocation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def update
locationObj.name = params[:location_name]
locationObj.location_type_id = params[:location_type]
locationObj.is_default = params[:defaultValue]
locationObj.is_main = params[:defaultMain]
unless locationObj.valid?
errorMsg = errorMsg.blank? ? locationObj.errors.full_messages.join("<br>") : locationObj.errors.full_messages.join("<br>") + "<br/>" + errorMsg
end
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/wkorderentity_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class WkorderentityController < WkbillingController
include WkinvoiceHelper
include WkbillingHelper
include WkorderentityHelper
include WkreportHelper

def index
@projects = nil
Expand Down Expand Up @@ -445,7 +446,7 @@ def getOrderComponetsId
end

def getSupplierAddress(invoice)
Setting.plugin_redmine_wktime['wktime_company_name'] + "\n" + Setting.plugin_redmine_wktime['wktime_company_address']
getMainLocation + "\n" + getAddress
end

def getCustomerAddress(invoice)
Expand Down
Loading

0 comments on commit 14dc647

Please sign in to comment.