Skip to content

Commit

Permalink
Merge pull request #9807 from hmislk/Issue#9343_Disable_receive_Button
Browse files Browse the repository at this point in the history
Issue#9343 disable receive button Closes #9343
  • Loading branch information
DeshaniPubudu authored Dec 23, 2024
2 parents 8a2554d + 9f1dfa2 commit 7155698
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev_ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ jobs:
# Check if the application is reachable
for i in {1..5}; do
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$SERVER_IP/rh/faces/index1.xhtml)
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://dev.carecode.org/rh/faces/index1.xhtml)
if [ "$RESPONSE_CODE" == "200" ]; then
echo "Application is reachable and healthy."
break
elif [ "$i" == "5" ]; then
echo "Application is not reachable or unhealthy at http://$SERVER_IP/rh (HTTP $RESPONSE_CODE)"
echo "Application is not reachable or unhealthy at https://dev.carecode.org/rh (HTTP $RESPONSE_CODE)"
break
fi
sleep 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ public void setSelectedDateType(String selectedDateType) {
this.selectedDateType = selectedDateType;
}


public Investigation getInvestigation() {
return investigation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public String navigateToEditRecieveIssue() {
public String navigateToAproveRecieveIssue() {
return "/pharmacy/pharmacy_transfer_receive_approval?faces-redirect=true";
}

public String navigateToReprintRecieveIssue() {
return "/pharmacy/pharmacy_reprint_transfer_receive?faces-redirect=true";
}
Expand Down Expand Up @@ -125,12 +125,11 @@ public void setIssuedBill(Bill issuedBill) {
receivedBill = null;
generateBillComponent();
}

// public String navigateBackToRecieveList(){
// return "/pharmacy/pharmacy_transfer_issued_list_with_approval?faces-redirect=true";
// }

public String navigateToRecieveIssue(){
public String navigateToRecieveIssue() {
return "/pharmacy/pharmacy_transfer_receive_with_approval?faces-redirect=true";
}

Expand Down Expand Up @@ -166,6 +165,27 @@ public void generateBillComponent() {
@EJB
private StockFacade stockFacade;

public String navigateToPharmacyReceiveForRequests() {
if (issuedBill == null || issuedBill.getId() == null) {
JsfUtil.addErrorMessage("No Bill Selected");
return "";
}

if (isAlreadyReceived(issuedBill)) {
JsfUtil.addErrorMessage("Already Received!");
return "";
}

return "/pharmacy/pharmacy_transfer_receive?faces-redirect=true";
}

public boolean isAlreadyReceived(Bill bill) {
if (bill.getForwardReferenceBills() == null || bill.getForwardReferenceBills().isEmpty()) {
return false;
}
return true;
}

public void settle() {

saveBill();
Expand Down Expand Up @@ -423,7 +443,7 @@ public void settleApprove() {

getReceivedBill().setNetTotal(calTotal());
getReceivedBill().setTotal(calTotal());

getIssuedBill().setReferenceBill(getReceivedBill());
getReceivedBill().setReferenceBill(getIssuedBill());

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<persistence version="2.2" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="hmisPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/Ruhunu</jta-data-source>
<jta-data-source>jdbc/ruhunu</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level.sql" value="SEVERE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
ajax="false"
icon="fas fa-check"
class="ui-button-success mx-2"
action="/pharmacy/pharmacy_transfer_receive?faces-redirect=true"
action="#{transferReceiveController.navigateToPharmacyReceiveForRequests()}"
disabled="#{p.cancelled eq true}">
<f:setPropertyActionListener target="#{transferReceiveController.issuedBill}" value="#{p}"/>
</p:commandButton>
Expand Down

0 comments on commit 7155698

Please sign in to comment.