Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/AboPanel.java |
---|
240,6 → 240,7 |
SubscriptionChecker checker = new SubscriptionChecker(elt.getTable()); |
Map<SQLRow, Calendar> listLastCreateElt = checker.check(); |
Date today = new Date(); |
for (SQLRow rowAbonnement : listLastCreateElt.keySet()) { |
// FIXME On recupere des abonnements archives (à tester sur BD 2Si) |
249,8 → 250,9 |
Calendar date = listLastCreateElt.get(rowAbonnement); |
if (date == null) { |
date = rowsCmd.getDate("DATE"); |
} |
date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type)); |
} |
while (date.getTime().compareTo(today) < 0) { |
// Si l'abonnement n'est pas expiré |
if (rowAbonnement.getObject("DATE_FIN_" + type) == null || date.compareTo(rowAbonnement.getDate("DATE_FIN_" + type)) <= 0) { |
270,7 → 272,9 |
ExceptionHandler.handle("Erreur lors de la création " + elt.getSingularName() + " d'abonnement.", exn); |
} |
} |
date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type)); |
} |
} |
} |
} |
} |
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/FacturesAboPanel.java |
---|
75,11 → 75,13 |
idMvt = sqlRowAccessor.getInt("ID_MOUVEMENT"); |
if (idMvt > 1) { |
// on supprime tout ce qui est lié à la facture |
System.err.println("Archivage des fils"); |
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE"); |
eltEcr.archiveMouvementProfondeur(idMvt, false); |
} |
} |
System.err.println("Regeneration des ecritures"); |
if (idMvt > 1) { |
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/Module.java |
---|
2,6 → 2,7 |
import java.awt.event.ActionEvent; |
import java.io.IOException; |
import java.sql.SQLException; |
import java.util.Calendar; |
import javax.swing.AbstractAction; |
49,7 → 50,7 |
} |
@Override |
protected void install(DBContext ctxt) { |
protected void install(DBContext ctxt) throws SQLException, IOException { |
super.install(ctxt); |
if (ctxt.getLastInstalledVersion() == null) { |
82,21 → 83,6 |
createTable.addColumn("NB_MOIS_COMMANDE", "int DEFAULT 3"); |
createTable.addColumn("CREATE_COMMANDE", "boolean DEFAULT false"); |
// ctxt.manipulateData(new IClosure<DBRoot>() { |
// @Override |
// public void executeChecked(DBRoot input) { |
// // Undefined Affaire |
// SQLRowValues rowVals = new SQLRowValues(input.getTable("ABONNEMENT")); |
// try { |
// rowVals.insert(); |
// } catch (SQLException exn) { |
// // TODO Bloc catch auto-généré |
// exn.printStackTrace(); |
// } |
// |
// } |
// }); |
AlterTableRestricted alterNumero = ctxt.getAlterTable("NUMEROTATION_AUTO"); |
alterNumero.addVarCharColumn("ABONNEMENT_FORMAT", 128); |
alterNumero.addIntegerColumn("ABONNEMENT_START", 1); |
113,6 → 99,9 |
alterCmd.addForeignColumn("ID_ABONNEMENT", createTable); |
alterCmd.addColumn("CREATION_AUTO_VALIDER", "boolean DEFAULT false"); |
ctxt.executeSQL(); |
SQLRowValues rowVals = new SQLRowValues(ctxt.getRoot().getTable("ABONNEMENT")); |
rowVals.insert(); |
} |
} |
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/SubscriptionChecker.java |
---|
47,6 → 47,8 |
vals.put("NUMERO", null); |
vals.put("DATE", null); |
vals.put("ID_ABONNEMENT", null); |
vals.put("PREVISIONNELLE", null); |
vals.put("CREATION_AUTO_VALIDER", null); |
final SQLRowValuesListFetcher fetcher = new SQLRowValuesListFetcher(vals); |
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
92,7 → 94,7 |
Calendar calStartFact = sqlRow.getDate("DATE_DEBUT_" + this.type); |
SQLRowValues rowFact = map.get(sqlRow.getID()); |
if (rowFact != null) { |
if (rowFact.getObject("CREATION_AUTO_VALIDER") != null && rowFact.getBoolean("CREATION_AUTO_VALIDER")) { |
if (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 |