Skip to content

Commit

Permalink
Merge pull request #302 from dhanasingh/dev
Browse files Browse the repository at this point in the history
v4.7.1
  • Loading branch information
Mohanraj1996 authored Nov 13, 2023
2 parents fbe7a51 + 68112c3 commit 63e214f
Show file tree
Hide file tree
Showing 18 changed files with 357 additions and 349 deletions.
23 changes: 8 additions & 15 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Webinar on ERPmine – Inventory , Nov 28th, 2023, 5 PM India (11:30 AM GMT)
= Webinar on ERPmine – Inventory , Nov 28th, 2023, 5 PM India (11:30 AM GMT)

Please click here to register if interested,
https://us02web.zoom.us/meeting/register/tZMpcuGspzkiGNweG8nlkM2udL28xKDaDbY_
Expand All @@ -11,7 +11,6 @@ https://us02web.zoom.us/meeting/register/tZMpcuGspzkiGNweG8nlkM2udL28xKDaDbY_
* Asset and depreciation
* Disposed Asset
* Asset and stock Report

-----

= ERPmine
Expand All @@ -29,6 +28,8 @@ This Plugin has the following modules:
Leave Request
Integrate with Attendance / Time clock devices
Schedule Shifts
Skills
Referrals
User Unbilledtilization Report

* *PayRoll*
Expand Down Expand Up @@ -109,22 +110,14 @@ 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
=== Release Notes for v4.7.1

* *Features*
- Add Sales Quote module.
- Add "activity type" column in Generate Invoice popup page.
- Add language support for Portuguese.
- Redmine 5.1 compatibility.

* *Bug* *fixes*
- Save Custom query issue in spent time filter.
- Add validation for available quantity in material log page.
- Compatibility error with PostGIS database.
- Make Custom fields editable in the timesheet page.
- Remove the deprecated rss_key.
- The CRM Contacts dropdown is not populating in one scenario.

We would like to thank Agilex Cyber Management Solutions for partially sponsored this release.

- Cannot update clock-in/clock-out in timesheet header.
- Conflict with redmine_dmsf plugin.

=== Customization

Expand Down
19 changes: 12 additions & 7 deletions app/controllers/wkorderentity_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def getSupplierAddress(invoice)
end

def getCustomerAddress(invoice)
invoice.parent.name + "\n" + (invoice.parent.address.blank? ? "" : invoice.parent.address.fullAddress) + (invoice&.parent_type == 'WkAccount' ? "\n" + "GST No: " + invoice&.parent&.tax_number.to_s : "")
invoice.parent.name + "\n" + (invoice.parent.address.blank? ? "" : invoice.parent.address.fullAddress) + (invoice&.parent_type == 'WkAccount' && invoice&.parent&.tax_number.present? ? "\n" + "GST No: " + invoice&.parent&.tax_number.to_s : "")
end

def getAutoPostModule
Expand Down Expand Up @@ -738,14 +738,19 @@ def invoice_to_pdf(invoice)
end
pdf.ln
if invoiceComp.present?
pdf.SetFontStyle('B',10)
pdf.set_fill_color(230, 230, 230)
pdf.RDMCell(table_width, 7, l(:label_terms_cond) + ":", 1, 0, '', 1)
pdf.set_fill_color(255, 255, 255)
pdf.ln
if addDescription
pdf.SetFontStyle('B',10)
pdf.set_fill_color(230, 230, 230)
pdf.RDMCell(table_width, 7, l(:label_terms_cond) + ":", 1, 0, '', 1)
pdf.set_fill_color(255, 255, 255)
pdf.ln
end
pdf.SetFontStyle('',10)
invoiceComp.each do |comp|
pdf.RDMCell(table_width, 5, comp[:name] + ": " + comp[:value], 1, 0, '', 1)
pdf.SetFontStyle('B',10)
pdf.RDMCell(100, 5, comp[:name], 1, 0, '', 1)
pdf.SetFontStyle('',10)
pdf.RDMCell(table_width - 100, 5, comp[:value], 1, 0, '', 1)
pdf.ln
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/wktime_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,13 @@ def updateAttendance
wkattendance = WkAttendance.find(entryvalues[0])
entrydate = wkattendance.start_time
start_local = entrydate.localtime
starttime = start_local.change({ hour: entryvalues[1].to_time.strftime("%H"), min: entryvalues[1].to_time.strftime("%M"), sec: entryvalues[1].to_time.strftime("%S") })
starttime = start_local.change({ hour: entryvalues[1].to_time.strftime("%H").to_i, min: entryvalues[1].to_time.strftime("%M").to_i, sec: entryvalues[1].to_time.strftime("%S").to_i })
oldendvalue = entryvalues[2]
if (params[:nightshift] == "true")
entryvalues[2] = "23:59"
end
if !entryvalues[2].blank?
endtime = start_local.change({ hour: entryvalues[2].to_time.strftime("%H"), min: entryvalues[2].to_time.strftime("%M"), sec: entryvalues[2].to_time.strftime("%S") })
endtime = start_local.change({ hour: entryvalues[2].to_time.strftime("%H").to_i, min: entryvalues[2].to_time.strftime("%M").to_i, sec: entryvalues[2].to_time.strftime("%S").to_i })
end
wkattendance.start_time = starttime
wkattendance.end_time = endtime
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/wkdocument_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,8 @@ def location_attachment(attachment, options={})
url = url_for(controller: "wkdocument", action: "download", id: attachment.id)
(html_options[:editable] || html_options[:download]) ? link_to( text, url, html_options) : text
end

