Skip to content

Commit 14fe53a

Browse files
authored
Merge pull request #11587 from hmislk/11399-phone-number-validation-for-sale-for-cashier
11399 phone number validation for sale for cashier
2 parents aa1a5a7 + 6a9e0d7 commit 14fe53a

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

src/main/java/com/divudi/bean/pharmacy/AmpController.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,11 +655,19 @@ private void saveVmp() {
655655

656656
public void save() {
657657
if (current == null) {
658-
JsfUtil.addErrorMessage("Nothuing selected");
658+
JsfUtil.addErrorMessage("No AMP is selected");
659659
return;
660660
}
661+
662+
if(current.getId() != null){
663+
if(!configOptionApplicationController.getBooleanValueByKey("Enable edit and delete AMP from Pharmacy Administration.", false)){
664+
JsfUtil.addErrorMessage("You have no privilage to edit AMPs.");
665+
return;
666+
}
667+
}
668+
661669
if (current.getName() == null || current.getName().isEmpty()) {
662-
JsfUtil.addErrorMessage("No Name");
670+
JsfUtil.addErrorMessage("Please add a name to AMP");
663671
return;
664672
}
665673

@@ -681,6 +689,7 @@ public void save() {
681689
JsfUtil.addErrorMessage("No VMP selected");
682690
return;
683691
}
692+
684693
if (current.getCategory() == null) {
685694
if (current.getVmp().getCategory() != null) {
686695
current.setCategory(current.getVmp().getCategory());

src/main/java/com/divudi/bean/pharmacy/PharmacySaleController.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,21 @@ public void settlePreBill() {
20672067
false
20682068
);
20692069

2070+
if (configOptionApplicationController.getBooleanValueByKey("Patient Phone number is mandotary in sale for cashier", true)) {
2071+
if (getPatient().getPatientPhoneNumber() == null && getPatient().getPatientMobileNumber() == null) {
2072+
JsfUtil.addErrorMessage("Please enter phone number of the patient");
2073+
return;
2074+
} else if (getPatient().getId() == null) {
2075+
if (getPatient().getPatientPhoneNumber() != null && !(String.valueOf(getPatient().getPatientPhoneNumber()).length() >= 10)) {
2076+
JsfUtil.addErrorMessage("Please enter valid phone number with more than 10 digits of the patient");
2077+
return;
2078+
} else if (getPatient().getPatientMobileNumber() != null && !(String.valueOf(getPatient().getPatientMobileNumber()).length() >= 10)) {
2079+
JsfUtil.addErrorMessage("Please enter valid mobile number with more than 10 digits of the patient");
2080+
return;
2081+
}
2082+
}
2083+
}
2084+
20702085
Patient pt = null;
20712086
if (patientRequiredForPharmacySale) {
20722087
if (getPatient() == null

src/main/webapp/pharmacy/admin/amp.xhtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
icon="fa fa-trash"
3838
onclick="if (!confirm('Are you sure you want to delete this record?'))
3939
return false;" action="#{ampController.delete()}"
40+
disabled="#{!configOptionApplicationController.getBooleanValueByKey('Enable edit and delete AMP from Pharmacy Administration.', false)}"
4041
value="Delete"
4142
update="acAmp gpDetail msg" process="btnDelete"
4243
class="m-1 ui-button-danger w-25">

src/main/webapp/pharmacy/pharmacy_bill_retail_sale_1.xhtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,8 @@
712712

713713
<p:commandButton icon="fas fa-file-invoice" value="Sale 1" action="pharmacy_bill_retail_sale?faces-redirect=true" rendered="#{webUserController.hasPrivilege('PharmacySale')}" actionListener="#{pharmacySaleController.pharmacyRetailSale()}" />
714714
<p:commandButton icon="fas fa-file-invoice" disabled="true" value="Sale 2" action="pharmacy_bill_retail_sale_1?faces-redirect=true" rendered="#{webUserController.hasPrivilege('PharmacySale')}" actionListener="#{pharmacySaleController1.pharmacyRetailSale()}" />
715-
<p:commandButton icon="fas fa-file-invoice" value="Sale 3" action="pharmacy_bill_retail_sale_2?faces-redirect=true" rendered="#{webUserController.hasPrivilege('PharmacySale')}" actionListener="#{pharmacySaleController12.pharmacyRetailSale()}" />
716-
<p:commandButton icon="fas fa-file-invoice" value="Sale 4" action="pharmacy_bill_retail_sale_3?faces-redirect=true" rendered="#{webUserController.hasPrivilege('PharmacySale')}" actionListener="#{pharmacySaleController13.pharmacyRetailSale()}" />
715+
<p:commandButton icon="fas fa-file-invoice" value="Sale 3" action="/pharmacy/pharmacy_bill_retail_sale_2?faces-redirect=true" rendered="#{webUserController.hasPrivilege('PharmacySale')}" actionListener="#{pharmacySaleController2.pharmacyRetailSale()}" />
716+
<p:commandButton icon="fas fa-file-invoice" value="Sale 4" action="pharmacy_bill_retail_sale_3?faces-redirect=true" rendered="#{webUserController.hasPrivilege('PharmacySale')}" actionListener="#{pharmacySaleController3.pharmacyRetailSale()}" />
717717

718718

719719
</div>

0 commit comments

Comments
 (0)