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 140 → Révision 141

/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/ModuleOperation.java
166,6 → 166,7
 
MainFrame.getInstance().getTabbedPane().addTab("Planning", comp);
MainFrame.getInstance().getTabbedPane().addTab("Planning journalier", comp2);
MainFrame.getInstance().getTabbedPane().addTab("Chantiers", new GanttChantierPanel());
MainFrame.getInstance().getTabbedPane().setSelectedIndex(1);
}
 
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/GanttChantierPanel.java
Nouveau fichier
0,0 → 1,30
package org.openconcerto.modules.operation;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.Calendar;
 
import javax.swing.JPanel;
 
import org.jopencalendar.ui.YearActivityPanel;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
public class GanttChantierPanel extends JPanel {
public GanttChantierPanel() {
this.setOpaque(false);
final int year = Calendar.getInstance().get(Calendar.YEAR);
final OperationCalendarManager manager = new OperationCalendarManager("Gantt");
final YearActivityPanel p = new YearActivityPanel(manager, year);
p.setPrintButtonVisible(false);
p.setOpaque(false);
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
c.insets = new Insets(0, 0, 0, 0);
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
this.add(p, c);
 
}
}
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/MultiOperationSQLComponent.java
5,6 → 5,7
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
22,6 → 23,9
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSyntax;
import org.openconcerto.sql.model.SQLSystem;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.SQLTextCombo;
172,39 → 176,36
private List<Number> multipleInsertCalendarGroups(int numberOfRowToCreate, String name, String description) {
final List<Number> ids = new ArrayList<Number>();
//
final DBRoot root = ComptaPropsConfiguration.getInstanceCompta().getRootSociete();
SQLTable tCalendarItemGroup = root.getTable("CALENDAR_ITEM_GROUP");
String query = "INSERT INTO " + tCalendarItemGroup.getQuotedName();
query += " (\"NAME\", \"DESCRIPTION\", \"ORDRE\") select " + SQLBase.quoteStringStd(name) + ", " + SQLBase.quoteStringStd(description) + ", COALESCE(MAX(\"ORDRE\"), 0) + 1 ";
query += "FROM " + tCalendarItemGroup.getQuotedName() + " RETURNING \"ID\"";
SQLTable tCalendarItemGroup = getDirectory().getElement("CALENDAR_ITEM_GROUP").getTable();
if (tCalendarItemGroup.getServer().getSQLSystem().equals(SQLSystem.POSTGRESQL)) {
final SQLSyntax syntax = this.getTable().getDBSystemRoot().getSyntax();
final List<String> fields = Arrays.asList("NAME", "DESCRIPTION", "ORDRE");
final List<List<String>> values = new ArrayList<List<String>>(numberOfRowToCreate);
for (int i = 0; i < numberOfRowToCreate; i++) {
final List<String> row = new ArrayList<String>(fields.size());
row.add(syntax.quoteString(name));
row.add(syntax.quoteString(description));
row.add("( select COALESCE(MAX(\"ORDRE\"), 0) + " + (i + 1) + " from " + tCalendarItemGroup.getQuotedName() + " )");
values.add(row);
}
 
final List<String> queries = new ArrayList<String>(numberOfRowToCreate);
final List<ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(numberOfRowToCreate);
final ResultSetHandler handler = new ResultSetHandler() {
 
@Override
public Object handle(ResultSet rs) throws SQLException {
if (rs.next()) {
return rs.getObject(1);
}
return null;
try {
ids.addAll(SQLRowValues.insertIDs(tCalendarItemGroup, "(" + SQLSyntax.quoteIdentifiers(fields) + ") " + syntax.getValues(values, fields.size())));
} catch (Exception e) {
e.printStackTrace();
}
};
 
for (int i = 0; i < numberOfRowToCreate; i++) {
queries.add(query);
handlers.add(handler);
}
 
try {
final List<?> r = SQLUtils.executeMultiple(this.getTable().getDBSystemRoot(), queries, handlers);
for (Object object : r) {
if (object instanceof Number) {
ids.add((Number) object);
} else {
SQLRowValues v = new SQLRowValues(tCalendarItemGroup);
v.put("NAME", name);
v.put("DESCRIPTION", description);
int i = 0;
try {
for (i = 0; i < numberOfRowToCreate; i++) {
ids.add(v.insert().getIDNumber());
}
} catch (SQLException e) {
throw new IllegalStateException("cannot insert rowvalues " + i + " [" + numberOfRowToCreate + "]", e);
}
} catch (Exception e) {
e.printStackTrace();
}
 
return ids;
215,44 → 216,50
 
final List<Number> ids = new ArrayList<Number>();
int size = calendarGroupIds.size();
final List<String> queries = new ArrayList<String>(size);
final List<ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(size);
final ResultSetHandler handler = new ResultSetHandler() {
if (this.getTable().getServer().getSQLSystem().equals(SQLSystem.POSTGRESQL)) {
final SQLSyntax syntax = this.getTable().getDBSystemRoot().getSyntax();
final List<String> fields = Arrays.asList("ID_SITE", "STATUS", "TYPE", "DESCRIPTION", "PLANNER_UID", "PLANNER_XML", "ID_USER_COMMON", "ID_CALENDAR_ITEM_GROUP", "ORDRE");
final List<List<String>> values = new ArrayList<List<String>>(size);
for (int i = 0; i < size; i++) {
final List<String> row = new ArrayList<String>(fields.size());
row.add(String.valueOf(idSite));
row.add(syntax.quoteString(status));
row.add(syntax.quoteString(type));
row.add(syntax.quoteString(description));
row.add(syntax.quoteString(plannerUid));
row.add(syntax.quoteString(plannerXML));
row.add(String.valueOf(idUser));
row.add(String.valueOf(calendarGroupIds.get(i).longValue()));
row.add("( select COALESCE(MAX(\"ORDRE\"), 0) + " + (i + 1) + " from " + this.getTable().getQuotedName() + " )");
values.add(row);
}
 
@Override
public Object handle(ResultSet rs) throws SQLException {
if (rs.next()) {
return rs.getObject(1);
}
return null;
try {
ids.addAll(SQLRowValues.insertIDs(getTable(), "(" + SQLSyntax.quoteIdentifiers(fields) + ") " + syntax.getValues(values, fields.size())));
} catch (Exception e) {
e.printStackTrace();
}
};
 
for (int i = 0; i < size; i++) {
String query = "INSERT INTO " + getTable().getQuotedName();
query += " (\"ID_SITE\", \"STATUS\", \"TYPE\", \"DESCRIPTION\", \"PLANNER_UID\", \"PLANNER_XML\", \"ID_USER_COMMON\", \"ID_CALENDAR_ITEM_GROUP\" , \"ORDRE\") ";
query += "select " + idSite + ", " + SQLBase.quoteStringStd(status) + ", " + SQLBase.quoteStringStd(type) + ", " + SQLBase.quoteStringStd(description) + ", "
+ SQLBase.quoteStringStd(plannerUid) + ", " + SQLBase.quoteStringStd(plannerXML) + ", " + idUser + ", " + calendarGroupIds.get(i).longValue()
+ ", COALESCE(MAX(\"ORDRE\"), 0) + 1 ";
query += "FROM " + getTable().getQuotedName() + " RETURNING \"ID\"";
 
queries.add(query);
handlers.add(handler);
}
 
try {
final List<?> r = SQLUtils.executeMultiple(this.getTable().getDBSystemRoot(), queries, handlers);
for (Object object : r) {
if (object instanceof Number) {
ids.add((Number) object);
} else {
final SQLRowValues v = new SQLRowValues(getTable());
v.put("ID_SITE", idSite);
v.put("STATUS", status);
v.put("TYPE", type);
v.put("DESCRIPTION", description);
v.put("PLANNER_UID", plannerUid);
v.put("PLANNER_XML", plannerXML);
v.put("ID_USER_COMMON", idUser);
int i = 0;
try {
for (i = 0; i < size; i++) {
v.put("ID_CALENDAR_ITEM_GROUP", calendarGroupIds.get(i));
ids.add(v.insert().getIDNumber());
}
} catch (SQLException e) {
throw new IllegalStateException("cannot insert rowvalues " + i + " [" + size + "]", e);
}
} catch (Exception e) {
e.printStackTrace();
}
 
return ids;
 
}
 
private void multipleInsertCalendarItems(List<Number> calendarGroupIds, List<Number> operationsIds, List<DateRange> ranges, String summary, String description, String status) {
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/OperationCalendarManager.java
1,36 → 1,52
package org.openconcerto.modules.operation;
 
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.swing.SwingUtilities;
 
import org.jopencalendar.model.Flag;
import org.jopencalendar.model.JCalendarItem;
import org.jopencalendar.model.JCalendarItemGroup;
import org.jopencalendar.ui.JCalendarItemProvider;
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowMode;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.model.graph.PathBuilder;
import org.openconcerto.sql.users.User;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.ui.date.DateRange;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.StringUtils;
import org.openconcerto.utils.cc.ITransformer;
 
public class OperationCalendarManager extends JCalendarItemProvider {
private DBRoot root;
 
public OperationCalendarManager(String name) {
super(name);
this.root = ComptaPropsConfiguration.getInstanceCompta().getRootSociete();
}
 
public OperationCalendarManager(String name, DBRoot root) {
super(name);
this.root = root;
}
 
private List<User> users;
private List<String> states;
private boolean hideLocked = false;
55,6 → 71,19
return getItemInWeek(week, year, this.users, this.states);
}
 
@Override
public List<JCalendarItem> getItemInYear(int year, int week1, int week2) {
final Calendar c = Calendar.getInstance();
c.clear();
c.set(Calendar.YEAR, year);
c.set(Calendar.WEEK_OF_YEAR, week1);
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
final Date date1 = c.getTime();
c.set(Calendar.WEEK_OF_YEAR, week2);
final Date date2 = c.getTime();
return getItemIn(date1, date2, this.users, this.states);
}
 
private List<JCalendarItem> getItemInWeek(final int week, final int year, final List<User> selectedUsers, final List<String> selectedStates) {
final Calendar c = Calendar.getInstance();
c.clear();
68,6 → 97,10
}
 
public List<JCalendarItem> getItemIn(final Date date1, final Date date2, List<User> selectedUsers, final List<String> selectedStates) {
return getItemIn(date1, date2, selectedUsers, selectedStates, null);
}
 
public List<JCalendarItem> getItemIn(final Date date1, final Date date2, List<User> selectedUsers, final List<String> selectedStates, final String uid) {
final List<User> users = new ArrayList<User>();
if (selectedUsers == null) {
users.addAll(UserManager.getInstance().getAllActiveUsers());
80,10 → 113,8
if (selectedStates != null && selectedStates.isEmpty()) {
return Collections.emptyList();
}
final DBRoot root = ComptaPropsConfiguration.getInstanceCompta().getRootSociete();
 
final SQLRowValues valCalendarItems = new SQLRowValues(root.getTable("CALENDAR_ITEM"));
valCalendarItems.putNulls("START", "END", "DURATION_S", "SUMMARY", "DESCRIPTION", "FLAGS", "STATUS", "SOURCE_ID", "SOURCE_TABLE");
valCalendarItems.putNulls("START", "END", "DURATION_S", "SUMMARY", "DESCRIPTION", "FLAGS", "STATUS", "SOURCE_ID", "SOURCE_TABLE", "UID", "LOCATION");
final SQLRowValues valsCalendarItemsGroup = valCalendarItems.putRowValues("ID_CALENDAR_ITEM_GROUP");
valsCalendarItemsGroup.put("NAME", null);
 
102,7 → 133,20
 
@Override
public SQLSelect transformChecked(SQLSelect input) {
input.andWhere(new Where(valCalendarItems.getTable().getField("START"), date1, true, date2, false));
if (date1 != null && date2 != null) {
input.andWhere(new Where(valCalendarItems.getTable().getField("START"), date1, true, date2, false));
}
if (uid != null) {
Where ww = new Where(valCalendarItems.getTable().getField("UID"), "=", uid);
try {
int i = Integer.parseInt(uid);
ww = ww.or(new Where(valCalendarItems.getTable().getKey(), "=", i));
} catch (Exception e) {
 
}
 
input.andWhere(ww);
}
return input;
}
});
116,7 → 160,6
// Le status utilisé est celui de OPERATION
input.andWhere(new Where(input.getAlias(valOperation.getTable()).getField("STATUS"), selectedStates));
}
System.err.println("OperationCalendarManager.getItemIn(...).new ITransformer() {...}.transformChecked() " + input);
return input;
}
});
145,6 → 188,8
 
final List<SQLRowValues> rows = fetcher.fetch();
 
final Map<String, JCalendarItemGroup> groups = new HashMap<String, JCalendarItemGroup>();
 
final List<JCalendarItem> result = new ArrayList<JCalendarItem>(rows.size());
for (SQLRowValues r : rows) {
final SQLRowValues user = r.followPath(p);
151,12 → 196,24
 
if (user != null) {
final SQLRowValues operation = r.followPath(pItemToOperation);
final JCalendarItemDB item = new JCalendarItemDB(r.getString("SOURCE_TABLE"), r.getLong("SOURCE_ID"), r.getForeign("ID_CALENDAR_ITEM_GROUP").getID());
final JCalendarItemDB item = new JCalendarItemDB(r.getID(), r.getString("SOURCE_TABLE"), r.getInt("SOURCE_ID"), r.getForeign("ID_CALENDAR_ITEM_GROUP").getID());
 
item.setDayOnly(false);
item.setDtStart(r.getDate("START"));
item.setDtEnd(r.getDate("END"));
item.setSummary(r.getString("SUMMARY"));
item.setLocation(r.getString("LOCATION"));
 
final String string = r.getForeign("ID_CALENDAR_ITEM_GROUP").getString("NAME");
 
JCalendarItemGroup g = groups.get(string);
if (g == null) {
g = new JCalendarItemGroup();
g.setName(string);
groups.put(string, g);
}
item.setGroup(g);
 
if (r.getString("FLAGS") != null) {
List<String> str = StringUtils.fastSplit(r.getString("FLAGS"), ',');
 
182,9 → 239,21
item.setOperationType(operation.getString("TYPE"));
item.setPlannerXML(operation.getString("PLANNER_XML"));
item.setPlannerUID(operation.getString("PLANNER_UID"));
item.setSiteName(operation.getForeign("ID_SITE").getString("NAME"));
item.setSiteId(operation.getForeign("ID_SITE").getIDNumber());
item.setSiteComment(operation.getForeign("ID_SITE").getString("COMMENT"));
if (operation.getForeign("ID_SITE") != null) {
item.setSiteName(operation.getForeign("ID_SITE").getString("NAME"));
item.setSiteId(operation.getForeign("ID_SITE").getIDNumber());
item.setSiteComment(operation.getForeign("ID_SITE").getString("COMMENT"));
} else {
item.setSiteName("");
item.setSiteId(-1);
item.setSiteComment("");
}
 
String ruid = r.getString("UID");
if (ruid == null || ruid.isEmpty()) {
ruid = String.valueOf(r.getID());
}
item.setUId(ruid);
boolean isLocked = item.hasFlag(Flag.getFlag("locked"));
if (!this.hideLocked && isLocked) {
result.add(item);
196,4 → 265,92
}
return result;
}
 
public void addOrUpdateOperation(int idUser, String uid, Date start, Date end, String summary, String description, String location) throws SQLException {
JCalendarItem i = this.getItemFromUid(uid);
final SQLTable tOperation = root.getTable(ModuleOperation.TABLE_OPERATION);
if (i == null) {
// Create all from scratch
 
SQLRowValues vOperation = new SQLRowValues(tOperation);
vOperation.put("ID_SITE", null);
vOperation.put("ID_USER_COMMON", idUser);
vOperation.put("TYPE", "Inconnu");
vOperation.put("STATUS", "Non classé");
vOperation.put("DESCRIPTION", description);
 
final SQLRow operationRow = vOperation.commit();
SQLRow calendarGroupRow = operationRow.getForeignRow("ID_CALENDAR_ITEM_GROUP", SQLRowMode.DEFINED);
 
final SQLRowValues rowItemGroup = new SQLRowValues(root.getTable("CALENDAR_ITEM_GROUP"));
rowItemGroup.put("NAME", summary);
rowItemGroup.put("DESCRIPTION", description);
 
calendarGroupRow = rowItemGroup.commit();
// Update Operation
SQLRowValues operationSQLRowValues = operationRow.asRowValues();
operationSQLRowValues.put("ID_CALENDAR_ITEM_GROUP", calendarGroupRow.getID());
operationSQLRowValues.commit();
// Insert Calendar Items
DateRange dateRange = new DateRange();
dateRange.setStart(start.getTime());
dateRange.setStop(end.getTime());
final SQLRowValues rowItem = new SQLRowValues(root.getTable("CALENDAR_ITEM"));
rowItem.put("START", new Date(dateRange.getStart()));
rowItem.put("END", new Date(dateRange.getStop()));
rowItem.put("DURATION_S", (dateRange.getStop() - dateRange.getStart()) / 1000);
rowItem.put("SUMMARY", summary);
rowItem.put("DESCRIPTION", description);
rowItem.put("LOCATION", location);
rowItem.put("FLAGS", "");
rowItem.put("STATUS", operationRow.getString("STATUS"));
rowItem.put("ID_CALENDAR_ITEM_GROUP", calendarGroupRow.getID());
rowItem.put("SOURCE_ID", operationRow.getID());
rowItem.put("SOURCE_TABLE", ModuleOperation.TABLE_OPERATION);
rowItem.put("UID", uid);
rowItem.commit();
} else {
if (i instanceof JCalendarItemDB) {
JCalendarItemDB item = (JCalendarItemDB) i;
//
final SQLRowValues vOperation = tOperation.getRow((int) item.getSourceId()).createEmptyUpdateRow();
vOperation.put("DESCRIPTION", description);
vOperation.commit();
// group
final SQLTable tGroup = root.getTable("CALENDAR_ITEM_GROUP");
final SQLRowValues rowItemGroup = tGroup.getRow(item.getIdCalendarGroup()).createEmptyUpdateRow();
rowItemGroup.put("NAME", summary);
rowItemGroup.put("DESCRIPTION", description);
rowItemGroup.commit();
// item
final SQLTable tItem = root.getTable("CALENDAR_ITEM");
DateRange dateRange = new DateRange();
dateRange.setStart(start.getTime());
dateRange.setStop(end.getTime());
final SQLRowValues rowItem = tItem.getRow(item.getId()).createEmptyUpdateRow();
rowItem.put("START", new Date(dateRange.getStart()));
rowItem.put("END", new Date(dateRange.getStop()));
rowItem.put("DURATION_S", (dateRange.getStop() - dateRange.getStart()) / 1000);
rowItem.put("SUMMARY", summary);
rowItem.put("DESCRIPTION", description);
rowItem.put("LOCATION", location);
rowItem.commit();
}
}
 
}
 
public boolean delete(JCalendarItem item) {
// TODO Auto-generated method stub
return false;
}
 
public JCalendarItem getItemFromUid(String uid) {
List<JCalendarItem> l = getItemIn(null, null, null, null, uid);
if (l.isEmpty()) {
System.err.println("OperationCalendarManager.getItemFromUid() nothing in db for uid: " + uid);
return null;
}
return l.get(0);
}
}
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/MultipleDayCalendarWithToolBar.java
27,6 → 27,7
 
import org.jopencalendar.ui.DatePicker;
import org.jopencalendar.ui.DayView;
import org.jopencalendar.ui.ItemPartView;
import org.jopencalendar.ui.MultipleDayView;
import org.jopencalendar.ui.MultipleDayViewHeader;
 
63,6 → 64,15
});
toolbar.add(new JLabel(" Zoom"));
toolbar.add(zoomSlider);
JButton reloadButton = createButton(new ImageIcon(ItemPartView.class.getResource("auto.png")));
toolbar.add(reloadButton);
reloadButton.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
reload();
}
});
this.setLayout(new GridBagLayout());
//
GridBagConstraints c = new GridBagConstraints();
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/JCalendarItemDB.java
9,20 → 9,22
 
public class JCalendarItemDB extends JCalendarItem {
private final String tableSource;
private final long id;
private final int id;
private String status;
private String type;
private long idCalendarGroup;
private int idCalendarGroup;
private String plannerXML;
private String plannerUID;
private String siteName;
private String siteComment;
private Number siteId;
private int idSource;
 
public JCalendarItemDB(String tableSource, long id, long idCalendarGroup) {
public JCalendarItemDB(int id, String tableSource, int idSource, int idCalendarGroup) {
this.tableSource = tableSource;
this.id = id;
this.idCalendarGroup = idCalendarGroup;
this.idSource = idSource;
}
 
public SQLElement getSourceElement() {
34,17 → 36,17
return this.tableSource;
}
 
public long getSourceId() {
return id;
public int getSourceId() {
return idSource;
}
 
public long getIdCalendarGroup() {
public int getIdCalendarGroup() {
return idCalendarGroup;
}
 
@Override
public int hashCode() {
return (int) (tableSource.hashCode() + id);
return id;
}
 
@Override
51,7 → 53,7
public boolean equals(Object obj) {
if (obj instanceof JCalendarItemDB) {
final JCalendarItemDB o = (JCalendarItemDB) obj;
return o.id == id && o.tableSource.equals(tableSource);
return o.id == id;
}
return super.equals(obj);
}
124,4 → 126,8
public Number getSiteId() {
return siteId;
}
 
public int getId() {
return this.id;
}
}
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/OperationSQLElement.java
30,7 → 30,7
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.utils.SQLUtils;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.utils.RTInterruptedException;
 
public class OperationSQLElement extends ModuleElement {
50,8 → 50,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
SQLTableModelSourceOnline source = super.createTableSource();
protected void _initTableSource(SQLTableModelSource source) {
super._initTableSource(source);
source.getColumns().add(new BaseSQLTableModelColumn("Date", Timestamp.class) {
 
@Override
71,8 → 71,6
return FieldPath.create(p, Arrays.asList("START"));
}
});
 
return source;
}
 
@Override
92,7 → 90,7
*
* @throws SQLException
* @throws RTInterruptedException
* */
*/
@SuppressWarnings("unchecked")
public void fastDelete(List<Long> operationsIds) throws RTInterruptedException, SQLException {
if (operationsIds.isEmpty()) {
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/JCalendarItemInfoPanel.java
60,6 → 60,17
c.gridy++;
final JLabel c5 = new JLabel("Etat : " + itemDb.getStatus());
this.add(c5, c);
// Localisation
if (item.getLocation() != null && !item.getLocation().trim().isEmpty()) {
c.gridy++;
c.weighty = 0;
final ITextArea comp1 = new ITextArea(item.getLocation());
comp1.setOpaque(false);
comp1.setBorder(null);
comp1.setEditable(false);
this.add(comp1, c);
}
 
c.gridy++;
c.weighty = 1;
final ITextArea comp2 = new ITextArea(item.getDescription());
/trunk/Modules/Module Operation/src/org/openconcerto/modules/operation/OperationSQLComponent.java
112,12 → 112,14
return id;
}
 
private void updateCalendar(int id) {
private void updateCalendar(int idOperation) {
final DBRoot root = ComptaPropsConfiguration.getInstanceCompta().getRootSociete();
final SQLTable tOperation = root.getTable(ModuleOperation.TABLE_OPERATION);
final SQLRow operationRow = tOperation.getRow(id);
final SQLRow operationRow = tOperation.getRow(idOperation);
SQLRow calendarGroupRow = operationRow.getForeignRow("ID_CALENDAR_ITEM_GROUP", SQLRowMode.DEFINED);
List<String> oldUIds = new ArrayList<String>();
if (calendarGroupRow != null) {
oldUIds.addAll(getUUidsFromCalendarGroupId(root, calendarGroupRow.getID()));
// Remove associated CalendarItems AND CalendarItemGroups
final SQLTable tItems = root.getTable("CALENDAR_ITEM");
String deleteReq = "DELETE FROM " + tItems.getSQLName().quote() + " WHERE ";
144,6 → 146,7
operationSQLRowValues.commit();
// Insert Calendar Items
final List<DateRange> ranges = this.getDateRangeTable().getRanges();
int index = 0;
for (DateRange dateRange : ranges) {
final SQLRowValues rowItem = new SQLRowValues(root.getTable("CALENDAR_ITEM"));
rowItem.put("START", new Date(dateRange.getStart()));
154,9 → 157,14
rowItem.put("FLAGS", "");
rowItem.put("STATUS", operationRow.getString("STATUS"));
rowItem.put("ID_CALENDAR_ITEM_GROUP", calendarGroupRow.getID());
rowItem.put("SOURCE_ID", id);
rowItem.put("SOURCE_ID", idOperation);
rowItem.put("SOURCE_TABLE", ModuleOperation.TABLE_OPERATION);
// apply old UIDs
if (index < oldUIds.size()) {
rowItem.put("UID", oldUIds.get(index));
}
rowItem.commit();
index++;
}
 
} catch (SQLException e) {
165,6 → 173,26
 
}
 
@SuppressWarnings("rawtypes")
private List<String> getUUidsFromCalendarGroupId(DBRoot root, int id) {
final List<String> result = new ArrayList<String>();
final SQLTable tCalendarItem = root.getTable("CALENDAR_ITEM");
final SQLSelect s = new SQLSelect();
s.addSelect(tCalendarItem.getField("UID"));
final Where where = new Where(tCalendarItem.getField("ID_CALENDAR_ITEM_GROUP"), "=", id);
s.setWhere(where);
 
final List r = root.getDBSystemRoot().getDataSource().execute(s.asString());
 
for (Object line : r) {
final String uid = (String) ((Map) line).get("UID");
if (uid != null && !uid.trim().isEmpty()) {
result.add(uid);
}
}
return result;
}
 
public void setDate(Date date) {
final List<DateRange> list = new ArrayList<DateRange>();
list.add(new DateRange(date.getTime()));
/trunk/Modules/Module Project/.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"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/tracker/ProjectTracker.java
Nouveau fichier
0,0 → 1,500
package org.openconcerto.modules.project.tracker;
 
import java.awt.AWTException;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.MenuItem;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PopupMenu;
import java.awt.RenderingHints;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.Window.Type;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableCellRenderer;
 
public class ProjectTracker {
private static final Color BLUE = Color.decode("#0097A7");
private static final Color BG_LIGHT_GRAY = new Color(240, 240, 240);
private boolean active = true;
List<TrackedProject> l = new ArrayList<TrackedProject>();
 
public ProjectTracker() {
l.add(new TrackedProject("EDF - site internet"));
final TrackedProject pr = new TrackedProject("Logo SNCF ");
l.add(pr);
 
Thread t = new Thread(new Runnable() {
 
@Override
public void run() {
Point oldPoint = MouseInfo.getPointerInfo().getLocation();
int c = 0;
while (true) {
Point p = MouseInfo.getPointerInfo().getLocation();
if (p.equals(oldPoint)) {
c++;
if (c > 5 && isActive()) {
setActive(false);
}
} else {
c = 0;
if (!isActive()) {
setActive(true);
}
}
oldPoint = p;
try {
Thread.sleep(1 * 1000);
refresh();
 
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
}
}
});
t.setDaemon(true);
t.start();
}
 
protected void refresh() {
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
createContent.repaint();
dataModel.fireTableDataChanged();
updateTrayIcon();
}
});
 
}
 
protected synchronized void setActive(boolean b) {
this.active = b;
System.out.println("ProjectTracker.setActive() " + b);
}
 
public synchronized boolean isActive() {
return active;
}
 
public static void main(String[] args) throws InterruptedException {
ProjectTracker t = new ProjectTracker();
t.showFrame();
 
}
 
public JComponent createContent;
protected JComponent detailsContent;
private ProjectTableModel dataModel;
JFrame f;
 
private void showFrame() {
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
if (f == null) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
f = new JFrame("OpenConcerto");
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTabbedPane tPane = new JTabbedPane();
createContent = createContent();
detailsContent = createDetailsContent();
tPane.addTab("Projets", createContent);
tPane.addTab("Détails", detailsContent);
f.setContentPane(tPane);
 
f.pack();
initTray();
 
}
f.setVisible(true);
 
}
 
});
 
}
 
void toggleFrame() {
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
if (f != null) {
f.setVisible(!f.isVisible());
}
}
});
}
 
