OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 29 → Rev 30

/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/LeadSQLElement.java
New file
0,0 → 1,64
package org.openconcerto.modules.customerrelationship.lead;
 
import java.util.ArrayList;
import java.util.List;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.GlobalMapper;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.group.Group;
import org.openconcerto.utils.CollectionMap;
 
public class LeadSQLElement extends ComptaSQLConfElement {
public static final String ELEMENT_CODE = "customerrelationship.lead";
 
public LeadSQLElement() {
super(Module.TABLE_LEAD, "un prospect", "prospects");
}
 
@Override
protected String createCode() {
return ELEMENT_CODE;
}
 
@Override
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("COMPANY");
l.add("FIRSTNAME");
l.add("NAME");
return l;
}
 
@Override
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("COMPANY");
l.add("FIRSTNAME");
l.add("NAME");
return l;
}
 
@Override
protected List<String> getPrivateFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_ADRESSE");
return l;
}
 
@Override
public CollectionMap<String, String> getShowAs() {
return CollectionMap.singleton(null, getComboFields());
}
 
@Override
public SQLComponent createComponent() {
final String groupId = this.getCode() + ".default";
final Group group = GlobalMapper.getInstance().getGroup(groupId);
if (group == null) {
throw new IllegalStateException("No group found for id " + groupId);
}
return new LeadSQLComponent(this, group);
}
 
}
/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/labels.xml
New file
0,0 → 1,24
<?xml version="1.0" encoding="UTF-8" ?>
<ROOT>
<TABLE name="LEAD">
<FIELD name="NAME" label="Nom" />
<FIELD name="NUMBER" label="Numéro" titlelabel="N°" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="COMPANY" label="Entreprise" titlelabel="Entreprise" />
<FIELD name="FIRSTNAME" label="Prénom" titlelabel="Prénom" />
<FIELD name="PHONE" label="Téléphone" titlelabel="Téléphone" />
<FIELD name="MOBILE" label="Mobile" titlelabel="Mobile" />
<FIELD name="FAX" label="Fax" titlelabel="Fax" />
<FIELD name="EMAIL" label="Email" titlelabel="Email" />
<FIELD name="WEBSITE" label="Site internet" titlelabel="Site internet" />
<FIELD name="ID_ADRESSE" label="Adresse" titlelabel="Adresse" />
<FIELD name="INFORMATION" label="Description" titlelabel="Description" />
<FIELD name="INDUSTRY" label="Secteur d'activité" titlelabel="Secteur" />
<FIELD name="REVENUE" label="Chiffre d'affaire" titlelabel="C.A." />
<FIELD name="EMPLOYEES" label="Nombre de salariés" titlelabel="Salariés" />
<FIELD name="RATING" label="Évaluation" titlelabel="Évaluation" />
<FIELD name="SOURCE" label="Origine du contact" titlelabel="Origine" />
<FIELD name="STATUS" label="Status" titlelabel="Status" />
<FIELD name="ID_COMMERCIAL" label="Assigné à" titlelabel="Assigné à" />
</TABLE>
</ROOT>
/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/LeadGroup.java
New file
0,0 → 1,54
package org.openconcerto.modules.customerrelationship.lead;
 
import org.openconcerto.ui.group.Group;
import org.openconcerto.ui.group.LayoutHints;
 
public class LeadGroup extends Group {
 
public LeadGroup() {
super("customerrelationship.lead.default");
final Group g = new Group("customerrelationship.lead.identifier");
g.add("NUMBER");
g.add("DATE");
g.add("COMPANY", LayoutHints.DEFAULT_LARGE_FIELD_HINTS);
this.add(g);
 
final Group gContact = new Group("customerrelationship.lead.person");
gContact.add("NAME");
gContact.add("FIRSTNAME");
this.add(gContact, LayoutHints.DEFAULT_SEPARATED_GROUP_HINTS);
 
final Group gCustomer = new Group("customerrelationship.lead.contact");
gCustomer.add("PHONE");
gCustomer.add("MOBILE");
gCustomer.add("FAX");
gCustomer.add("EMAIL", LayoutHints.DEFAULT_LARGE_FIELD_HINTS);
gCustomer.add("WEBSITE", LayoutHints.DEFAULT_LARGE_FIELD_HINTS);
this.add(gCustomer, LayoutHints.DEFAULT_SEPARATED_GROUP_HINTS);
 
final Group gAddress = new Group("customerrelationship.lead.address");
gAddress.add("ID_ADRESSE");
this.add(gAddress, LayoutHints.DEFAULT_SEPARATED_GROUP_HINTS);
 
final Group gInfos = new Group("customerrelationship.lead.info");
gInfos.add("INFORMATION", new LayoutHints(true, true, true, true, true));
gInfos.add("INDUSTRY");
gInfos.add("REVENUE");
gInfos.add("EMPLOYEES");
this.add(gInfos);
 
final Group gState = new Group("customerrelationship.lead.state");
gState.add("RATING");
gState.add("SOURCE");
gState.add("STATUS");
gState.add("ID_COMMERCIAL");
this.add(gState);
 
}
 
public static void main(String[] args) {
final LeadGroup leadGroup = new LeadGroup();
leadGroup.dumpTwoColumn();
leadGroup.dumpOneColumn();
}
}
/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/ModuleResources_fr.properties
New file
0,0 → 1,2
name=Prospects
description=Gestion des prospects
/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/Module.java
New file
0,0 → 1,103
package org.openconcerto.modules.customerrelationship.lead;
 
