Skip to content

Commit

Permalink
Merge branch 'dev-feature-pmt37-csv-import'
Browse files Browse the repository at this point in the history
  • Loading branch information
lugipfupf committed Feb 15, 2017
2 parents 62117ab + 218dc22 commit 82120b2
Show file tree
Hide file tree
Showing 25 changed files with 2,041 additions and 107 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/openbravo/data/gui/Populator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2016 Beat Luginbühl <[email protected]>
*
* 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/>.
*/
package com.openbravo.data.gui;

/**
*
* @author Beat Luginbühl <[email protected]>
*/
@FunctionalInterface
public interface Populator<T> {
public void populate(T data);
}
80 changes: 54 additions & 26 deletions src/main/java/com/openbravo/pos/customers/DataLogicCustomers.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.openbravo.format.Formats;
import com.openbravo.pos.forms.AppLocal;
import com.openbravo.pos.forms.BeanFactoryDataSingle;
import com.openbravo.pos.forms.DataLogicSales;

/**
* @author JG uniCenta
Expand All @@ -48,6 +49,36 @@ public class DataLogicCustomers extends BeanFactoryDataSingle {
Datas.BOOLEAN,
Datas.STRING};

private static final String[] fields = new String[]
{
"ID",
"TAXID",
"SEARCHKEY",
"NAME",
"NOTES",
"VISIBLE",
"CARD",
"MAXDEBT",
"CURDATE",
"CURDEBT",
"FIRSTNAME",
"LASTNAME",
"EMAIL",
"PHONE",
"PHONE2",
"FAX",
"ADDRESS",
"ADDRESS2",
"POSTAL",
"CITY",
"REGION",
"COUNTRY",
"TAXCATEGORY",
"IMAGE"
};

private static String baseSentence;

/**
*
* @param s
Expand All @@ -58,31 +89,7 @@ public void init(Session s){
this.s = s;
tcustomers = new TableDefinition(s
, "CUSTOMERS"
, new String[] {
"ID",
"TAXID",
"SEARCHKEY",
"NAME",
"NOTES",
"VISIBLE",
"CARD",
"MAXDEBT",
"CURDATE",
"CURDEBT",
"FIRSTNAME",
"LASTNAME",
"EMAIL",
"PHONE",
"PHONE2",
"FAX",
"ADDRESS",
"ADDRESS2",
"POSTAL",
"CITY",
"REGION",
"COUNTRY",
"TAXCATEGORY",
"IMAGE" }
, fields
, new String[] {
"ID",
AppLocal.getIntString("label.taxid"),
Expand Down Expand Up @@ -160,6 +167,14 @@ public void init(Session s){
Formats.NULL }
, new int[] {0}
);

StringBuilder sqlBuilder = new StringBuilder("SELECT ");
for (int i = 0; i < fields.length; i++) {
sqlBuilder.append(fields[i]);
sqlBuilder.append(", ");
}
sqlBuilder.append(" FROM CUSTOMERS");
this.baseSentence = sqlBuilder.toString();
}

// JG 20 Sept 12 extended for Postal - CustomerList list
Expand Down Expand Up @@ -299,5 +314,18 @@ public int execInTransaction(Object params) throws BasicException {
*/
public final TableDefinition getTableCustomers() {
return tcustomers;
}
}

public CustomerInfoExt findCustomersBy(String field, Object value) {

StringBuilder sqlBuilder = new StringBuilder(this.baseSentence);
sqlBuilder.append(" WHERE ");
sqlBuilder.append(field);
sqlBuilder.append(" = ?");

PreparedSentence sentence = new PreparedSentence(this.s, sqlBuilder.toString());

// will be implemented for next release
return null;
}
}
Loading

0 comments on commit 82120b2

Please sign in to comment.