Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy Wed Nov 2 19:09:13 2016 @@ -22,148 +22,148 @@ import org.apache.ofbiz.entity.util.* import org.apache.ofbiz.service.ServiceUtil import org.apache.ofbiz.base.util.* -shipmentId = request.getParameter("shipmentId"); -orderId = request.getParameter("purchaseOrderId"); -shipGroupSeqId = request.getParameter("shipGroupSeqId"); -context.shipmentId = shipmentId; -context.shipGroupSeqId = shipGroupSeqId; +shipmentId = request.getParameter("shipmentId") +orderId = request.getParameter("purchaseOrderId") +shipGroupSeqId = request.getParameter("shipGroupSeqId") +context.shipmentId = shipmentId +context.shipGroupSeqId = shipGroupSeqId // Retrieve the map resident in session which stores order item quantities to receive -itemQuantitiesToReceive = session.getAttribute("purchaseOrderItemQuantitiesToReceive"); +itemQuantitiesToReceive = session.getAttribute("purchaseOrderItemQuantitiesToReceive") if (itemQuantitiesToReceive) { - sessionShipmentId = itemQuantitiesToReceive._shipmentId; - sessionOrderId = itemQuantitiesToReceive._orderId; + sessionShipmentId = itemQuantitiesToReceive._shipmentId + sessionOrderId = itemQuantitiesToReceive._orderId if ((sessionShipmentId && !sessionShipmentId.equals(shipmentId)) || ((sessionOrderId && !sessionOrderId.equals(orderId))) || "Y".equals(request.getParameter("clearAll"))) { // Clear the map if the shipmentId or orderId are different than the current ones, or // if the clearAll parameter is present - itemQuantitiesToReceive.clear(); + itemQuantitiesToReceive.clear() } } -shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); -context.shipment = shipment; +shipment = from("Shipment").where("shipmentId", shipmentId).queryOne() +context.shipment = shipment if (!shipment) { - return; + return } -isPurchaseShipment = "PURCHASE_SHIPMENT".equals(shipment.shipmentTypeId); -context.isPurchaseShipment = isPurchaseShipment; +isPurchaseShipment = "PURCHASE_SHIPMENT".equals(shipment.shipmentTypeId) +context.isPurchaseShipment = isPurchaseShipment if (!isPurchaseShipment) { - return; + return } -facility = shipment.getRelatedOne("DestinationFacility", false); -context.facility = facility; -context.facilityId = shipment.destinationFacilityId; -context.now = UtilDateTime.nowTimestamp(); +facility = shipment.getRelatedOne("DestinationFacility", false) +context.facility = facility +context.facilityId = shipment.destinationFacilityId +context.now = UtilDateTime.nowTimestamp() if (!orderId) { - orderId = shipment.primaryOrderId; + orderId = shipment.primaryOrderId } if (!shipGroupSeqId) { - shipGroupSeqId = shipment.primaryShipGroupSeqId; + shipGroupSeqId = shipment.primaryShipGroupSeqId } -context.orderId = orderId; +context.orderId = orderId if (!orderId) { - return; + return } -orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); -context.orderHeader = orderHeader; +orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() +context.orderHeader = orderHeader if (!orderHeader) { - return; + return } -isPurchaseOrder = "PURCHASE_ORDER".equals(orderHeader.orderTypeId); -context.isPurchaseOrder = isPurchaseOrder; +isPurchaseOrder = "PURCHASE_ORDER".equals(orderHeader.orderTypeId) +context.isPurchaseOrder = isPurchaseOrder if (!isPurchaseOrder) { - return; + return } // Get the base currency from the facility owner, for currency conversions -baseCurrencyUomId = null; +baseCurrencyUomId = null if (facility) { - owner = facility.getRelatedOne("OwnerParty", false); + owner = facility.getRelatedOne("OwnerParty", false) if (owner) { - result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")]); + result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")]) if (!ServiceUtil.isError(result) && result.partyAccountingPreference) { - ownerAcctgPref = result.partyAccountingPreference; + ownerAcctgPref = result.partyAccountingPreference } } if (ownerAcctgPref) { - baseCurrencyUomId = ownerAcctgPref.baseCurrencyUomId; + baseCurrencyUomId = ownerAcctgPref.baseCurrencyUomId } } -inventoryItemTypes = from("InventoryItemType").queryList(); -context.inventoryItemTypes = inventoryItemTypes; +inventoryItemTypes = from("InventoryItemType").queryList() +context.inventoryItemTypes = inventoryItemTypes // Populate the tracking map with shipment and order IDs if (!itemQuantitiesToReceive) { - itemQuantitiesToReceive = [_shipmentId : shipmentId, _orderId : orderId]; + itemQuantitiesToReceive = [_shipmentId : shipmentId, _orderId : orderId] } -oiasgaLimitMap = null; +oiasgaLimitMap = null if (shipGroupSeqId) { - oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId]; + oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId] } -orderItemDatas = [:] as TreeMap; -totalAvailableToReceive = 0; +orderItemDatas = [:] as TreeMap +totalAvailableToReceive = 0 // Populate the order item data for the FTL -orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false); +orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId'], false) orderItems.each { orderItemAndShipGroupAssoc -> - product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false); + product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false) // Get the order item, since the orderItemAndShipGroupAssoc's quantity field is manipulated in some cases - orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemAndShipGroupAssoc.orderItemSeqId).queryOne(); - orderItemData = [:]; + orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemAndShipGroupAssoc.orderItemSeqId).queryOne() + orderItemData = [:] // Get the item's ordered quantity - totalOrdered = 0; - ordered = orderItem.getDouble("quantity"); + totalOrdered = 0 + ordered = orderItem.getDouble("quantity") if (ordered) { - totalOrdered += ordered.doubleValue(); + totalOrdered += ordered.doubleValue() } - cancelled = orderItem.getDouble("cancelQuantity"); + cancelled = orderItem.getDouble("cancelQuantity") if (cancelled) { - totalOrdered -= cancelled.doubleValue(); + totalOrdered -= cancelled.doubleValue() } // Get the item quantity received from all shipments via the ShipmentReceipt entity - totalReceived = 0.0; - receipts = from("ShipmentReceipt").where("orderId", orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList(); - fulfilledReservations = [] as ArrayList; + totalReceived = 0.0 + receipts = from("ShipmentReceipt").where("orderId", orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList() + fulfilledReservations = [] as ArrayList if (receipts) { receipts.each { rec -> - accepted = rec.getDouble("quantityAccepted"); - rejected = rec.getDouble("quantityRejected"); + accepted = rec.getDouble("quantityAccepted") + rejected = rec.getDouble("quantityRejected") if (accepted) { - totalReceived += accepted.doubleValue(); + totalReceived += accepted.doubleValue() } if (rejected) { - totalReceived += rejected.doubleValue(); + totalReceived += rejected.doubleValue() } // Get the reservations related to this receipt - oisgirs = from("OrderItemShipGrpInvRes").where("inventoryItemId", rec.inventoryItemId).queryList(); + oisgirs = from("OrderItemShipGrpInvRes").where("inventoryItemId", rec.inventoryItemId).queryList() if (oisgirs) { - fulfilledReservations.addAll(oisgirs); + fulfilledReservations.addAll(oisgirs) } } } - orderItemData.fulfilledReservations = fulfilledReservations; + orderItemData.fulfilledReservations = fulfilledReservations // Update the unit cost with the converted value, if any if (baseCurrencyUomId && orderHeader.currencyUom) { if (product) { - result = runService('convertUom', [uomId : orderHeader.currencyUom, uomIdTo : baseCurrencyUomId, originalValue : orderItem.unitPrice]); + result = runService('convertUom', [uomId : orderHeader.currencyUom, uomIdTo : baseCurrencyUomId, originalValue : orderItem.unitPrice]) if (!ServiceUtil.isError(result)) { - orderItem.unitPrice = result.convertedValue; + orderItem.unitPrice = result.convertedValue } } } @@ -171,103 +171,103 @@ orderItems.each { orderItemAndShipGroupA // Retrieve the backordered quantity // TODO: limit to a facility? The shipment destination facility is not necessarily the same facility as the inventory conditions = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.productId), - EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.LESS_THAN, BigDecimal.ZERO)]; - negativeInventoryItems = from("InventoryItem").where(conditions).queryList(); - backOrderedQuantity = 0; + EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.LESS_THAN, BigDecimal.ZERO)] + negativeInventoryItems = from("InventoryItem").where(conditions).queryList() + backOrderedQuantity = 0 negativeInventoryItems.each { negativeInventoryItem -> - backOrderedQuantity += negativeInventoryItem.getDouble("availableToPromiseTotal").doubleValue(); + backOrderedQuantity += negativeInventoryItem.getDouble("availableToPromiseTotal").doubleValue() } - orderItemData.backOrderedQuantity = Math.abs(backOrderedQuantity); + orderItemData.backOrderedQuantity = Math.abs(backOrderedQuantity) // Calculate how many units it should be possible to recieve for this purchase order - availableToReceive = totalOrdered - totalReceived; - totalAvailableToReceive += availableToReceive; - orderItemData.availableToReceive = availableToReceive; - orderItemData.totalQuantityReceived = totalReceived; - orderItemData.shipGroupSeqId = orderItemAndShipGroupAssoc.shipGroupSeqId; - orderItemData.orderItem = orderItem; - orderItemData.product = product; - orderItemDatas.put(orderItem.orderItemSeqId, orderItemData); + availableToReceive = totalOrdered - totalReceived + totalAvailableToReceive += availableToReceive + orderItemData.availableToReceive = availableToReceive + orderItemData.totalQuantityReceived = totalReceived + orderItemData.shipGroupSeqId = orderItemAndShipGroupAssoc.shipGroupSeqId + orderItemData.orderItem = orderItem + orderItemData.product = product + orderItemDatas.put(orderItem.orderItemSeqId, orderItemData) } -context.orderItemDatas = orderItemDatas.values(); +context.orderItemDatas = orderItemDatas.values() // Handle any item product quantities to receive by adding to the map in session -productIdToReceive = request.getParameter("productId"); -productQtyToReceive = request.getParameter("quantity"); -context.newQuantity = productQtyToReceive; +productIdToReceive = request.getParameter("productId") +productQtyToReceive = request.getParameter("quantity") +context.newQuantity = productQtyToReceive if (productIdToReceive) { - List candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : productIdToReceive]); + List candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : productIdToReceive]) // If the productId as given isn't found in the order, try any goodIdentifications and use the first match if (!candidateOrderItems) { - goodIdentifications = from("GoodIdentification").where("idValue", productIdToReceive).queryList(); + goodIdentifications = from("GoodIdentification").where("idValue", productIdToReceive).queryList() if (goodIdentifications) { - giit = goodIdentifications.iterator(); + giit = goodIdentifications.iterator() while (giit.hasNext()) { - goodIdentification = giit.next(); - candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : goodIdentification.productId]); + goodIdentification = giit.next() + candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : goodIdentification.productId]) if (candidateOrderItems) { - productIdToReceive = goodIdentification.productId; - break; + productIdToReceive = goodIdentification.productId + break } } } } if (candidateOrderItems) { - quantity = 0; + quantity = 0 if (productQtyToReceive) { try { - quantity = Double.parseDouble(productQtyToReceive); + quantity = Double.parseDouble(productQtyToReceive) } catch (Exception e) { // Ignore the quantity update if there's a problem parsing it } } - totalQuantityUsed = 0; - totalQuantityToReceiveBefore = 0; - pqit = candidateOrderItems.iterator(); + totalQuantityUsed = 0 + totalQuantityToReceiveBefore = 0 + pqit = candidateOrderItems.iterator() while (pqit.hasNext() && totalQuantityUsed < quantity) { - candidateOrderItem = pqit.next(); - orderItemSeqId = candidateOrderItem.orderItemSeqId; - qtyBefore = itemQuantitiesToReceive.containsKey(orderItemSeqId) ? itemQuantitiesToReceive.get(orderItemSeqId) : 0; - totalQuantityToReceiveBefore += qtyBefore; - qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).availableToReceive - qtyBefore; + candidateOrderItem = pqit.next() + orderItemSeqId = candidateOrderItem.orderItemSeqId + qtyBefore = itemQuantitiesToReceive.containsKey(orderItemSeqId) ? itemQuantitiesToReceive.get(orderItemSeqId) : 0 + totalQuantityToReceiveBefore += qtyBefore + qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).availableToReceive - qtyBefore if (qtyMaxAvailable <= 0) { - continue; + continue } - qtyUsedForItem = quantity - totalQuantityUsed >= qtyMaxAvailable ? qtyMaxAvailable : quantity - totalQuantityUsed; - itemQuantitiesToReceive.put(orderItemSeqId, qtyUsedForItem + qtyBefore); - totalQuantityUsed += qtyUsedForItem; + qtyUsedForItem = quantity - totalQuantityUsed >= qtyMaxAvailable ? qtyMaxAvailable : quantity - totalQuantityUsed + itemQuantitiesToReceive.put(orderItemSeqId, qtyUsedForItem + qtyBefore) + totalQuantityUsed += qtyUsedForItem } // If there's any quantity to receive left after using as much as possible for every relevant order item, add an error message to the context if (quantity > totalQuantityUsed) { - context.ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive = true; + context.ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive = true } // Notify if some or all of the quantity just entered for the product will go to a backorder - backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).orderItemSeqId).backOrderedQuantity - totalQuantityToReceiveBefore; + backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).orderItemSeqId).backOrderedQuantity - totalQuantityToReceiveBefore if (backOrderedQuantity > 0) { - totalQtyUsedForBackorders = backOrderedQuantity >= totalQuantityUsed ? totalQuantityUsed : backOrderedQuantity; + totalQtyUsedForBackorders = backOrderedQuantity >= totalQuantityUsed ? totalQuantityUsed : backOrderedQuantity if (totalQtyUsedForBackorders > 0) { - context.quantityToReceive = totalQuantityUsed; - context.quantityToBackOrder = totalQtyUsedForBackorders; - context.ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder = true; + context.quantityToReceive = totalQuantityUsed + context.quantityToBackOrder = totalQtyUsedForBackorders + context.ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder = true } } } else { // Add an error message to the context if the productId doesn't exist in this purchase order - context.ProductReceiveInventoryAgainstPurchaseOrderProductNotFound = true; + context.ProductReceiveInventoryAgainstPurchaseOrderProductNotFound = true } } // Put the tracking map back into the session, in case it has been reconstructed -session.setAttribute("purchaseOrderItemQuantitiesToReceive", itemQuantitiesToReceive); -context.itemQuantitiesToReceive = itemQuantitiesToReceive; -context.totalAvailableToReceive = totalAvailableToReceive; +session.setAttribute("purchaseOrderItemQuantitiesToReceive", itemQuantitiesToReceive) +context.itemQuantitiesToReceive = itemQuantitiesToReceive +context.totalAvailableToReceive = totalAvailableToReceive Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ReviewOrdersNotPickedOrPacked.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.util.EntityUtil -import java.text.SimpleDateFormat; +import java.text.SimpleDateFormat -condList = []; -condList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED")); -condList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")); -condList.add(EntityCondition.makeCondition("pickSheetPrintedDate", EntityOperator.NOT_EQUAL, null)); -orderHeaders = from("OrderHeader").where(condList).queryList(); -orders = []; -SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'/'K:mm a"); +condList = [] +condList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED")) +condList.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")) +condList.add(EntityCondition.makeCondition("pickSheetPrintedDate", EntityOperator.NOT_EQUAL, null)) +orderHeaders = from("OrderHeader").where(condList).queryList() +orders = [] +SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'/'K:mm a") orderHeaders.each { orderHeader -> - itemIssuanceList = from("ItemIssuance").where("orderId", orderHeader.orderId).queryList(); + itemIssuanceList = from("ItemIssuance").where("orderId", orderHeader.orderId).queryList() if (itemIssuanceList) { - orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "Y"]); + orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "Y"]) } else { - orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "N"]); + orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "N"]) } } -context.orders = orders; +context.orders = orders Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ShipmentManifest.groovy Wed Nov 2 19:09:13 2016 @@ -21,44 +21,44 @@ import org.apache.ofbiz.entity.* import org.apache.ofbiz.base.util.* import org.apache.ofbiz.content.report.* -shipmentId = request.getParameter("shipmentId"); -shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); +shipmentId = request.getParameter("shipmentId") +shipment = from("Shipment").where("shipmentId", shipmentId).queryOne() if (shipment) { - shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", null, ['shipmentRouteSegmentId', 'shipmentPackageSeqId'], false); - shipmentPackageDatas = [] as LinkedList; + shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", null, ['shipmentRouteSegmentId', 'shipmentPackageSeqId'], false) + shipmentPackageDatas = [] as LinkedList if (shipmentPackageRouteSegs) { shipmentPackageRouteSegs.each { shipmentPackageRouteSeg -> - shipmentPackages = shipmentPackageRouteSeg.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false); - shipmentRouteSegment = shipmentPackageRouteSeg.getRelatedOne("ShipmentRouteSegment", false); + shipmentPackages = shipmentPackageRouteSeg.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false) + shipmentRouteSegment = shipmentPackageRouteSeg.getRelatedOne("ShipmentRouteSegment", false) if (shipmentPackages) { shipmentPackages.each { shipmentPackage -> - shipmentItemsDatas = [] as LinkedList; - shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false); + shipmentItemsDatas = [] as LinkedList + shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false) if (shipmentPackageContents) { shipmentPackageContents.each { shipmentPackageContent -> - shipmentItemsData = [:]; - packageQuantity = shipmentPackageContent.getDouble("quantity"); - shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem", false); + shipmentItemsData = [:] + packageQuantity = shipmentPackageContent.getDouble("quantity") + shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem", false) if (shipmentItem) { - shippedQuantity = shipmentItem.getDouble("quantity"); - shipmentItemsData.shipmentItem = shipmentItem; - shipmentItemsData.shippedQuantity = shippedQuantity; - shipmentItemsData.packageQuantity = packageQuantity; - shipmentItemsDatas.add(shipmentItemsData); + shippedQuantity = shipmentItem.getDouble("quantity") + shipmentItemsData.shipmentItem = shipmentItem + shipmentItemsData.shippedQuantity = shippedQuantity + shipmentItemsData.packageQuantity = packageQuantity + shipmentItemsDatas.add(shipmentItemsData) } } } - shipmentPackageData = [:]; - shipmentPackageData.shipmentPackage = shipmentPackage; - shipmentPackageData.shipmentRouteSegment = shipmentRouteSegment; - shipmentPackageData.shipmentItemsDatas = shipmentItemsDatas; - shipmentPackageDatas.add(shipmentPackageData); + shipmentPackageData = [:] + shipmentPackageData.shipmentPackage = shipmentPackage + shipmentPackageData.shipmentRouteSegment = shipmentRouteSegment + shipmentPackageData.shipmentItemsDatas = shipmentItemsDatas + shipmentPackageDatas.add(shipmentPackageData) } } } } - context.shipmentPackageDatas = shipmentPackageDatas; + context.shipmentPackageDatas = shipmentPackageDatas } -context.shipmentId = shipmentId; -context.shipment = shipment; +context.shipmentId = shipmentId +context.shipment = shipment Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/VerifyPick.groovy Wed Nov 2 19:09:13 2016 @@ -17,110 +17,110 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilProperties; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.order.order.OrderReadHelper; -import org.apache.ofbiz.shipment.verify.VerifyPickSession; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.base.util.UtilProperties +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.order.order.OrderReadHelper +import org.apache.ofbiz.shipment.verify.VerifyPickSession +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.entity.condition.EntityOperator -verifyPickSession = session.getAttribute("verifyPickSession"); +verifyPickSession = session.getAttribute("verifyPickSession") if (!verifyPickSession) { - verifyPickSession = new VerifyPickSession(dispatcher, userLogin); - session.setAttribute("verifyPickSession", verifyPickSession); + verifyPickSession = new VerifyPickSession(dispatcher, userLogin) + session.setAttribute("verifyPickSession", verifyPickSession) } -shipmentId = parameters.shipmentId; +shipmentId = parameters.shipmentId if (!shipmentId) { - shipmentId = request.getAttribute("shipmentId"); + shipmentId = request.getAttribute("shipmentId") } -context.shipmentId = shipmentId; +context.shipmentId = shipmentId if (shipmentId) { - context.orderId = null; - shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); + context.orderId = null + shipment = from("Shipment").where("shipmentId", shipmentId).queryOne() if (shipment) { - shipmentItemBillingList = shipment.getRelated("ShipmentItemBilling", null, null, false); - invoiceIds = EntityUtil.getFieldListFromEntityList(shipmentItemBillingList, "invoiceId", true); + shipmentItemBillingList = shipment.getRelated("ShipmentItemBilling", null, null, false) + invoiceIds = EntityUtil.getFieldListFromEntityList(shipmentItemBillingList, "invoiceId", true) if (invoiceIds) { - context.invoiceIds = invoiceIds; - parameters.orderId = null; + context.invoiceIds = invoiceIds + parameters.orderId = null } } } -facilityId = parameters.facilityId; +facilityId = parameters.facilityId if (facilityId) { - facility = from("Facility").where("facilityId", facilityId).queryOne(); - context.facility = facility; + facility = from("Facility").where("facilityId", facilityId).queryOne() + context.facility = facility } -verifyPickSession.setFacilityId(facilityId); -orderId = parameters.orderId; -shipGroupSeqId = parameters.shipGroupSeqId; +verifyPickSession.setFacilityId(facilityId) +orderId = parameters.orderId +shipGroupSeqId = parameters.shipGroupSeqId if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) { - idArray = orderId.split("\\/"); - orderId = idArray[0]; - shipGroupSeqId = idArray[1]; + idArray = orderId.split("\\/") + orderId = idArray[0] + shipGroupSeqId = idArray[1] } else if (orderId && !shipGroupSeqId) { - shipGroupSeqId = "00001"; + shipGroupSeqId = "00001" } -picklistBinId = parameters.picklistBinId; +picklistBinId = parameters.picklistBinId if (picklistBinId) { - picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne(); + picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne() if (picklistBin) { - orderId = picklistBin.primaryOrderId; - shipGroupSeqId = picklistBin.primaryShipGroupSeqId; - verifyPickSession.setPicklistBinId(picklistBinId); + orderId = picklistBin.primaryOrderId + shipGroupSeqId = picklistBin.primaryShipGroupSeqId + verifyPickSession.setPicklistBinId(picklistBinId) } } if (orderId && !picklistBinId) { - picklistBin = from("PicklistBin").where("primaryOrderId", orderId).queryFirst(); + picklistBin = from("PicklistBin").where("primaryOrderId", orderId).queryFirst() if (picklistBin) { - picklistBinId = picklistBin.picklistBinId; - verifyPickSession.setPicklistBinId(picklistBinId); + picklistBinId = picklistBin.picklistBinId + verifyPickSession.setPicklistBinId(picklistBinId) } } -context.orderId = orderId; -context.shipGroupSeqId = shipGroupSeqId; -context.picklistBinId = picklistBinId; -context.isOrderStatusApproved = false; +context.orderId = orderId +context.shipGroupSeqId = shipGroupSeqId +context.picklistBinId = picklistBinId +context.isOrderStatusApproved = false if (orderId) { - orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() if (orderHeader) { - OrderReadHelper orh = new OrderReadHelper(orderHeader); - context.orderId = orderId; - context.orderHeader = orderHeader; - context.orderReadHelper = orh; + OrderReadHelper orh = new OrderReadHelper(orderHeader) + context.orderId = orderId + context.orderHeader = orderHeader + context.orderReadHelper = orh - orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId); - context.orderItemShipGroup = orderItemShipGroup; - List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")); - orderItems = orh.getOrderItemsByCondition(exprs); - context.orderItems = orderItems; + orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId) + context.orderItemShipGroup = orderItemShipGroup + List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")) + orderItems = orh.getOrderItemsByCondition(exprs) + context.orderItems = orderItems if ("ORDER_APPROVED".equals(orderHeader.statusId)) { - context.isOrderStatusApproved = true; + context.isOrderStatusApproved = true if (shipGroupSeqId) { - productStoreId = orh.getProductStoreId(); - context.productStoreId = productStoreId; - shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList(); + productStoreId = orh.getProductStoreId() + context.productStoreId = productStoreId + shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList() if (shipments) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId], locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId], locale)) } } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale)) } } else { - context.isOrderStatusApproved = false; - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPicking", [orderId : orderId], locale)); + context.isOrderStatusApproved = false + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPicking", [orderId : orderId], locale)) } } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale)) } } -context.verifyPickSession = verifyPickSession; +context.verifyPickSession = verifyPickSession Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/ViewShipment.groovy Wed Nov 2 19:09:13 2016 @@ -19,42 +19,42 @@ import org.apache.ofbiz.entity.condition.* -shipmentId = parameters.shipmentId; +shipmentId = parameters.shipmentId if (!shipmentId) { - shipmentId = request.getAttribute("shipmentId"); + shipmentId = request.getAttribute("shipmentId") } -shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); +shipment = from("Shipment").where("shipmentId", shipmentId).queryOne() -context.shipmentId = shipmentId; -context.shipment = shipment; +context.shipmentId = shipmentId +context.shipment = shipment if (shipment) { - context.shipmentType = shipment.getRelatedOne("ShipmentType", false); - context.statusItem = shipment.getRelatedOne("StatusItem", false); - context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false); - context.toPerson = shipment.getRelatedOne("ToPerson", false); - context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false); - context.fromPerson = shipment.getRelatedOne("FromPerson", false); - context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false); - context.originFacility = shipment.getRelatedOne("OriginFacility", false); - context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false); - context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false); - context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false); + context.shipmentType = shipment.getRelatedOne("ShipmentType", false) + context.statusItem = shipment.getRelatedOne("StatusItem", false) + context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false) + context.toPerson = shipment.getRelatedOne("ToPerson", false) + context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false) + context.fromPerson = shipment.getRelatedOne("FromPerson", false) + context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false) + context.originFacility = shipment.getRelatedOne("OriginFacility", false) + context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false) + context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false) + context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false) } // check permission -hasPermission = false; +hasPermission = false if (security.hasEntityPermission("FACILITY", "_VIEW", userLogin)) { - hasPermission = true; + hasPermission = true } else { if (shipment) { if (shipment.primaryOrderId) { // allow if userLogin is associated with the primaryOrderId with the SUPPLIER_AGENT roleTypeId - orderRole = from("OrderRole").where("orderId", shipment.primaryOrderId, "partyId", userLogin.partyId, "roleTypeId", "SUPPLIER_AGENT").queryOne(); + orderRole = from("OrderRole").where("orderId", shipment.primaryOrderId, "partyId", userLogin.partyId, "roleTypeId", "SUPPLIER_AGENT").queryOne() if (orderRole) { - hasPermission = true; + hasPermission = true } } } } -context.hasPermission = hasPermission; +context.hasPermission = hasPermission Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy (original) +++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/WeightPackage.groovy Wed Nov 2 19:09:13 2016 @@ -17,188 +17,188 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilProperties; -import org.apache.ofbiz.entity.GenericValue; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.util.EntityUtilProperties; -import org.apache.ofbiz.order.order.OrderReadHelper; -import org.apache.ofbiz.shipment.weightPackage.WeightPackageSession; +import org.apache.ofbiz.base.util.UtilProperties +import org.apache.ofbiz.entity.GenericValue +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.util.EntityUtilProperties +import org.apache.ofbiz.order.order.OrderReadHelper +import org.apache.ofbiz.shipment.weightPackage.WeightPackageSession -weightPackageSession = session.getAttribute("weightPackageSession"); +weightPackageSession = session.getAttribute("weightPackageSession") if (!weightPackageSession) { - weightPackageSession = new WeightPackageSession(dispatcher, userLogin); - session.setAttribute("weightPackageSession", weightPackageSession); + weightPackageSession = new WeightPackageSession(dispatcher, userLogin) + session.setAttribute("weightPackageSession", weightPackageSession) } -context.weightPackageSession = weightPackageSession; +context.weightPackageSession = weightPackageSession -showWarningForm = parameters.showWarningForm; +showWarningForm = parameters.showWarningForm if (!showWarningForm) { - showWarningForm = request.getAttribute("showWarningForm"); + showWarningForm = request.getAttribute("showWarningForm") if (!showWarningForm) { - showWarningForm = false; + showWarningForm = false } } -context.showWarningForm = showWarningForm; +context.showWarningForm = showWarningForm -orderId = parameters.orderId; -shipGroupSeqId = parameters.shipGroupSeqId; +orderId = parameters.orderId +shipGroupSeqId = parameters.shipGroupSeqId -shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst(); -context.shipment = shipment; +shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst() +context.shipment = shipment if (shipment) { - invoice = from("ShipmentItemBilling").where("shipmentId", shipment.shipmentId).queryFirst(); - context.invoice = invoice; + invoice = from("ShipmentItemBilling").where("shipmentId", shipment.shipmentId).queryFirst() + context.invoice = invoice } else { - context.invoice = null; + context.invoice = null } -actualCost = null; +actualCost = null if (shipment) { - shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", shipment.shipmentId).queryFirst(); - actualCost = shipmentRouteSegment.actualCost; + shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", shipment.shipmentId).queryFirst() + actualCost = shipmentRouteSegment.actualCost if (actualCost) { - context.shipmentPackages = from("ShipmentPackage").where("shipmentId", shipment.shipmentId).queryList(); + context.shipmentPackages = from("ShipmentPackage").where("shipmentId", shipment.shipmentId).queryList() } } -facilityId = parameters.facilityId; +facilityId = parameters.facilityId if (facilityId) { - facility = from("Facility").where("facilityId", facilityId).queryOne(); - context.facility = facility; + facility = from("Facility").where("facilityId", facilityId).queryOne() + context.facility = facility } if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) { - idSplit = orderId.split("\\/"); - orderId = idSplit[0]; - shipGroupSeqId = idSplit[1]; + idSplit = orderId.split("\\/") + orderId = idSplit[0] + shipGroupSeqId = idSplit[1] } else if (orderId && !shipGroupSeqId) { - shipGroupSeqId = "00001"; + shipGroupSeqId = "00001" } -picklistBinId = parameters.picklistBinId; +picklistBinId = parameters.picklistBinId if (picklistBinId) { - picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne(); + picklistBin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne() if (picklistBin) { - orderId = picklistBin.primaryOrderId; - shipGroupSeqId = picklistBin.primaryShipGroupSeqId; + orderId = picklistBin.primaryOrderId + shipGroupSeqId = picklistBin.primaryShipGroupSeqId } else { - picklistBinId = null; + picklistBinId = null } } -shipmentId = parameters.shipmentId; +shipmentId = parameters.shipmentId if (!shipmentId) { - shipmentId = request.getAttribute("shipmentId"); + shipmentId = request.getAttribute("shipmentId") } if (!shipmentId && shipment) { - shipmentId = shipment.shipmentId; + shipmentId = shipment.shipmentId } -context.shipmentId = shipmentId; +context.shipmentId = shipmentId if (shipmentId) { // Get the primaryOrderId from the shipment - shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); + shipment = from("Shipment").where("shipmentId", shipmentId).queryOne() if (shipment && shipment.primaryOrderId) { - orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList(); - invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true); + orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList() + invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true) if (invoiceIds) { - context.invoiceIds = invoiceIds; + context.invoiceIds = invoiceIds } } if (shipment.statusId && "SHIPMENT_PACKED" == shipment.statusId) { - orderId = null; + orderId = null } - shipmentPackageRouteSegs = from("ShipmentPackageRouteSeg").where("shipmentId", shipmentId).queryList(); - shipmentPackageRouteSegList = []; + shipmentPackageRouteSegs = from("ShipmentPackageRouteSeg").where("shipmentId", shipmentId).queryList() + shipmentPackageRouteSegList = [] shipmentPackageRouteSegs.each { shipmentPackageRouteSeg -> if (shipmentPackageRouteSeg.labelImage) { - shipmentPackageRouteSegList.add(shipmentPackageRouteSeg); + shipmentPackageRouteSegList.add(shipmentPackageRouteSeg) } } - context.shipmentPackageRouteSegList = shipmentPackageRouteSegList; + context.shipmentPackageRouteSegList = shipmentPackageRouteSegList } weightPackageSession.setShipmentId(shipmentId) -weightPackageSession.setPrimaryShipGroupSeqId(shipGroupSeqId); -weightPackageSession.setPrimaryOrderId(orderId); -weightPackageSession.setPicklistBinId(picklistBinId); -weightPackageSession.setFacilityId(facilityId); -context.primaryOrderId = orderId; +weightPackageSession.setPrimaryShipGroupSeqId(shipGroupSeqId) +weightPackageSession.setPrimaryOrderId(orderId) +weightPackageSession.setPicklistBinId(picklistBinId) +weightPackageSession.setFacilityId(facilityId) +context.primaryOrderId = orderId -carrierPartyId = null; +carrierPartyId = null if (orderId) { - orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() if (orderHeader) { - OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader); - GenericValue orderItemShipGroup = orderReadHelper.getOrderItemShipGroup(shipGroupSeqId); - carrierPartyId = orderItemShipGroup.carrierPartyId; + OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader) + GenericValue orderItemShipGroup = orderReadHelper.getOrderItemShipGroup(shipGroupSeqId) + carrierPartyId = orderItemShipGroup.carrierPartyId if ("ORDER_APPROVED".equals(orderHeader.statusId)) { if (shipGroupSeqId) { if (shipment) { - productStoreId = orderReadHelper.getProductStoreId(); - shippableItemInfo = orderReadHelper.getOrderItemAndShipGroupAssoc(shipGroupSeqId); - shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList(); - shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId); - shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId); - shippableQuantity = orderReadHelper.getShippableQuantity(shipGroupSeqId); - estimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity); + productStoreId = orderReadHelper.getProductStoreId() + shippableItemInfo = orderReadHelper.getOrderItemAndShipGroupAssoc(shipGroupSeqId) + shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList() + shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId) + shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId) + shippableQuantity = orderReadHelper.getShippableQuantity(shipGroupSeqId) + estimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity) if (weightPackageSession.getPackedLines(orderId)) { - shipWeight = weightPackageSession.getShippableWeight(orderId); - newEstimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shipWeight, shippableQuantity); - context.newEstimatedShippingCost = newEstimatedShippingCost; + shipWeight = weightPackageSession.getShippableWeight(orderId) + newEstimatedShippingCost = weightPackageSession.getShipmentCostEstimate(orderItemShipGroup, orderId, productStoreId, shippableItemInfo, shippableTotal, shipWeight, shippableQuantity) + context.newEstimatedShippingCost = newEstimatedShippingCost } - context.productStoreId = productStoreId; - context.estimatedShippingCost = estimatedShippingCost; + context.productStoreId = productStoreId + context.estimatedShippingCost = estimatedShippingCost } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerified", ["orderId" : orderId], locale)); - orderId = null; + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotVerified", ["orderId" : orderId], locale)) + orderId = null } } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale)); - orderId = null; + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoShipGroupSequenceIdFoundCannotProcess", locale)) + orderId = null } } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPacking", [orderId : orderId], locale)); - orderId = null; + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderNotApprovedForPacking", [orderId : orderId], locale)) + orderId = null } } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale)); - orderId = null; + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderIdNotFound", [orderId : orderId], locale)) + orderId = null } - context.orderedQuantity = weightPackageSession.getOrderedQuantity(orderId); + context.orderedQuantity = weightPackageSession.getOrderedQuantity(orderId) } -weightPackageSession.setCarrierPartyId(carrierPartyId); -context.orderId = orderId; -context.shipGroupSeqId = shipGroupSeqId; -context.picklistBinId = picklistBinId; +weightPackageSession.setCarrierPartyId(carrierPartyId) +context.orderId = orderId +context.shipGroupSeqId = shipGroupSeqId +context.picklistBinId = picklistBinId if (carrierPartyId) { - carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList(); - shipmentBoxTypes = []; + carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList() + shipmentBoxTypes = [] carrierShipmentBoxTypes.each { carrierShipmentBoxType -> - shipmentBoxTypes.add(from("ShipmentBoxType").where("shipmentBoxTypeId", carrierShipmentBoxType.shipmentBoxTypeId).queryOne()); - context.shipmentBoxTypes = shipmentBoxTypes; + shipmentBoxTypes.add(from("ShipmentBoxType").where("shipmentBoxTypeId", carrierShipmentBoxType.shipmentBoxTypeId).queryOne()) + context.shipmentBoxTypes = shipmentBoxTypes } } if (actualCost) { - context.newEstimatedShippingCost = actualCost; + context.newEstimatedShippingCost = actualCost } -defaultDimensionUomId = null; +defaultDimensionUomId = null if (facility) { - defaultDimensionUomId = facility.defaultDimensionUomId; + defaultDimensionUomId = facility.defaultDimensionUomId } if (!defaultDimensionUomId) { - defaultDimensionUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.dimension.uom", "LEN_in", delegator); + defaultDimensionUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.dimension.uom", "LEN_in", delegator) } -context.defaultDimensionUomId = defaultDimensionUomId; +context.defaultDimensionUomId = defaultDimensionUomId -defaultWeightUomId = null; +defaultWeightUomId = null if (facility) { - defaultWeightUomId = facility.defaultWeightUomId; + defaultWeightUomId = facility.defaultWeightUomId } if (!defaultWeightUomId) { - defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator); + defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator) } -context.defaultWeightUomId = defaultWeightUomId; +context.defaultWeightUomId = defaultWeightUomId Modified: ofbiz/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy Wed Nov 2 19:09:13 2016 @@ -17,15 +17,15 @@ * under the License. */ -import java.util.*; -import org.apache.ofbiz.entity.util.*; +import java.util.* +import org.apache.ofbiz.entity.util.* -boolean isCalOwner = false; -List partyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId], null, false)); +boolean isCalOwner = false +List partyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId], null, false)) for (partyAssign in partyAssignments) { if ("CAL_OWNER".equals(partyAssign.roleTypeId) || "CAL_DELEGATE".equals(partyAssign.roleTypeId)) { - isCalOwner = true; - break; + isCalOwner = true + break } } -context.isCalOwner = isCalOwner; +context.isCalOwner = isCalOwner Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/CreateUrlParam.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; +import org.apache.ofbiz.base.util.UtilMisc // Allow containing screens to specify URL parameters to be included in calendar navigation links -List urlParameterNames = context.urlParameterNames; +List urlParameterNames = context.urlParameterNames if (urlParameterNames == null) { - urlParameterNames = UtilMisc.toList("fixedAssetId", "partyId", "workEffortTypeId", "calendarType", "hideEvents", "portalPageId"); + urlParameterNames = UtilMisc.toList("fixedAssetId", "partyId", "workEffortTypeId", "calendarType", "hideEvents", "portalPageId") } -StringBuilder sb = new StringBuilder(); +StringBuilder sb = new StringBuilder() for (entry in parameters.entrySet()) { if (urlParameterNames.contains(entry.getKey())) { - sb.append("&").append(entry.getKey()).append("=").append(entry.getValue()); + sb.append("&").append(entry.getKey()).append("=").append(entry.getValue()) } } -context.put("urlParam", sb.toString()); +context.put("urlParam", sb.toString()) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Days.groovy Wed Nov 2 19:09:13 2016 @@ -17,33 +17,33 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.base.util.UtilValidate; +import java.sql.Timestamp +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.base.util.UtilValidate -String startParam = parameters.startTime; -Timestamp start = null; +String startParam = parameters.startTime +Timestamp start = null if (UtilValidate.isNotEmpty(startParam)) { - start = new Timestamp(Long.parseLong(startParam)); + start = new Timestamp(Long.parseLong(startParam)) } if (start == null) { - start = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale); + start = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale) } else { - start = UtilDateTime.getDayStart(start, timeZone, locale); + start = UtilDateTime.getDayStart(start, timeZone, locale) } -Timestamp prev = UtilDateTime.getDayStart(start, -1, timeZone, locale); -context.prevMillis = new Long(prev.getTime()).toString(); -Timestamp next = UtilDateTime.getDayStart(start, 1, timeZone, locale); -context.nextMillis = new Long(next.getTime()).toString(); -Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters); -serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 24, "periodType", Calendar.HOUR, "locale", locale, "timeZone", timeZone)); +Timestamp prev = UtilDateTime.getDayStart(start, -1, timeZone, locale) +context.prevMillis = new Long(prev.getTime()).toString() +Timestamp next = UtilDateTime.getDayStart(start, 1, timeZone, locale) +context.nextMillis = new Long(next.getTime()).toString() +Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters) +serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 24, "periodType", Calendar.HOUR, "locale", locale, "timeZone", timeZone)) if (context.entityExprList) { - serviceCtx.entityExprList = entityExprList; + serviceCtx.entityExprList = entityExprList } -Map result = runService('getWorkEffortEventsByPeriod', serviceCtx); -context.put("periods", result.get("periods")); -context.put("maxConcurrentEntries", result.get("maxConcurrentEntries")); -context.put("start", start); -context.put("prev", prev); -context.put("next", next); +Map result = runService('getWorkEffortEventsByPeriod', serviceCtx) +context.put("periods", result.get("periods")) +context.put("maxConcurrentEntries", result.get("maxConcurrentEntries")) +context.put("start", start) +context.put("prev", prev) +context.put("next", next) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Month.groovy Wed Nov 2 19:09:13 2016 @@ -17,56 +17,56 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.base.util.UtilValidate; +import java.sql.Timestamp +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.base.util.UtilValidate -String startParam = parameters.startTime; -Timestamp start = null; +String startParam = parameters.startTime +Timestamp start = null if (UtilValidate.isNotEmpty(startParam)) { - start = new Timestamp(Long.parseLong(startParam)); + start = new Timestamp(Long.parseLong(startParam)) } if (start == null) { - start = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale); + start = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale) } else { - start = UtilDateTime.getMonthStart(start, timeZone, locale); + start = UtilDateTime.getMonthStart(start, timeZone, locale) } -tempCal = UtilDateTime.toCalendar(start, timeZone, locale); -numDays = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH); -prev = UtilDateTime.getMonthStart(start, -1, timeZone, locale); -context.prevMillis = new Long(prev.getTime()).toString(); -next = UtilDateTime.getDayStart(start, numDays+1, timeZone, locale); -context.nextMillis = new Long(next.getTime()).toString(); -end = UtilDateTime.getMonthEnd(start, timeZone, locale); +tempCal = UtilDateTime.toCalendar(start, timeZone, locale) +numDays = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH) +prev = UtilDateTime.getMonthStart(start, -1, timeZone, locale) +context.prevMillis = new Long(prev.getTime()).toString() +next = UtilDateTime.getDayStart(start, numDays+1, timeZone, locale) +context.nextMillis = new Long(next.getTime()).toString() +end = UtilDateTime.getMonthEnd(start, timeZone, locale) //Find out what date to get from -getFrom = null; -prevMonthDays = tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek(); -if (prevMonthDays < 0) prevMonthDays += 7; -tempCal.add(Calendar.DATE, -prevMonthDays); -numDays += prevMonthDays; -getFrom = new Timestamp(tempCal.getTimeInMillis()); -firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR); -context.put("firstWeekNum", firstWeekNum); +getFrom = null +prevMonthDays = tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek() +if (prevMonthDays < 0) prevMonthDays += 7 +tempCal.add(Calendar.DATE, -prevMonthDays) +numDays += prevMonthDays +getFrom = new Timestamp(tempCal.getTimeInMillis()) +firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR) +context.put("firstWeekNum", firstWeekNum) // also get days until the end of the week at the end of the month -lastWeekCal = UtilDateTime.toCalendar(end, timeZone, locale); -monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK); -getTo = UtilDateTime.getWeekEnd(end, timeZone, locale); -lastWeekCal = UtilDateTime.toCalendar(getTo, timeZone, locale); -followingMonthDays = lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay; +lastWeekCal = UtilDateTime.toCalendar(end, timeZone, locale) +monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK) +getTo = UtilDateTime.getWeekEnd(end, timeZone, locale) +lastWeekCal = UtilDateTime.toCalendar(getTo, timeZone, locale) +followingMonthDays = lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay if (followingMonthDays < 0) { - followingMonthDays += 7; + followingMonthDays += 7 } -numDays += followingMonthDays; -Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters); -serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", getFrom, "calendarType", "VOID", "numPeriods", numDays, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone)); +numDays += followingMonthDays +Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters) +serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", getFrom, "calendarType", "VOID", "numPeriods", numDays, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone)) if (context.entityExprList) { - serviceCtx.entityExprList = entityExprList; + serviceCtx.entityExprList = entityExprList } -result = runService('getWorkEffortEventsByPeriod', serviceCtx); -context.put("periods",result.get("periods")); -context.put("maxConcurrentEntries", result.get("maxConcurrentEntries")); -context.put("start", start); -context.put("end", end); -context.put("prev", prev); -context.put("next", next); +result = runService('getWorkEffortEventsByPeriod', serviceCtx) +context.put("periods",result.get("periods")) +context.put("maxConcurrentEntries", result.get("maxConcurrentEntries")) +context.put("start", start) +context.put("end", end) +context.put("prev", prev) +context.put("next", next) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Upcoming.groovy Wed Nov 2 19:09:13 2016 @@ -17,32 +17,32 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; +import org.apache.ofbiz.base.util.UtilMisc -facilityId = parameters.get("facilityId"); -fixedAssetId = parameters.get("fixedAssetId"); -partyId = parameters.get("partyId"); -workEffortTypeId = parameters.get("workEffortTypeId"); -calendarType = parameters.calendarType; -start = nowTimestamp.clone(); -eventsParam = ""; +facilityId = parameters.get("facilityId") +fixedAssetId = parameters.get("fixedAssetId") +partyId = parameters.get("partyId") +workEffortTypeId = parameters.get("workEffortTypeId") +calendarType = parameters.calendarType +start = nowTimestamp.clone() +eventsParam = "" if (facilityId != null) { - eventsParam = "facilityId=" + facilityId; + eventsParam = "facilityId=" + facilityId } if (fixedAssetId != null) { - eventsParam = "fixedAssetId=" + fixedAssetId; + eventsParam = "fixedAssetId=" + fixedAssetId } if (partyId != null) { - eventsParam = "partyId=" + partyId; + eventsParam = "partyId=" + partyId } if (workEffortTypeId != null) { - eventsParam = "workEffortTypeId=" + workEffortTypeId; + eventsParam = "workEffortTypeId=" + workEffortTypeId } -Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE); -serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "calendarType", calendarType, "locale", locale, "timeZone", timeZone)); +Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE) +serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", workEffortTypeId, "calendarType", calendarType, "locale", locale, "timeZone", timeZone)) -Map result = runService('getWorkEffortEventsByPeriod',serviceCtx); -context.put("days", result.get("periods")); -context.put("start", start); -context.put("eventsParam", eventsParam); +Map result = runService('getWorkEffortEventsByPeriod',serviceCtx) +context.put("days", result.get("periods")) +context.put("start", start) +context.put("eventsParam", eventsParam) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/calendar/Week.groovy Wed Nov 2 19:09:13 2016 @@ -17,35 +17,35 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.base.util.UtilValidate; +import java.sql.Timestamp +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.base.util.UtilValidate -String startParam = parameters.startTime; -Timestamp start = null; +String startParam = parameters.startTime +Timestamp start = null if (UtilValidate.isNotEmpty(startParam)) { - start = new Timestamp(Long.parseLong(startParam)); + start = new Timestamp(Long.parseLong(startParam)) } if (start == null) { - start = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale); + start = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale) } else { - start = UtilDateTime.getWeekStart(start, timeZone, locale); + start = UtilDateTime.getWeekStart(start, timeZone, locale) } -Timestamp prev = UtilDateTime.getDayStart(start, -7, timeZone, locale); -context.prevMillis = new Long(prev.getTime()).toString(); -Timestamp next = UtilDateTime.getDayStart(start, 7, timeZone, locale); -context.nextMillis = new Long(next.getTime()).toString(); -Timestamp end = UtilDateTime.getDayStart(start, 6, timeZone, locale); -Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters); -serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone)); +Timestamp prev = UtilDateTime.getDayStart(start, -7, timeZone, locale) +context.prevMillis = new Long(prev.getTime()).toString() +Timestamp next = UtilDateTime.getDayStart(start, 7, timeZone, locale) +context.nextMillis = new Long(next.getTime()).toString() +Timestamp end = UtilDateTime.getDayStart(start, 6, timeZone, locale) +Map serviceCtx = dispatcher.getDispatchContext().makeValidContext("getWorkEffortEventsByPeriod", "IN", parameters) +serviceCtx.putAll(UtilMisc.toMap("userLogin", userLogin, "start", start, "numPeriods", 7, "periodType", Calendar.DATE, "locale", locale, "timeZone", timeZone)) if (context.entityExprList) { - serviceCtx.entityExprList = entityExprList; + serviceCtx.entityExprList = entityExprList } -Map result = runService('getWorkEffortEventsByPeriod',serviceCtx); -context.put("periods",result.get("periods")); -context.put("maxConcurrentEntries",result.get("maxConcurrentEntries")); -context.put("start",start); -context.put("end",end); -context.put("prev",prev); -context.put("next",next); +Map result = runService('getWorkEffortEventsByPeriod',serviceCtx) +context.put("periods",result.get("periods")) +context.put("maxConcurrentEntries",result.get("maxConcurrentEntries")) +context.put("start",start) +context.put("end",end) +context.put("prev",prev) +context.put("next",next) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/content/WorkEffortContentWrapper.groovy Wed Nov 2 19:09:13 2016 @@ -17,14 +17,14 @@ * under the License. */ - import org.apache.ofbiz.workeffort.content.WorkEffortContentWrapper; + import org.apache.ofbiz.workeffort.content.WorkEffortContentWrapper - workEffort = context.get("workEffort"); + workEffort = context.get("workEffort") if (workEffort == null && workEffortId != null) { - workEffort = from("WorkEffort").where("workEffortId", workEffortId).cache(true).queryOne(); + workEffort = from("WorkEffort").where("workEffortId", workEffortId).cache(true).queryOne() } if (workEffort != null) { - wrapper = WorkEffortContentWrapper.makeWorkEffortContentWrapper(workEffort, request); - context.put("workEffortContentWrapper", wrapper); + wrapper = WorkEffortContentWrapper.makeWorkEffortContentWrapper(workEffort, request) + context.put("workEffortContentWrapper", wrapper) } Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,44 +17,44 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession; +import java.sql.Timestamp +import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession -searchOperator = parameters.get("SEARCH_OPERATOR"); +searchOperator = parameters.get("SEARCH_OPERATOR") if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) { - searchOperator = "OR"; + searchOperator = "OR" } //create the fromDate for calendar -fromCal = Calendar.getInstance(); -fromCal.setTime(new java.util.Date()); -fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)); -fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)); -fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)); -fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)); -fromTs = new Timestamp(fromCal.getTimeInMillis()); -fromStr = fromTs.toString(); -fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.put("fromDateStr", fromStr); +fromCal = Calendar.getInstance() +fromCal.setTime(new java.util.Date()) +fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)) +fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)) +fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)) +fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)) +fromTs = new Timestamp(fromCal.getTimeInMillis()) +fromStr = fromTs.toString() +fromStr = fromStr.substring(0, fromStr.indexOf('.')) +context.put("fromDateStr", fromStr) // create the thruDate for calendar -toCal = Calendar.getInstance(); -toCal.setTime(new java.util.Date()); -toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)); -toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)); -toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)); -toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); -toTs = new Timestamp(toCal.getTimeInMillis()); -toStr = toTs.toString(); -context.put("thruDateStr", toStr); - -searchConstraintStrings = WorkEffortSearchSession.searchGetConstraintStrings(false, session, delegator); -searchSortOrderString = WorkEffortSearchSession.searchGetSortOrderString(false, request); -workEffortAssocTypes = from("WorkEffortAssocType").queryList(); -roleTypes = from("RoleType").queryList(); - -context.put("searchOperator", searchOperator); -context.put("searchConstraintStrings", searchConstraintStrings); -context.put("searchSortOrderString", searchSortOrderString); -context.put("workEffortAssocTypes", workEffortAssocTypes); -context.put("roleTypes", roleTypes); +toCal = Calendar.getInstance() +toCal.setTime(new java.util.Date()) +toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)) +toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)) +toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)) +toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)) +toTs = new Timestamp(toCal.getTimeInMillis()) +toStr = toTs.toString() +context.put("thruDateStr", toStr) + +searchConstraintStrings = WorkEffortSearchSession.searchGetConstraintStrings(false, session, delegator) +searchSortOrderString = WorkEffortSearchSession.searchGetSortOrderString(false, request) +workEffortAssocTypes = from("WorkEffortAssocType").queryList() +roleTypes = from("RoleType").queryList() + +context.put("searchOperator", searchOperator) +context.put("searchConstraintStrings", searchConstraintStrings) +context.put("searchSortOrderString", searchSortOrderString) +context.put("workEffortAssocTypes", workEffortAssocTypes) +context.put("roleTypes", roleTypes) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/find/WorkEffortSearchResults.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchEvents; -import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession; +import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchEvents +import org.apache.ofbiz.workeffort.workeffort.WorkEffortSearchSession // note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again -WorkEffortSearchSession.processSearchParameters(parameters, request); -Map result = WorkEffortSearchEvents.getWorkEffortSearchResult(request, delegator); +WorkEffortSearchSession.processSearchParameters(parameters, request) +Map result = WorkEffortSearchEvents.getWorkEffortSearchResult(request, delegator) -context.put("workEffortIds", result.get("workEffortIds")); -context.put("viewIndex", result.get("viewIndex")); -context.put("viewSize", result.get("viewSize")); -context.put("listSize", result.get("listSize")); -context.put("lowIndex", result.get("lowIndex")); -context.put("highIndex", result.get("highIndex")); -context.put("searchConstraintStrings", result.get("searchConstraintStrings")); -context.put("searchSortOrderString", result.get("searchSortOrderString")); +context.put("workEffortIds", result.get("workEffortIds")) +context.put("viewIndex", result.get("viewIndex")) +context.put("viewSize", result.get("viewSize")) +context.put("listSize", result.get("listSize")) +context.put("lowIndex", result.get("lowIndex")) +context.put("highIndex", result.get("highIndex")) +context.put("searchConstraintStrings", result.get("searchConstraintStrings")) +context.put("searchSortOrderString", result.get("searchSortOrderString")) Modified: ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy (original) +++ ofbiz/trunk/applications/workeffort/groovyScripts/workeffort/request/RequestList.groovy Wed Nov 2 19:09:13 2016 @@ -17,6 +17,6 @@ * under the License. */ -Map requests = runService('getCustRequestsByRole', ["userLogin": userLogin]); +Map requests = runService('getCustRequestsByRole', ["userLogin": userLogin]) -context.put("custRequestAndRoles", requests.get("custRequestAndRoles")); +context.put("custRequestAndRoles", requests.get("custRequestAndRoles")) Modified: ofbiz/trunk/framework/common/groovyScripts/CcTypes.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/CcTypes.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/CcTypes.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/CcTypes.groovy Wed Nov 2 19:09:13 2016 @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator context.creditCardTypes = delegator.findList("Enumeration", EntityCondition.makeCondition("enumTypeId", EntityOperator.EQUALS, "CREDIT_CARD_TYPE"), ["enumId", "enumCode"] as Set, null, null, false); \ No newline at end of file Modified: ofbiz/trunk/framework/common/groovyScripts/CertKeystore.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/CertKeystore.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/CertKeystore.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/CertKeystore.groovy Wed Nov 2 19:09:13 2016 @@ -1,15 +1,15 @@ -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import java.io.IOException +import java.util.ArrayList +import java.util.Collection +import java.util.List -import org.apache.ofbiz.base.component.ComponentConfig; -import org.apache.ofbiz.base.component.ComponentConfig.KeystoreInfo; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.base.util.KeyStoreUtil; +import org.apache.ofbiz.base.component.ComponentConfig +import org.apache.ofbiz.base.component.ComponentConfig.KeystoreInfo +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.base.util.KeyStoreUtil -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* cert = org.apache.ofbiz.base.util.KeyStoreUtil.pemToCert(certString) if (cert){ @@ -21,7 +21,7 @@ if (cert){ stores = [] store = [] -Collection<ComponentConfig> allComponentConfigs = ComponentConfig.getAllComponents(); +Collection<ComponentConfig> allComponentConfigs = ComponentConfig.getAllComponents() for (ComponentConfig cc: allComponentConfigs) { if (cc.getKeystoreInfos()){ componentName = cc.getComponentName() |
Free forum by Nabble | Edit this page |