def container_attachments_edit_path(container)
wk_object_attachments_edit_path container.class.name.underscore.pluralize, container.id
end
end
1 change: 0 additions & 1 deletion app/helpers/wkpublicholiday_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
module WkpublicholidayHelper
include WktimeHelper
include WkcrmenumerationHelper
include CalendarsHelper

def selectLocation(model, locId)
ddArray = Array.new
Expand Down
1 change: 0 additions & 1 deletion app/helpers/wkscheduling_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module WkschedulingHelper
include WktimeHelper
include CalendarsHelper
include WkattendanceHelper
include WkcrmenumerationHelper

Expand Down
35 changes: 18 additions & 17 deletions app/lib/application_helper_patch.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
module ApplicationHelper
def format_object(object, html=true, &block)
if block_given?
if block
object = yield object
end
case object.class.name
when 'Array'
case object
when Array
formatted_objects = object.map {|o| format_object(o, html)}
html ? safe_join(formatted_objects, ', ') : formatted_objects.join(', ')
when 'Time'
when Time
format_time(object)
when 'Date'
when Date
format_date(object)
when 'Fixnum'
when Integer
object.to_s
when 'Float'
when Float
sprintf "%.2f", object
when 'User', 'Group'
when User, Group
html ? link_to_principal(object) : object.to_s
when 'Project'
when Project
html ? link_to_project(object) : object.to_s
when 'Version'
when Version
html ? link_to_version(object) : object.to_s
when 'TrueClass'
when TrueClass
l(:general_text_Yes)
when 'FalseClass'
when FalseClass
l(:general_text_No)
when 'Issue'
when Issue
object.visible? && html ? link_to_issue(object) : "##{object.id}"
when 'Attachment'
when Attachment
if html
content_tag(
:span,
Expand All @@ -42,16 +42,17 @@ def format_object(object, html=true, &block)
else
object.filename
end
# ============= ERPmine_patch Redmine 5.0 =====================
when 'WkInventoryItem'
# ============= ERPmine_patch Redmine 5.1 =====================
when WkInventoryItem
brandName = object.product_item.brand.blank? ? "" : object.product_item.brand.name
modelName = object.product_item.product_model.blank? ? "" : object.product_item.product_model.name
str = "#{object.product_item.product.name} - #{brandName} - #{modelName}"
assetObj = object.asset_property
str = str + ' - ' +assetObj.name if object&.product_type != 'I'
str
# =============================
when 'CustomValue', 'CustomFieldValue'
when CustomValue, CustomFieldValue
return "" unless object.customized&.visible?
if object.custom_field
f = object.custom_field.format.formatted_custom_value(self, object, html)
if f.nil? || f.is_a?(String)
Expand Down
7 changes: 4 additions & 3 deletions app/lib/context_menus_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def self.included(base)
base.class_eval do

def time_entries
# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
@options_by_custom_field = {}
if session[:timelog][:spent_type] === "T"
# =======================
Expand All @@ -16,14 +16,15 @@ def time_entries
@time_entry = @time_entries.first
end

@projects = @time_entries.collect(&:project).compact.uniq
@projects = @time_entries.filter_map(&:project).uniq
@project = @projects.first if @projects.size == 1
@activities = @projects.map(&:activities).reduce(:&)

edit_allowed = @time_entries.all? {|t| t.editable_by?(User.current)}
@can = {:edit => edit_allowed, :delete => edit_allowed}
@back = back_url

@options_by_custom_field = {}
if @can[:edit]
custom_fields = @time_entries.map(&:editable_custom_fields).reduce(:&).reject(&:multiple?).select {|field| field.format.bulk_edit_supported}
custom_fields.each do |field|
Expand All @@ -34,7 +35,7 @@ def time_entries
end
end

# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
elsif session[:timelog][:spent_type] === "E"
@time_entries = WkExpenseEntry.where(id: params[:ids]).to_a
@can = {:edit => true, :delete => true}
Expand Down
8 changes: 4 additions & 4 deletions app/lib/issues_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def destroy
time_entries = TimeEntry.where(:issue_id => issues_and_descendants_ids)
@hours = time_entries.sum(:hours).to_f

# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
expense_entries = WkExpenseEntry.where(:issue_id => issues_and_descendants_ids)
@amount = expense_entries.sum(:amount).to_f

Expand Down Expand Up @@ -41,7 +41,7 @@ def destroy
return
else
time_entries.update_all(:issue_id => nil)
# ============= ERPmine_patch Redmine 5.0 ===========
# ============= ERPmine_patch Redmine 5.1 ===========
expense_entries.update_all(:issue_id => nil)
material_entries.update_all(:issue_id => nil) #for material and resident entry update
# ==============================================
Expand All @@ -56,7 +56,7 @@ def destroy
return
else
time_entries.update_all(:issue_id => reassign_to.id, :project_id => reassign_to.project_id)
# ============= ERPmine_patch Redmine 5.0 ===========
# ============= ERPmine_patch Redmine 5.1 ===========
expense_entries.update_all(:issue_id => reassign_to.id, :project_id => reassign_to.project_id)

#for material and resident entry update
Expand All @@ -67,7 +67,7 @@ def destroy
# display the destroy form if it's a user request
return unless api_request?
end
# ============= ERPmine_patch Redmine 5.0 ===========
# ============= ERPmine_patch Redmine 5.1 ===========
end
# ==============================================
end
Expand Down
58 changes: 30 additions & 28 deletions app/lib/queries_helper_patch.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module QueriesHelper

def self.included(base)
base.send(:include, InstanceMethods)
# def self.included(base)
# base.send(:include, InstanceMethods)

base.class_eval do
unloadable
alias_method :column_value_without_wktime_projects, :column_value
alias_method :column_value, :column_value_with_wktime_projects
end
end
# base.class_eval do
# unloadable
# alias_method :column_value_without_wktime_projects, :column_value
# alias_method :column_value, :column_value_with_wktime_projects
# end
# end

module InstanceMethods
# module InstanceMethods
def column_value_with_wktime_projects(column, item, value)
case column.name
# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
when :inventory_item_id
formProductItem(item)
when :selling_price
Expand All @@ -33,13 +33,15 @@ def column_value_with_wktime_projects(column, item, value)
column_value_without_wktime_projects(column, item, value)
end
end
end
alias_method :column_value_without_wktime_projects, :column_value
alias_method :column_value, :column_value_with_wktime_projects
# end

def render_query_totals(query)
return unless query.totalable_columns.present?

totals = query.totalable_columns.map do |column|
# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
if [:quantity, :selling_price].include? column.name
product_type = session[:timelog][:spent_type] == "M" ? 'I' : session[:timelog][:spent_type]
query[:filters]['product_type'] = {"operator":"=","values" => product_type}
Expand All @@ -51,21 +53,21 @@ def render_query_totals(query)
end

def query_to_csv(items, query, options={})
columns = query.columns

Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
# csv header fields
csv << columns.map {|c| c.caption.to_s}
# csv lines
items.each do |item|
# ============= ERPmine_patch Redmine 5.0 =====================
csv << columns.map {|c| [:inventory_item_id].include?(c.name) ? wk_csv_content(item) : csv_content(c, item)}
# =============================
end
end
end
columns = query.columns
Redmine::Export::CSV.generate(encoding: params[:encoding], field_separator: params[:field_separator]) do |csv|
# csv header fields
csv << columns.map {|c| c.caption.to_s}
# csv lines
items.each do |item|
# ============= ERPmine_patch Redmine 5.1 =====================
csv << columns.map {|c| [:inventory_item_id].include?(c.name) ? wk_csv_content(item) : csv_content(c, item)}
# =============================
end
end
end

# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
def wk_csv_content(item)
formProductItem(item)
end
Expand All @@ -84,11 +86,11 @@ def formProductItem(item)

# Renders the list of queries for the sidebar
def render_sidebar_queries(klass, project)
# ============= ERPmine_patch Redmine 5.0 =====================
# ============= ERPmine_patch Redmine 5.1 =====================
spent_type = session[:timelog] && session[:timelog][:spent_type]
kclassName = spent_type == "M" || spent_type == "A" ? WkMaterialEntryQuery : (spent_type == 'E' ? WkExpenseEntryQuery : klass)
queries = sidebar_queries(kclassName, project)
# =============================
# =============================

out = ''.html_safe
out << query_links(l(:label_my_queries), queries.select(&:is_private?))
Expand Down
Loading

0 comments on commit 63e214f

Please sign in to comment.