Skip to content

Commit

Permalink
fix NullPointerexception
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudFofou committed Nov 19, 2024
1 parent 7f0556b commit bc799e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
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.
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);
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$
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"));
}
});
}
return jButtonTrashPatient;
Expand Down

0 comments on commit bc799e2

Please sign in to comment.