Skip to content

Commit

Permalink
Merge pull request #62 from dhanasingh/dev
Browse files Browse the repository at this point in the history
v2.2.1
  • Loading branch information
dhineshrajasekar authored Jul 13, 2016
2 parents 54befb9 + 0462407 commit 372d36d
Show file tree
Hide file tree
Showing 39 changed files with 501 additions and 281 deletions.
25 changes: 9 additions & 16 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,17 @@ 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 2.2
Release Notes for 2.2.1
Features:
- Made compatible with Redmine 3.2.2.
- Clock-in and clock-out widget in all pages.
- Pagination in the report popup.
- Allow TE Admin to Delete entry in attendance.
- Hide Expense, Attendance and Reports modules.
- Configuration for Min/Max hours per week.
- Configuration for non submission mails to group of users.
- Made compatible with Redmine 3.3.0.
- Time & Expense report in Report module.
- Show the first clock in and last clock out of the day.
- Show the List page for view permission holder also.
Bugs:
- Fixed Does not support other language Issue Id Validation Message.
- Fixed Log Time : Approved/submitted sheet don't allow time entry through edit issue screen.
- Fixed Show 'No record to display' if there is no record in attendance report.
- Fixed Mobile web compatibility.
- Fixed Min Hours Per Day : validation for Min Hours is less then Max Hours.
- Fixed Expense total does not show correctly in Deleted Projects.
- Fixed last day of the month not shown in the attendance report.
- Fixed Does not save expense amount greater then 100000.
- Fixed the clock in/out column shift error.
- Fixed the leave total hours bug in attendance list.
- Added permission logic for viewing expenses report.
- Left align the report header.
Customization:
For any Customization/Support, please contact us, our consulting team will be happy to help you

Expand Down
14 changes: 6 additions & 8 deletions app/controllers/wkattendance_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ def index
@status = params[:status] || 1
@groups = Group.all.sort
sqlStr = ""
if !findLastAttnEntry.blank?
@lastAttnEntry = findLastAttnEntry[0]
end
lastMonthStartDt = Date.civil(Date.today.year, Date.today.month, 1) << 1
if(Setting.plugin_redmine_wktime['wktime_leave'].blank?)
sqlStr = " select u.id as user_id, u.firstname, u.lastname, u.status, -1 as issue_id from users u where u.type = 'User' "
sqlStr = " select u.id as user_id, u.firstname, u.lastname, u.status, -1 as issue_id from users u"
if !params[:group_id].blank?
sqlStr = sqlStr + " left join groups_users gu on u.id = gu.user_id"
end
sqlStr = sqlStr + " where u.type = 'User' "
else
listboxArr = Setting.plugin_redmine_wktime['wktime_leave'][0].split('|')
issueId = listboxArr[0]
Expand All @@ -37,10 +38,7 @@ def index
findBySql(sqlStr)
end

def edit
if !findLastAttnEntry.blank?
@lastAttnEntry = findLastAttnEntry[0]
end
def edit
sqlStr = getQueryStr + " where i.id in (#{getLeaveIssueIds}) and u.type = 'User' and u.id = #{params[:user_id]} order by i.subject"
@leave_details = WkUserLeave.find_by_sql(sqlStr)
render :action => 'edit'
Expand Down
42 changes: 2 additions & 40 deletions app/controllers/wkbase_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class WkbaseController < ApplicationController
unloadable

def findLastAttnEntry
WkAttendance.find_by_sql("select a.* from wk_attendances a inner join ( select max(start_time) as start_time,user_id from wk_attendances where user_id = #{User.current.id} group by user_id ) vw on a.start_time = vw.start_time and a.user_id = vw.user_id order by a.start_time ")
end


def updateClockInOut
if !findLastAttnEntry.blank?
Expand Down Expand Up @@ -47,41 +45,5 @@ def addNewAttendance
end
wkattendance.user_id = User.current.id
wkattendance.save()
end

def computeWorkedHours(startTime,endTime, ishours)
currentEntryDate = startTime.localtime
workedHours = endTime-startTime
if !Setting.plugin_redmine_wktime['wktime_break_time'].blank?
Setting.plugin_redmine_wktime['wktime_break_time'].each_with_index do |element,index|
listboxArr = element.split('|')
breakStart = currentEntryDate.change({ hour: listboxArr[0], min:listboxArr[1], sec: '00' })
breakEnd = currentEntryDate.change({ hour: listboxArr[2], min:listboxArr[3], sec: '00' })
if(!(startTime>breakEnd || endTime < breakStart))
if startTime < breakStart
if endTime < breakEnd
workedHours = workedHours - (endTime-breakStart)
else
workedHours = workedHours - (breakEnd-breakStart)
end
else
if endTime > breakEnd
workedHours = workedHours - (breakEnd-startTime)
else
workedHours = nil
end
end
end
end
end
if ishours
workedHours = (workedHours/1.hour).round(2) unless workedHours.blank?
end
workedHours
end