protected JComponent createDetailsContent() {
JTable t = new JTable();
t.setRowHeight(t.getRowHeight() + 4);
dataModel = new ProjectTableModel(l);
t.setModel(dataModel);
t.getColumnModel().getColumn(0).setMinWidth(150);
t.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer() {
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
final Component tableCellRendererComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
setFont(getFont().deriveFont(Font.BOLD));
if (row == table.getModel().getRowCount() - 1) {
setBackground(Color.GRAY);
setForeground(Color.WHITE);
} else if (!isSelected) {
setBackground(Color.WHITE);
setForeground(Color.BLACK);
}
return tableCellRendererComponent;
}
});
for (int i = 1; i < t.getColumnCount(); i++) {
t.getColumnModel().getColumn(i).setCellRenderer(new DefaultTableCellRenderer() {
{
setHorizontalAlignment(SwingConstants.RIGHT);
}
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
final Component tableCellRendererComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
if (row == table.getModel().getRowCount() - 1) {
setBackground(Color.LIGHT_GRAY);
setForeground(Color.BLACK);
} else if (!isSelected) {
setBackground(Color.WHITE);
setForeground(Color.BLACK);
}
return tableCellRendererComponent;
}
});
}
 
final JScrollPane jScrollPane = new JScrollPane(t);
jScrollPane.setPreferredSize(new Dimension(420, 50));
return jScrollPane;
}
 
