Skip to content

Commit 0a53e13

Browse files
Merge 25.11 to 26.3
2 parents bddd077 + 6c6dafe commit 0a53e13

6 files changed

Lines changed: 102 additions & 27 deletions

File tree

onprc_billing/resources/queries/onprc_billing/leaseFees.sql

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ When a5.id is not Null
5656
then (Select c.rowid from Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer')}.onprc_billing.chargeableItems c where c.itemCode = 'ONR41')
5757
When (a4.id is not null and (TIMESTAMPDIFF('SQL_TSI_Day',a.date,a.projectedRelease)) <=14 and a.endDate is null and a.ageAtTime.AgeAtTimeYearsRounded < 1)
5858
then (Select c.rowid from Site.{substitutePath moduleProperty('ONPRC_Billing','BillingContainer')}.onprc_billing.chargeableItems c where c.itemCode = 'ONR44')
59-
WHEN (a.duration <= CAST(javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_MAX_DURATION') as INTEGER) AND a.enddate IS NOT NULL AND a.assignCondition = a.releaseCondition) THEN (SELECT rowid FROM onprc_billing_public.chargeableItems ci WHERE ci.active = true AND ci.name = javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_NAME'))
60-
WHEN (a.duration <= CAST(javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_MAX_DURATION') as INTEGER) AND a.enddate IS NOT NULL AND a.assignCondition = a.releaseCondition) THEN (SELECT rowid FROM onprc_billing_public.chargeableItems ci WHERE ci.active = true AND ci.name = javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_NAME'))
59+
WHEN (a.duration <= CAST(javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_MAX_DURATION') as INTEGER) AND a.enddate IS NOT NULL AND a.assignCondition = a.releaseCondition) THEN (SELECT rowid FROM onprc_billing_public.chargeableItems ci WHERE ci.active = true AND ci.name = javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_NAME'))
6160
WHEN a2.id IS NOT NULL THEN (SELECT rowid FROM onprc_billing_public.chargeableItems ci WHERE (ci.startDate <= a.date and ci.endDate >= a.date) AND ci.name = javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.TMB_LEASE_NAME'))
6261
ELSE lf.chargeId
6362
END as chargeId,
@@ -81,7 +80,8 @@ CASE
8180
where b.id = a.id and a1.project.protocol = a2.project.protocol) > 0 THEN 0
8281

8382
WHEN (a.duration = 0 AND a.enddate IS NOT NULL AND a.assignCondition = a.releaseCondition) THEN 1
84-
WHEN (fl.id Is Not Null) THEN 0
83+
-- Exempt PI-purchased NHPs from lease fees
84+
WHEN (fl.id IS NOT NULL) THEN 0
8585
--This will check for infants born to resource moms and will not charge
8686

8787
WHEN (a.duration <= CAST(javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_MAX_DURATION') as INTEGER) AND a.enddate IS NOT NULL AND a.assignCondition = a.releaseCondition) THEN a.duration
@@ -139,21 +139,20 @@ LEFT JOIN onprc_billing.leaseFeeDefinition lf ON (
139139
AND lf.active = true
140140
)
141141

142-
143-
144-
--adds the reasearch owned animal exemption
145-
LEFT JOIN study.flags fl on
146-
(a.id = fl.id
147-
and fl.flag.code = 4034
148-
and (a.date >= fl.date and a.date <=COALESCE(fl.enddate,Now()) ))
149-
142+
-- Add PI-purchased NHP flag data
143+
LEFT JOIN study.flags fl
144+
ON (a.id = fl.id
145+
AND fl.flag.code = 4034
146+
AND a.date BETWEEN CAST(fl.date AS DATE) AND COALESCE(fl.enddate, now())
147+
)
150148

151149
WHERE CAST(a.datefinalized AS DATE) >= CAST(STARTDATE as DATE) AND CAST(a.datefinalized AS DATE) <= CAST(ENDDATE as DATE)
152150
AND a.qcstate.publicdata = true --and a.participantID.demographics.species.common not in ('Rabbit','Guinea Pigs')
153151

154152

155-
--add setup fees for all starts, except day leases aznd sla
153+
-- Add lease setup fees for all lease starts, except day leases, PI-purchased NHPs, and sla
156154
UNION ALL
155+
157156
SELECT
158157
a.id,
159158
a.date,
@@ -168,7 +167,7 @@ SELECT
168167
' ' as ESPFAnimal,
169168
'Lease Setup Fees' as category,
170169
(SELECT rowid FROM onprc_billing_public.chargeableItems ci WHERE ci.active = true AND ci.name = javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.LEASE_SETUP_FEES')) as chargeId,
171-
1 as quantity,
170+
1 AS quantity,
172171
cast(null as integer) as leaseCharge1,
173172
cast(null as integer) as leaseCharge2,
174173
a.objectid as sourceRecord,
@@ -179,11 +178,19 @@ SELECT
179178

180179
FROM study.assignment a
181180

181+
-- Add PI-purchased NHP flag data
182+
LEFT JOIN study.flags fl
183+
ON (a.id = fl.id
184+
AND fl.flag.code = 4034
185+
AND a.date BETWEEN CAST(fl.date AS DATE) AND COALESCE(fl.enddate, now())
186+
)
187+
182188
WHERE CAST(a.datefinalized AS DATE) >= CAST(STARTDATE as DATE) AND CAST(a.datefinalized AS DATE) <= CAST(ENDDATE as DATE)
183189
AND a.qcstate.publicdata = true
184190
--only charge setup fee for leases >24H. note: duration assumes today as end, so exclude null enddates
185191
AND ((a.duration > CAST(javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.DAY_LEASE_MAX_DURATION') as INTEGER)) OR ( a.assignCondition != a.releaseCondition AND a.enddate IS NULL))
186192
and a.id.demographics.species Not IN ('Rabbit','Guinea Pigs')
193+
AND fl.id IS NULL -- Exempt PI-purchased NHPs from lease setup fees
187194

188195
--add released animals that need adjustments
189196
UNION ALL
@@ -208,9 +215,9 @@ a5.id as ESPFAnimal,
208215
--////This selectes the charge ID to be used
209216
(SELECT max(rowid) as rowid FROM onprc_billing_public.chargeableItems ci WHERE ci.name = javaConstant('org.labkey.onprc_billing.ONPRC_BillingManager.LEASE_FEE_ADJUSTMENT') and ci.active = true) as chargeId,
210217
CASE
211-
when (fl.id Is Not Null) then 0
212-
else 1
213-
end as quantity,
218+
WHEN (fl.id IS NOT NULL) THEN 0 -- Exempt PI-purchased NHPs from lease fees
219+
ELSE 1
220+
END AS quantity,
214221
lf2.chargeId as leaseCharge1,
215222
lf.chargeId as leaseCharge2,
216223
a.objectid as sourceRecord,
@@ -248,11 +255,12 @@ LEFT join assignment_U42ESPF a5 on
248255
and a5.dateonly <=a.dateOnly
249256
AND a5.endDateCoalesced >= a.dateOnly)
250257

251-
--adds the reasearch owned animal exemption
252-
LEFT JOIN study.flags fl on
253-
(a.id = fl.id
254-
and fl.flag.code = 4034
255-
and (a.date >= fl.date and a.date <=COALESCE(fl.enddate,Now()) ))
258+
-- Add PI-purchased NHP flag data
259+
LEFT JOIN study.flags fl
260+
ON (a.id = fl.id
261+
AND fl.flag.code = 4034
262+
AND a.date BETWEEN CAST(fl.date AS DATE) AND COALESCE(fl.enddate, now())
263+
)
256264

257265
WHERE a.releaseCondition != a.projectedReleaseCondition
258266
and (A.id != A5.id or A5.id is Null)

onprc_ehr/resources/queries/onprc_ehr/ChemistryPanicNotification.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ select a.Id,
1414
from study.ClinpathRuns a, study.chemistryResults b
1515
Where a.objectid = b.runid
1616
And a.type = 'biochemistry'
17-
And b.qualresult like '%panic%'
17+
And b.qualresult like '%alert%'
18+
1819
And a.qcstate = 18
1920
And b.qcstate = 18
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<customView xmlns="http://labkey.org/data/xml/queryCustomView" >
2+
<columns>
3+
<column name="Id/curLocation/area">
4+
<properties>
5+
<property name="columnTitle" value="Area"/>
6+
</properties>
7+
</column>
8+
<column name="Id/curLocation/room">
9+
<properties>
10+
<property name="columnTitle" value="Room"/>
11+
</properties>
12+
</column>
13+
<column name="Id/curLocation/cage">
14+
<properties>
15+
<property name="columnTitle" value="Cage"/>
16+
</properties>
17+
</column>
18+
<column name="Id"/>
19+
<column name="Id/utilization/use"/>
20+
<column name="species"/>
21+
<column name="geographic_origin"/>
22+
<column name="gender"/>
23+
<column name="calculated_status"/>
24+
<column name="birth"/>
25+
<column name="Id/age/yearAndDays">
26+
<properties>
27+
<property name="columnTitle" value="Age(Year and Days)"/>
28+
</properties>
29+
</column>
30+
<column name="Id/MostRecentWeight/MostRecentWeight">
31+
<properties>
32+
<property name="columnTitle" value="Current Weight (kg)"/>
33+
</properties>
34+
</column>
35+
<column name="Id/MostRecentWeight/MostRecentWeightDate">
36+
<properties>
37+
<property name="columnTitle" value="Weight Date"/>
38+
</properties>
39+
</column>
40+
<column name="Id/viral_status/viralStatus">
41+
<properties>
42+
<property name="columnTitle" value="Viral Status"/>
43+
</properties>
44+
</column>
45+
46+
<column name="Id/mostRecentBCS/date">
47+
<properties>
48+
<property name="columnTitle" value="Last Most Recent BCS Date"/>
49+
</properties>
50+
</column>
51+
<column name="Id/mostRecentBCS/score">
52+
<properties>
53+
<property name="columnTitle" value="BCS Score"/>
54+
</properties>
55+
</column>
56+
57+
<column name="history"/>
58+
</columns>
59+
60+
</customView>

onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,8 +1381,10 @@ exports.init = function(EHR){
13811381
// Added: 10-6-2025
13821382
EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'chemistryResults', function (helper, scriptErrors, row, oldRow) {
13831383

1384-
if (row.Id && row.qualresult && row.qualresult.indexOf('panic') !== -1) {
1385-
console.log("panic values: " + row.qualresult);
1384+
1385+
if (row.Id && row.qualresult && row.qualresult.indexOf('alert') !== -1) {
1386+
1387+
console.log("alert values: " + row.qualresult);
13861388
triggerHelper.sendClinpathPanicEmail(row.Id, row.runid, row.objectid);
13871389
}
13881390
});

onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,8 @@ public void exec(ResultSet object) throws SQLException
26402640

26412641
public void sendClinpathPanicEmail(String id, String runid, String objectid)
26422642
{
2643-
String subject = "Chemistry Results with Panic values";
2643+
String subject = "Chemistry Results with alert values";
2644+
26442645
Container c = getContainer();
26452646

26462647

@@ -2671,7 +2672,7 @@ public void sendClinpathPanicEmail(String id, String runid, String objectid)
26712672

26722673
if (ts.getRowCount() == 0)
26732674
{
2674-
html.append("There are no Chemistry Panlc Values to display");
2675+
html.append("There are no Chemistry Alert Values to display");
26752676

26762677
return;
26772678
}

onprc_ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_RestrictedIssueTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,16 @@ public void restrictedIssueSearchTest()
293293
// verify that we can return links even if the user doesn't have permission to view a restricted issue
294294
Assert.assertTrue("Number of search results not expected", resultsPage.getResults().size() == 2);
295295

296-
// verify assigned to users will see both results but shouldn't be able to see details of issues not assigned to them
296+
// verify assigned to users will see both results but shouldn't be able to see details of issues not assigned to them,
297+
// also verify that there is a warning rendered if a search result is restricted
297298
impersonate(USER1.getEmail());
299+
assertTextPresent("Restricted Issue: You do not have access. Contact your administrator for access.");
298300
verifyIssueAccess(ISSUE_1, true);
299301
verifyIssueAccess(ISSUE_2, false);
300302
stopImpersonating(false);
301303

302304
impersonate(USER2.getEmail());
305+
assertTextPresent("Restricted Issue: You do not have access. Contact your administrator for access.");
303306
verifyIssueAccess(ISSUE_1, false);
304307
verifyIssueAccess(ISSUE_2, true);
305308
stopImpersonating();

0 commit comments

Comments
 (0)