Skip to content

Commit

Permalink
Merge pull request #4823 from bcgov/dev-rook-AH-4679
Browse files Browse the repository at this point in the history
Ticket 4679 - Scenario 12 AC + Ticket 4671 - Adj to Validation for OIPC Inquiry
  • Loading branch information
Aman-Hundal authored Dec 4, 2023
2 parents c1fdc80 + e103866 commit 35a7d86
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
5 changes: 3 additions & 2 deletions forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ const FOIRequest = React.memo(({ userDetail }) => {
_status,
requestExtensions,
});

setRequestStatus(mappedBottomText);
};

Expand Down Expand Up @@ -1045,7 +1045,8 @@ const FOIRequest = React.memo(({ userDetail }) => {
</div>

<div className="foileftpanelstatus">
{bottomTextArray.length > 0 &&
{isOIPCReview && requestDetails.isreopened ? ""
: bottomTextArray.length > 0 &&
_requestStatus &&
_requestStatus.toLowerCase().includes("days") &&
bottomTextArray.map((text) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const OIPCItem = (props) => {
InputLabelProps={{ shrink: true }}
InputProps={{inputProps: { max: formatDate(new Date())} }}
type="date"
error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.receiveddate === null}
error={(!oipc.outcomeid || oipc.outcomeid === 5) && oipc.receiveddate === null || oipc.receiveddate === ""}
required
disabled={oipc.outcomeid && oipc.outcomeid !== 5}
/>
Expand Down Expand Up @@ -367,6 +367,8 @@ const OIPCItem = (props) => {
InputLabelProps={{ shrink: true }}
InputProps={{inputProps: { min: oipc.receiveddate ? formatDate(new Date(oipc.receiveddate)) : null } }}
type="date"
error={oipc.inquiryattributes.orderno ? (!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.inquirydate === null || oipc.inquiryattributes.inquirydate === "" : false}
required={oipc.inquiryattributes.orderno}
disabled={oipc.outcomeid && oipc.outcomeid !== 5}
/>
</Grid>
Expand All @@ -378,6 +380,8 @@ const OIPCItem = (props) => {
value={oipc.inquiryattributes.orderno}
onChange = {(event) => handleInquiryFields(event.target.value, "ORDERNO")}
InputLabelProps={{ shrink: true }}
error={oipc.inquiryattributes.inquirydate ? (!oipc.outcomeid || oipc.outcomeid === 5) && oipc.inquiryattributes.orderno === "" : false}
required={oipc.inquiryattributes.inquirydate}
disabled={oipc.outcomeid && oipc.outcomeid !== 5}
placeholder="Order Number"
/>
Expand Down
8 changes: 7 additions & 1 deletion forms-flow-web/src/components/FOI/FOIRequest/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,13 @@ export const checkValidationError = (
!requiredRequestDetailsValues.requestStartDate ||
!requiredAxisDetails.axisRequestId ||
(oipcData?.length > 0 && isOipcReview && oipcData?.some((oipc) => {
return oipc.oipcno === "" || oipc.receiveddate === null || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null;
if (oipc.inquiryattributes?.inquirydate) {
return oipc.inquiryattributes.orderno === "";
}
if (oipc.inquiryattributes?.orderno) {
return oipc.inquiryattributes?.inquirydate === null || oipc.inquiryattributes?.inquirydate === "";
}
return oipc.oipcno === "" || oipc.receiveddate === null || oipc.receiveddate === "" || oipc.reviewtypeid === null || oipc.reasonid === null || oipc.statusid === null;
}))
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def __preparebaseinfo(self,request,foiministryrequestid,requestministry,requestm
'selectedMinistries':[{'code':requestministry['programarea.bcgovcode'],'id':requestministry['foiministryrequestid'],'name':requestministry['programarea.name'],'selected':'true'}],
'divisions': self.getdivisions(requestministrydivisions),
'isoipcreview': requestministry['isoipcreview'],
'isreopened': self.hasreopened(foiministryrequestid),
'oipcdetails': self.getoipcdetails(foiministryrequestid, requestministry['version']),
'onholdTransitionDate': self.getonholdtransition(foiministryrequestid),
'stateTransition': FOIMinistryRequest.getstatesummary(foiministryrequestid),
Expand Down Expand Up @@ -268,6 +269,14 @@ def getministryrequest(self, foiministryrequestid):
def __genericdateformat(self):
return '%Y-%m-%d'

def hasreopened(self, requestid):
states = FOIMinistryRequest.getstatesummary(requestid)
if len(states) > 0:
current_state = states[0]
if current_state != "Closed" and any(state['status'] == "Closed" for state in states):
return True
return False

def __prepareapplicant(self,firstname= None, middlename= None, lastname= None, businessname= None):
return {
'firstName': firstname,
Expand Down
16 changes: 15 additions & 1 deletion request-management-api/request_api/services/requestservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ def calculateduedate(self, ministryrequestid, foirequest, paymentdate):

def __skipduedatecalculation(self, ministryrequestid, offholddate):
previousoffholddate = FOIMinistryRequest.getlastoffholddate(ministryrequestid)
foiministry_request = FOIMinistryRequest.getrequest(ministryrequestid)
request_reopened = self.__hasreopened(ministryrequestid, "ministryrequest")
if previousoffholddate not in (None, ''):
previouspaymentdate_pst = datetimehandler().convert_to_pst(previousoffholddate)
if datetimehandler().getdate(previouspaymentdate_pst).date() == datetimehandler().getdate(offholddate).date():
return True
if foiministry_request['isoipcreview'] == True and request_reopened:
return True
return False

def __isincludeoffhold(self):
Expand All @@ -165,4 +169,14 @@ def saverestrictedrequest(self,ministryrequestid,type, isrestricted,userid):
version = FOIMinistryRequest.getversionforrequest(ministryrequestid)
FOIRestrictedMinistryRequest.disablerestrictedrequests(ministryrequestid,type,userid)
return FOIRestrictedMinistryRequest.saverestrictedrequest(ministryrequestid,type,isrestricted, version, userid)


def __hasreopened(self, requestid, requesttype):
if requesttype == "rawrequest":
states = FOIRawRequest.getstatesummary(requestid)
else:
states = FOIMinistryRequest.getstatesummary(requestid)
if len(states) > 0:
current_state = states[0]
if current_state != "Closed" and any(state['status'] == "Closed" for state in states):
return True
return False

0 comments on commit 35a7d86

Please sign in to comment.