private JComponent createContent() {
JPanel p = new JPanel();
p.setLayout(new GridLayout(this.l.size(), 1));
for (TrackedProject trackedProject : l) {
p.add(createProjectPanel(trackedProject));
}
 
return p;
}
 
private JPanel createProjectPanel(final TrackedProject trackedProject) {
JPanel p = new JPanel();
p.setLayout(new GridBagLayout());
p.setOpaque(true);
p.setBackground(Color.WHITE);
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(2, 3, 2, 2);
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.WEST;
c.gridx = 0;
c.gridy = 0;
c.weightx = 1;
JLabel b = new JLabel(trackedProject.getTitle());
p.add(b, c);
c.gridy++;
p.add(createInfoSelector(trackedProject), c);
c.gridx++;
c.gridy = 0;
c.gridheight = 2;
c.fill = GridBagConstraints.BOTH;
c.weightx = 0;
c.weighty = 1;
 
final JLabel timeLabel = new JLabel("II:II", SwingConstants.CENTER) {
@Override
public String getText() {
return trackedProject.getTotalDuration();
}
 
@Override
public Dimension getMinimumSize() {
return new Dimension(100, super.getMinimumSize().height);
}
 
@Override
public Dimension getPreferredSize() {
return new Dimension(100, super.getPreferredSize().height);
 
}
};
timeLabel.setFont(timeLabel.getFont().deriveFont(Font.BOLD, 14));
p.add(timeLabel, c);
 
c.gridx++;
p.add(createCounter(trackedProject), c);
return p;
}
 
