r2888 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/account lima-swing/src/main/java/org/chorem/lima/ui/account/model lima-swing/src/main/java/org/chorem/lima/ui/accountsreports
Author: jpepin Date: 2010-05-07 20:27:12 +0200 (Fri, 07 May 2010) New Revision: 2888 Url: http://chorem.org/repositories/revision/lima/2888 Log: Suppression de la fiche d'identit?\195?\169 pour les comptes de tiers, am?\195?\169lioration visualisation des comptes Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-07 18:27:12 UTC (rev 2888) @@ -22,7 +22,6 @@ import java.util.List; import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.Identity; /** * Account service. @@ -47,7 +46,7 @@ */ void createAccount(Account masterAccount, Account account) throws LimaException; - void createSubLedger(Account masterAccount, Account account, Identity identity) throws LimaException; + void createSubLedger(Account masterAccount, Account account) throws LimaException; void updateAccount(Account account) throws LimaException; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-07 18:27:12 UTC (rev 2888) @@ -38,8 +38,6 @@ import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountDAO; import org.chorem.lima.entity.EntryDAO; -import org.chorem.lima.entity.Identity; -import org.chorem.lima.entity.IdentityDAO; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; @@ -135,7 +133,7 @@ * Permet de créer des comptes tiers */ @Override - public void createSubLedger(Account masterAccount, Account account, Identity identity) + public void createSubLedger(Account masterAccount, Account account) throws LimaException { //check rules before create the account @@ -160,11 +158,6 @@ accountDAO.create(account); - IdentityDAO identityDAO = - LimaCallaoDAOHelper.getIdentityDAO(transaction); - identityDAO.create(identity); - account.setIdentity(identity); - // check if the masteraccount exist; if (masterAccount != null) { masterAccount.addSubLedgers(account); @@ -344,14 +337,6 @@ TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - //Check if the account is a subledger - Identity existIdentity = account.getIdentity(); - if (existIdentity != null) { - // update identity - IdentityDAO identityDAO = - LimaCallaoDAOHelper.getIdentityDAO(transaction); - identityDAO.update(existIdentity); - } // update account AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(transaction); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-07 18:27:12 UTC (rev 2888) @@ -379,18 +379,20 @@ try { topiaTransaction = rootContext.beginTransaction(); EntryDAO entryDAO= LimaCallaoDAOHelper.getEntryDAO(topiaTransaction); - - if (beginDate != null && endDate != null && account != null) { + TopiaQuery query = entryDAO.createQuery(); + + if (account != null) { + query + .add(Entry.ACCOUNT, account); + } + if (beginDate != null && endDate != null){ String transactionDateProperty = TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TRANSACTION_DATE); - TopiaQuery query = entryDAO.createQuery("E"); - query - .add(Entry.ACCOUNT, account) - .add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") + query.add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") .addParam("beginDate", beginDate) .addParam("endDate", endDate); - entries=entryDAO.findAllByQuery(query); } - + entries=entryDAO.findAllByQuery(query); + //IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION for (Entry entry : entries) { entry.getEntryBook(); Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-05-07 18:27:12 UTC (rev 2888) @@ -30,9 +30,6 @@ import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; -import org.chorem.lima.entity.Identity; -import org.chorem.lima.entity.IdentityDAO; -import org.chorem.lima.entity.IdentityImpl; import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.chorem.lima.ui.account.model.AccountTreeTableModel; import org.chorem.lima.ui.account.AccountForm; @@ -130,13 +127,10 @@ Account newAccount = new AccountImpl(); SubLedgerForm subledgerForm = new SubLedgerForm(view); subledgerForm.setAccount(newAccount); - Identity newIdentity = new IdentityImpl(); - subledgerForm.setIdentity(newIdentity); // jaxx constructor don't call super() ? subledgerForm.setLocationRelativeTo(view); subledgerForm.setVisible(true); newAccount=subledgerForm.getAccount(); - newIdentity=subledgerForm.getIdentity(); // null == cancel action if (newAccount != null) { @@ -147,7 +141,7 @@ // add it try { accountsTreeTableModel. - addSubLedger(treePath, newAccount, newIdentity); + addSubLedger(treePath, newAccount); } catch (LimaBusinessException ex) { if (log.isErrorEnabled()) { log.error("Can't add subledger", ex); @@ -177,7 +171,7 @@ int selectedRow = view.getAccountsTreeTable().getSelectedRow(); TreePath treePath = view.getAccountsTreeTable().getPathForRow(selectedRow); // not null Account selectedObject = (Account)treePath.getLastPathComponent(); - //TODO update Account or update SubLedger + //update Account or update SubLedger if (selectedObject != null) { // get current selection path if ( selectedRow != -1) { @@ -185,43 +179,42 @@ } else { treePath = new TreePath(accountsTreeTableModel.getRoot()); } - //test if selectedrow is account or ledger - Identity existIdentity = selectedObject.getIdentity(); - // if is an account or subaccount - if (existIdentity == null) { - AccountForm accountForm = new AccountForm(view); - accountForm.setAccount(selectedObject); - // jaxx constructor don't call super() ? - accountForm.setLocationRelativeTo(view); - accountForm.setVisible(true); - // null == cancel action - selectedObject = accountForm.getAccount(); + //test if selectedrow is account or ledger + + if (selectedObject.getGeneralLedger()==null){ + //TODO pepin 20100507 + AccountForm accountForm = new AccountForm(view); + accountForm.setAccount(selectedObject); + // jaxx constructor don't call super() ? + accountForm.setLocationRelativeTo(view); + accountForm.setVisible(true); + // null == cancel action + selectedObject = accountForm.getAccount(); } - // else is a subledger - else{ - SubLedgerForm subLedgerForm = new SubLedgerForm(view); - subLedgerForm.setAccount(selectedObject); - subLedgerForm.setIdentity(existIdentity); - // jaxx constructor don't call super() ? - subLedgerForm.setLocationRelativeTo(view); - subLedgerForm.setVisible(true); - // null == cancel action - selectedObject = subLedgerForm.getAccount(); - } - //if action confirmed - if (selectedObject != null){ - // update it - try { - - accountsTreeTableModel. - updateAccount(treePath, selectedObject); - } catch (LimaException ex) { - if (log.isErrorEnabled()) { - log.error("Can't add update", ex); - } - ErrorHelper.showErrorDialog("Can't add update", ex); - } + // else is a subledger + else{ + SubLedgerForm subLedgerForm = new SubLedgerForm(view); + subLedgerForm.setAccount(selectedObject); + // jaxx constructor don't call super() ? + subLedgerForm.setLocationRelativeTo(view); + subLedgerForm.setVisible(true); + // null == cancel action + selectedObject = subLedgerForm.getAccount(); + } + //if action confirmed + if (selectedObject != null){ + // update it + try { + + accountsTreeTableModel. + updateAccount(treePath, selectedObject); + } catch (LimaException ex) { + if (log.isErrorEnabled()) { + log.error("Can't add update", ex); + } + ErrorHelper.showErrorDialog("Can't add update", ex); } + } } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-05-07 18:27:12 UTC (rev 2888) @@ -18,7 +18,6 @@ <JDialog defaultCloseOperation="dispose_on_close" modal="true"> <org.chorem.lima.entity.Account id="account" javaBean='null'/> - <org.chorem.lima.entity.Identity id="identity" javaBean='null'/> <Boolean id="addState" javaBean='true'/> @@ -66,128 +65,19 @@ onActionPerformed="getAccount().setType((String)getTypeComboBox().getSelectedItem())"/> </cell> </row> - <!-- NAME CONTACT--> + <!-- Lien Fiche contact--> <row> <cell fill="horizontal"> - <JLabel text="lima.identity.name"/> - </cell> - <cell fill="horizontal"> - <JTextField id="nameIdentityTextField" text="{getIdentity().getName()}"/> - <javax.swing.text.Document javaBean="getNameIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setName(getNameIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setName(getNameIdentityTextField().getText())' /> - </cell> - <cell fill="horizontal"> <JLabel text="lima.identity.contact"/> </cell> <cell fill="horizontal"> - <JTextField id="contactIdentityTextField" text="{getIdentity().getContact()}"/> - <javax.swing.text.Document javaBean="getContactIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setContact(getContactIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setContact(getContactIdentityTextField().getText())' /> + <JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/> + <javax.swing.text.Document javaBean="getThirdPartyTextField().getDocument()" + onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())' + onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())' /> </cell> </row> - <!-- SIRET--> <row> - <cell fill="horizontal"> - <JLabel text="lima.identity.siret"/> - </cell> - <cell fill="horizontal"> - <JTextField id="SiretIdentityTextField" text="{getIdentity().getSiret()}"/> - <javax.swing.text.Document javaBean="getSiretIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setSiret(getSiretIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setSiret(getSiretIdentityTextField().getText())' /> - </cell> - </row> - <!-- ADDRESS --> - <row> - <cell fill="horizontal"> - <JLabel text="lima.identity.address"/> - </cell> - <cell fill="horizontal"> - <JTextField id="addressIdentityTextField" text="{getIdentity().getAddress()}"/> - <javax.swing.text.Document javaBean="getAddressIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setAddress(getAddressIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setAddress(getAddressIdentityTextField().getText())' /> - </cell> - </row> - <!-- ZIPCODE CITY--> - <row> - <cell fill="horizontal"> - <JLabel text="lima.identity.zipcode"/> - </cell> - <cell fill="horizontal"> - <JTextField id="ZipCodeIdentityTextField" text="{getIdentity().getZipCode()}"/> - <javax.swing.text.Document javaBean="getZipCodeIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setZipCode(getZipCodeIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setZipCode(getZipCodeIdentityTextField().getText())' /> - </cell> - <cell fill="horizontal"> - <JLabel text="lima.identity.city"/> - </cell> - <cell fill="horizontal"> - <JTextField id="cityIdentityTextField" text="{getIdentity().getCity()}"/> - <javax.swing.text.Document javaBean="getCityIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setCity(getCityIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setCity(getCityIdentityTextField().getText())' /> - </cell> - </row> - <!-- COUNTRY--> - <row> - <cell fill="horizontal"> - <JLabel text="lima.identity.country"/> - </cell> - <cell fill="horizontal"> - <JTextField id="CountryIdentityTextField" text="{getIdentity().getCountry()}"/> - <javax.swing.text.Document javaBean="getCountryIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setCountry(getCountryIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setCountry(getCountryIdentityTextField().getText())' /> - </cell> - </row> - <!-- PHONE FAX--> - <row> - <cell fill="horizontal"> - <JLabel text="lima.identity.phone"/> - </cell> - <cell fill="horizontal"> - <JTextField id="phoneIdentityTextField" text="{getIdentity().getPhone()}"/> - <javax.swing.text.Document javaBean="getPhoneIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setPhone(getPhoneIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setPhone(getPhoneIdentityTextField().getText())' /> - </cell> - <cell fill="horizontal"> - <JLabel text="lima.identity.fax"/> - </cell> - <cell fill="horizontal"> - <JTextField id="faxIdentityTextField" text="{getIdentity().getFax()}"/> - <javax.swing.text.Document javaBean="getFaxIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setFax(getFaxIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setFax(getFaxIdentityTextField().getText())' /> - </cell> - </row> - <!-- fin fiche identite EMAIL WEBSITE--> - <row> - <cell fill="horizontal"> - <JLabel text="lima.identity.email"/> - </cell> - <cell fill="horizontal"> - <JTextField id="emailIdentityTextField" text="{getIdentity().getEmail()}"/> - <javax.swing.text.Document javaBean="getEmailIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setEmail(getEmailIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setEmail(getEmailIdentityTextField().getText())' /> - </cell> - <cell fill="horizontal"> - <JLabel text="lima.identity.website"/> - </cell> - <cell fill="horizontal"> - <JTextField id="websiteIdentityTextField" text="{getIdentity().getWebsite()}"/> - <javax.swing.text.Document javaBean="getWebsiteIdentityTextField().getDocument()" - onInsertUpdate='getIdentity().setWebsite(getWebsiteIdentityTextField().getText())' - onRemoveUpdate='getIdentity().setWebsite(getWebsiteIdentityTextField().getText())' /> - </cell> - </row> - <!-- fin fiche identite --> - <row> <cell fill="none"> <JButton text="lima.common.ok" onActionPerformed="dispose()"/> </cell> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/model/AccountTreeTableModel.java 2010-05-07 18:27:12 UTC (rev 2888) @@ -31,7 +31,6 @@ import org.chorem.lima.business.LimaException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; -import org.chorem.lima.entity.Identity; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.account.AccountViewHandler; import org.jdesktop.swingx.treetable.AbstractTreeTableModel; @@ -231,13 +230,13 @@ * @param account * @throws LimaException */ - public void addSubLedger(TreePath path, Account account, Identity identity) throws LimaException { + public void addSubLedger(TreePath path, Account account) throws LimaException { // Calling account service Account parentAccount = (Account)path.getLastPathComponent(); if (parentAccount == getRoot()) { parentAccount = null; } - accountService.createSubLedger(parentAccount, account, identity); + accountService.createSubLedger(parentAccount, account); int index = getIndexOfChild(path.getLastPathComponent(), account); modelSupport.fireChildAdded(path, index, account); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-05-07 16:27:07 UTC (rev 2887) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-05-07 18:27:12 UTC (rev 2888) @@ -178,31 +178,33 @@ public void setBeginDate(Date date){ selectedBeginDate = date; - log.debug(date); - } + cacheDataList=getDataList(); + fireTableDataChanged(); } public void setEndDate(Date date){ selectedEndDate = date; - log.debug(date); + cacheDataList=getDataList(); + fireTableDataChanged(); } - /** - * @param entryBook - * @throws LimaException - */ + public void setAccount(Account account) { - if (account != null){ - selectedAccount = account; - try { - log.debug(selectedAccount); - cacheDataList = financialTransactionService.getAllEntriesForAccount(selectedAccount, selectedBeginDate, selectedEndDate); + selectedAccount = account; + cacheDataList=getDataList(); + fireTableDataChanged(); + } + + public List<Entry> getDataList(){ + List<Entry> results = new ArrayList<Entry>(); + try { + results = financialTransactionService.getAllEntriesForAccount(selectedAccount, selectedBeginDate, selectedEndDate); + } + catch (LimaException eee) { + if (log.isErrorEnabled()) { + log.debug("Can't update model", eee); } - catch (LimaException eee) { - if (log.isErrorEnabled()) { - log.debug("Can't update model", eee); - } - ErrorHelper.showErrorDialog("Can't get entries list", eee); - } + ErrorHelper.showErrorDialog("Can't get entries list", eee); } + return results; } }
participants (1)
-
jpepin@users.chorem.org