def totalhours
dateStr = getConvertDateStr('start_time')
(WkAttendance.where("user_id = #{User.current.id} and #{dateStr} = '#{Time.now.strftime("%Y-%m-%d")}'").sum(:hours)).round(2)
end
end
end
106 changes: 80 additions & 26 deletions app/controllers/wkexpense_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,38 @@ def reportdetail
@query = WkExpenseEntryQuery.build_from_params(params, :project => @project, :name => '_')
sort_init(@query.sort_criteria.empty? ? [['spent_on', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns)
scope = expense_entry_scope(:order => sort_clause).
includes(:project, :user, :issue).
preload(:issue => [:project, :tracker, :status, :assigned_to, :priority])
set_managed_projects
projectid = -1
ismanagedProject = false
currentProject = Project.where(:identifier => params[:project_id])
if !currentProject.blank?
projectid = currentProject[0].id
end
projectids = ''
@manage_view_spenttime_projects.each{ |manageproject|
if projectids !=''
projectids += ', '
end
projectids += manageproject.id.to_s
if projectid == manageproject.id
ismanagedProject = true
end
}
if (!@manage_view_spenttime_projects.blank? && ismanagedProject) || isAccountUser
scope = expense_entry_scope(:order => sort_clause).
includes(:project, :user, :issue).
preload(:issue => [:project, :tracker, :status, :assigned_to, :priority])
else
cond =''
if projectid > 0
cond = "user_id = #{User.current.id} and project_id in (#{projectid}) "
elsif !@manage_view_spenttime_projects.blank?
cond = "project_id in (#{projectids}) "
else
cond = "user_id = #{User.current.id}"
end
scope = WkExpenseEntry.where(cond)
end
respond_to do |format|
format.html {
@entry_count = scope.count
Expand Down Expand Up @@ -108,27 +137,39 @@ def report
def deleteEntry
respond_to do |format|
format.html {
delete(params[:id])
flash[:notice] = l(:notice_successful_delete)
if delete(params[:id])
flash[:notice] = l(:notice_successful_delete)
else
flash[:error] = l(:error_expense_entry_delete)
end
redirect_to :action => 'reportdetail', :project_id => params[:project]
}
end
end

def textfield_size
6
end
def textfield_size
6
end

def showClockInOut
false
end
def maxHourPerWeek
0
end
def showClockInOut
false
end

def getNewCustomField
nil
end

def getTELabel
l(:label_wk_expensesheet)
end

def maxHourPerWeek
0
end

def minHourPerWeek
0
end
def minHourPerWeek
0
end
private
def getSpecificField
"amount"
Expand Down Expand Up @@ -183,10 +224,6 @@ def setValueForSpField(teEntry,spValue,decimal_separator,entry)
teEntry.currency = getUnit(entry)
end

def getNewCustomField
nil
end

def getWkEntity
Wkexpense.new
end
Expand All @@ -200,7 +237,28 @@ def deleteWkEntity(cond)
end

def delete(ids)
WkExpenseEntry.delete(ids)
#WkExpenseEntry.delete(ids)
errMsg = false
@expense_entries = WkExpenseEntry.find_by_sql("SELECT * FROM wk_expense_entries w where id = #{ids} ;")
destroyed = WkExpenseEntry.transaction do
@expense_entries.each do |t|
status = getExpenseEntryStatus(t.spent_on, t.user_id)
if !status.blank? && ('a' == status || 's' == status || 'l' == status)
errMsg = false
else
errMsg = true
WkExpenseEntry.delete(ids)
end
end
end
errMsg
end

def getExpenseEntryStatus(spent_on, user_id)
start_day = getStartDay(spent_on)
result = Wkexpense.where(['begin_date = ? AND user_id = ?', start_day, user_id])
result = result[0].blank? ? 'n' : result[0].status
return result
end

def findTEEntries(ids)
Expand Down Expand Up @@ -251,10 +309,6 @@ def expense_entry_scope(options={})
scope
end

def getTELabel
l(:label_wk_expensesheet)
end

def findTEEntryBySql(query)
WkExpenseEntry.find_by_sql(query)
end
Expand Down
Loading

0 comments on commit 372d36d

Please sign in to comment.