OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Comparer les révisions

Ignorer les espaces blanc Révision 168 → Révision 169

/trunk/Modules/Module Subscription/.settings/org.eclipse.jdt.core.prefs
1,11 → 1,11
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.8
/trunk/Modules/Module Subscription/.classpath
1,7 → 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"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/CheckArticleAction.java
Nouveau fichier
0,0 → 1,59
package org.openconcerto.modules.subscription;
 
import java.awt.event.ActionEvent;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
 
import javax.swing.AbstractAction;
 
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
 
public class CheckArticleAction extends AbstractAction {
 
private DBRoot root;
 
public CheckArticleAction(DBRoot root) {
this.root = root;
}
 
@Override
public void actionPerformed(ActionEvent e) {
 
SQLTable tableDevisElt = this.root.getTable("DEVIS_ELEMENT");
SQLTable tableCmd = this.root.getTable("COMMANDE_CLIENT_ELEMENT");
SQLTable tableFacture = this.root.getTable("SAISIE_VENTE_FACTURE_ELEMENT");
SQLTable tableAvoir = this.root.getTable("AVOIR_CLIENT_ELEMENT");
 
List<SQLTable> tables = Arrays.asList(tableDevisElt, tableCmd, tableFacture, tableAvoir);
for (SQLTable sqlTable : tables) {
SQLSelect sel = new SQLSelect();
 
sel.addSelect(sqlTable.getField("CODE"));
sel.addSelect(sqlTable.getField("NOM"));
 
Where w = new Where(sqlTable.getField("ID_ARTICLE"), "=", 1);
sel.setWhere(w);
List<SQLRow> res = SQLRowListRSH.execute(sel);
for (SQLRow sqlRow : res) {
int id = ReferenceArticleSQLElement.getIdForCN(sqlRow.asRowValues(), false);
if (id > 1) {
try {
sqlRow.createEmptyUpdateRow().put("ID_ARTICLE", id).update();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
 
}
 
}
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/FacturesAboPanel.java
94,7 → 94,7
 
private boolean checkUniciteNumero(String num, int idFact) {
SQLTable tableFacture = Configuration.getInstance().getRoot().findTable("SAISIE_VENTE_FACTURE");
final SQLSelect selNum = new SQLSelect(tableFacture.getDBSystemRoot(), true);
final SQLSelect selNum = new SQLSelect();
selNum.addSelect(tableFacture.getKey(), "COUNT");
final Where w = new Where(tableFacture.getField("NUMERO"), "=", num);
selNum.setWhere(w);
108,12 → 108,12
 
@Override
protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
// TODO Raccord de méthode auto-généré
super.injectRow(row, rowVals, dateNew, rowAbonnement);
rowVals.put("NUMERO", "ABO--" + NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class));
rowVals.put("ID_ADRESSE", row.getObject("ID_ADRESSE"));
rowVals.put("ID_COMPTE_PCE_SERVICE", row.getObject("ID_COMPTE_PCE_SERVICE"));
rowVals.put("PORT_HT", row.getObject("PORT_HT"));
rowVals.put("NET_A_PAYER", row.getObject("T_TTC"));
rowVals.put("REMISE_HT", row.getObject("REMISE_HT"));
 
rowVals.put("NOM", row.getObject("NOM"));
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/AboPanel.java
17,6 → 17,7
import javax.swing.JPanel;
import javax.swing.SwingWorker;
 
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.modules.subscription.SubscriptionChecker;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
225,6 → 226,11
if (row.getTable().contains("ID_AFFAIRE")) {
rowVals.put("ID_AFFAIRE", row.getObject("ID_AFFAIRE"));
}
if (row.getTable().contains("ID_TAXE_PORT") && !row.isForeignEmpty("ID_TAXE_PORT")) {
rowVals.put("ID_TAXE_PORT", row.getObject("ID_TAXE_PORT"));
} else {
rowVals.put("ID_TAXE_PORT", TaxeCache.getCache().getFirstTaxe().getID());
}
}
 
/**
251,7 → 257,7
if (date == null) {
date = rowsCmd.getDate("DATE");
}
date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type));
// date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type));
while (date.getTime().compareTo(today) < 0) {
 
// Si l'abonnement n'est pas expiré
266,6 → 272,7
try {
 
rowVals.commit();
 
// FIXME Voir avec Guillaume create or not create document
} catch (SQLException exn) {
 
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/SubscriptionChecker.java
47,7 → 47,10
vals.put("NUMERO", null);
vals.put("DATE", null);
vals.put("ID_ABONNEMENT", null);
vals.put("PREVISIONNELLE", null);
final boolean containsPrev = this.table.contains("PREVISIONNELLE");
if (containsPrev) {
vals.put("PREVISIONNELLE", null);
}
vals.put("CREATION_AUTO_VALIDER", null);
 
final SQLRowValuesListFetcher fetcher = new SQLRowValuesListFetcher(vals);
75,7 → 78,7
}
 
// Verification du renouvellement des abonnements
SQLSelect selAb = new SQLSelect(this.table.getDBSystemRoot(), true);
SQLSelect selAb = new SQLSelect();
SQLTable tableAb = Configuration.getInstance().getRoot().findTable("ABONNEMENT");
selAb.addSelectStar(tableAb);
List<SQLRow> rows = SQLRowListRSH.execute(selAb);
94,7 → 97,7
Calendar calStartFact = sqlRow.getDate("DATE_DEBUT_" + this.type);
SQLRowValues rowFact = map.get(sqlRow.getID());
if (rowFact != null) {
if (rowFact.getObject("PREVISIONNELLE") != null && !rowFact.getBoolean("PREVISIONNELLE")) {
if (!containsPrev || (rowFact.getObject("PREVISIONNELLE") != null && !rowFact.getBoolean("PREVISIONNELLE"))) {
calStartFact = rowFact.getDate("DATE");
} else {
// Si le dernier element de l'abonnement n'a pas été validé on ne crée pas
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/element/SubscriptionSQLComponent.java
20,7 → 20,6
import javax.swing.SwingConstants;
 
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
import org.openconcerto.erp.core.sales.quote.element.DevisSQLElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
53,7 → 52,6
labelNumero.setVisible(b);
labelDate.setVisible(b);
textNumero.setVisible(b);
 
date.setVisible(b);
client.setVisible(b);
}
150,7 → 148,6
this.addView(textDescription, "DESCRIPTION");
this.addView(client, "ID_CLIENT");
 
// Codé mais jamais lancé.. a verifier: nom des champs
}
 
private Component createTypeAboComponent(String type, String idName) {
180,11 → 177,6
c.gridx++;
c.weightx = 1;
final ElementComboBox item = new ElementComboBox();
// SQLElement elt =
// Configuration.getInstance().getDirectory().getElement(getTable().getForeignTable(idName));
// ComboSQLRequest req = new ComboSQLRequest(elt.getComboRequest(true),
// Arrays.asList(elt.getTable().getField("NUMERO"), elt.getTable().getField("ID_CLIENT")));
// item.init(elt, req);
panel.add(item, c);
 
// Start
241,15 → 233,7
return panel;
}
 
// @Override
// protected SQLRowValues createDefaults() {
// SQLRowValues rowVals = new SQLRowValues(getTable());
// return super.createDefaults();
// }
 
public void setFieldEnabled(JComponent item, JComponent startDate, JComponent stopDate, JComponent textPeriod, boolean b) {
System.err.println(b);
// Thread.dumpStack();
item.setEnabled(b);
startDate.setEnabled(b);
stopDate.setEnabled(b);
265,7 → 249,6
 
@Override
public void select(SQLRowAccessor r) {
// TODO Auto-generated method stub
super.select(r);
if (r != null) {
this.textNumero.setIdSelected(r.getID());
274,14 → 257,13
 
@Override
public int insert(SQLRow order) {
// TODO Auto-generated method stub
int id = super.insert(order);
// incrémentation du numéro auto
if (NumerotationAutoSQLElement.getNextNumero(DevisSQLElement.class).equalsIgnoreCase(this.textNumero.getText().trim())) {
if (NumerotationAutoSQLElement.getNextNumero(SubscriptionSQLElement.class).equalsIgnoreCase(this.textNumero.getText().trim())) {
final SQLRowValues rowVals = new SQLRowValues(this.tableNum);
int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(DevisSQLElement.class));
int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(SubscriptionSQLElement.class));
val++;
rowVals.put(NumerotationAutoSQLElement.getLabelNumberFor(DevisSQLElement.class), new Integer(val));
rowVals.put(NumerotationAutoSQLElement.getLabelNumberFor(SubscriptionSQLElement.class), val);
try {
rowVals.update(2);
} catch (final SQLException e) {
291,9 → 273,4
return id;
}
 
@Override
public void update() {
// TODO Auto-generated method stub
super.update();
}
}
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/element/SubscriptionSQLElement.java
18,18 → 18,26
 
@Override
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>();
l.add("NUMERO");
l.add("DATE");
l.add("NOM");
l.add("ID_CLIENT");
l.add("DESCRIPTION");
l.add("DATE_DEBUT_FACTURE");
l.add("DATE_FIN_FACTURE");
l.add("NB_MOIS_FACTURE");
l.add("DATE_DEBUT_DEVIS");
l.add("DATE_FIN_DEVIS");
l.add("NB_MOIS_DEVIS");
l.add("DATE_DEBUT_COMMANDE");
l.add("DATE_FIN_COMMANDE");
l.add("NB_MOIS_COMMANDE");
return l;
}
 
@Override
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
final List<String> l = new ArrayList<>(3);
l.add("NUMERO");
l.add("NOM");
l.add("ID_CLIENT");
48,6 → 56,6
 
@Override
protected String createCode() {
return createCodeFromPackage();
return "subscription";
}
}