OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 174
Line 23... Line 23...
23
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
23
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
24
import org.openconcerto.erp.core.supplychain.order.ui.EtatDemandeAchatRenderer;
24
import org.openconcerto.erp.core.supplychain.order.ui.EtatDemandeAchatRenderer;
25
import org.openconcerto.sql.element.SQLComponent;
25
import org.openconcerto.sql.element.SQLComponent;
26
import org.openconcerto.sql.model.SQLInjector;
26
import org.openconcerto.sql.model.SQLInjector;
27
import org.openconcerto.sql.model.SQLRow;
27
import org.openconcerto.sql.model.SQLRow;
-
 
28
import org.openconcerto.sql.model.SQLRowListRSH;
28
import org.openconcerto.sql.model.SQLRowValues;
29
import org.openconcerto.sql.model.SQLRowValues;
29
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
30
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
30
import org.openconcerto.sql.model.SQLSelect;
31
import org.openconcerto.sql.model.SQLSelect;
31
import org.openconcerto.sql.model.SQLTable;
32
import org.openconcerto.sql.model.SQLTable;
32
import org.openconcerto.sql.model.Where;
33
import org.openconcerto.sql.model.Where;
Line 90... Line 91...
90
        {
91
        {
91
            RowAction actionP = new RowAction(new AbstractAction("Transfert en demande de prix") {
92
            RowAction actionP = new RowAction(new AbstractAction("Transfert en demande de prix") {
92
 
93
 
93
                @Override
94
                @Override
94
                public void actionPerformed(ActionEvent e) {
95
                public void actionPerformed(ActionEvent e) {
95
                    List<SQLRowValues> rows = IListe.get(e).getSelectedRows();
-
 
96
                    StyleSQLElement styleElt = getDirectory().getElement(StyleSQLElement.class);
96
                    StyleSQLElement styleElt = getDirectory().getElement(StyleSQLElement.class);
97
                    int idNormal = styleElt.getAllStyleByName().get("Normal");
97
                    int idNormal = styleElt.getAllStyleByName().get("Normal");
98
 
98
 
99
                    SQLRowValues rowVals = new SQLRowValues(getTable().getTable("DEMANDE_PRIX"));
99
                    SQLRowValues rowVals = new SQLRowValues(getTable().getTable("DEMANDE_PRIX"));
100
                    rowVals.put("DATE", new Date());
100
                    rowVals.put("DATE", new Date());
101
                    SQLInjector inj = SQLInjector.getInjector(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"));
101
                    SQLInjector inj = SQLInjector.getInjector(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"));
102
                    for (SQLRowValues sqlRowValues : rows) {
-
 
-
 
102
 
103
                        SQLRow row = sqlRowValues.asRow();
103
                    final List<SQLRow> rows = SQLRowListRSH.fetch(IListe.get(e).getRequest().getPrimaryTable(), IListe.get(e).getSelection().getSelectedIDs());
-
 
104
 
104
                        row.fetchValues();
105
                    for (SQLRow row : rows) {
105
                        rowVals.put("ID_AFFAIRE", row.getForeignID("ID_AFFAIRE"));
106
                        rowVals.put("ID_AFFAIRE", row.getForeignID("ID_AFFAIRE"));
106
                        SQLRowValues rowValsCmdElt = inj.createRowValuesFrom(row);
107
                        SQLRowValues rowValsCmdElt = inj.createRowValuesFrom(row);
107
                        rowValsCmdElt.put("ID_STYLE", idNormal);
108
                        rowValsCmdElt.put("ID_STYLE", idNormal);
108
                        rowValsCmdElt.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
109
                        rowValsCmdElt.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
109
                        rowValsCmdElt.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
110
                        rowValsCmdElt.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
Line 150... Line 151...
150
        {
151
        {
151
            RowAction actionP = new RowAction(new AbstractAction("Transfert en commande") {
152
            RowAction actionP = new RowAction(new AbstractAction("Transfert en commande") {
152
 
153
 
153
                @Override
154
                @Override
154
                public void actionPerformed(ActionEvent e) {
155
                public void actionPerformed(ActionEvent e) {
155
                    List<SQLRowValues> rows = IListe.get(e).getSelectedRows();
-
 
156
                    StyleSQLElement styleElt = getDirectory().getElement(StyleSQLElement.class);
156
                    StyleSQLElement styleElt = getDirectory().getElement(StyleSQLElement.class);
157
                    int idNormal = styleElt.getAllStyleByName().get("Normal");
157
                    int idNormal = styleElt.getAllStyleByName().get("Normal");
158
 
158
 
159
                    SQLRowValues rowVals = new SQLRowValues(getTable().getTable("COMMANDE"));
159
                    SQLRowValues rowVals = new SQLRowValues(getTable().getTable("COMMANDE"));
160
                    rowVals.put("DATE", new Date());
160
                    rowVals.put("DATE", new Date());
161
                    SQLInjector inj = SQLInjector.getInjector(getTable(), getTable().getTable("COMMANDE_ELEMENT"));
161
                    SQLInjector inj = SQLInjector.getInjector(getTable(), getTable().getTable("COMMANDE_ELEMENT"));
162
                    for (SQLRowValues sqlRowValues : rows) {
-
 
163
                        SQLRow row = sqlRowValues.asRow();
162
                    final List<SQLRow> rows = SQLRowListRSH.fetch(IListe.get(e).getRequest().getPrimaryTable(), IListe.get(e).getSelection().getSelectedIDs());
164
                        row.fetchValues();
163
                    for (SQLRow row : rows) {
165
                        rowVals.put("ID_AFFAIRE", row.getForeignID("ID_AFFAIRE"));
164
                        rowVals.put("ID_AFFAIRE", row.getForeignID("ID_AFFAIRE"));
166
                        SQLRowValues rowValsCmdElt = inj.createRowValuesFrom(row);
165
                        SQLRowValues rowValsCmdElt = inj.createRowValuesFrom(row);
167
                        rowValsCmdElt.put("ID_STYLE", idNormal);
166
                        rowValsCmdElt.put("ID_STYLE", idNormal);
168
                        rowValsCmdElt.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
167
                        rowValsCmdElt.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
169
                        rowValsCmdElt.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
168
                        rowValsCmdElt.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());