This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 9c2a4711664117acab90fef3eff32bca36d1d76b Author: dcosse <cosse@codelutin.com> Date: Tue Jul 28 14:42:15 2015 +0200 refs #1241 modificaction des écans de 1er configuration afin de prendre en compte les changements sur l'identité. --- .../chorem/lima/business/api/AccountService.java | 6 + .../chorem/lima/business/api/EntryBookService.java | 6 + .../chorem/lima/business/api/ImportService.java | 11 ++ .../lima/business/ejb/AccountServiceImpl.java | 7 + .../lima/business/ejb/EntryBookServiceImpl.java | 7 + .../lima/business/ejb/ImportServiceImpl.java | 17 +- .../chorem/lima/ui/importexport/ImportExport.java | 8 + .../opening/{OpeningView.css => BackupPanel.css} | 29 ---- .../org/chorem/lima/ui/opening/BackupPanel.jaxx | 39 +++++ .../{OpeningView.css => BackupPanelHandler.java} | 42 ++--- .../chorem/lima/ui/opening/CreateIdentityPanel.css | 10 +- .../lima/ui/opening/CreateIdentityPanel.jaxx | 64 ++++---- .../ui/opening/CreateIdentityPanelHandler.java | 1 - .../org/chorem/lima/ui/opening/OpeningView.css | 11 +- .../org/chorem/lima/ui/opening/OpeningView.jaxx | 28 +++- .../chorem/lima/ui/opening/OpeningViewHandler.java | 175 +++++++++++++++++---- .../resources/i18n/lima-swing_en_GB.properties | 1 + .../resources/i18n/lima-swing_fr_FR.properties | 1 + 18 files changed, 317 insertions(+), 146 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java index b21482d..5aba6f6 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java @@ -108,4 +108,10 @@ public interface AccountService { List<Account> stringToListAccounts(String selectedAccounts); Account findAccountById(String accountId); + + /** + * Remove all accounts from Lima. + * It's suppose they have no related Entities + */ + void removeAllAccounts(); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java index 4552ade..7e0ccda 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/EntryBookService.java @@ -103,4 +103,10 @@ public interface EntryBookService { * @return All looked for entry books */ List<EntryBook> findAllEntryBookByEntryBookCodes(List<String> entryBookCodes); + + /** + * Remove all Lima Entry Books + * /!\ becarefull they must not be related to other entities + */ + void removeAllEntryBooks(); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java index d3af17f..08cd68b 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/ImportService.java @@ -55,6 +55,17 @@ public interface ImportService { ImportExportResults importEntriesFromEbp(String datas); + /** + * Remove BCR, Financial Transaction and VAT + */ + void removeAccountabilityLayouts(); + + /** + * Remove all entry books + * /!\ be careful, entry books must not be related to other entities + */ + void removeInitallyImportedEntryBook(); + // String importAsPDF(String data, // ImportExportEntityEnum importExportEntityEnum, // boolean saveMode); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java index b19619f..44022e7 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java @@ -305,4 +305,11 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe } return account; } + + @Override + public void removeAllAccounts() { + AccountTopiaDao dao = getDaoHelper().getAccountDao(); + List<Account> accounts = dao.findAll(); + dao.deleteAll(accounts); + } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java index fbdff26..f2df897 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java @@ -202,4 +202,11 @@ public class EntryBookServiceImpl extends AbstractLimaService implements EntryBo } return result; } + + @Override + public void removeAllEntryBooks() { + EntryBookTopiaDao dao = getDaoHelper().getEntryBookDao(); + List<EntryBook> entryBooks = dao.findAll(); + dao.deleteAll(entryBooks); + } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java index a505e8b..9d77b9d 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java @@ -153,15 +153,30 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ }; @Override + public void removeAccountabilityLayouts() { + // vat + vatStatementService.removeAllVatStatement(); + // financialstatement + financialStatementService.removeAllFinancialStatement(); + // accounts + accountService.removeAllAccounts(); + } + + @Override + public void removeInitallyImportedEntryBook() { + entryBookService.removeAllEntryBooks(); + } + + @Override public ImportExportResults importAccountAsCSV(String contents) { ImportExportResults results = new ImportExportResults(); ImportResult result = results.createAddAndGetImportResult(Account.class); - InputStream contentStream = IOUtils.toInputStream(contents); if (StringUtils.isBlank(contents)) { result.addException(new NoDataToImportException()); } else { + InputStream contentStream = IOUtils.toInputStream(contents); try { ImportModel<Account> model = new AccountModel(); Import<Account> accounts = Import.newImport(model, contentStream); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java index 526bfa7..d0d0c47 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java @@ -168,6 +168,14 @@ public class ImportExport { } + public void resetInitialAccountabilityLayoutsImport() { + importService.removeAccountabilityLayouts(); + } + + public void resetInitialImportedEntryBook() { + importService.removeInitallyImportedEntryBook(); + } + public void processImportExport(final ImportExportEnum importExportChoice, boolean verbose) { switch (importExportChoice) { case CSV_ALL_EXPORT: diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css b/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanel.css similarity index 70% copy from lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css copy to lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanel.css index 5c8b8d4..73493ec 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanel.css @@ -19,39 +19,10 @@ * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ -#openingDialog { - modal : true; - title : "lima.opening"; -} - -#identityIcon { - icon : "identity.png"; -} - -#accountsIcon { - icon : "accounts.png"; -} - -#entrybooksIcon { - icon : "entryBooks.png"; -} - -#fiscalperiodsIcon { - icon : "fiscalYears.png"; -} - #welcomeLabel { text : "lima.opening.welcome"; } #importButton { text : "lima.opening.import"; -} - -#cancel { - text : "lima.opening.close"; -} - -#ok { - text : "lima.opening.next"; } \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanel.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanel.jaxx new file mode 100644 index 0000000..4b978b1 --- /dev/null +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanel.jaxx @@ -0,0 +1,39 @@ +<!-- + #%L + Lima :: Swing + %% + Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<JPanel> + + <BackupPanelHandler id="handler" javaBean="new BackupPanelHandler(this)"/> + + <Table> + <row> + <cell> + <JLabel id="welcomeLabel"/> + </cell> + </row> + <row> + <cell> + <JButton id="importButton" + onActionPerformed="handler.importBackup()"/> + </cell> + </row> + </Table> +</JPanel> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css b/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanelHandler.java similarity index 61% copy from lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css copy to lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanelHandler.java index 5c8b8d4..6bfc2a7 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/BackupPanelHandler.java @@ -1,3 +1,5 @@ +package org.chorem.lima.ui.opening; + /* * #%L * Lima :: Swing @@ -19,39 +21,21 @@ * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% */ -#openingDialog { - modal : true; - title : "lima.opening"; -} -#identityIcon { - icon : "identity.png"; -} - -#accountsIcon { - icon : "accounts.png"; -} +import org.chorem.lima.enums.ImportExportEnum; +import org.chorem.lima.ui.importexport.ImportExport; -#entrybooksIcon { - icon : "entryBooks.png"; -} +public class BackupPanelHandler { -#fiscalperiodsIcon { - icon : "fiscalYears.png"; -} + protected BackupPanel view; -#welcomeLabel { - text : "lima.opening.welcome"; -} -#importButton { - text : "lima.opening.import"; -} + public BackupPanelHandler(BackupPanel view) { + this.view = view; + } -#cancel { - text : "lima.opening.close"; + public void importBackup() { + ImportExport importExport = new ImportExport(view); + importExport.importExport(ImportExportEnum.CSV_ALL_IMPORT, null, null, true); + } } - -#ok { - text : "lima.opening.next"; -} \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css index 7d8da6b..91b9aca 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.css @@ -33,6 +33,7 @@ #descriptionTextField { text : {handler.getIdentity().getDescription()}; + rows : 5; } #addressLabel { @@ -41,14 +42,7 @@ #addressTextField { text : {handler.getIdentity().getAddress()}; -} - -#address2Label { - text : "lima.identity.address2"; -} - -#address2TextField { - text : {handler.getIdentity().getAddress2()}; + rows : 5; } #zipCodeLabel { diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx index d99f7f9..f34d862 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanel.jaxx @@ -19,7 +19,7 @@ <http://www.gnu.org/licenses/gpl-3.0.html>. #L% --> -<JPanel> +<JPanel constraints="BorderLayout.CENTER"> <import> org.chorem.lima.ui.opening.CreateIdentityPanelHandler </import> @@ -28,92 +28,84 @@ <Table> <row> - <cell fill="horizontal"> + <cell> <JLabel id="nameLabel" /> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="nameTextField" /> </cell> </row> <row> - <cell fill="horizontal"> - <JLabel id="descriptionLabel"/> - </cell> - <cell fill="horizontal"> - <JTextField id="descriptionTextField"/> - </cell> - </row> - <row> - <cell fill="horizontal"> + <cell> <JLabel id="addressLabel"/> </cell> - <cell fill="horizontal"> - <JTextField id="addressTextField" /> - </cell> - </row> - <row> - <cell fill="horizontal"> - <JLabel id="address2Label"/> - </cell> - <cell fill="horizontal"> - <JTextField id="address2TextField"/> + <cell> + <JTextArea id="addressTextField" /> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel id="zipCodeLabel"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="zipCodeTextField"/> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel text="lima.identity.city"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="cityTextField" /> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel id="businessNumberLabel"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="businessNumberTextField"/> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel id="vatNumberLabel"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="vatNumberTextField"/> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel id="classificationCodeLabel"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="classificationCodeTextField"/> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel id="phoneNumberLabel"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="phoneNumberTextField"/> </cell> </row> <row> - <cell fill="horizontal"> + <cell> <JLabel id="emailLabel"/> </cell> - <cell fill="horizontal"> + <cell> <JTextField id="emailTextField" /> </cell> </row> + <row> + <cell> + <JLabel id="descriptionLabel"/> + </cell> + <cell> + <JTextArea id="descriptionTextField"/> + </cell> + </row> </Table> </JPanel> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java index 97a5f0d..f043022 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/CreateIdentityPanelHandler.java @@ -58,7 +58,6 @@ public class CreateIdentityPanelHandler { identity.setName(view.getNameTextField().getText()); identity.setDescription(view.getDescriptionTextField().getText()); identity.setAddress(view.getAddressTextField().getText()); - identity.setAddress2(view.getAddress2TextField().getText()); identity.setZipCode(view.getZipCodeTextField().getText()); identity.setCity(view.getCityTextField().getText()); identity.setBusinessNumber(view.getBusinessNumberTextField().getText()); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css index 5c8b8d4..8c7ec30 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.css @@ -24,6 +24,11 @@ title : "lima.opening"; } +#backupIcon { + icon : "backup.png"; + border: {BorderFactory.createLineBorder(new Color(0x66, 0xcc, 0x00), 2)} +} + #identityIcon { icon : "identity.png"; } @@ -52,6 +57,10 @@ text : "lima.opening.close"; } -#ok { +#next { text : "lima.opening.next"; +} + +#previous { + text : "lima.opening.previous"; } \ No newline at end of file diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx index 10968ae..d997866 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningView.jaxx @@ -23,7 +23,9 @@ layout="{new BorderLayout()}"> <import> + java.awt.Color javax.swing.BorderFactory + java.awt.FlowLayout javax.swing.ImageIcon jaxx.runtime.SwingUtil </import> @@ -32,13 +34,17 @@ <script> <![CDATA[ - getRootPane().setDefaultButton(ok); + getRootPane().setDefaultButton(next); protected void performNext() { dispose(); } protected void performCancel() { dispose(); } + + void $afterCompleteSetup() { + handler.init(); + } ]]> </script> @@ -48,13 +54,15 @@ <Table> <row> <cell weightx="0.1"> + <JLabel id="backupIcon"/> + </cell> + </row> + <row> + <cell> <JLabel id="identityIcon"/> </cell> <cell weightx="0.9" rows="4" fill="both"> <JPanel id='panel'> - <JLabel id="welcomeLabel"/> - <JButton id="importButton" - onActionPerformed="handler.importBackup()"/> </JPanel> </cell> </row> @@ -77,16 +85,20 @@ </cell> </row> <row weighty="0.1"> - <cell weightx="0.8"> + <cell weightx="0.7"> <JLabel text=''/> </cell> <cell weightx="0.1" fill="none"> <JButton id="cancel" onActionPerformed="performCancel()"/> </cell> - <cell weightx="0.1" fill="none"> - <JButton id="ok" - onActionPerformed="handler.next()"/> + <cell> + <JPanel layout="{new FlowLayout()}"> + <JButton id="previous" + onActionPerformed="handler.previous()"/> + <JButton id="next" + onActionPerformed="handler.next()"/> + </JPanel> </cell> </row> </Table> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java index f2b5b64..0b4a5be 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/opening/OpeningViewHandler.java @@ -53,29 +53,80 @@ public class OpeningViewHandler { protected OpeningView view; + + protected BackupPanel backupPanel; //Panels - private CreateAccountsPanel caPanel; + protected CreateAccountsPanel caPanel; - private CreateIdentityPanel idPanel; + protected CreateIdentityPanel idPanel; - private CreateEntryBookPanel ebPanel; + protected CreateEntryBookPanel ebPanel; - private CreateFiscalPeriodPanel fsPanel; + protected CreateFiscalPeriodPanel fsPanel; public OpeningViewHandler(OpeningView view) { this.view = view; - caPanel = new CreateAccountsPanel(); + backupPanel = new BackupPanel(); idPanel = new CreateIdentityPanel(); + caPanel = new CreateAccountsPanel(); ebPanel = new CreateEntryBookPanel(); fsPanel = new CreateFiscalPeriodPanel(); - step = 0; } + public void init() { + step = 0; + next(); + } - public void importBackup() { + public void previous() { ImportExport importExport = new ImportExport(view); - importExport.importExport(ImportExportEnum.CSV_ALL_IMPORT, null, null, true); - view.dispose(); + JPanel panel = view.getPanel(); + panel.removeAll(); + step = step - 2; + switch (step) { + case 0: + view.getPrevious().setEnabled(false); + view.getIdentityIcon().setBorder(noBorder); + view.getBackupIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(backupPanel); + panel.validate(); + view.repaint(); + step++; + break; + case 1: + //refresh UI + view.getAccountsIcon().setBorder(noBorder); + view.getIdentityIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(idPanel); + panel.validate(); + view.repaint(); + step++; + break; + case 2: + //refresh UI + // remove all accounts + view.getEntrybooksIcon().setBorder(noBorder); + view.getAccountsIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + caPanel.getButtonGroup().setSelectedValue(null); + panel.add(caPanel); + panel.validate(); + view.repaint(); + step++; + break; + case 3: + view.getNext().setText(t("lima.opening.next")); + // remove all entry books + view.getFiscalperiodsIcon().setBorder(noBorder); + view.getEntrybooksIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(ebPanel); + panel.validate(); + view.repaint(); + step++; + break; + default: + break; + } + } public void next() { @@ -84,14 +135,25 @@ public class OpeningViewHandler { panel.removeAll(); switch (step) { case 0: + view.getPrevious().setEnabled(false); //refresh UI + view.getBackupIcon().setBorder(BorderFactory.createLineBorder(green, 2)); + panel.add(backupPanel); + panel.validate(); + view.repaint(); + step++; + break; + case 1: + view.getPrevious().setEnabled(true); + //refresh UI + view.getBackupIcon().setBorder(noBorder); view.getIdentityIcon().setBorder(BorderFactory.createLineBorder(green, 2)); panel.add(idPanel); panel.validate(); view.repaint(); step++; break; - case 1: + case 2: idPanel.getHandler().updateIdentity(); //refresh UI view.getIdentityIcon().setBorder(noBorder); @@ -101,26 +163,10 @@ public class OpeningViewHandler { view.repaint(); step++; break; - case 2: - Object value = caPanel.getButtonGroup().getSelectedValue(); - // if action confirmed - if (value != null) { - if (value instanceof AccountsChartEnum) { - AccountsChartEnum defaultAccountsChartEnum = (AccountsChartEnum) value; - //Import accounts chart - switch (defaultAccountsChartEnum) { - case IMPORT_EBP: - importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT, - null, defaultAccountsChartEnum.getDefaultFileURL(), false); - break; - - default: - importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT, - null, defaultAccountsChartEnum.getDefaultFileURL(), false); - break; - } - } - } + + case 3: + importAccountabilityLayouts(importExport); + view.getAccountsIcon().setBorder(noBorder); view.getEntrybooksIcon().setBorder(BorderFactory.createLineBorder(green, 2)); panel.add(ebPanel); @@ -128,20 +174,23 @@ public class OpeningViewHandler { view.repaint(); step++; break; - case 3: + + case 4: if (ebPanel.getImportEntryBook().isSelected()) { importExport.importExport(ImportExportEnum.CSV_ENTRYBOOKS_IMPORT, null, EntryBooksChartEnum.DEFAULT.getDefaultFileURL(), false); + } else { + importExport.resetInitialImportedEntryBook(); } view.getEntrybooksIcon().setBorder(noBorder); view.getFiscalperiodsIcon().setBorder(BorderFactory.createLineBorder(green, 2)); panel.add(fsPanel); panel.validate(); - view.getOk().setText(t("lima.opening.end")); + view.getNext().setText(t("lima.opening.end")); view.repaint(); step++; break; - case 4: + case 5: try { FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); fiscalPeriod.setBeginDate(fsPanel.getBeginDatePicker().getDate()); @@ -157,6 +206,66 @@ public class OpeningViewHandler { } } view.dispose(); + break; + } + } + + protected void importAccountabilityLayouts(ImportExport importExport) { + Object value = caPanel.getButtonGroup().getSelectedValue(); + // if action confirmed + if (value != null) { + // reset previous imported values + importExport.resetInitialAccountabilityLayoutsImport(); + + AccountsChartEnum defaultAccountsChartEnum = (AccountsChartEnum) value; + //Import accounts chart + switch (defaultAccountsChartEnum) { + case IMPORT_EBP: + importExport.importExport(ImportExportEnum.EBP_ACCOUNTCHARTS_IMPORT, + null, defaultAccountsChartEnum.getDefaultFileURL(), false); + break; + + default: + importExport.importExport(ImportExportEnum.CSV_ACCOUNTCHARTS_IMPORT, + null, defaultAccountsChartEnum.getDefaultFileURL(), false); + break; + } + //Import financialstatement + switch (defaultAccountsChartEnum) { + case SHORTENED: + importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT, + null, defaultAccountsChartEnum.getDefaultFileURL(), false); + break; + case DEVELOPED: + importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT, + null, FinancialStatementsChartEnum.DEVELOPED.getDefaultFileUrl() , false); + break; + default: + importExport.importExport(ImportExportEnum.CSV_FINANCIALSTATEMENTS_IMPORT, + null, FinancialStatementsChartEnum.BASE.getDefaultFileUrl(), false); + break; + } + //Import vatstatement + switch (defaultAccountsChartEnum) { + case SHORTENED: + + importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, + null, VatStatementsChartEnum.SHORTENED.getDefaultFileUrl(), false); + break; + case BASE: + importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, + null, VatStatementsChartEnum.BASE.getDefaultFileUrl(), false); + break; + case DEVELOPED: + importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, + null, VatStatementsChartEnum.DEVELOPED.getDefaultFileUrl(), false); + break; + default: + importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT, + null, VatStatementsChartEnum.DEFAULT.getDefaultFileUrl(), false); + break; + } + } } } diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index 4f79843..5eeb591 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -483,6 +483,7 @@ lima.opening.entryBook=Select it to import default entry books lima.opening.fiscalPeriod=Create fiscal period lima.opening.import=Import a CSV backup lima.opening.next=Next +lima.opening.previous=Previous lima.opening.welcome=<html><center>Welcome to Lima<br/>this assistant help you to start your business accounting in the blink of an eye<br/>OR import instantly your already existing save in CSV format<br/><br/><br/><br/></center></html> lima.paste=Paste lima.preferences=Preferences diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index ef47c97..9747eee 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -490,6 +490,7 @@ lima.opening.entryBook=<html>Cochez la case pour importer les journaux par défa lima.opening.fiscalPeriod=Création de l'exercice lima.opening.import=Importer une sauvegarde CSV lima.opening.next=Suivant +lima.opening.previous=Retour lima.opening.welcome=<html><center>Bienvenue dans Lima<br/>Laissez vous guider par cet assistant pour démarrer votre comptabilité en quelques instants <br/>Ou bien importer directement une ancienne sauvegarde de LIMA au format CSV<br/><br/><br/><br/></center></html> lima.paste=Coller lima.preferences=Préférences -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.