Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/element/ProjectSQLElement.java |
---|
8,6 → 8,7 |
import javax.swing.SwingUtilities; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement; |
import org.openconcerto.sql.Configuration; |
16,7 → 17,10 |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.request.ComboSQLRequest; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.sqlobject.JUniqueTextField; |
import org.openconcerto.sql.view.EditFrame; |
24,6 → 28,7 |
import org.openconcerto.ui.component.ITextArea; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import org.openconcerto.utils.cc.ITransformer; |
public class ProjectSQLElement extends ComptaSQLConfElement { |
35,6 → 40,9 |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("ID_CLIENT"); |
if (getTable().contains("ID_SOCIETE_COMMON")) { |
l.add("ID_SOCIETE_COMMON"); |
} |
l.add("ID_TYPE_AFFAIRE"); |
l.add("NUMERO"); |
l.add("ID_ETAT_AFFAIRE"); |
43,7 → 51,26 |
return l; |
} |
protected void _initComboRequest(ComboSQLRequest req) { |
super._initComboRequest(req); |
if (getTable().contains("ID_SOCIETE_COMMON")) { |
final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration.getInstance()); |
final int socID = comptaPropsConfiguration.getSocieteID(); |
req.setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
Where w = new Where(getTable().getField("ID_SOCIETE_COMMON"), "=", (Object) null).or(new Where(getTable().getField("ID_SOCIETE_COMMON"), "=", 1)) |
.or(new Where(getTable().getField("ID_SOCIETE_COMMON"), "=", socID)); |
input.andWhere(w); |
return input; |
} |
}); |
} |
} |
@Override |
protected List<String> getComboFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("NUMERO"); |
77,7 → 104,9 |
this.addView("ID_CLIENT", "1;" + REQ); |
this.addView("ID_COMMERCIAL", "1"); |
this.addView("ID_DEVIS", "1"); |
if (getTable().contains("ID_SOCIETE_COMMON")) { |
this.addView("ID_SOCIETE_COMMON", "1"); |
} |
this.addView("ID_TYPE_AFFAIRE", "1;left"); |
final ElementComboBox boxEtatAffaire = new ElementComboBox(); |
this.addView(boxEtatAffaire, "ID_ETAT_AFFAIRE", "1;left;" + REQ); |