private Component createCounter(final TrackedProject trackedProject) {
JPanel p = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (trackedProject.getState() == TrackedProject.STATE_RUNNING) {
g.setColor(BLUE);
} else {
g.setColor(BG_LIGHT_GRAY);
}
int s = Math.min(getWidth(), getHeight());
g.fillOval(0, 0, s, s);
if (trackedProject.getState() != TrackedProject.STATE_RUNNING) {
// Play
g.setColor(Color.GRAY);
g2.setStroke(new BasicStroke(1f));
g.fillPolygon(new int[] { (15 * s) / 50, (40 * s) / 50, (15 * s) / 50 }, new int[] { (10 * s) / 50, (25 * s) / 50, (40 * s) / 50 }, 3);
} else {
// Pause
g.setColor(Color.WHITE);
g2.setStroke(new BasicStroke(6f));
g.drawLine((17 * s) / 50, (15 * s) / 50, (17 * s) / 50, (35 * s) / 50);
g.drawLine((33 * s) / 50, (15 * s) / 50, (33 * s) / 50, (35 * s) / 50);
}
}
};
p.setPreferredSize(new Dimension(50, 50));
p.setMinimumSize(new Dimension(50, 50));
p.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (trackedProject.getState() != TrackedProject.STATE_RUNNING) {
start(trackedProject);
} else {
stop(trackedProject);
}
}
});
return p;
}
 
