diff --git a/README.rdoc b/README.rdoc
index f092fe45..3923debd 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -110,12 +110,9 @@ For more information on features, please refer to the user guide
rake redmine:plugins:migrate NAME=redmine_wktime VERSION=0 RAILS_ENV=production
-=== Release Notes for v4.7.5
+=== Release Notes for v4.8
-* *Bug* *fixes*
- - Fixed month wise date sorting issue in Accounting module
- - Fixed monthly closing balance total issue in Accounting module
- - Fixed unable to save amount of less then 1 in Accounting module
+ - Redmine 6.0 compatibility.
=== Customization
diff --git a/app/controllers/wkaccounting_controller.rb b/app/controllers/wkaccounting_controller.rb
index db4506e4..14f1a474 100644
--- a/app/controllers/wkaccounting_controller.rb
+++ b/app/controllers/wkaccounting_controller.rb
@@ -15,24 +15,24 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-class WkaccountingController < WkbaseController
- unloadable
+class WkaccountingController < WkbaseController
+
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update]
before_action :check_ac_admin_and_redirect, :only => [:destroy]
include WkaccountingHelper
def index
end
-
+
def check_perm_and_redirect
unless check_permission
render_403
return false
end
end
-
+
def check_ac_admin_and_redirect
- unless validateERPPermission("A_ACC_PRVLG")
+ unless validateERPPermission("A_ACC_PRVLG")
render_403
return false
end
@@ -40,6 +40,6 @@ def check_ac_admin_and_redirect
def check_permission
ret = false
- return validateERPPermission("B_ACC_PRVLG") || validateERPPermission("A_ACC_PRVLG")
+ return validateERPPermission("B_ACC_PRVLG") || validateERPPermission("A_ACC_PRVLG")
end
end
diff --git a/app/controllers/wkasset_controller.rb b/app/controllers/wkasset_controller.rb
index 1e192ab3..da4feb32 100644
--- a/app/controllers/wkasset_controller.rb
+++ b/app/controllers/wkasset_controller.rb
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkassetController < WkproductitemController
- unloadable
+
menu_item :wkproduct
include WktimeHelper
include WkassetdepreciationHelper
diff --git a/app/controllers/wkassetdepreciation_controller.rb b/app/controllers/wkassetdepreciation_controller.rb
index b76f6f50..a09146e6 100644
--- a/app/controllers/wkassetdepreciation_controller.rb
+++ b/app/controllers/wkassetdepreciation_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkassetdepreciationController < WkassetController
- unloadable
+
menu_item :wkproduct
include WktimeHelper
include WkinventoryHelper
diff --git a/app/controllers/wkattendance_controller.rb b/app/controllers/wkattendance_controller.rb
index 3f72b0ee..c6ade5c7 100644
--- a/app/controllers/wkattendance_controller.rb
+++ b/app/controllers/wkattendance_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkattendanceController < WkbaseController
- unloadable
+
menu_item :wkattendance
include WktimeHelper
diff --git a/app/controllers/wkattributegroup_controller.rb b/app/controllers/wkattributegroup_controller.rb
index 7c87e386..3761621f 100644
--- a/app/controllers/wkattributegroup_controller.rb
+++ b/app/controllers/wkattributegroup_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkattributegroupController < WkinventoryController
- unloadable
+
menu_item :wkproduct
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy, :edit_product_attribute, :updateProductAttribute]
@@ -42,7 +42,7 @@ def index
end
entries = entries.reorder(sort_clause)
respond_to do |format|
- format.html {
+ format.html {
@groupEntries = formPagination(entries)
}
format.csv{
@@ -52,23 +52,23 @@ def index
}
end
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
pageEntries = entries.limit(@limit).offset(@offset)
pageEntries
end
-
+
def edit
@groupEntry = nil
unless params[:group_id].blank?
@groupEntry = WkAttributeGroup.find(params[:group_id])
@groupAttrEntries = formPagination(@groupEntry.product_attributes)
- end
- end
-
- def update
+ end
+ end
+
+ def update
if params[:group_id].blank?
attrGroup = WkAttributeGroup.new
else
@@ -84,7 +84,7 @@ def update
flash[:error] = attrGroup.errors.full_messages.join("
")
end
end
-
+
def destroy
attrGroup = WkAttributeGroup.find(params[:group_id].to_i)
if attrGroup.destroy
@@ -94,15 +94,15 @@ def destroy
end
redirect_back_or_default :action => 'index', :tab => params[:tab]
end
-
+
def edit_product_attribute
@attributeEntry = nil
@groupEntry = WkAttributeGroup.find(params[:group_id].to_i)
unless params[:product_attribute_id].blank?
@attributeEntry = WkProductAttribute.find(params[:product_attribute_id])
- end
+ end
end
-
+
def updateProductAttribute
if params[:product_attribute_id].blank?
productAttr = WkProductAttribute.new
@@ -120,7 +120,7 @@ def updateProductAttribute
flash[:error] = product.errors.full_messages.join("
")
end
end
-
+
def destroyProductAttribute
productAttr = WkProductAttribute.find(params[:product_attribute_id].to_i)
groupId = productAttr.group_id
@@ -131,8 +131,8 @@ def destroyProductAttribute
end
redirect_back_or_default :action => 'edit' , :tab => 'wkattributegroup', :group_id => groupId
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -145,7 +145,7 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
def set_filter_session
diff --git a/app/controllers/wkbase_controller.rb b/app/controllers/wkbase_controller.rb
index ad169f96..c0fdab62 100644
--- a/app/controllers/wkbase_controller.rb
+++ b/app/controllers/wkbase_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkbaseController < ApplicationController
- unloadable
+
before_action :require_login
before_action :clear_sort_session, :unseen
before_action :check_update_user_permissions, :only => [:updateWkuserData, :getWkuserData, :updateWkuserVal]
diff --git a/app/controllers/wkbrand_controller.rb b/app/controllers/wkbrand_controller.rb
index 2586e465..01e6d7c7 100644
--- a/app/controllers/wkbrand_controller.rb
+++ b/app/controllers/wkbrand_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkbrandController < WkinventoryController
- unloadable
+
menu_item :wkproduct
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy, :edit_product_model, :updateProductModel]
diff --git a/app/controllers/wkcontact_controller.rb b/app/controllers/wkcontact_controller.rb
index 772247bd..94d6d388 100644
--- a/app/controllers/wkcontact_controller.rb
+++ b/app/controllers/wkcontact_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkcontactController < WkcrmController
- unloadable
+
include WkaccountprojectHelper
include WksalesquoteHelper
diff --git a/app/controllers/wkcrm_controller.rb b/app/controllers/wkcrm_controller.rb
index 3ddf4b69..d452b662 100644
--- a/app/controllers/wkcrm_controller.rb
+++ b/app/controllers/wkcrm_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkcrmController < WkbaseController
- unloadable
+
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update]
before_action :check_crm_admin_and_redirect, :only => [:destroy]
diff --git a/app/controllers/wkcrmaccount_controller.rb b/app/controllers/wkcrmaccount_controller.rb
index 0baf790f..2965a0d1 100644
--- a/app/controllers/wkcrmaccount_controller.rb
+++ b/app/controllers/wkcrmaccount_controller.rb
@@ -1,9 +1,9 @@
class WkcrmaccountController < WkaccountController
- unloadable
+
menu_item :wklead
accept_api_auth :index, :edit, :update
def getAccountType
'A'
- end
+ end
end
diff --git a/app/controllers/wkcrmactivity_controller.rb b/app/controllers/wkcrmactivity_controller.rb
index b885ba73..c7109ad9 100644
--- a/app/controllers/wkcrmactivity_controller.rb
+++ b/app/controllers/wkcrmactivity_controller.rb
@@ -17,7 +17,7 @@
class WkcrmactivityController < WkcrmController
- unloadable
+
menu_item :wklead
include WktimeHelper
include WkdocumentHelper
diff --git a/app/controllers/wkcrmcontact_controller.rb b/app/controllers/wkcrmcontact_controller.rb
index 627597a6..866a2b48 100644
--- a/app/controllers/wkcrmcontact_controller.rb
+++ b/app/controllers/wkcrmcontact_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkcrmcontactController < WkcontactController
- unloadable
+
menu_item :wklead
accept_api_auth :index, :edit, :update
diff --git a/app/controllers/wkcrmenumeration_controller.rb b/app/controllers/wkcrmenumeration_controller.rb
index 3814eb7a..8b334393 100644
--- a/app/controllers/wkcrmenumeration_controller.rb
+++ b/app/controllers/wkcrmenumeration_controller.rb
@@ -16,11 +16,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkcrmenumerationController < WkbaseController
- unloadable
+
include WktimeHelper
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy]
-
+
accept_api_auth :getCrmEnumerations
include WkcrmenumerationHelper
@@ -36,14 +36,14 @@ def index
entries = nil
if !enumName.blank? && !enumerationType.blank?
entries = WkCrmEnumeration.where(:enum_type => enumerationType).where("LOWER(name) like LOWER(?)", "%#{enumName}%")
- elsif enumName.blank? && !enumerationType.blank?
+ elsif enumName.blank? && !enumerationType.blank?
entries = WkCrmEnumeration.where(:enum_type => enumerationType)
elsif !enumName.blank? && enumerationType.blank?
entries = WkCrmEnumeration.where("LOWER(name) like LOWER(?)", "%#{enumName}%")
else
entries = WkCrmEnumeration.all
end
- entries = entries.reorder(sort_clause)
+ entries = entries.reorder(sort_clause)
respond_to do |format|
format.html {
formPagination(entries)
@@ -55,16 +55,16 @@ def index
}
end
end
-
+
def edit
@enumEntry = nil
unless params[:enum_id].blank?
@enumEntry = WkCrmEnumeration.find(params[:enum_id].to_i)
end
end
-
+
def update
- wkcrmenumeration = nil
+ wkcrmenumeration = nil
unless params[:enum_id].blank?
wkcrmenumeration = WkCrmEnumeration.find(params[:enum_id].to_i)
else
@@ -75,7 +75,7 @@ def update
wkcrmenumeration.active = params[:enumActive]
wkcrmenumeration.enum_type = params[:enumType]
wkcrmenumeration.is_default = params[:enumDefaultValue]
- if wkcrmenumeration.valid?
+ if wkcrmenumeration.valid?
wkcrmenumeration.save
redirect_to :controller => 'wkcrmenumeration',:action => 'index' , :tab => 'wkcrmenumeration'
flash[:notice] = l(:notice_successful_update)
@@ -84,19 +84,19 @@ def update
redirect_to :controller => 'wkcrmenumeration',:action => 'edit'
end
end
-
+
def set_filter_session
filters = [:enumname, :enumType]
super(filters)
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@crmenum = entries.limit(@limit).offset(@offset)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -109,16 +109,16 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
-
+
def destroy
WkCrmEnumeration.find(params[:enum_id].to_i).destroy
-
+
flash[:notice] = l(:notice_successful_delete)
redirect_back_or_default :action => 'index', :tab => params[:tab]
end
-
+
def check_perm_and_redirect
unless User.current.admin? || hasSettingPerm
render_403
diff --git a/app/controllers/wkdelivery_controller.rb b/app/controllers/wkdelivery_controller.rb
index 3764c303..d45acd8d 100644
--- a/app/controllers/wkdelivery_controller.rb
+++ b/app/controllers/wkdelivery_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkdeliveryController < WkinventoryController
- unloadable
+
menu_item :wkproduct
before_action :require_login
@@ -46,23 +46,23 @@ def index
elsif filter_type == '2' && contact_id.blank?
parentType = 'WkCrmContact'
end
-
+
if filter_type == '3' && !account_id.blank?
parentType = 'WkAccount'
parentId = account_id
elsif filter_type == '3' && account_id.blank?
parentType = 'WkAccount'
end
-
- unless parentId.blank?
+
+ unless parentId.blank?
sqlwhere = sqlwhere + " and wk_shipments.parent_id = '#{parentId}' "
end
-
+
unless parentType.blank?
sqlwhere = sqlwhere + " and wk_shipments.parent_type = '#{parentType}' "
end
-
- if !@from.blank? && !@to.blank?
+
+ if !@from.blank? && !@to.blank?
sqlwhere = sqlwhere + " and wk_shipments.shipment_date between '#{@from}' and '#{@to}' "
end
@@ -167,7 +167,7 @@ def update
deliveryItem.org_selling_price = params["selling_price_#{i}"]
end
deliveryItem.currency = sysCurrency
- deliveryItem.selling_price = getExchangedAmount(params["currency_#{i}"], params["selling_price_#{i}"])
+ deliveryItem.selling_price = getExchangedAmount(params["currency_#{i}"], params["selling_price_#{i}"])
deliveryItem.serial_number = params["serial_number_#{i}"]
deliveryItem.running_sn = params["running_sn_#{i}"]
deliveryItem.notes = params["notes_#{i}"]
@@ -184,8 +184,8 @@ def update
end
end
i = i + 1
- end
- if errorMsg.blank?
+ end
+ if errorMsg.blank?
redirect_to action: 'index', controller: controller_name, tab: controller_name
flash[:notice] = l(:notice_successful_update)
else
@@ -208,14 +208,14 @@ def set_filter_session
filters = [:period_type, :period, :contact_id, :account_id, :project_id, :polymorphic_filter, :from, :to, :delivery_status]
super(filters, {from: @from, to: @to})
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@deliveryEntries = entries.limit(@limit).offset(@offset)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -228,13 +228,13 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
-
+
def additionalContactType
false
end
-
+
def additionalAccountType
false
end
@@ -250,7 +250,7 @@ def getOrderContactType
def getAccountDDLbl
l(:field_account)
end
-
+
def getShipmentType
'O'
end
@@ -262,11 +262,11 @@ def showProjectDD
def getAdditionalDD
"wkdelivery/deliveryadditionaldd"
end
-
+
def textfield_size
6
end
-
+
def populateProductItemDD
itemArr = ""
if params[:update_DD] =='inventory_item'
@@ -304,5 +304,5 @@ def getInvoiceNos
respond_to do |format|
format.text { render :plain => invoiceArr }
end
- end
+ end
end
diff --git a/app/controllers/wkdocument_controller.rb b/app/controllers/wkdocument_controller.rb
index fae742f2..96852526 100644
--- a/app/controllers/wkdocument_controller.rb
+++ b/app/controllers/wkdocument_controller.rb
@@ -16,11 +16,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkdocumentController < WkbaseController
- unloadable
+
before_action :find_attachment, :only => [:destroy, :download]
include WkdocumentHelper
helper :attachments
-
+
def new
end
@@ -70,7 +70,7 @@ def detect_content_type(attachment)
end
content_type.to_s
end
-
+
def disposition(attachment)
if attachment.is_pdf?
'inline'
diff --git a/app/controllers/wkexchangerate_controller.rb b/app/controllers/wkexchangerate_controller.rb
index a3ce682a..c87fa832 100644
--- a/app/controllers/wkexchangerate_controller.rb
+++ b/app/controllers/wkexchangerate_controller.rb
@@ -1,9 +1,9 @@
class WkexchangerateController < WkbillingController
- unloadable
+
menu_item :wkcrmenumeration
def index
- entries = WkExCurrencyRate.all
+ entries = WkExCurrencyRate.all
formPagination(entries)
end
@@ -19,24 +19,24 @@ def update
curExchanges.from_c = params[:from_currency][i]
curExchanges.to_c = params[:to_currency][i]
curExchanges.ex_rate = params[:rate][i]
- curExchanges.save()
+ curExchanges.save()
end
-
- if !arrId.blank?
+
+ if !arrId.blank?
WkExCurrencyRate.where(:id => arrId).delete_all
end
-
+
redirect_to :controller => 'wkexchangerate',:action => 'index' , :tab => 'wkexchangerate'
flash[:notice] = l(:notice_successful_update)
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@curentry = entries.limit(@limit).offset(@offset)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -49,7 +49,7 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
end
diff --git a/app/controllers/wkexpense_controller.rb b/app/controllers/wkexpense_controller.rb
index 046a5ebd..ceba1b11 100644
--- a/app/controllers/wkexpense_controller.rb
+++ b/app/controllers/wkexpense_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkexpenseController < WktimeController
- unloadable
+
menu_item :wktime
before_action :find_optional_project, :only => [:reportdetail, :report]
diff --git a/app/controllers/wkgltransaction_controller.rb b/app/controllers/wkgltransaction_controller.rb
index c86b050e..404359cf 100644
--- a/app/controllers/wkgltransaction_controller.rb
+++ b/app/controllers/wkgltransaction_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkgltransactionController < WkaccountingController
- unloadable
+
include WkgltransactionHelper
accept_api_auth :index, :edit, :update
@@ -105,14 +105,14 @@ def index
@summaryHash[key][:ledger_id] = entry.ledger_id
end
end
-
+
dup_summary = sort_direction == "desc" ? @summaryHash.to_a.reverse.to_h : @summaryHash
dup_summary.each do |key, value|
getSummeryamount(key, value)
@summaryHash[key][:CB] = @closeBal
end
@summaryHashFirstKey = dup_summary.keys.first
-
+
else
formPagination(transaction.reorder(sort_clause))
isSubCr = isSubtractCr(@selectedLedger.ledger_type)
@@ -130,7 +130,7 @@ def index
end
transaction
end
-
+
def edit
@transEntry = nil
@transDetails = nil
diff --git a/app/controllers/wkgrouppermission_controller.rb b/app/controllers/wkgrouppermission_controller.rb
index d4d53730..08f81098 100644
--- a/app/controllers/wkgrouppermission_controller.rb
+++ b/app/controllers/wkgrouppermission_controller.rb
@@ -1,5 +1,5 @@
class WkgrouppermissionController < ApplicationController
- unloadable
+
menu_item :wkcrmenumeration
include WktimeHelper
before_action :check_permission_tab_and_redirect, :only => [:index, :edit, :update]
diff --git a/app/controllers/wkimportattendance_controller.rb b/app/controllers/wkimportattendance_controller.rb
index bf362617..33a52aab 100644
--- a/app/controllers/wkimportattendance_controller.rb
+++ b/app/controllers/wkimportattendance_controller.rb
@@ -15,22 +15,22 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-class WkimportattendanceController < WkattendanceController
-unloadable
+class WkimportattendanceController < WkattendanceController
+
include WkimportattendanceHelper
before_action :require_login
before_action :check_ta_admin_and_redirect, :only => [:new]
require 'csv'
-
+
def new
end
-
+
def show
file = params[:file]
unless file.blank?
- filePath = file.path
+ filePath = file.path
begin
isSuccess = importAttendance(filePath, false)
rescue Exception => e
@@ -42,12 +42,12 @@ def show
redirect_to :action => 'new'
end
end
-
+
def check_ta_admin_and_redirect
unless validateERPPermission('A_TE_PRVLG')
render_403
return false
end
end
-
+
end
diff --git a/app/controllers/wkinventory_controller.rb b/app/controllers/wkinventory_controller.rb
index 98457b0b..d2faac63 100644
--- a/app/controllers/wkinventory_controller.rb
+++ b/app/controllers/wkinventory_controller.rb
@@ -1,5 +1,5 @@
class WkinventoryController < WkbaseController
- unloadable
+
before_action :require_login
diff --git a/app/controllers/wkinvoice_controller.rb b/app/controllers/wkinvoice_controller.rb
index c90360e8..c5b2fe94 100644
--- a/app/controllers/wkinvoice_controller.rb
+++ b/app/controllers/wkinvoice_controller.rb
@@ -319,7 +319,7 @@ def getQuantityDetails
spent = entry.spent
items = {project_name: spent.project.name, issue: spent&.issue&.subject.to_s, user: spent.user&.name, date: spent.spent_on}
if params[:itemType] == 'i'
- items[:hour] = spent.try(:hours)
+ items[:hour] = format_hours(spent.try(:hours) || "")
elsif params[:itemType] == 'e'
items[:field_amount] = spent.try(:currency)+spent.try(:amount).to_s
end
@@ -339,7 +339,7 @@ def getUnbilledQtyDetails
unbilledEntries.map do |entry|
items = {project_name: entry.project.name, issue: entry.issue.to_s, user: entry.user.name, date: entry.spent_on}
if params[:itemType] == 'i'
- items[:hour] = entry.try(:hours)
+ items[:hour] = format_hours(entry.try(:hours) || "")
elsif params[:itemType] == 'e'
items[:amount] = entry.try(:currency)+entry.try(:amount).to_s
end
@@ -365,8 +365,7 @@ def generateTimeEntries
lastArray = invIntervals.length - 1
todate = invIntervals[lastArray][1]
timeEntries = WkInvoiceItem.getGenerateEntries(todate.to_date, fromDate.to_date, parent_id, parent_type, params[:projectID], TimeEntry, "time_entries")
-
- data1 = timeEntries.map{|e| {id: e.id, acc_name: (e&.name || e&.c_name), proj_name: e&.project&.name, subject: e.issue.to_s, usr_name: e&.user&.name, activity: e&.activity.to_s, spent_on: e.spent_on, hours: e.hours}}
+ data1 = timeEntries.map{|e| {id: e.id, acc_name: (e&.name || e&.c_name), proj_name: e&.project&.name, subject: e.issue.to_s, usr_name: e&.user&.name, activity: e&.activity.to_s, spent_on: e.spent_on, hours: format_hours(e.hours)}}
listHeader1 = { acc_cont_name: l(:field_account), project_name: l(:label_project), issue: l(:label_invoice_name), user: l(:label_user), activity: l(:label_activity_type), date: l(:label_date), hour: l(:field_hours) }
materialEntries = WkInvoiceItem.getGenerateEntries(todate.to_date, fromDate.to_date, parent_id, parent_type, params[:projectID], WkMaterialEntry, "wk_material_entries")
diff --git a/app/controllers/wklead_controller.rb b/app/controllers/wklead_controller.rb
index 3c272d8c..21f4e9c1 100644
--- a/app/controllers/wklead_controller.rb
+++ b/app/controllers/wklead_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkleadController < WkcrmController
- unloadable
+
include WktimeHelper
include WkleadHelper
include WkaccountprojectHelper
diff --git a/app/controllers/wkledger_controller.rb b/app/controllers/wkledger_controller.rb
index c3fdab9a..c1602c9e 100644
--- a/app/controllers/wkledger_controller.rb
+++ b/app/controllers/wkledger_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkledgerController < WkaccountingController
- unloadable
+
menu_item :wkgltransaction
before_action :check_ac_admin_and_redirect, :only => [:update, :destroy]
before_action :check_perm_and_redirect, :only => [:index, :edit]
@@ -57,11 +57,11 @@ def index
end
end
end
-
+
def edit
@ledgersDetail = WkLedger.where(:id => params[:ledger_id].to_i)
end
-
+
def update
wkledger = nil
errorMsg = nil
@@ -72,7 +72,7 @@ def update
end
wkledger.name = params[:name]
wkledger.ledger_type = params[:ledger_type] unless params[:ledger_type].blank?
- wkledger.currency = Setting.plugin_redmine_wktime['wktime_currency']
+ wkledger.currency = Setting.plugin_redmine_wktime['wktime_currency']
wkledger.opening_balance = params[:opening_balance].blank? ? 0 : params[:opening_balance]
wkledger.owner = wkledger.ledger_type =='SY' ? 's' : 'u'
unless wkledger.save()
@@ -82,11 +82,11 @@ def update
redirect_to :controller => 'wkledger',:action => 'index' , :tab => 'wkledger'
flash[:notice] = l(:notice_successful_update)
else
- flash[:error] = errorMsg
+ flash[:error] = errorMsg
redirect_to :controller => 'wkledger',:action => 'edit'
end
end
-
+
def destroy
ledger = WkLedger.find(params[:ledger_id].to_i)
if ledger.ledger_type == 'SY'
@@ -98,19 +98,19 @@ def destroy
end
redirect_back_or_default :action => 'index', :tab => params[:tab]
end
-
+
def set_filter_session
filters = [:ledger_type, :name]
super(filters)
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@ledgers = entries.order(:id).limit(@limit).offset(@offset)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -123,7 +123,7 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
end
diff --git a/app/controllers/wklocation_controller.rb b/app/controllers/wklocation_controller.rb
index 5da88500..527e5dc3 100644
--- a/app/controllers/wklocation_controller.rb
+++ b/app/controllers/wklocation_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WklocationController < WkbaseController
- unloadable
+
menu_item :wkcrmenumeration
include WktimeHelper
include WkdocumentHelper
@@ -60,14 +60,14 @@ def index
}
end
end
-
+
def edit
@locEntry = nil
unless params[:location_id].blank?
@locEntry = WkLocation.find(params[:location_id])
end
end
-
+
def update
errorMsg = nil
if params[:location_id].blank? || params[:location_id].to_i == 0
@@ -94,11 +94,11 @@ def update
redirect_to :controller => controller_name,:action => 'index' , :tab => controller_name
flash[:notice] = l(:notice_successful_update)
else
- flash[:error] = errorMsg
+ flash[:error] = errorMsg
redirect_to :controller => controller_name,:action => 'edit', :location_id => locationObj.id
end
end
-
+
def destroy
location = WkLocation.find(params[:location_id].to_i)
if location.destroy
@@ -113,21 +113,21 @@ def set_filter_session
filters = [:location_name, :location_type, :show_on_map]
super(filters)
end
-
+
def check_perm_and_redirect
unless User.current.admin? || hasSettingPerm
render_403
return false
end
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@locationObj = entries.limit(@limit).offset(@offset)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -140,7 +140,7 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
def getlocations
diff --git a/app/controllers/wklogmaterial_controller.rb b/app/controllers/wklogmaterial_controller.rb
index e8d6967a..a20a8d72 100644
--- a/app/controllers/wklogmaterial_controller.rb
+++ b/app/controllers/wklogmaterial_controller.rb
@@ -1,5 +1,5 @@
class WklogmaterialController < TimelogController
- unloadable
+
prepend_before_action :change_params_controller
before_action :require_login
accept_api_auth :loadSpentType, :index, :spent_log, :modifyProductDD, :create, :update
diff --git a/app/controllers/wkopportunity_controller.rb b/app/controllers/wkopportunity_controller.rb
index 5ad35420..861c2b34 100644
--- a/app/controllers/wkopportunity_controller.rb
+++ b/app/controllers/wkopportunity_controller.rb
@@ -1,5 +1,5 @@
class WkopportunityController < WkcrmController
- unloadable
+
menu_item :wklead
include WktimeHelper
include WkopportunityHelper
diff --git a/app/controllers/wkorderentity_controller.rb b/app/controllers/wkorderentity_controller.rb
index da8caa1a..3fb2a308 100644
--- a/app/controllers/wkorderentity_controller.rb
+++ b/app/controllers/wkorderentity_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkorderentityController < WkbillingController
- unloadable
+
include WktimeHelper
include WkinvoiceHelper
include WkbillingHelper
diff --git a/app/controllers/wkpayment_controller.rb b/app/controllers/wkpayment_controller.rb
index 24f438ef..c68cd435 100644
--- a/app/controllers/wkpayment_controller.rb
+++ b/app/controllers/wkpayment_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkpaymentController < WkpaymententityController
- unloadable
+
menu_item :wkinvoice
accept_api_auth :index, :edit, :update
diff --git a/app/controllers/wkpaymententity_controller.rb b/app/controllers/wkpaymententity_controller.rb
index e0a591cb..2e8e765d 100644
--- a/app/controllers/wkpaymententity_controller.rb
+++ b/app/controllers/wkpaymententity_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkpaymententityController < WkbillingController
- unloadable
+
include WkpaymentHelper
include WkbillingHelper
include WktimeHelper
diff --git a/app/controllers/wkproduct_controller.rb b/app/controllers/wkproduct_controller.rb
index 59143600..9e45691c 100644
--- a/app/controllers/wkproduct_controller.rb
+++ b/app/controllers/wkproduct_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkproductController < WkinventoryController
- unloadable
+
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy, :category, :updateCategory]
@@ -56,22 +56,22 @@ def index
}
end
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@productEntries = entries.limit(@limit).offset(@offset)
end
-
+
def edit
@productEntry = nil
unless params[:product_id].blank?
@productEntry = WkProduct.find(params[:product_id])
@applicableTaxes = @productEntry.taxes.map { |r| r.id }
- end
- end
-
- def update
+ end
+ end
+
+ def update
if params[:product_id].blank?
product = WkProduct.new
else
@@ -87,10 +87,10 @@ def update
product.ledger_id = params[:ledger_id]
if product.save()
unless product.id.blank?
- taxId = params[:tax_id]
+ taxId = params[:tax_id]
WkProductTax.where(:product_id => product.id).where.not(:tax_id => taxId).delete_all()
unless taxId.blank?
- taxId.collect{ |id|
+ taxId.collect{ |id|
istaxid = WkProductTax.where("product_id = ? and tax_id = ? ", product.id, id).count
unless istaxid > 0
productTax = WkProductTax.new
@@ -99,7 +99,7 @@ def update
if !productTax.save()
errorMsg = productTax.errors.full_messages.join("
")
end
- end
+ end
}
end
end
@@ -110,7 +110,7 @@ def update
flash[:error] = product.errors.full_messages.join("
")
end
end
-
+
def destroy
product = WkProduct.find(params[:product_id].to_i)
if product.destroy
@@ -122,7 +122,7 @@ def destroy
end
def category
- entries = WkProductCategory.all
+ entries = WkProductCategory.all
formPagination(entries)
end
@@ -137,23 +137,23 @@ def updateCategory
end
category.name = params[:name][i]
category.description = params[:description][i]
- category.save()
+ category.save()
end
-
- if !arrId.blank?
+
+ if !arrId.blank?
WkProductCategory.where(:id => arrId).destroy_all
end
-
+
redirect_to :controller => 'wkproduct',:action => 'category' , :tab => 'wkproduct'
flash[:notice] = l(:notice_successful_update)
- end
+ end
def set_filter_session
filters = [:category_id, :name]
super(filters)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -166,6 +166,6 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
end
\ No newline at end of file
diff --git a/app/controllers/wkproductattribute_controller.rb b/app/controllers/wkproductattribute_controller.rb
index 62ccfbf1..7f97b29d 100644
--- a/app/controllers/wkproductattribute_controller.rb
+++ b/app/controllers/wkproductattribute_controller.rb
@@ -1,5 +1,5 @@
class WkproductattributeController < WkinventoryController
- unloadable
+
before_action :require_login
def index
diff --git a/app/controllers/wkproductcatagory_controller.rb b/app/controllers/wkproductcatagory_controller.rb
index a16359ce..c4fd378c 100644
--- a/app/controllers/wkproductcatagory_controller.rb
+++ b/app/controllers/wkproductcatagory_controller.rb
@@ -1,5 +1,5 @@
class WkproductcatagoryController < WkinventoryController
- unloadable
+
before_action :require_login
diff --git a/app/controllers/wkproductitem_controller.rb b/app/controllers/wkproductitem_controller.rb
index 247749dd..bc28e7cd 100644
--- a/app/controllers/wkproductitem_controller.rb
+++ b/app/controllers/wkproductitem_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkproductitemController < WkinventoryController
- unloadable
+
menu_item :wkproduct
before_action :require_login
before_action :check_perm_and_redirect, :only => [:index, :edit, :update, :destroy, :transfer, :updateTransfer]
diff --git a/app/controllers/wkproductmodel_controller.rb b/app/controllers/wkproductmodel_controller.rb
index f29c6d1c..e64e3e62 100644
--- a/app/controllers/wkproductmodel_controller.rb
+++ b/app/controllers/wkproductmodel_controller.rb
@@ -1,7 +1,7 @@
class WkproductmodelController < WkinventoryController
- unloadable
+
before_action :require_login
-
+
def index
end
diff --git a/app/controllers/wkpublicholiday_controller.rb b/app/controllers/wkpublicholiday_controller.rb
index bb5bee43..94af90f8 100644
--- a/app/controllers/wkpublicholiday_controller.rb
+++ b/app/controllers/wkpublicholiday_controller.rb
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkpublicholidayController < WkbaseController
- unloadable
+
menu_item :wkattendance
def index
diff --git a/app/controllers/wkpurchaseorder_controller.rb b/app/controllers/wkpurchaseorder_controller.rb
index db45ca01..bb94da3b 100644
--- a/app/controllers/wkpurchaseorder_controller.rb
+++ b/app/controllers/wkpurchaseorder_controller.rb
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkpurchaseorderController < WksupplierorderentityController
- unloadable
+
menu_item :wkrfq
@@pomutex = Mutex.new
diff --git a/app/controllers/wkquote_controller.rb b/app/controllers/wkquote_controller.rb
index 6929280d..3fe3c6d2 100644
--- a/app/controllers/wkquote_controller.rb
+++ b/app/controllers/wkquote_controller.rb
@@ -16,18 +16,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkquoteController < WksupplierorderentityController
- unloadable
+
menu_item :wkrfq
-
+
@@quotemutex = Mutex.new
-
+
def editOrderEntity
super
if params[:invoice_id].present?
@rfgQuoteEntry = WkRfqQuote.find(@invoice.rfq_quote&.id) if @invoice&.rfq_quote.present?
end
end
-
+
def newSupOrderEntity(parentId, parentType)
msg = ""
unless params[:rfq_id].blank?
@@ -37,69 +37,69 @@ def newSupOrderEntity(parentId, parentType)
redirect_to :action => 'new'
end
end
-
- # Synchronize the quote insert because maintain the sequence of invoice num key
+
+ # Synchronize the quote insert because maintain the sequence of invoice num key
def saveOrderInvoice(parentId, parentType, projectId, invDate, invoicePeriod, isgenerate, getInvoiceType)
- begin
- @@quotemutex.synchronize do
- addInvoice(parentId, parentType, projectId, invDate, invoicePeriod, isgenerate, getInvoiceType)
- end
+ begin
+ @@quotemutex.synchronize do
+ addInvoice(parentId, parentType, projectId, invDate, invoicePeriod, isgenerate, getInvoiceType)
+ end
rescue => ex
logger.error ex.message
end
- end
-
+ end
+
def saveOrderRelations
isWon = params[:quote_won].blank? ? nil : params[:quote_won]
winNote = params[:winning_note].blank? ? "" : params[:winning_note]
saveRfqQuotes(params[:rfq_quote_id], params[:rfq_id].to_i, @invoice.id, isWon, winNote)
end
-
+
def getInvoiceType
'Q'
end
-
+
def getLabelInvNum
l(:label_quote_number)
end
-
+
def getLabelNewInv
l(:label_new_quote)
end
-
+
def getHeaderLabel
l(:label_quotes)
end
-
+
def getItemLabel
l(:label_quote_items)
end
-
+
def getDateLbl
l(:label_quote_date)
end
-
+
def addQuoteFields
true
end
-
+
def getAdditionalDD
"wkquote/quoteadditionaldd"
end
-
+
def editInvNumber
true
end
-
+
def getOrderNumberPrefix
'wktime_quote_no_prefix'
end
-
+
def getNewHeaderLbl
l(:label_new_quote)
end
-
+
def getOrderContract(invoice)
contractStr = nil
rfq = invoice.rfq_quote.rfq
@@ -108,7 +108,7 @@ def getOrderContract(invoice)
end
contractStr
end
-
+
def getOrderComponetsId
'wktime_quote_components'
end
diff --git a/app/controllers/wkreferrals_controller.rb b/app/controllers/wkreferrals_controller.rb
index 9b84c1bd..3f1cb1ca 100644
--- a/app/controllers/wkreferrals_controller.rb
+++ b/app/controllers/wkreferrals_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkreferralsController < WkleadController
- unloadable
+
before_action :require_login, :check_module_permission
before_action :check_perm_and_redirect, only: [:update, :destroy]
before_action :check_permission, only: :getEmpDetails
diff --git a/app/controllers/wkreport_controller.rb b/app/controllers/wkreport_controller.rb
index ad80b105..d382bdc5 100644
--- a/app/controllers/wkreport_controller.rb
+++ b/app/controllers/wkreport_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkreportController < WkbaseController
-unloadable
+
include WktimeHelper
include WkreportHelper
diff --git a/app/controllers/wkrfq_controller.rb b/app/controllers/wkrfq_controller.rb
index b709f954..9d90391b 100644
--- a/app/controllers/wkrfq_controller.rb
+++ b/app/controllers/wkrfq_controller.rb
@@ -1,5 +1,5 @@
class WkrfqController < WkbaseController
- unloadable
+
include WktimeHelper
include WkorderentityHelper
include WkrfqHelper
@@ -43,7 +43,7 @@ def index
}
end
end
-
+
def formPagination(entries, sectiontype)
@entry_count = entries.count
setLimitAndOffset()
@@ -53,16 +53,16 @@ def formPagination(entries, sectiontype)
@invoiceEntries = entries.order(:id).limit(@limit).offset(@offset)
end
end
-
+
def edit
@rfqEntry = nil
unless params[:rfq_id].blank?
@rfqEntry = WkRfq.find(params[:rfq_id])
quoteList()
end
- end
-
- def update
+ end
+
+ def update
if params[:rfq_id].blank?
rfq = WkRfq.new
else
@@ -81,7 +81,7 @@ def update
flash[:error] = rfq.errors.full_messages.join("
")
end
end
-
+
def destroy
#WkRfq.find(params[:rfq_id].to_i).destroy
#flash[:notice] = l(:notice_successful_delete)
@@ -92,9 +92,9 @@ def destroy
flash[:error] = rfq.errors.full_messages.join("
")
end
redirect_back_or_default :action => 'index', :tab => params[:tab]
- end
-
- def setLimitAndOffset
+ end
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -107,49 +107,49 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
-
+
def deletePermission
validateERPPermission("A_PUR_PRVLG")
end
-
+
def check_perm_and_redirect
unless check_permission
render_403
return false
end
end
-
- def check_permission
- return validateERPPermission("B_PUR_PRVLG") || validateERPPermission("A_PUR_PRVLG")
+
+ def check_permission
+ return validateERPPermission("B_PUR_PRVLG") || validateERPPermission("A_PUR_PRVLG")
end
-
+
def check_pur_admin_and_redirect
- unless validateERPPermission("A_PUR_PRVLG")
+ unless validateERPPermission("A_PUR_PRVLG")
render_403
return false
end
end
-
+
def quoteList
rfqId = params[:rfq_id]
invIds = getInvoiceIds(rfqId, 'Q', false)
invEntries = WkInvoice.includes(:invoice_items).where( :id => invIds)
formPagination(invEntries, "quote")
end
-
+
def getLabelInvNum
l(:label_quote_number)
end
-
+
def getDateLbl
l(:label_quote_date)
end
-
+
def isInvPaymentLink
false
- end
+ end
def set_filter_session
filters = [:rfq_name, :rfq_date]
diff --git a/app/controllers/wkscheduling_controller.rb b/app/controllers/wkscheduling_controller.rb
index df3bd674..763cd37d 100644
--- a/app/controllers/wkscheduling_controller.rb
+++ b/app/controllers/wkscheduling_controller.rb
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkschedulingController < WkbaseController
- unloadable
+
menu_item :wkattendance
before_action :require_login
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
diff --git a/app/controllers/wkshift_controller.rb b/app/controllers/wkshift_controller.rb
index d2922b6d..be2aaf43 100644
--- a/app/controllers/wkshift_controller.rb
+++ b/app/controllers/wkshift_controller.rb
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkshiftController < WkbaseController
- unloadable
+
menu_item :wkattendance
before_action :require_login
diff --git a/app/controllers/wkshipment_controller.rb b/app/controllers/wkshipment_controller.rb
index 0b6ea9d4..82188261 100644
--- a/app/controllers/wkshipment_controller.rb
+++ b/app/controllers/wkshipment_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WkshipmentController < WkinventoryController
- unloadable
+
menu_item :wkproduct
before_action :require_login
diff --git a/app/controllers/wksupplieraccount_controller.rb b/app/controllers/wksupplieraccount_controller.rb
index f5e20fbb..2b338162 100644
--- a/app/controllers/wksupplieraccount_controller.rb
+++ b/app/controllers/wksupplieraccount_controller.rb
@@ -1,36 +1,36 @@
class WksupplieraccountController < WkaccountController
- unloadable
+
menu_item :wkrfq
include WktimeHelper
-
+
def getAccountType
'S'
end
-
+
def getContactType
'C'
end
-
+
def getContactController
'wksuppliercontact'
end
-
- def check_permission
- return validateERPPermission("B_PUR_PRVLG") || validateERPPermission("A_PUR_PRVLG")
+
+ def check_permission
+ return validateERPPermission("B_PUR_PRVLG") || validateERPPermission("A_PUR_PRVLG")
end
-
+
def check_crm_admin_and_redirect
- unless validateERPPermission("A_PUR_PRVLG")
+ unless validateERPPermission("A_PUR_PRVLG")
render_403
return false
end
end
-
+
def deletePermission
validateERPPermission("A_PUR_PRVLG")
end
-
+
def getAccountLbl
l(:label_supplier_account)
end
diff --git a/app/controllers/wksuppliercontact_controller.rb b/app/controllers/wksuppliercontact_controller.rb
index 0d7cbe68..ba428b93 100644
--- a/app/controllers/wksuppliercontact_controller.rb
+++ b/app/controllers/wksuppliercontact_controller.rb
@@ -1,44 +1,44 @@
class WksuppliercontactController < WkcontactController
- unloadable
+
menu_item :wkrfq
include WktimeHelper
-
+
def getContactType
'SC'
end
-
+
def getContactController
'wksuppliercontact'
end
-
+
def getAccountType
'S'
end
-
- def check_permission
- return validateERPPermission("B_PUR_PRVLG") || validateERPPermission("A_PUR_PRVLG")
+
+ def check_permission
+ return validateERPPermission("B_PUR_PRVLG") || validateERPPermission("A_PUR_PRVLG")
end
-
+
def check_crm_admin_and_redirect
- unless validateERPPermission("A_PUR_PRVLG")
+ unless validateERPPermission("A_PUR_PRVLG")
render_403
return false
end
end
-
+
def deletePermission
validateERPPermission("A_PUR_PRVLG")
end
-
+
def getAccountLbl
l(:label_supplier_account)
end
-
+
def lblNewContact
l(:label_new_item, l(:label_supplier_contact))
end
-
+
def contactLbl
l(:label_supplier_contact)
end
diff --git a/app/controllers/wksupplierinvoice_controller.rb b/app/controllers/wksupplierinvoice_controller.rb
index 7fe1bc86..b151f962 100644
--- a/app/controllers/wksupplierinvoice_controller.rb
+++ b/app/controllers/wksupplierinvoice_controller.rb
@@ -1,5 +1,5 @@
class WksupplierinvoiceController < WksupplierorderentityController
- unloadable
+
menu_item :wkrfq
@@simutex = Mutex.new
diff --git a/app/controllers/wksupplierorderentity_controller.rb b/app/controllers/wksupplierorderentity_controller.rb
index 84c8ea83..ea9c3e54 100644
--- a/app/controllers/wksupplierorderentity_controller.rb
+++ b/app/controllers/wksupplierorderentity_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WksupplierorderentityController < WkorderentityController
- unloadable
+
def newOrderEntity(parentId, parentType)
newSupOrderEntity(parentId, parentType)
diff --git a/app/controllers/wksupplierpayment_controller.rb b/app/controllers/wksupplierpayment_controller.rb
index b961de99..de00afdb 100644
--- a/app/controllers/wksupplierpayment_controller.rb
+++ b/app/controllers/wksupplierpayment_controller.rb
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WksupplierpaymentController < WkpaymententityController
- unloadable
+
menu_item :wkrfq
def getOrderAccountType
diff --git a/app/controllers/wksurvey_controller.rb b/app/controllers/wksurvey_controller.rb
index 9796b444..697f3832 100644
--- a/app/controllers/wksurvey_controller.rb
+++ b/app/controllers/wksurvey_controller.rb
@@ -17,7 +17,7 @@
class WksurveyController < WkbaseController
- unloadable
+
before_action :require_login, :survey_url_validation, :check_perm_and_redirect
before_action :check_permission , only: "survey_response"
accept_api_auth :index, :save_survey, :find_survey_for, :survey, :update_survey, :survey_result, :survey_response
diff --git a/app/controllers/wktime_controller.rb b/app/controllers/wktime_controller.rb
index e6e2ca3c..8f1ecc24 100644
--- a/app/controllers/wktime_controller.rb
+++ b/app/controllers/wktime_controller.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WktimeController < WkbaseController
-unloadable
+
include WktimeHelper
include WkcrmHelper
diff --git a/app/controllers/wkunitofmeasurement_controller.rb b/app/controllers/wkunitofmeasurement_controller.rb
index 7b2c58ec..4e4a61bc 100644
--- a/app/controllers/wkunitofmeasurement_controller.rb
+++ b/app/controllers/wkunitofmeasurement_controller.rb
@@ -1,19 +1,19 @@
class WkunitofmeasurementController < WkinventoryController
- unloadable
+
before_action :require_login
menu_item :wkproduct
-
+
def index
- entries = WkMesureUnit.all
+ entries = WkMesureUnit.all
formPagination(entries)
end
def update
- count = 0
+ count = 0
errorMsg = ""
arrId = Array.new
unless params[:actual_ids].blank?
- arrId = params[:actual_ids].split(",").map { |s| s.to_i }
+ arrId = params[:actual_ids].split(",").map { |s| s.to_i }
end
for i in 0..params[:uom_id].length-1
if params[:uom_id][i].blank?
@@ -24,33 +24,33 @@ def update
end
curExchanges.name = params[:name][i]
curExchanges.short_desc = params[:description][i]
- curExchanges.save()
+ curExchanges.save()
end
-
- if !arrId.blank?
+
+ if !arrId.blank?
arrId.each do |id|
des = WkMesureUnit.find(id)
if des.destroy
- count = count + 1
+ count = count + 1
else
errorMsg = errorMsg + des.errors.full_messages.join("
")
end
end
-
+
end
-
+
redirect_to :controller => 'wkunitofmeasurement',:action => 'index' , :tab => 'wkunitofmeasurement'
flash[:notice] = l(:notice_successful_update)
flash[:error] = errorMsg unless errorMsg.blank?
end
-
+
def formPagination(entries)
@entry_count = entries.count
setLimitAndOffset()
@curentry = entries.limit(@limit).offset(@offset)
end
-
- def setLimitAndOffset
+
+ def setLimitAndOffset
if api_request?
@offset, @limit = api_offset_and_limit
if !params[:limit].blank?
@@ -63,7 +63,7 @@ def setLimitAndOffset
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
@limit = @entry_pages.per_page
@offset = @entry_pages.offset
- end
+ end
end
end
diff --git a/app/helpers/wknotification_helper.rb b/app/helpers/wknotification_helper.rb
index 0759ee71..a4c2f8b1 100644
--- a/app/helpers/wknotification_helper.rb
+++ b/app/helpers/wknotification_helper.rb
@@ -23,16 +23,16 @@ def formNotificationText(notification)
notifyHash = {}
case WkUserNotification.getnotificationAction(notification)&.first&.name
when "fillSurvey"
- notification.source.survey_for_id ||= User.current.id if notification.source.survey_for_type == 'User'
- notifyHash['text'] = l(:label_complete_survey)+" "+notification.source.name.to_s
- notifyHash['url'] = {controller:'wksurvey', action:'survey', surveyForID: notification.source.survey_for_id, surveyForType: notification.source.survey_for_type, survey_id: notification.source_id, id: notification.source_id} if notification.source.survey_for_type.blank? || notification.source.survey_for_type.present? && notification.source.survey_for_id.present?
+ notification.source.survey_for_id ||= User.current.id if notification.source.present? && notification&.source&.survey_for_type == 'User'
+ notifyHash['text'] = l(:label_complete_survey)+" "+notification&.source&.name.to_s
+ notifyHash['url'] = {controller:'wksurvey', action:'survey', surveyForID: notification&.source&.survey_for_id, surveyForType: notification&.source&.survey_for_type, survey_id: notification.source_id, id: notification.source_id} if notification&.source&.survey_for_type.blank? || notification&.source&.survey_for_type.present? && notification&.source&.survey_for_id.present?
notifyHash['icon'] = "fa fa-file-text-o"
when "leaveRequested"
- notifyHash['text'] = l(:label_approve_leave)+" "+notification.source.user.name.to_s+" "+l(:label_on)+" "+notification.source.start_date.to_date.to_s
+ notifyHash['text'] = l(:label_approve_leave)+" "+notification&.source&.user.name.to_s+" "+l(:label_on)+" "+notification&.source&.start_date.to_date.to_s
notifyHash['url'] = {controller:'wkleaverequest', action:'edit', id: notification.source_id}
notifyHash['icon'] = "fa fa-user-circle"
when "leaveApproved"
- notifyHash['text'] = notification.source&.status == 'A' ? l(:label_your_leave)+" "+notification.source.start_date.to_date.to_s+" "+l(:label_is_approved) : l(:label_your_leave)+" "+notification.source.start_date.to_date.to_s+" "+l(:label_rejected)
+ notifyHash['text'] = notification.source&.status == 'A' ? l(:label_your_leave)+" "+notification&.source&.start_date.to_date.to_s+" "+l(:label_is_approved) : l(:label_your_leave)+" "+notification&.source&.start_date.to_date.to_s+" "+l(:label_rejected)
notifyHash['url'] = {controller:'wkleaverequest', action:'edit', id: notification.source_id}
notifyHash['icon'] = "fa fa-user-circle"
when 'invoiceGenerated'
@@ -44,42 +44,42 @@ def formNotificationText(notification)
notifyHash['url'] = {controller:'wkpayment', action:'edit', payment_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-usd"
when 'contractSigned'
- notifyHash['text'] = l(:label_contract)+" "+notification.source_id.to_s+" "+ l(:label_for)+" "+notification.source.parent.name.to_s+ " " +l(:label_has_created)
+ notifyHash['text'] = l(:label_contract)+" "+notification.source_id.to_s+" "+ l(:label_for)+" "+notification&.source&.parent.name.to_s+ " " +l(:label_has_created)
notifyHash['url'] = {controller:'wkcontract', action:'edit', contract_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-file-text-o"
when "nonSubmission"
- notifyHash['text'] = l(:button_submit)+" "+ l(:label_timesheet_on)+" "+notification.source.begin_date.to_s
- notifyHash['url'] = {controller:'wktime', action:'edit', startday: notification.source.begin_date, user_id: notification.source.user_id}
+ notifyHash['text'] = l(:button_submit)+" "+ l(:label_timesheet_on)+" "+notification&.source&.begin_date.to_s
+ notifyHash['url'] = {controller:'wktime', action:'edit', startday: notification&.source&.begin_date, user_id: notification&.source&.user_id}
notifyHash['icon'] = "fa fa-clock-o"
when 'timeApproved'
- notifyHash['text'] = l(:button_wk_approve)+" "+l(:label_timesheet_on)+" "+notification.source.begin_date.to_s+" "+l(:label_for)+" "+notification.source.user.name.to_s
- notifyHash['url'] = {controller:'wktime', action:'edit', startday: notification.source.begin_date, user_id: notification.source.user_id}
+ notifyHash['text'] = l(:button_wk_approve)+" "+l(:label_timesheet_on)+" "+notification&.source&.begin_date.to_s+" "+l(:label_for)+" "+notification&.source&.user.name.to_s
+ notifyHash['url'] = {controller:'wktime', action:'edit', startday: notification&.source&.begin_date, user_id: notification&.source&.user_id}
notifyHash['icon'] = "fa fa-clock-o"
when 'timeRejected'
- notifyHash['text'] = l(:label_timesheet_rejected)+" "+l(:label_on)+" "+notification.source.submitted_on.to_s
- notifyHash['url'] = {controller:'wktime', action:'edit', startday: notification.source.begin_date, user_id: notification.source.user_id}
+ notifyHash['text'] = l(:label_timesheet_rejected)+" "+l(:label_on)+" "+notification&.source&.submitted_on.to_s
+ notifyHash['url'] = {controller:'wktime', action:'edit', startday: notification&.source&.begin_date, user_id: notification&.source&.user_id}
notifyHash['icon'] = "fa fa-clock-o"
when 'surveyClosed'
- notifyHash['text'] = l(:label_survey)+" "+notification.source.name.to_s+" "+l(:label_has_closed)
+ notifyHash['text'] = l(:label_survey)+" "+notification&.source&.name.to_s+" "+l(:label_has_closed)
notifyHash['url'] = {controller:'wksurvey', action:'survey', survey_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'leadGenerated'
leadNotifyLabel(notification)
- notifyHash['text'] = @label+" "+notification.source.name.to_s+" "+l(:label_has_created)
+ notifyHash['text'] = @label+" "+notification&.source&.name.to_s+" "+l(:label_has_created)
notifyHash['url'] = {controller: @controller, action:'edit',lead_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-user-circle"
when 'leadConverted'
leadNotifyLabel(notification)
- notifyHash['text'] = @label+" "+notification.source.name.to_s+" "+ @text
+ notifyHash['text'] = @label+" "+notification&.source&.name.to_s+" "+ @text
notifyHash['url'] = {controller: @controller, action:'edit',lead_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-user-circle"
when 'opportunityStatusChanged'
status_name = getSaleStageHash[get_sales_stage(notification.source)].present? ? getSaleStageHash[get_sales_stage(notification.source)] : ""
- notifyHash['text'] = l(:label_opportunity)+" "+notification.source.name.to_s+" "+l(:label_has_changed)+" "+status_name
+ notifyHash['text'] = l(:label_opportunity)+" "+notification&.source&.name.to_s+" "+l(:label_has_changed)+" "+status_name
notifyHash['url'] = {controller:'wkopportunity', action:'edit',opp_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'salesActivityCompleted'
- notifyHash['text'] = l(:report_sales_activity)+" "+notification.source.name.to_s+" "+l(:label_has_completed)
+ notifyHash['text'] = l(:report_sales_activity)+" "+notification&.source&.name.to_s+" "+l(:label_has_completed)
notifyHash['url'] = {controller:'wkcrmactivity', action:'edit',activity_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'receiveGoods'
@@ -87,27 +87,27 @@ def formNotificationText(notification)
notifyHash['url'] = {controller:'wkshipment', action:'edit',shipment_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'disposeAsset'
- notifyHash['text'] = l(:label_asset)+" "+notification.source.name.to_s+" "+l(:label_has_disposed)
- notifyHash['url'] = {controller:'wkasset', action:'edit',inventory_item_id: notification.source.inventory_item_id, id: notification.source.inventory_item_id}
+ notifyHash['text'] = l(:label_asset)+" "+notification&.source&.name.to_s+" "+l(:label_has_disposed)
+ notifyHash['url'] = {controller:'wkasset', action:'edit',inventory_item_id: notification&.source&.inventory_item_id, id: notification&.source&.inventory_item_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'rfqCreated'
- notifyHash['text'] = l(:label_rfq)+" "+notification.source.name.to_s+" "+l(:label_has_created)
+ notifyHash['text'] = l(:label_rfq)+" "+notification&.source&.name.to_s+" "+l(:label_has_created)
notifyHash['url'] = {controller:'wkrfq', action:'edit',rfq_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'quoteReceived'
notifyHash['text'] = l(:label_rfq)+" "+l(:label_quote)+" #"+notification.source&.quote&.invoice_number.to_s+" "+l(:label_has_received)
- notifyHash['url'] = {controller:'wkquote', action:'edit',invoice_id: notification.source.quote_id, new_invoice: false, preview_billing:false, id: notification.source.quote_id}
+ notifyHash['url'] = {controller:'wkquote', action:'edit',invoice_id: notification&.source&.quote_id, new_invoice: false, preview_billing:false, id: notification&.source&.quote_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'purchaseOrderGenerated'
notifyHash['text'] = l(:label_purchase_order)+" #"+notification.source&.purchase_order&.invoice_number.to_s+" "+l(:label_has_created)
- notifyHash['url'] = {controller:'wkpurchaseorder', action:'edit',invoice_id: notification.source.purchase_order_id, new_invoice: false, preview_billing:false, id: notification.source.purchase_order_id}
+ notifyHash['url'] = {controller:'wkpurchaseorder', action:'edit',invoice_id: notification&.source&.purchase_order_id, new_invoice: false, preview_billing:false, id: notification&.source&.purchase_order_id}
notifyHash['icon'] = "fa fa-file-text-o"
when 'supplierInvoiceReceived'
notifyHash['text'] = l(:label_supplier_invoice)+" "+notification.source&.invoice_items.first.original_currency.to_s+notification.source&.invoice_items.sum(:original_amount).to_s+" "+ l(:label_has_generated)+" "+ l(:label_for)+" "+notification.source&.parent&.name.to_s
notifyHash['url'] = {controller:'wksupplierinvoice', action:'edit', invoice_id: notification.source_id, new_invoice: false, preview_billing: false, tab: 'wksupplierinvoice', id: notification.source_id}
notifyHash['icon'] = "fa fa-usd"
when 'supplierPaymentSent'
- notifyHash['text'] = l(:label_received_sup_payment)+" "+notification.source.payment_items.first.original_currency.to_s+WkPayment.getPaymentItems(notification.source).to_s+" "+l(:label_from)+" "+notification.source.parent.name.to_s
+ notifyHash['text'] = l(:label_received_sup_payment)+" "+notification&.source&.payment_items.first.original_currency.to_s+WkPayment.getPaymentItems(notification.source).to_s+" "+l(:label_from)+" "+notification&.source&.parent.name.to_s
notifyHash['url'] = {controller:'wksupplierpayment', action:'edit', payment_id: notification.source_id, id: notification.source_id}
notifyHash['icon'] = "fa fa-usd"
end
diff --git a/app/helpers/wkscheduling_helper.rb b/app/helpers/wkscheduling_helper.rb
index 705fb9b0..8db28aec 100644
--- a/app/helpers/wkscheduling_helper.rb
+++ b/app/helpers/wkscheduling_helper.rb
@@ -18,7 +18,7 @@ module WkschedulingHelper
include WktimeHelper
include WkattendanceHelper
include WkcrmenumerationHelper
-
+
def link_to_wkcalendar_display_day(calendarObject, options={})
s = ""
scheduleType = "P"
@@ -26,58 +26,58 @@ def link_to_wkcalendar_display_day(calendarObject, options={})
totalCount = 0
seeMore = false
dayValue = calendarObject["#{options[:day]}"]
- unless dayValue.blank?
+ unless dayValue.blank?
totalCount = dayValue.length
dayValue.each do | v |
- sval = v.split("-")
- content = sval[0].capitalize
+ sval = v.split("-")
+ content = sval[0].capitalize
schedules = sval[2].strip
if schedules == 'W'
content << link_to(h(sval[1]), url_for(:controller => controller_name, :action => 'edit', :date => options[:day], :schedule_type=> sval[3].strip, :only_path => true), :class => 'icon icon-test', :style => "color:green;")
else
content << "
" + link_to(h(l(:label_day_off)), url_for(:controller => controller_name, :action => 'edit', :date => options[:day], :schedule_type=> sval[3].strip, :only_path => true), :style => "color:red;") +"
" end - + scheduleType = sval[3].strip - # content << " : " + content_tag(:span, (schedules == 'W' ? "Work" : "Off"), :style => "color:#{(schedules == 'W' ? "purple" : "red")};") - - s = s + content + "..+#{totalCount} see more
" end if !s.blank? if scheduleType == 'S' - s = "#{options[:day]}
Name | Shift Name | |
---|---|---|
" + sval[0].capitalize + " | ".html_safe - + sval = v.split("-") + content << "" + sval[0].capitalize + " | ".html_safe + scheduleType = sval[3].strip schedules = sval[2].strip if schedules == 'W' @@ -85,14 +85,14 @@ def render_calendar_tooltip(calendarObject, options={}) else content << "" + " " + link_to(h(l(:label_day_off)), url_for(:controller => controller_name, :action => 'edit', :date => options[:day], :schedule_type=> sval[3].strip, :only_path => true), :style => "color:red;") + " | ".html_safe
end
- content << "" + content_tag(:span, (schedules == 'W' ? "Work" : "Off"), :style => "color:#{(schedules == 'W' ? "purple" : "red")};")+ " | ".html_safe + content << "".html_safe + # content << "" + content_tag(:span, (schedules == 'W' ? "Work" : "Off"), :style => "color:#{(schedules == 'W' ? "purple" : "red")};")+ " | ".html_safe end end content << "