Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-1363 | Fix NullPointerException on PatientBillEdit #2089

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bundle/language_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ angal.newbill.payment.btn.key
angal.newbill.paymentmadebeforebilldate.msg = Payment made before bill date.
angal.newbill.paymentreceipt.btn = Payment Receipt
angal.newbill.paymentreceipt.btn.key = N
angal.newbill.pleasefindpatientbeforeremotehim.msg = Please find patient first before remove him.
ArnaudFofou marked this conversation as resolved.
Show resolved Hide resolved
angal.newbill.pleaseinsertanameforthepatient.msg = Please insert a name for the patient.
angal.newbill.pleaseselectanitem.txt = Please select an item.
angal.newbill.refund.btn = Refund
Expand Down
27 changes: 15 additions & 12 deletions src/main/java/org/isf/accounting/gui/PatientBillEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ private JPanel getJPanelDate() {
jPanelDate.add(getJCalendarDate());
jPanelDate.add(getJButtonPickPatient());
jPanelDate.add(getJButtonTrashPatient());

if (!GeneralData.getGeneralData().getSINGLEUSER()) {
jPanelDate.add(getJLabelUser());
}
Expand All @@ -846,18 +847,20 @@ private JButton getJButtonTrashPatient() {
jButtonTrashPatient.setIcon(new ImageIcon("rsc/icons/remove_patient_button.png"));
jButtonTrashPatient.setToolTipText(MessageBundle.getMessage("angal.newbill.removethepatientassociatedwiththisbill.tooltip"));
jButtonTrashPatient.addActionListener(actionEvent -> {
// BILL
thisBill.setBillPatient(null);
thisBill.setIsPatient(false);
thisBill.getBillPatient().setCode(0);
ArnaudFofou marked this conversation as resolved.
Show resolved Hide resolved
thisBill.setPatName(""); //$NON-NLS-1$
thisBill.setAdmission(null);
// INTERFACE
jTextFieldPatient.setText("");
jTextFieldPatient.setEditable(false);
jButtonPickPatient.setText(MessageBundle.getMessage("angal.newbill.findpatient.btn"));
jButtonPickPatient.setToolTipText(MessageBundle.getMessage("angal.newbill.associateapatientwiththisbill.tooltip"));
jButtonTrashPatient.setEnabled(false);
if (thisBill.getBillPatient() != null) {
// BILL
thisBill.setBillPatient(null);
thisBill.setIsPatient(false);
thisBill.setPatName(""); //$NON-NLS-1$
ArnaudFofou marked this conversation as resolved.
Show resolved Hide resolved
thisBill.setAdmission(null);
// INTERFACE
jTextFieldPatient.setText("");
jTextFieldPatient.setEditable(false);
jButtonPickPatient.setText(MessageBundle.getMessage("angal.newbill.findpatient.btn"));
jButtonPickPatient.setToolTipText(MessageBundle.getMessage("angal.newbill.associateapatientwiththisbill.tooltip"));
} else {
MessageDialog.info(null, MessageBundle.getMessage("angal.newbill.pleasefindpatientbeforeremotehim.msg"));
ArnaudFofou marked this conversation as resolved.
Show resolved Hide resolved
}
});
}
return jButtonTrashPatient;
Expand Down