public boolean hasActiveProject() {
for (TrackedProject trackedProject : l) {
if (trackedProject.getState() == TrackedProject.STATE_RUNNING) {
return true;
}
;
}
return false;
}
 
protected void start(TrackedProject p) {
for (TrackedProject trackedProject : l) {
trackedProject.setState(TrackedProject.STATE_STOPPED);
}
p.setState(TrackedProject.STATE_RUNNING);
createContent.repaint();
}
 
protected void stop(TrackedProject p) {
for (TrackedProject trackedProject : l) {
trackedProject.setState(TrackedProject.STATE_STOPPED);
}
p.setState(TrackedProject.STATE_STOPPED);
createContent.repaint();
 
}
 
private Component createInfoSelector(final TrackedProject trackedProject) {
JPanel p = new JPanel();
p.setOpaque(false);
p.setLayout(new FlowLayout(FlowLayout.LEADING));
String[] str = trackedProject.getTypes();
final ButtonGroup g = new ButtonGroup();
 
for (int i = 0; i < str.length; i++) {
final String type = str[i];
final JButton b = new JButton(type) {
@Override
public void paint(Graphics g) {
if (isSelected()) {
if (trackedProject.getState() == TrackedProject.STATE_STOPPED) {
setBackground(Color.GRAY);
} else {
setBackground(BLUE);
}
setForeground(Color.WHITE);
} else {
setBackground(BG_LIGHT_GRAY);
setForeground(Color.GRAY);
}
super.paint(g);
}
 
};
if (i == 0) {
b.setSelected(true);
}
b.setMargin(new Insets(0, 2, 0, 2));
b.setBorderPainted(false);
b.setContentAreaFilled(false);
b.setOpaque(true);
b.setFocusPainted(false);
g.add(b);
p.add(b);
b.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
g.setSelected(b.getModel(), true);
trackedProject.setCurrentType(type);
}
});
}
 