import java.io.File;
import java.io.IOException;
 
import org.openconcerto.erp.config.Gestion;
import org.openconcerto.erp.config.MainFrame;
import org.openconcerto.erp.modules.AbstractModule;
import org.openconcerto.erp.modules.ComponentsContext;
import org.openconcerto.erp.modules.DBContext;
import org.openconcerto.erp.modules.ModuleFactory;
import org.openconcerto.erp.modules.ModuleManager;
import org.openconcerto.erp.modules.ModulePackager;
import org.openconcerto.erp.modules.RuntimeModuleFactory;
import org.openconcerto.sql.element.GlobalMapper;
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.SQLRequestLog;
import org.openconcerto.sql.ui.ConnexionPanel;
import org.openconcerto.sql.utils.SQLCreateTable;
 
public final class Module extends AbstractModule {
 
public static final String TABLE_LEAD = "LEAD";
 
public Module(ModuleFactory f) throws IOException {
super(f);
}
 
@Override
protected void install(DBContext ctxt) {
super.install(ctxt);
// TODO use version to upgrade
if (!ctxt.getTablesPreviouslyCreated().contains(TABLE_LEAD)) {
final SQLCreateTable createTable = ctxt.getCreateTable(TABLE_LEAD);
 
createTable.addVarCharColumn("NUMBER", 20);
createTable.addDateAndTimeColumn("DATE");
createTable.addVarCharColumn("FIRSTNAME", 64);
createTable.addVarCharColumn("NAME", 64);
createTable.addVarCharColumn("COMPANY", 64);
//
createTable.addVarCharColumn("PHONE", 16);
createTable.addVarCharColumn("MOBILE", 16);
createTable.addVarCharColumn("FAX", 16);
createTable.addVarCharColumn("EMAIL", 32);
createTable.addVarCharColumn("WEBSITE", 64);
//
createTable.addVarCharColumn("SOURCE", 200);
createTable.addVarCharColumn("STATUS", 50);
//
createTable.addForeignColumn("ADRESSE");
createTable.addForeignColumn("COMMERCIAL");
//
createTable.addVarCharColumn("INFORMATION", 512);
//
createTable.addVarCharColumn("INDUSTRY", 200);
createTable.addVarCharColumn("RATING", 200);
 
createTable.addIntegerColumn("REVENUE", 0);
createTable.addIntegerColumn("EMPLOYEES", 0);
 
}
}
 
@Override
protected void setupElements(SQLElementDirectory dir) {
super.setupElements(dir);
GlobalMapper.getInstance().map("customerrelationship.lead.default", new LeadGroup());
final LeadSQLElement element = new LeadSQLElement();
dir.addSQLElement(element);
 
}
 
@Override
protected void setupComponents(ComponentsContext ctxt) {
ctxt.addMenuItem(ctxt.createListAction(TABLE_LEAD), MainFrame.LIST_MENU);
}
 
@Override
protected void start() {
}
 
@Override
protected void stop() {
}
 
public static void main(String[] args) throws IOException {
System.setProperty(ConnexionPanel.QUICK_LOGIN, "true");
final File propsFile = new File("module.properties");
System.out.println(propsFile.getAbsolutePath());
final ModuleFactory factory = new RuntimeModuleFactory(propsFile);
SQLRequestLog.setEnabled(true);
SQLRequestLog.showFrame();
// uncomment to create and use the jar
final ModulePackager modulePackager = new ModulePackager(propsFile, new File("bin/"));
modulePackager.writeToDir(new File("../OpenConcerto/Modules"));
// final ModuleFactory factory = new JarModuleFactory(jar);
ModuleManager.getInstance().addFactories(new File("../OpenConcerto/Modules"));
ModuleManager.getInstance().addFactoryAndStart(factory, false);
Gestion.main(args);
}
 
}
/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/LeadSQLComponent.java
New file
0,0 → 1,43
package org.openconcerto.modules.customerrelationship.lead;
 
import java.util.HashSet;
import java.util.Set;
 
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
 
import org.openconcerto.sql.element.GroupSQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.component.ComboLockedMode;
import org.openconcerto.ui.group.Group;
 
public class LeadSQLComponent extends GroupSQLComponent {
public LeadSQLComponent(SQLElement element, Group group) {
super(element, group);
}
 
@Override
protected Set<String> createRequiredNames() {
final Set<String> s = new HashSet<String>(1);
s.add("ID_ADRESSE");
return s;
}
 
@Override
public JComponent getEditor(String id) {
if (id.equals("INFORMATION")) {
final JTextArea jTextArea = new JTextArea();
jTextArea.setFont(new JLabel().getFont());
return new JScrollPane(jTextArea);
} else if (id.equals("INDUSTRY") || id.equals("STATUS") || id.equals("RATING") || id.equals("SOURCE")) {
return new SQLSearchableTextCombo(ComboLockedMode.UNLOCKED, 1, 20, false);
} else if (id.equals("DATE")) {
return new JDate(true);
}
return super.getEditor(id);
}
}
/trunk/Modules/Module Lead/src/org/openconcerto/modules/customerrelationship/lead/ModuleResources.properties
New file
0,0 → 1,2
name=Leads
description=Adds leads support
/trunk/Modules/Module Lead/.classpath
New file
0,0 → 1,7
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenConcerto GoogleCode"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/Modules/Module Lead/.project
New file
0,0 → 1,17
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Module Lead</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>