remove customer reference to bankaccount

This commit is contained in:
Peter Hormanns 2014-07-28 11:57:08 +02:00
parent a027cf8d86
commit 7703bb2821
3 changed files with 64 additions and 64 deletions

View File

@ -93,8 +93,8 @@ public class Customer extends AbstractEntity implements Serializable {
@OneToMany(fetch = EAGER, cascade = ALL, mappedBy = "customer")
private Set<Contact> contacts;
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
private BankAccount bankAccount;
// @OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
// private BankAccount bankAccount;
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer")
@OrderBy("name")
@ -233,13 +233,13 @@ public class Customer extends AbstractEntity implements Serializable {
contacts.add(contact);
}
public BankAccount getBankAccount() {
return bankAccount;
}
public void setBankAccount(BankAccount bankAccount) {
this.bankAccount = bankAccount;
}
// public BankAccount getBankAccount() {
// return bankAccount;
// }
//
// public void setBankAccount(BankAccount bankAccount) {
// this.bankAccount = bankAccount;
// }
public Set<Pac> getPacs() {
return pacs;

View File

@ -36,12 +36,12 @@ public class CustomerModuleImpl extends AbstractModuleImpl {
if (contact.getFirstName() != null && contact.getFirstName().length() > 0) {
custComment = contact.getFirstName() + " " + contact.getLastName();
}
BankAccount bankAccount = newCustomer.getBankAccount();
if (bankAccount == null) {
bankAccount = new BankAccount();
bankAccount.setCustomer(newCustomer);
newCustomer.setBankAccount(bankAccount);
}
// BankAccount bankAccount = newCustomer.getBankAccount();
// if (bankAccount == null) {
// bankAccount = new BankAccount();
// bankAccount.setCustomer(newCustomer);
// newCustomer.setBankAccount(bankAccount);
// }
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
UnixUser custAccount = new UnixUser();

View File

@ -47,17 +47,17 @@ public class CustomerRemote extends AbstractRemote {
}
resultMap.put("sharessigned", Integer.toString(cust.getSharesSigned()));
resultMap.put("uidvat", cust.getUidVAT());
BankAccount bank = cust.getBankAccount();
if (bank != null) {
resultMap.put("autodebit_ga", bank.getAutoDebitGA() != null && bank.getAutoDebitGA() ? "Yes" : "No");
resultMap.put("autodebit_ar", bank.getAutoDebitAR() != null && bank.getAutoDebitAR() ? "Yes" : "No");
resultMap.put("autodebit_op", bank.getAutoDebitOP() != null && bank.getAutoDebitOP() ? "Yes" : "No");
resultMap.put("bank_customer", bank.getBankCustomer());
resultMap.put("bank_iban", bank.getBankIBAN());
resultMap.put("bank_bic", bank.getBankBIC());
resultMap.put("bank_name", bank.getBankName());
resultMap.put("mandat_ref", bank.getMandatRef());
}
// BankAccount bank = cust.getBankAccount();
// if (bank != null) {
// resultMap.put("autodebit_ga", bank.getAutoDebitGA() != null && bank.getAutoDebitGA() ? "Yes" : "No");
// resultMap.put("autodebit_ar", bank.getAutoDebitAR() != null && bank.getAutoDebitAR() ? "Yes" : "No");
// resultMap.put("autodebit_op", bank.getAutoDebitOP() != null && bank.getAutoDebitOP() ? "Yes" : "No");
// resultMap.put("bank_customer", bank.getBankCustomer());
// resultMap.put("bank_iban", bank.getBankIBAN());
// resultMap.put("bank_bic", bank.getBankBIC());
// resultMap.put("bank_name", bank.getBankName());
// resultMap.put("mandat_ref", bank.getMandatRef());
// }
Set<Contact> contacts = cust.getContacts();
if (contacts != null && !contacts.isEmpty()) {
Contact c = contacts.iterator().next();
@ -131,44 +131,44 @@ public class CustomerRemote extends AbstractRemote {
if (assertNotNull(uidVat)) {
cust.setUidVAT(uidVat);
}
BankAccount bank = cust.getBankAccount();
if (bank == null) {
bank = new BankAccount();
bank.setCustomer(cust);
cust.setBankAccount(bank);
bank.setMandatRef(memberNo);
}
String autoDebitGA = (String) setParams.get("autodebit_ga");
if (assertNotNull(autoDebitGA)) {
autoDebitGA = autoDebitGA.toUpperCase();
bank.setAutoDebitGA(new Boolean(autoDebitGA.startsWith("T") || autoDebitGA.startsWith("Y")));
}
String autoDebitAR = (String) setParams.get("autodebit_ar");
if (assertNotNull(autoDebitAR)) {
autoDebitAR = autoDebitAR.toUpperCase();
bank.setAutoDebitAR(new Boolean(autoDebitAR.startsWith("T") || autoDebitAR.startsWith("Y")));
}
String autoDebitOP = (String) setParams.get("autodebit_op");
if (assertNotNull(autoDebitOP)) {
autoDebitOP = autoDebitOP.toUpperCase();
bank.setAutoDebitOP(new Boolean(autoDebitOP.startsWith("T") || autoDebitOP.startsWith("Y")));
}
String bankCustomer = (String) setParams.get("bank_customer");
if (assertNotNull(bankCustomer)) {
bank.setBankCustomer(bankCustomer);
}
String bankIBAN = (String) setParams.get("bank_iban");
if (assertNotNull(bankIBAN)) {
bank.setBankIBAN(bankIBAN);
}
String bankBIC = (String) setParams.get("bank_bic");
if (assertNotNull(bankBIC)) {
bank.setBankBIC(bankBIC);
}
String bankName = (String) setParams.get("bank_name");
if (assertNotNull(bankName)) {
bank.setBankName(bankName);
}
// BankAccount bank = cust.getBankAccount();
// if (bank == null) {
// bank = new BankAccount();
// bank.setCustomer(cust);
// cust.setBankAccount(bank);
// bank.setMandatRef(memberNo);
// }
// String autoDebitGA = (String) setParams.get("autodebit_ga");
// if (assertNotNull(autoDebitGA)) {
// autoDebitGA = autoDebitGA.toUpperCase();
// bank.setAutoDebitGA(new Boolean(autoDebitGA.startsWith("T") || autoDebitGA.startsWith("Y")));
// }
// String autoDebitAR = (String) setParams.get("autodebit_ar");
// if (assertNotNull(autoDebitAR)) {
// autoDebitAR = autoDebitAR.toUpperCase();
// bank.setAutoDebitAR(new Boolean(autoDebitAR.startsWith("T") || autoDebitAR.startsWith("Y")));
// }
// String autoDebitOP = (String) setParams.get("autodebit_op");
// if (assertNotNull(autoDebitOP)) {
// autoDebitOP = autoDebitOP.toUpperCase();
// bank.setAutoDebitOP(new Boolean(autoDebitOP.startsWith("T") || autoDebitOP.startsWith("Y")));
// }
// String bankCustomer = (String) setParams.get("bank_customer");
// if (assertNotNull(bankCustomer)) {
// bank.setBankCustomer(bankCustomer);
// }
// String bankIBAN = (String) setParams.get("bank_iban");
// if (assertNotNull(bankIBAN)) {
// bank.setBankIBAN(bankIBAN);
// }
// String bankBIC = (String) setParams.get("bank_bic");
// if (assertNotNull(bankBIC)) {
// bank.setBankBIC(bankBIC);
// }
// String bankName = (String) setParams.get("bank_name");
// if (assertNotNull(bankName)) {
// bank.setBankName(bankName);
// }
Set<Contact> contacts = cust.getContacts();
Contact c = null;
if (contacts == null || contacts.isEmpty()) {