return p;
}
 
boolean lastState = false;
 
void updateTrayIcon() {
boolean a = this.hasActiveProject();
if (a != lastState) {
initTray();
 
lastState = a;
}
}
 
protected boolean initTray() {
// Check the SystemTray is supported
if (!SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return false;
}
final PopupMenu popup = new PopupMenu();
final SystemTray tray = SystemTray.getSystemTray();
final TrayIcon trayIcon = new TrayIcon(createTrayIcon(tray));
 
// Create a pop-up menu components
MenuItem loginItem = new MenuItem("Afficher");
 
MenuItem exitItem = new MenuItem("Quitter");
 
// Add components to pop-up menu
popup.add(loginItem);
popup.addSeparator();
 
popup.add(exitItem);
 
trayIcon.setPopupMenu(popup);
trayIcon.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("ProjectTracker.initTray().new MouseAdapter() {...}.mouseClicked()" + this);
if (e.getButton() == MouseEvent.BUTTON3) {
final Frame frame = new Frame("");
frame.setUndecorated(true);
frame.setType(Type.UTILITY);
frame.setResizable(false);
frame.add(popup);
frame.setVisible(true);
 
} else {
toggleFrame();
}
}
});
loginItem.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("ProjectTracker.initTray().new ActionListener() {...}.actionPerformed()");
showFrame();
}
});
exitItem.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
 
