Attached Files | 32395.diff [^] (27,866 bytes) 2016-05-11 18:07 [Show Content] [Hide Content]diff -r 36cffc78188e src/org/openbravo/module/fixstock/RestoreStockValue.java
--- a/src/org/openbravo/module/fixstock/RestoreStockValue.java Wed Aug 12 14:27:06 2015 +0200
+++ b/src/org/openbravo/module/fixstock/RestoreStockValue.java Wed May 11 17:54:08 2016 +0200
@@ -74,8 +74,9 @@
logger.logln(OBMessageUtils.messageBD("Success", false));
bundle.setResult(result);
} catch (OBException e) {
- String message = OBMessageUtils.parseTranslation(bundle.getConnection(), bundle.getContext()
- .toVars(), OBContext.getOBContext().getLanguage().getLanguage(), e.getMessage());
+ String message = OBMessageUtils.parseTranslation(bundle.getConnection(),
+ bundle.getContext().toVars(), OBContext.getOBContext().getLanguage().getLanguage(),
+ e.getMessage());
result.setMessage(message);
result.setType("Error");
log4j.error(message, e);
@@ -98,17 +99,17 @@
}
}
- private void addNotProcessedShipmentReceipt(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addNotProcessedShipmentReceipt(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
+ where.append(
+ " SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
where.append(" il.storageBin.id, il.attributeSetValue.id, il.uOM.id,");
where.append(" orderUOM.id,");
- where
- .append(" sum(CASE i.movementType WHEN 'C-' THEN (-1 * il.movementQuantity) ELSE il.movementQuantity END) as movementqty,");
- where
- .append(" sum(CASE i.movementType WHEN 'C-' THEN (-1 * il.orderQuantity) ELSE il.orderQuantity END) as qtyorder");
+ where.append(
+ " sum(CASE i.movementType WHEN 'C-' THEN (-1 * il.movementQuantity) ELSE il.movementQuantity END) as movementqty,");
+ where.append(
+ " sum(CASE i.movementType WHEN 'C-' THEN (-1 * il.orderQuantity) ELSE il.orderQuantity END) as qtyorder");
where.append(" FROM MaterialMgmtShipmentInOutLine il");
where.append(" join il.shipmentReceipt as i");
where.append(" join il.product as p");
@@ -117,11 +118,11 @@
where.append(" and p.stocked = true");
where.append(" and p.productType = 'I'");
where.append(" and i.documentStatus = 'DR'");
- where.append(" and ad_isorgincluded(i.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
where
- .append(" group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
+ .append(" and ad_isorgincluded(i.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
+ where.append(
+ " group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -160,11 +161,11 @@
}
}
- private void addNotProcessedInventory(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addNotProcessedInventory(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
+ where.append(
+ " SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
where.append(" il.storageBin.id, il.attributeSetValue.id, il.uOM.id,");
where.append(" orderUOM.id,");
where.append(" sum(il.quantityCount-il.bookQuantity),");
@@ -177,11 +178,11 @@
where.append(" and p.stocked = true");
where.append(" and p.productType = 'I'");
where.append(" and i.processed = false");
- where.append(" and ad_isorgincluded(i.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
where
- .append(" group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
+ .append(" and ad_isorgincluded(i.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
+ where.append(
+ " group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -220,11 +221,11 @@
}
}
- private void addDraftInternalConsumption(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addDraftInternalConsumption(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
+ where.append(
+ " SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
where.append(" il.storageBin.id, il.attributeSetValue.id, il.uOM.id,");
where.append(" orderUOM.id,");
where.append(" sum(-1*il.movementQuantity) as movementqty,");
@@ -237,11 +238,11 @@
where.append(" and p.stocked = true");
where.append(" and p.productType = 'I'");
where.append(" and i.processed = false");
- where.append(" and ad_isorgincluded(i.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
where
- .append(" group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
+ .append(" and ad_isorgincluded(i.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
+ where.append(
+ " group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -280,11 +281,11 @@
}
}
- private void addNotProcessedMovement(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addNotProcessedMovement(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
+ where.append(
+ " SELECT il.client.id, il.organization.id, max(il.updatedBy.id) as updatedby, p.id,");
where.append(" il.storageBin.id, il.newStorageBin.id, il.attributeSetValue.id, il.uOM.id,");
where.append(" orderUOM.id,");
where.append(" sum(il.movementQuantity) as movementqty,");
@@ -297,11 +298,11 @@
where.append(" and p.stocked = true");
where.append(" and p.productType = 'I'");
where.append(" and i.processed = false");
- where.append(" and ad_isorgincluded(i.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
where
- .append(" group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.newStorageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
+ .append(" and ad_isorgincluded(i.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
+ where.append(
+ " group by il.client.id, il.organization.id, p.id, il.storageBin.id, il.newStorageBin.id, il.attributeSetValue.id, il.uOM.id, orderUOM.id");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -319,14 +320,14 @@
String productUOM = (String) scrollableResults.get()[8];
BigDecimal movementQty = (BigDecimal) scrollableResults.get()[9];
BigDecimal orderQty = (BigDecimal) scrollableResults.get()[10];
- RestoreStockValueData.updateInventory(bundle.getConnection().getConnection(), bundle
- .getConnection(), client, organization, updatedBy, product, locator, attribute, uom,
- productUOM, null, null, null, movementQty != null ? movementQty.negate().toString()
- : null, orderQty != null ? orderQty.negate().toString() : null);
RestoreStockValueData.updateInventory(bundle.getConnection().getConnection(),
- bundle.getConnection(), client, organization, updatedBy, product, newlocator,
- attribute, uom, productUOM, null, null, null,
- movementQty != null ? movementQty.toString() : null,
+ bundle.getConnection(), client, organization, updatedBy, product, locator, attribute,
+ uom, productUOM, null, null, null,
+ movementQty != null ? movementQty.negate().toString() : null,
+ orderQty != null ? orderQty.negate().toString() : null);
+ RestoreStockValueData.updateInventory(bundle.getConnection().getConnection(),
+ bundle.getConnection(), client, organization, updatedBy, product, newlocator, attribute,
+ uom, productUOM, null, null, null, movementQty != null ? movementQty.toString() : null,
orderQty != null ? orderQty.toString() : null);
counter++;
if (counter % 100 == 0) {
@@ -346,17 +347,17 @@
}
}
- private void addNotProcessedProduction(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addNotProcessedProduction(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT pl.client.id, pl.organization.id, max(pl.updatedBy.id) as updatedby, p.id,");
+ where.append(
+ " SELECT pl.client.id, pl.organization.id, max(pl.updatedBy.id) as updatedby, p.id,");
where.append(" pl.storageBin.id, pl.attributeSetValue.id, pl.uOM.id,");
where.append(" orderUOM.id,");
- where
- .append(" sum(case when pl.productionType = '+' then pl.movementQuantity else (-1 * pl.movementQuantity) end) as movementqty,");
- where
- .append(" sum(case when pl.productionType = '+' then pl.orderQuantity else (-1 * pl.orderQuantity) end) as qtyorder");
+ where.append(
+ " sum(case when pl.productionType = '+' then pl.movementQuantity else (-1 * pl.movementQuantity) end) as movementqty,");
+ where.append(
+ " sum(case when pl.productionType = '+' then pl.orderQuantity else (-1 * pl.orderQuantity) end) as qtyorder");
where.append(" FROM ManufacturingProductionLine pl");
where.append(" join pl.productionPlan as pp");
where.append(" join pp.production as pr");
@@ -366,11 +367,11 @@
where.append(" and p.stocked = true");
where.append(" and p.productType = 'I'");
where.append(" and pr.processed = false");
- where.append(" and ad_isorgincluded(pr.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
- where
- .append(" group by pl.client.id, pl.organization.id, p.id, pl.storageBin.id, pl.attributeSetValue.id, pl.uOM.id, orderUOM.id");
+ where.append(
+ " and ad_isorgincluded(pr.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
+ where.append(
+ " group by pl.client.id, pl.organization.id, p.id, pl.storageBin.id, pl.attributeSetValue.id, pl.uOM.id, orderUOM.id");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -409,8 +410,8 @@
}
}
- private void addTransactions(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addTransactions(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
where.append(" SELECT t.client.id, t.organization.id, max(t.updatedBy.id) as updatedby, p.id,");
where.append(" t.storageBin.id, t.attributeSetValue.id, t.uOM.id,");
@@ -425,11 +426,11 @@
where.append(" left join t.orderUOM as orderUOM");
where.append(" where p.stocked = true");
where.append(" and p.productType = 'I'");
- where.append(" and ad_isorgincluded(t.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
where
- .append(" group by t.client.id, t.organization.id, p.id, t.storageBin.id, t.attributeSetValue.id, t.uOM.id, orderUOM.id, phi.movementDate");
+ .append(" and ad_isorgincluded(t.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
+ where.append(
+ " group by t.client.id, t.organization.id, p.id, t.storageBin.id, t.attributeSetValue.id, t.uOM.id, orderUOM.id, phi.movementDate");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -448,9 +449,10 @@
BigDecimal movementQty = (BigDecimal) scrollableResults.get()[8];
BigDecimal orderQty = (BigDecimal) scrollableResults.get()[9];
Date inventoryDate = (Date) scrollableResults.get()[10];
- RestoreStockValueData.updateInventory(bundle.getConnection().getConnection(), bundle
- .getConnection(), client, organization, updatedBy, product, locator, attribute, uom,
- productUOM, movementQty.toString(), orderQty != null ? orderQty.toString() : null,
+ RestoreStockValueData.updateInventory(bundle.getConnection().getConnection(),
+ bundle.getConnection(), client, organization, updatedBy, product, locator, attribute,
+ uom, productUOM, movementQty.toString(),
+ orderQty != null ? orderQty.toString() : null,
inventoryDate != null ? OBDateUtils.formatDate(inventoryDate) : null, null, null);
} catch (Exception e) {
log4j.error("Error updating inventory", e);
@@ -473,19 +475,19 @@
}
}
- private void updateReservedQuatities(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void updateReservedQuatities(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
where.append(" SELECT r.product.id, rs.storageBin.id, rs.attributeSetValue.id, r.uOM.id, ");
where.append(" sum(rs.quantity-coalesce(rs.released,0)),");
- where
- .append(" sum(case when rs.allocated = true then (rs.quantity-coalesce(rs.released,0)) else 0 end)");
+ where.append(
+ " sum(case when rs.allocated = true then (rs.quantity-coalesce(rs.released,0)) else 0 end)");
where.append(" FROM MaterialMgmtReservationStock rs");
where.append(" join rs.reservation as r");
where.append(" where r.rESStatus <> 'DR'");
- where.append(" and ad_isorgincluded(rs.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
+ where.append(
+ " and ad_isorgincluded(rs.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
where.append(" group by r.product.id, rs.storageBin.id, rs.attributeSetValue.id, r.uOM.id");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
@@ -525,7 +527,7 @@
private void updateReservedQty(ProcessBundle bundle, String product, String locator,
String attribute, String uom, BigDecimal reservedQty, BigDecimal allocatedQty)
- throws SQLException {
+ throws SQLException {
String strUpdate = "update MaterialMgmtStorageDetail sd set sd.reservedQty = :reservedQty, sd.allocatedQuantity = :allocatedQuantity where sd.orderUOM is null and sd.product.id = :product "
+ " and sd.storageBin.id = :storageBin"
+ " and sd.uOM.id = :uOM and sd.attributeSetValue.id = :attributeSetValue";
@@ -541,26 +543,28 @@
logger.logln("Entries updated: " + updated);
}
- private void addSalesOrderEntries(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addSalesOrderEntries(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT ol.client.id, ol.organization.id, ol.updatedBy.id as updatedby, ol.product.id,");
+ where.append(
+ " SELECT ol.client.id, ol.organization.id, ol.updatedBy.id as updatedby, ol.product.id,");
where.append(" ol.warehouse.id, ol.attributeSetValue.id, ol.uOM.id,");
where.append(" orderUOM.id,");
where.append(" ol.orderedQuantity,");
where.append(" ol.reservedQuantity,");
- where.append(" ol.orderQuantity");
+ where.append(" ol.orderQuantity,");
+ where.append(" secUOM.id");
where.append(" FROM OrderLine ol");
where.append(" join ol.salesOrder as o");
where.append(" left join ol.orderUOM as orderUOM");
+ where.append(" left join orderUOM.uOM as secUOM");
where.append(" where ol.product is not null");
where.append(" and ol.deliveredQuantity <> ol.orderedQuantity");
where.append(" and o.documentStatus in ('CO', 'IP')");
where.append(" and o.salesTransaction = true");
- where.append(" and ad_isorgincluded(ol.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
+ where.append(
+ " and ad_isorgincluded(ol.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -578,19 +582,20 @@
BigDecimal orderedqty = (BigDecimal) scrollableResults.get()[8];
BigDecimal reservedqty = (BigDecimal) scrollableResults.get()[9];
BigDecimal orderqty = (BigDecimal) scrollableResults.get()[10];
+ String secUOM = (String) scrollableResults.get()[11];
counter++;
BigDecimal qtyorder = null;
if (orderedqty.compareTo(reservedqty) == 0) {
qtyorder = orderqty;
} else if (productUOM != null && !"".equals(productUOM)) {
- qtyorder = new BigDecimal(RestoreStockValueData.convertUOM(bundle.getConnection()
- .getConnection(), bundle.getConnection(), reservedqty.toString(), uom, productUOM,
- "Y"));
+ qtyorder = new BigDecimal(
+ RestoreStockValueData.convertUOM(bundle.getConnection().getConnection(),
+ bundle.getConnection(), reservedqty.toString(), uom, secUOM, "Y"));
}
- RestoreStockValueData.updateStoragePending(bundle.getConnection().getConnection(), bundle
- .getConnection(), client, organization, updatedBy, product, warehouse, attribute, uom,
- productUOM, reservedqty != null ? reservedqty.toString() : null,
+ RestoreStockValueData.updateStoragePending(bundle.getConnection().getConnection(),
+ bundle.getConnection(), client, organization, updatedBy, product, warehouse, attribute,
+ uom, productUOM, reservedqty != null ? reservedqty.toString() : null,
qtyorder != null ? qtyorder.toString() : null, "0", null);
if (counter % 100 == 0) {
// OBDal.getInstance().getConnection(true).commit();
@@ -609,28 +614,30 @@
}
}
- private void addPurchaseOrderEntries(ProcessBundle bundle) throws ServletException,
- NoConnectionAvailableException, SQLException {
+ private void addPurchaseOrderEntries(ProcessBundle bundle)
+ throws ServletException, NoConnectionAvailableException, SQLException {
StringBuffer where = new StringBuffer();
- where
- .append(" SELECT ol.client.id, ol.organization.id, ol.updatedBy.id as updatedby, ol.product.id,");
+ where.append(
+ " SELECT ol.client.id, ol.organization.id, ol.updatedBy.id as updatedby, ol.product.id,");
where.append(" ol.warehouse.id, ol.attributeSetValue.id, ol.uOM.id,");
where.append(" orderUOM.id,");
where.append(" ol.orderedQuantity,");
- where
- .append(" ol.orderedQuantity - (select coalesce(sum(po.quantity),0) from ProcurementPOInvoiceMatch po where po.goodsShipmentLine is not null and po.salesOrderLine = ol) as pendingqty,");
- where.append(" ol.orderQuantity");
+ where.append(
+ " ol.orderedQuantity - (select coalesce(sum(po.quantity),0) from ProcurementPOInvoiceMatch po where po.goodsShipmentLine is not null and po.salesOrderLine = ol) as pendingqty,");
+ where.append(" ol.orderQuantity,");
+ where.append(" secUOM.id");
where.append(" FROM OrderLine ol");
where.append(" join ol.salesOrder as o");
- where.append(" join ol.orderUOM as orderUOM");
+ where.append(" left join ol.orderUOM as orderUOM");
+ where.append(" left join orderUOM.uOM as secUOM");
where.append(" where ol.product is not null");
- where
- .append(" and ol.orderedQuantity <> (select coalesce(sum(po.quantity),0) from ProcurementPOInvoiceMatch po where po.goodsShipmentLine is not null and po.salesOrderLine = ol)");
+ where.append(
+ " and ol.orderedQuantity <> (select coalesce(sum(po.quantity),0) from ProcurementPOInvoiceMatch po where po.goodsShipmentLine is not null and po.salesOrderLine = ol)");
where.append(" and o.documentStatus in ('CO', 'IP')");
where.append(" and o.salesTransaction = false");
- where.append(" and ad_isorgincluded(ol.organization.id, '"
- + bundle.getContext().getOrganization() + "', '" + bundle.getContext().getClient()
- + "') <> -1 ");
+ where.append(
+ " and ad_isorgincluded(ol.organization.id, '" + bundle.getContext().getOrganization()
+ + "', '" + bundle.getContext().getClient() + "') <> -1 ");
Query query = OBDal.getInstance().getSession().createQuery(where.toString());
ScrollableResults scrollableResults = query.scroll(ScrollMode.FORWARD_ONLY);
@@ -648,6 +655,7 @@
BigDecimal orderedqty = (BigDecimal) scrollableResults.get()[8];
BigDecimal pendingqty = (BigDecimal) scrollableResults.get()[9];
BigDecimal orderqty = (BigDecimal) scrollableResults.get()[10];
+ String secUOM = (String) scrollableResults.get()[11];
counter++;
BigDecimal qtyorder = null;
@@ -656,7 +664,7 @@
} else if (productUOM != null && !"".equals(productUOM)) {
qtyorder = new BigDecimal(
RestoreStockValueData.convertUOM(bundle.getConnection().getConnection(),
- bundle.getConnection(), pendingqty.toString(), uom, productUOM, "Y"));
+ bundle.getConnection(), pendingqty.toString(), uom, secUOM, "Y"));
}
RestoreStockValueData.updateStoragePending(bundle.getConnection().getConnection(),
bundle.getConnection(), client, organization, updatedBy, product, warehouse, attribute,
@@ -685,21 +693,21 @@
final Query deleteStockProposed = OBDal.getInstance().getSession()
.createQuery(strDeleteStockProposed);
deleteStockProposed.setParameter("clientId", bundle.getContext().getClient());
- deleteStockProposed.setParameterList("orgs", new OrganizationStructureProvider().getChildTree(
- bundle.getContext().getOrganization(), true));
+ deleteStockProposed.setParameterList("orgs", new OrganizationStructureProvider()
+ .getChildTree(bundle.getContext().getOrganization(), true));
deleteStockProposed.executeUpdate();
// First delete Stock aux
String strDeleteStockAux = "delete from MaterialMgmtStorageStockAux where client.id = :clientId and organization.id in (:orgs)";
final Query deleteStockAux = OBDal.getInstance().getSession().createQuery(strDeleteStockAux);
deleteStockAux.setParameter("clientId", bundle.getContext().getClient());
- deleteStockAux.setParameterList("orgs", new OrganizationStructureProvider().getChildTree(bundle
- .getContext().getOrganization(), true));
+ deleteStockAux.setParameterList("orgs", new OrganizationStructureProvider()
+ .getChildTree(bundle.getContext().getOrganization(), true));
deleteStockAux.executeUpdate();
String strDelete = "delete from MaterialMgmtStorageDetail where client.id = :clientId and organization.id in (:orgs)";
final Query delete = OBDal.getInstance().getSession().createQuery(strDelete);
delete.setParameter("clientId", bundle.getContext().getClient());
- delete.setParameterList("orgs", new OrganizationStructureProvider().getChildTree(bundle
- .getContext().getOrganization(), true));
+ delete.setParameterList("orgs", new OrganizationStructureProvider()
+ .getChildTree(bundle.getContext().getOrganization(), true));
int deleted = delete.executeUpdate();
OBDal.getInstance().getConnection(true).commit();
logger.logln("Entries deleted: " + deleted);
@@ -709,8 +717,8 @@
String strDelete = "delete from MaterialMgmtStoragePending where client.id = :clientId and organization.id in (:orgs)";
final Query delete = OBDal.getInstance().getSession().createQuery(strDelete);
delete.setParameter("clientId", bundle.getContext().getClient());
- delete.setParameterList("orgs", new OrganizationStructureProvider().getChildTree(bundle
- .getContext().getOrganization(), true));
+ delete.setParameterList("orgs", new OrganizationStructureProvider()
+ .getChildTree(bundle.getContext().getOrganization(), true));
int deleted = delete.executeUpdate();
OBDal.getInstance().getConnection(true).commit();
logger.logln("Entries deleted: " + deleted);
diff -r 36cffc78188e src/org/openbravo/module/fixstock/RestoreStockValue_data.xsql
--- a/src/org/openbravo/module/fixstock/RestoreStockValue_data.xsql Wed Aug 12 14:27:06 2015 +0200
+++ b/src/org/openbravo/module/fixstock/RestoreStockValue_data.xsql Wed May 11 17:54:08 2016 +0200
@@ -75,7 +75,7 @@
<Parameter name="qtyorderordered"/>
</SqlMethod>
- <SqlMethod name="convertUOM" type="callableStatement" connection="true" return="string">
+ <SqlMethod name="convertUOM" type="preparedStatement" connection="true" return="string">
<SqlMethodComment></SqlMethodComment>
<Sql><![CDATA[
select C_Uom_Convert(
|