hr_lite 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/controllers/hr_lite/admin/leave_balances_controller.rb +1 -0
- data/app/controllers/hr_lite/admin/leave_requests_controller.rb +7 -5
- data/app/models/hr_lite/leave_balance.rb +2 -1
- data/app/models/hr_lite/leave_request.rb +7 -5
- data/app/views/hr_lite/admin/leave_balances/index.html.erb +1 -1
- data/app/views/hr_lite/admin/leave_requests/show.html.erb +7 -3
- data/lib/hr_lite/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 175c2fc4265dd0055f39926d529060dedeb14386991eb9f43d1b3f0e80112dce
|
|
4
|
+
data.tar.gz: 733cc4423053d7ca4b8d27acd03165dd073481f767131731179432392a3be335
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d26ff16fb6dc9bc592374a0920d659556b7ad8d466fccfa6a24084bfada3bd95fd4b756e2de2ae01138dab005d7e612fd58883b80e1a7ef333f53bd75748f191
|
|
7
|
+
data.tar.gz: 96b6f9c358ecba6d459da48a97cbdc866f5dbabb1a7ab1dff4345961cdf4e6780c0ae4f7dd56635a66aa41a5078b830423cb1740eada0acda5c4350b4d84590d
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.28.0] - 2026-10-10
|
|
11
|
+
|
|
12
|
+
- HR and leadership can cancel any approved or pending leave at any time, past dates included. A reason is required; it is kept as the decision note and in the audit log. Employees still cancel their own leave only before it starts. A cancelled past day with no punch shows as absent.
|
|
13
|
+
- Leave always accrues from the joining date. Somebody with no joining date (no HR profile) now accrues nothing instead of a full year, and the team balances grid flags them with "No joining date".
|
|
14
|
+
|
|
10
15
|
## [0.27.0] - 2026-10-10
|
|
11
16
|
|
|
12
17
|
- HR and admins can fix leave they recorded (type, dates, half day) at any time, past dates included, without cancelling it. A reason is required; it is kept as the decision note and in the audit log (`leave.corrected`), and the balance and loss-of-pay split are worked out again.
|
|
@@ -5,6 +5,7 @@ module HrLite
|
|
|
5
5
|
@year = sanitized_year
|
|
6
6
|
@types = LeaveType.active.where(paid: true).where.not(annual_quota: nil)
|
|
7
7
|
@employees = HrLite.employees.select { |employee| hr_reaches?("leave.view", employee) }
|
|
8
|
+
@no_joining_date = @employees.map(&:id) - EmployeeProfile.where(user_id: @employees.map(&:id)).where.not(date_of_joining: nil).pluck(:user_id)
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
# Manual credit/debit — also the comp-off credit mechanism.
|
|
@@ -73,12 +73,14 @@ module HrLite
|
|
|
73
73
|
# not be released at all, and the quota stayed spent.
|
|
74
74
|
def cancel
|
|
75
75
|
request = find_decidable
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
redirect_to
|
|
76
|
+
note = params[:decision_note].to_s.strip
|
|
77
|
+
if !request.cancellable_by?(hr_current_user)
|
|
78
|
+
redirect_to admin_leave_request_path(request), alert: "This leave can no longer be cancelled."
|
|
79
|
+
elsif note.blank?
|
|
80
|
+
redirect_to admin_leave_request_path(request), alert: "A reason is required to cancel."
|
|
79
81
|
else
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
request.cancel!(actor: hr_current_user, note: note)
|
|
83
|
+
redirect_to admin_leave_requests_path, notice: "Leave cancelled — the balance is released."
|
|
82
84
|
end
|
|
83
85
|
end
|
|
84
86
|
|
|
@@ -97,7 +97,8 @@ module HrLite
|
|
|
97
97
|
# nil when the person joins only after this leave year ends.
|
|
98
98
|
def accrual_start(range)
|
|
99
99
|
doj = employment_window.first
|
|
100
|
-
return
|
|
100
|
+
return nil if doj.nil? # no joining date, no accrual — never a full year by default
|
|
101
|
+
return range.first if doj <= range.first
|
|
101
102
|
|
|
102
103
|
start = doj.day <= 15 ? doj.beginning_of_month : doj.next_month.beginning_of_month
|
|
103
104
|
start > range.last ? nil : start
|
|
@@ -91,23 +91,25 @@ module HrLite
|
|
|
91
91
|
|
|
92
92
|
# Owner may cancel while pending, or an approved future leave (quota
|
|
93
93
|
# returns automatically because `used` is computed). Admins may cancel
|
|
94
|
-
#
|
|
94
|
+
# anybody else's pending/approved leave at any time, past dates included.
|
|
95
95
|
def cancellable_by?(actor)
|
|
96
|
-
return false unless pending? ||
|
|
96
|
+
return false unless pending? || approved?
|
|
97
|
+
return pending? || start_date > Date.current if user_id == actor.id
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
HrLite.admin?(actor) || HrLite.leadership?(actor)
|
|
99
100
|
end
|
|
100
101
|
|
|
101
|
-
def cancel!(actor:)
|
|
102
|
+
def cancel!(actor:, note: nil)
|
|
102
103
|
was_approved = approved?
|
|
103
104
|
transaction do
|
|
104
105
|
self.status = "cancelled"
|
|
105
106
|
self.decided_by_id = actor.id
|
|
106
107
|
self.decided_at = Time.current
|
|
108
|
+
self.decision_note = note if note.present?
|
|
107
109
|
save!
|
|
108
110
|
# Cancelling an APPROVED leave hands the days back to the balance, so
|
|
109
111
|
# it is a quota change as much as a status change.
|
|
110
|
-
audit!("cancelled", actor, was_approved ? "was approved" : nil)
|
|
112
|
+
audit!("cancelled", actor, [ note.presence, was_approved ? "was approved" : nil ].compact.join("; ").presence)
|
|
111
113
|
# And nobody should still be asked to decide a request that has been
|
|
112
114
|
# called off — it would sit in their inbox for ever.
|
|
113
115
|
approval_route.cancel_all!
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<tbody>
|
|
15
15
|
<% @employees.each do |employee| %>
|
|
16
16
|
<tr>
|
|
17
|
-
<td data-label="Employee"><%= hr_display_name(employee) %></td>
|
|
17
|
+
<td data-label="Employee"><%= hr_display_name(employee) %><% if @no_joining_date.include?(employee.id) %><br><span class="hrl-badge hrl-badge--bad">No joining date — no leave accrues</span><% end %></td>
|
|
18
18
|
<% @types.each do |type| %>
|
|
19
19
|
<% balance = HrLite::LeaveBalance.for(employee, type, @year) %>
|
|
20
20
|
<td data-label="<%= type.code %>" class="hrl-num"><span><strong><%= hrl_days(balance.available) %></strong> left<br><span class="hrl-small hrl-muted"><%= hrl_days(balance.used) %>/<%= hrl_days(balance.entitled) %> used</span></span></td>
|
|
@@ -34,15 +34,19 @@
|
|
|
34
34
|
</section>
|
|
35
35
|
<% end %>
|
|
36
36
|
|
|
37
|
-
<%#
|
|
37
|
+
<%# HR can call off approved leave at any time, past dates included — the
|
|
38
38
|
balance is recomputed live, so cancelling gives the days straight back. %>
|
|
39
39
|
<% if @request.cancellable_by?(hr_current_user) && !@request.pending? %>
|
|
40
40
|
<section class="hrl-card">
|
|
41
41
|
<h2 class="hrl-card__title">Cancel</h2>
|
|
42
|
-
<p class="hrl-small hrl-muted">Releases the days back to their balance.
|
|
43
|
-
|
|
42
|
+
<p class="hrl-small hrl-muted">Releases the days back to their balance. A past day with
|
|
43
|
+
no punch will then show as absent.</p>
|
|
44
44
|
<%= form_with url: hr_lite.cancel_admin_leave_request_path(@request), method: :post, local: true,
|
|
45
45
|
html: { data: { turbo_confirm: "Cancel this approved leave?" } } do %>
|
|
46
|
+
<div class="hrl-field">
|
|
47
|
+
<label for="cancel_note">Reason (required)</label>
|
|
48
|
+
<textarea name="decision_note" id="cancel_note" class="hrl-input" required></textarea>
|
|
49
|
+
</div>
|
|
46
50
|
<div class="hrl-form-actions">
|
|
47
51
|
<button class="hrl-btn hrl-btn--danger" type="submit">Cancel this leave</button>
|
|
48
52
|
</div>
|
data/lib/hr_lite/version.rb
CHANGED