try {
if (tray.getTrayIcons().length > 0)
tray.remove(tray.getTrayIcons()[0]);
tray.add(trayIcon);
return true;
} catch (AWTException e) {
System.out.println("TrayIcon could not be added.");
return false;
}
 
}
 
private Image createTrayIcon(SystemTray tray) {
Dimension trayIconSize = tray.getTrayIconSize();
final int width = trayIconSize.width;
final int height = trayIconSize.height;
BufferedImage off_Image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
 
Graphics2D g2 = off_Image.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (this.hasActiveProject()) {
g2.setColor(BLUE);
} else {
g2.setColor(Color.GRAY);
}
g2.fillRect(0, 0, width, height);
g2.setColor(Color.WHITE);
float s = Math.min(width, height);
g2.fillPolygon(new int[] { (int) (15 * s) / 50, (int) (40 * s) / 50, (int) (15 * s) / 50 }, new int[] { (int) (10 * s) / 50, (int) (26 * s) / 50, (int) (42 * s) / 50 }, 3);
 
return off_Image;
 
}
 
}
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/tracker/TrackedProject.java
Nouveau fichier
0,0 → 1,113
package org.openconcerto.modules.project.tracker;
 
import java.util.HashMap;
import java.util.Map;
 
public class TrackedProject {
public static final int STATE_RUNNING = 0;
public static final int STATE_PAUSED = 1;
public static final int STATE_STOPPED = 2;
private String title;
private int state = STATE_STOPPED;
private Map<String, Integer> map = new HashMap<String, Integer>();
private String type;
private long timeAtStartInMs = -1;
 
public TrackedProject(String title) {
this.title = title;
this.type = getTypes()[0];
}
 
public String getTitle() {
return title;
}
 
public int getState() {
return state;
}
 
public void setState(int state) {
if (state != this.state) {
 
if (state == STATE_RUNNING) {
timeAtStartInMs = System.currentTimeMillis() - getDuration(this.type) * 1000;
} else {
storeCurrentValue();
}
this.state = state;
}
}
 
private void storeCurrentValue() {
final Integer s = Integer.valueOf((int) ((System.currentTimeMillis() - timeAtStartInMs) / 1000));
map.put(type, s);
System.out.println("TrackedProject.setState() store " + s + " for " + type);
}
 
public String getTotalDuration() {
String[] s = getTypes();
int total = 0;
for (String t : s) {
total += getDuration(t);
}
return formatDuration(total);
}
 
public String[] getTypes() {
return new String[] { "Etude", "Graphisme", "Dév.", "Tests", "Correctifs" };
}
 
public void setCurrentType(String type) {
if (state == STATE_RUNNING)
storeCurrentValue();
 
// if (state == STATE_RUNNING) {
timeAtStartInMs = System.currentTimeMillis() - getDuration(type) * 1000;
// }
this.type = type;
}
 
public int getDuration(String type) {
if (state == STATE_RUNNING && this.type.equals(type) && timeAtStartInMs > 0) {
return (int) ((System.currentTimeMillis() - timeAtStartInMs) / 1000);
}
Integer i = map.get(type);
if (i == null) {
i = Integer.valueOf(0);
map.put(type, i);
 
}
// System.out.println("TrackedProject.getDuration() " + this.getTitle() + " " + type + " : "
// + i);
return i;
}
 
public static String formatDuration(int s) {
int seconds = s % 60;
int mins = (s / 60) % 60;
int hours = s / 3600;
String r = "";
if (s >= 60) {
if (hours > 0) {
r += hours + "h";
}
if (hours > 0 && mins < 10) {
r += "0" + mins + "m";
} else {
r += +mins + "m";
}
}
if ((mins + hours) > 0 && seconds < 10) {
r += "0" + seconds + "s";
} else {
r += +seconds + "s";
}
return r;
}
 
public static void main(String[] args) {
for (int i = 0; i < 5000; i++) {
System.out.println("TrackedProject.main() " + i + " " + formatDuration(i));
}
}
}
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/tracker/ProjectTableModel.java
Nouveau fichier
0,0 → 1,85
package org.openconcerto.modules.project.tracker;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.table.AbstractTableModel;
 
