Author: bpoussin Date: 2013-02-24 04:00:17 +0100 (Sun, 24 Feb 2013) New Revision: 317 Url: http://chorem.org/projects/chorem/repository/revisions/317 Log: certain client on change de nom, il faut supporter les deux Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java Modified: trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-23 18:22:33 UTC (rev 316) +++ trunk/chorem-entities/src/main/java/org/chorem/ImportChoremTopia.java 2013-02-24 03:00:17 UTC (rev 317) @@ -455,6 +455,13 @@ System.out.println(String.format("%s contracts loaded", count)); } + protected String getPayerId(String proposed, String codelutin) { + if (StringUtils.equals(codelutin, proposed)) { + return null; + } + return proposed; + } + @Step(4) public void importInvoices(String filename) { System.out.println(String.format("Try to import invoices '%s'", filename)); @@ -497,6 +504,18 @@ Set<String> unknowCustomers = new HashSet<String>(); for (Company c : customerResult) { customers.put(c.getName(), c.getWikittyId()); + // ajout d'alias pour certain client qui ont change de nom + if ("Ecole des Mines Nantes - EMN".equals(c.getName())) { + customers.put("Ecole des Mines Nantes", c.getWikittyId()); + } else if ("IRSTEA".equals(c.getName())) { + customers.put("Cemagref", c.getWikittyId()); + } else if ("IRSTEA".equals(c.getName())) { + customers.put("Cemagref", c.getWikittyId()); + } else if ("Herboristerie Cailleau".equals(c.getName())) { + customers.put("Cailleau Herboristerie", c.getWikittyId()); + } else if ("XWiki SAS".equals(c.getName())) { + customers.put("XPertNet", c.getWikittyId()); + } } // Pour les supplier @@ -537,7 +556,8 @@ InvoiceImpl invoice = new InvoiceImpl(); invoice.setCategory(categories.get(category)); invoice.setBeneficiary(codeLutinId); - invoice.setPayer(customers.get(company)); + // code lutin, ne peut pas etre le beneficiaire et le payer en meme temps + invoice.setPayer(getPayerId(customers.get(company), codeLutinId)); invoice.setReference(number); invoice.setAmount(amount); invoice.setVAT(19.6);