Line 29... |
Line 29... |
29 |
import org.openconcerto.sql.model.SQLRowValues;
|
29 |
import org.openconcerto.sql.model.SQLRowValues;
|
30 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
30 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
31 |
import org.openconcerto.sql.model.SQLSelect;
|
31 |
import org.openconcerto.sql.model.SQLSelect;
|
32 |
import org.openconcerto.sql.model.SQLTable;
|
32 |
import org.openconcerto.sql.model.SQLTable;
|
33 |
import org.openconcerto.sql.model.Where;
|
33 |
import org.openconcerto.sql.model.Where;
|
- |
|
34 |
import org.openconcerto.sql.request.ListSQLRequest;
|
- |
|
35 |
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
|
34 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
36 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
35 |
import org.openconcerto.sql.users.rights.UserRightsManager;
|
37 |
import org.openconcerto.sql.users.rights.UserRightsManager;
|
36 |
import org.openconcerto.sql.view.list.IListe;
|
38 |
import org.openconcerto.sql.view.list.IListe;
|
- |
|
39 |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
|
37 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
40 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
38 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
41 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
39 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
42 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
40 |
import org.openconcerto.ui.FrameUtil;
|
43 |
import org.openconcerto.ui.FrameUtil;
|
41 |
import org.openconcerto.utils.DecimalUtils;
|
44 |
import org.openconcerto.utils.DecimalUtils;
|
Line 65... |
Line 68... |
65 |
PredicateRowAction stock = new PredicateRowAction(new AbstractAction("Mettre à jour les stocks") {
|
68 |
PredicateRowAction stock = new PredicateRowAction(new AbstractAction("Mettre à jour les stocks") {
|
66 |
|
69 |
|
67 |
@Override
|
70 |
@Override
|
68 |
public void actionPerformed(ActionEvent e) {
|
71 |
public void actionPerformed(ActionEvent e) {
|
69 |
if (UserRightsManager.getCurrentUserRights().canAdd(getTable().getDBRoot().getTable("STOCK"))) {
|
72 |
if (UserRightsManager.getCurrentUserRights().canAdd(getTable().getDBRoot().getTable("STOCK"))) {
|
70 |
final PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), IListe.get(e).getSelectedRows()), "Mise à jour des stocks");
|
73 |
final PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), IListe.get(e).getSelectedRowAccessors()), "Mise à jour des stocks");
|
71 |
FrameUtil.show(p);
|
74 |
FrameUtil.show(p);
|
72 |
} else {
|
75 |
} else {
|
73 |
JOptionPane.showMessageDialog(null, "Vous n'avez les droits suffisants pour modifier manuellement les stocks!");
|
76 |
JOptionPane.showMessageDialog(null, "Vous n'avez les droits suffisants pour modifier manuellement les stocks!");
|
74 |
}
|
77 |
}
|
75 |
}
|
78 |
}
|
Line 148... |
Line 151... |
148 |
}
|
151 |
}
|
149 |
|
152 |
|
150 |
return rowStock;
|
153 |
return rowStock;
|
151 |
}
|
154 |
}
|
152 |
|
155 |
|
- |
|
156 |
@Override
|
- |
|
157 |
protected SQLTableModelSourceOnline instantiateTableSourceOnline(ListSQLRequest req) {
|
- |
|
158 |
return new SQLTableModelSourceOnline(req, this, KeepMode.ROW);
|
- |
|
159 |
}
|
- |
|
160 |
|
153 |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) throws SQLException {
|
161 |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) throws SQLException {
|
154 |
|
162 |
|
155 |
SQLRowAccessor rowStock = null;
|
163 |
SQLRowAccessor rowStock = null;
|
156 |
final int idDepot;
|
164 |
final int idDepot;
|
157 |
if (rowValsSource.getForeign("ID_DEPOT_STOCK") != null && !rowValsSource.isForeignEmpty("ID_DEPOT_STOCK")) {
|
165 |
if (rowValsSource.getForeign("ID_DEPOT_STOCK") != null && !rowValsSource.isForeignEmpty("ID_DEPOT_STOCK")) {
|
Line 375... |
Line 383... |
375 |
rowValsCode.putNulls("ID");
|
383 |
rowValsCode.putNulls("ID");
|
376 |
final Where w = new Where(rowValsCode.getTable().getField("ID_ARTICLE"), "=", rowArticleFind.getID())
|
384 |
final Where w = new Where(rowValsCode.getTable().getField("ID_ARTICLE"), "=", rowArticleFind.getID())
|
377 |
.and(new Where(rowValsCode.getTable().getField("ID_FOURNISSEUR"), "=", fournisseur.getID()));
|
385 |
.and(new Where(rowValsCode.getTable().getField("ID_FOURNISSEUR"), "=", fournisseur.getID()));
|
378 |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsCode).fetch(w);
|
386 |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsCode).fetch(w);
|
379 |
for (SQLRowValues sqlRowAccessor : fetch) {
|
387 |
for (SQLRowValues sqlRowAccessor : fetch) {
|
380 |
rowValsElt.put("ID_CODE_FOURNISSEUR", sqlRowAccessor.getID());
|
388 |
rowValsElt.put("ID_CODE_FOURNISSEUR", sqlRowAccessor);
|
381 |
}
|
389 |
}
|
382 |
}
|
390 |
}
|
383 |
map.add(fournisseur, rowValsElt);
|
391 |
map.add(fournisseur, rowValsElt);
|
384 |
}
|
392 |
}
|
385 |
|
393 |
|