public class ProjectTableModel extends AbstractTableModel {
private final List<TrackedProject> list;
 
public ProjectTableModel(List<TrackedProject> l) {
list = l;
}
 
@Override
public int getRowCount() {
return list.size() + 1;
}
 
@Override
public int getColumnCount() {
final List<String> l = getColumns();
return l.size() + 1;
}
 
private List<String> getColumns() {
List<String> l = new ArrayList<String>();
for (TrackedProject trackedProject : list) {
String[] t = trackedProject.getTypes();
for (int i = 0; i < t.length; i++) {
String string = t[i];
if (!l.contains(string)) {
l.add(string);
}
}
}
return l;
}
 
@Override
public String getColumnName(int columnIndex) {
if (columnIndex == 0) {
return "Projets";
}
return getColumns().get(columnIndex - 1);
}
 
@Override
public Class<?> getColumnClass(int columnIndex) {
return String.class;
}
 
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
 
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (rowIndex == getRowCount() - 1) {
if (columnIndex == 0) {
return "Total";
} else {
String n = getColumnName(columnIndex);
int total = 0;
for (TrackedProject trackedProject : list) {
total += trackedProject.getDuration(n);
}
return total + "s";
}
}
 
final TrackedProject trackedProject = list.get(rowIndex);
if (columnIndex == 0) {
return trackedProject.getTitle();
}
String n = getColumnName(columnIndex);
return trackedProject.getDuration(n) + "s";
}
 
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
}
 
}
/trunk/Modules/Module Time Tracking/src/org/openconcerto/modules/timetracking/Module.java
193,7 → 193,8
final SQLElement element = Configuration.getInstance().getDirectory().getElement("AFFAIRE_TEMPS");
final EditFrame frame = new EditFrame(element);
final SQLRowValues rowVals = new SQLRowValues(element.getTable());
final List<SQLRow> rows = IListe.get(e).getSelectedRow().asRow().getReferentRows(element.getTable().getTable("COMMANDE_CLIENT"));
final SQLRowValues selectedRow = IListe.get(e).getSelectedRow();
final List<SQLRow> rows = selectedRow.getTable().getRow(selectedRow.getID()).getReferentRows(element.getTable().getTable("COMMANDE_CLIENT"));
if (rows.size() < 1) {
JOptionPane.showMessageDialog(null, "Aucune commande en cours associée à cette affaire.");
return;
/trunk/Modules/Module Time Tracking/src/org/openconcerto/modules/timetracking/element/ProjectTimeTrackingSQLElement.java
13,7 → 13,7
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.group.Group;
import org.openconcerto.utils.ListMap;
 
63,8 → 63,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
final SQLTableModelSourceOnline source = super.createTableSource();
protected void _initTableSource(SQLTableModelSource res) {
super._initTableSource(res);
 
final BaseSQLTableModelColumn semaine = new BaseSQLTableModelColumn("Semaine", Integer.class) {
 
79,8 → 79,8
return Collections.singleton(new FieldPath(p, "DATE"));
}
};
source.getColumns().add(semaine);
return source;
res.getColumns().add(semaine);
 
}
 
}
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/FacturesAboPanel.java
37,9 → 37,9
@Override
protected void validItem(SQLRowAccessor sqlRowAccessor) {
// Affectation d'un numero
SQLRowValues rowVals = sqlRowAccessor.asRowValues();
SQLRowValues rowVals = sqlRowAccessor.createEmptyUpdateRow();
String nextNumero = NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class);
 
rowVals.put("DATE", new Date());
rowVals.put("NUMERO", nextNumero);
 
SQLRowValues rowValsNum = new SQLRowValues(tableNum);
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/AboPanel.java
85,7 → 85,6
validItem(sqlRowAccessor);
}
 
 
}
}, true, "subscription.validate");
this.actionValid.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
162,7 → 161,7
* @param sqlRowAccessor
*/
protected void validItem(SQLRowAccessor sqlRowAccessor) {
SQLRowValues rowVals = sqlRowAccessor.asRowValues();
SQLRowValues rowVals = sqlRowAccessor.createEmptyUpdateRow();
rowVals.put("CREATION_AUTO_VALIDER", Boolean.TRUE);
try {
rowVals.update();