Hi All, when creating a purchase order there is a Short Cuts link for "Requirements" which ends up here "RequirementsForSupplier" however, the list of requirments seems to be a list of all approved requirements regardless of the current supplier for the purchase order. is this the intended purpose? Thanx Fred _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Sounds like a bug to me. Does the URL add a partyId for the supplier?
What if you add the supplier partyId to the URL (just try it manually in your browser.) Si Fred Forester wrote: > Hi All, > > > when creating a purchase order there is a Short Cuts link for > "Requirements" which ends up here "RequirementsForSupplier" however, the > list of requirments seems to be a list of all approved requirements > regardless of the current supplier for the purchase order. is this the > intended purpose? > > Thanx > Fred > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Si, tried that, made no difference. I also do not see any reference to partyId being used by that code since it only uses the Requirements entity. I would think a view is needed to tie Requirements to SupplierProduct and maybe even Party to get the supplier name. btw, I used this url https://10.10.1.101:8443/ordermgr/control/RequirementsForSupplier?partyId=15 Thanx Fred Si Chen wrote: > Sounds like a bug to me. Does the URL add a partyId for the supplier? > What if you add the supplier partyId to the URL (just try it manually in > your browser.) > > Si > > Fred Forester wrote: > >>Hi All, >> >> >>when creating a purchase order there is a Short Cuts link for >>"Requirements" which ends up here "RequirementsForSupplier" however, the >>list of requirments seems to be a list of all approved requirements >>regardless of the current supplier for the purchase order. is this the >>intended purpose? >> >>Thanx >>Fred >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> >> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Si,
I assume then that this is a bug. would replacing "getRequirementsForSupplier" with a Dynamic View be the way to go? thanx Fred Fred Forester wrote: > Si, > > tried that, made no difference. I also do not see any reference to > partyId being used by that code since it only uses the Requirements > entity. I would think a view is needed to tie Requirements to > SupplierProduct and maybe even Party to get the supplier name. > > btw, I used this url > https://10.10.1.101:8443/ordermgr/control/RequirementsForSupplier?partyId=15 > > Thanx > Fred > > > > Si Chen wrote: > >>Sounds like a bug to me. Does the URL add a partyId for the supplier? >>What if you add the supplier partyId to the URL (just try it manually in >>your browser.) >> >>Si >> >>Fred Forester wrote: >> >> >>>Hi All, >>> >>> >>>when creating a purchase order there is a Short Cuts link for >>>"Requirements" which ends up here "RequirementsForSupplier" however, the >>>list of requirments seems to be a list of all approved requirements >>>regardless of the current supplier for the purchase order. is this the >>>intended purpose? >>> >>>Thanx >>>Fred >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >>> >>> >> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Fred, Si,
the "getRequirementsForSupplier" is really not completely implemented right now: the service definition should be ok but the service implementation is clearly not; so, yes at least it should look at the party to fiter out the requirements... Fred, if you want to complete the service and prepare a patch I'd be happy to review and commit it. Jacopo Fred Forester wrote: > Si, > > I assume then that this is a bug. would replacing > "getRequirementsForSupplier" with a Dynamic View be the way to go? > > thanx > Fred > > > Fred Forester wrote: >> Si, >> >> tried that, made no difference. I also do not see any reference to >> partyId being used by that code since it only uses the Requirements >> entity. I would think a view is needed to tie Requirements to >> SupplierProduct and maybe even Party to get the supplier name. >> >> btw, I used this url >> https://10.10.1.101:8443/ordermgr/control/RequirementsForSupplier?partyId=15 >> >> Thanx >> Fred >> >> >> >> Si Chen wrote: >> >>> Sounds like a bug to me. Does the URL add a partyId for the supplier? >>> What if you add the supplier partyId to the URL (just try it manually in >>> your browser.) >>> >>> Si >>> >>> Fred Forester wrote: >>> >>> >>>> Hi All, >>>> >>>> >>>> when creating a purchase order there is a Short Cuts link for >>>> "Requirements" which ends up here "RequirementsForSupplier" however, the >>>> list of requirments seems to be a list of all approved requirements >>>> regardless of the current supplier for the purchase order. is this the >>>> intended purpose? >>>> >>>> Thanx >>>> Fred >>>> _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Jacopo, ok, I'll let you know. Thanx Fred Jacopo Cappellato wrote: > Fred, Si, > > the "getRequirementsForSupplier" is really not completely implemented > right now: the service definition should be ok but the service > implementation is clearly not; so, yes at least it should look at the > party to fiter out the requirements... > > Fred, if you want to complete the service and prepare a patch I'd be > happy to review and commit it. > > Jacopo > > Fred Forester wrote: > >>Si, >> >>I assume then that this is a bug. would replacing >>"getRequirementsForSupplier" with a Dynamic View be the way to go? >> >>thanx >>Fred >> >> >>Fred Forester wrote: >> >>>Si, >>> >>>tried that, made no difference. I also do not see any reference to >>>partyId being used by that code since it only uses the Requirements >>>entity. I would think a view is needed to tie Requirements to >>>SupplierProduct and maybe even Party to get the supplier name. >>> >>>btw, I used this url >>>https://10.10.1.101:8443/ordermgr/control/RequirementsForSupplier?partyId=15 >>> >>>Thanx >>>Fred >>> >>> >>> >>>Si Chen wrote: >>> >>> >>>>Sounds like a bug to me. Does the URL add a partyId for the supplier? >>>>What if you add the supplier partyId to the URL (just try it manually in >>>>your browser.) >>>> >>>>Si >>>> >>>>Fred Forester wrote: >>>> >>>> >>>> >>>>>Hi All, >>>>> >>>>> >>>>>when creating a purchase order there is a Short Cuts link for >>>>>"Requirements" which ends up here "RequirementsForSupplier" however, the >>>>>list of requirments seems to be a list of all approved requirements >>>>>regardless of the current supplier for the purchase order. is this the >>>>>intended purpose? >>>>> >>>>>Thanx >>>>>Fred >>>>> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Jacopo, the patch is attached and based on 7445 I wasnt sure how to merge the incomming requirementConditions with the conditions being built by the code. comments welcome. Thanx Fred Fred Forester wrote: > Jacopo, > > ok, I'll let you know. > > Thanx > Fred > > > Jacopo Cappellato wrote: > >>Fred, Si, >> >>the "getRequirementsForSupplier" is really not completely implemented >>right now: the service definition should be ok but the service >>implementation is clearly not; so, yes at least it should look at the >>party to fiter out the requirements... >> >>Fred, if you want to complete the service and prepare a patch I'd be >>happy to review and commit it. >> >>Jacopo >> >>Fred Forester wrote: >> >> >>>Si, >>> >>>I assume then that this is a bug. would replacing >>>"getRequirementsForSupplier" with a Dynamic View be the way to go? >>> >>>thanx >>>Fred >>> >>> >>>Fred Forester wrote: >>> >>> >>>>Si, >>>> >>>>tried that, made no difference. I also do not see any reference to >>>>partyId being used by that code since it only uses the Requirements >>>>entity. I would think a view is needed to tie Requirements to >>>>SupplierProduct and maybe even Party to get the supplier name. >>>> >>>>btw, I used this url >>>>https://10.10.1.101:8443/ordermgr/control/RequirementsForSupplier?partyId=15 >>>> >>>>Thanx >>>>Fred >>>> >>>> >>>> >>>>Si Chen wrote: >>>> >>>> >>>> >>>>>Sounds like a bug to me. Does the URL add a partyId for the supplier? >>>>>What if you add the supplier partyId to the URL (just try it manually in >>>>>your browser.) >>>>> >>>>>Si >>>>> >>>>>Fred Forester wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>Hi All, >>>>>> >>>>>> >>>>>>when creating a purchase order there is a Short Cuts link for >>>>>>"Requirements" which ends up here "RequirementsForSupplier" however, the >>>>>>list of requirments seems to be a list of all approved requirements >>>>>>regardless of the current supplier for the purchase order. is this the >>>>>>intended purpose? >>>>>> >>>>>>Thanx >>>>>>Fred >>>>>> >> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > Index: applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java =================================================================== --- applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (revision 12) +++ applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (working copy) @@ -277,4 +277,128 @@ } + /* + * Parameters: partyId of a supplier optionally a productId + * will return a list of requirements + */ + public static Map getRequirementsForSupplier(DispatchContext dctx, Map context) { + + Debug.logInfo("Enter getRequirementsForSupplier", module); + Map results = ServiceUtil.returnSuccess(); + LinkedList dataList = new LinkedList(); + GenericDelegator delegator = dctx.getDelegator(); + + String partyId = (String) context.get("partyId"); + String productId = (String) context.get("productId"); + // field not present in Requirement + String currencyUomId = (String) context.get("currencyUomId"); + // not sure how to combine this list with the other. + EntityCondition requirementConditions = (EntityCondition) context.get("requirementConditions"); + + // create the dynamic view entity + DynamicViewEntity dynamicView = new DynamicViewEntity(); + + // default view settings + dynamicView.addMemberEntity("RE", "Requirement"); + dynamicView.addMemberEntity("SP", "SupplierProduct"); + dynamicView.addAlias("RE", "requirementId"); + dynamicView.addAlias("RE", "requiredByDate"); + dynamicView.addAlias("RE", "description"); + dynamicView.addAlias("RE", "requirementTypeId"); + dynamicView.addAlias("RE", "quantity"); + dynamicView.addAlias("RE", "statusId"); + dynamicView.addAlias("SP", "partyId"); + dynamicView.addAlias("SP", "productId"); + dynamicView.addRelation("one", "", "SupplierProduct", ModelKeyMap.makeKeyMapList("productId")); + + dynamicView.addViewLink("RE", "SP", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + + // define the main condition & expression list + List andExprs = FastList.newInstance(); + EntityCondition mainCond = null; + + List orderBy = FastList.newInstance(); + List fieldsToSelect = FastList.newInstance(); + // fields we need to select; will be used to set distinct + fieldsToSelect.add("productId"); + fieldsToSelect.add("requirementId"); + fieldsToSelect.add("description"); + fieldsToSelect.add("requiredByDate"); + fieldsToSelect.add("quantity"); + + EntityExpr eqPO = new EntityExpr("requirementTypeId", EntityOperator.EQUALS, "MRP_PRO_PURCH_ORDER"); + EntityExpr eqPR = new EntityExpr("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"); + andExprs.add(new EntityExpr(eqPO,EntityOperator.OR,eqPR)); + + andExprs.add(new EntityExpr("statusId",EntityOperator.EQUALS,"REQ_APPROVED")); + + if (partyId != null && partyId.length() > 0) { + andExprs.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId)); + } +/* + else + { + Debug.logInfo("No PartyId",module); + results.put("supplierProductList",null); + } +*/ + + if (productId != null && productId.length() > 0) { + //andExprs.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); + andExprs.add(new EntityExpr( + new EntityFunction.UPPER(new EntityFieldValue("productId")), + EntityOperator.LIKE, productId.toUpperCase() + "%")); + } +/* + else + { + Debug.logInfo("No productId",module); + results.put("supplierProductList",null); + } +*/ + + orderBy.add("requirementId"); + + if (andExprs.size() > 0) mainCond = new EntityConditionList(andExprs, EntityOperator.AND); + Debug.logInfo("Calling dynaview", module); + if (mainCond != null) + { + Debug.logInfo("Have mainCond", module); + try + { + // set distinct on so we only get one row per order + EntityFindOptions findOpts = new EntityFindOptions(true, + EntityFindOptions.TYPE_SCROLL_INSENSITIVE, + EntityFindOptions.CONCUR_READ_ONLY, + true); + Debug.logInfo("Have EntityFindOptions", module); + // using list iterator + EntityListIterator pli = delegator.findListIteratorByCondition(dynamicView, + mainCond, + null, + fieldsToSelect, + orderBy, + findOpts); + Debug.logInfo("Have EntityListIterator", module); + GenericValue gv = null; + while ((gv = (GenericValue) pli.next()) != null) + { + //Debug.logInfo("Row: " + gv.get("productId") + " " + gv.get("internalName"), module); + dataList.add(gv); + } + pli.close(); + results.put("requirementsForSupplier",dataList); + } + catch (GenericEntityException e) + { + String errMsg = "Failure in getRequirementsForSupplier, rolling back transaction: " + e.toString(); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); + } + } + + Debug.logInfo("Exiting getRequirementsForSupplier", module); + return results; + } + } Index: applications/order/servicedef/services_requirement.xml =================================================================== --- applications/order/servicedef/services_requirement.xml (revision 10) +++ applications/order/servicedef/services_requirement.xml (working copy) @@ -76,6 +76,15 @@ <attribute name="workReqFulfTypeId" type="String" mode="IN" optional="true"/> </service> + <service name="getRequirementsForSupplier" engine="java" + location="org.ofbiz.product.supplier.SupplierProductServices" invoke="getRequirementsForSupplier"> + <description>Retrieves requirements information for suppliers</description> + <attribute mode="IN" name="requirementConditions" type="org.ofbiz.entity.condition.EntityCondition" optional="true"/> + <attribute mode="IN" name="partyId" type="String" optional="true"/> + <attribute mode="IN" name="currencyUomId" type="String" optional="true"/> + <attribute mode="OUT" name="requirementsForSupplier" type="java.util.List" optional="true"/> + </service> +<!-- <service name="getRequirementsForSupplier" engine="simple" location="org/ofbiz/order/requirement/RequirementServices.xml" invoke="getRequirementsForSupplier"> <description>Retrieves requirements information for suppliers</description> @@ -84,6 +93,8 @@ <attribute mode="IN" name="currencyUomId" type="String" optional="true"/> <attribute mode="OUT" name="requirementsForSupplier" type="java.util.List" optional="true"/> </service> +--> + <service name="createOrderRequirementCommitment" engine="simple" auth="true" location="org/ofbiz/order/order/OrderServices.xml" invoke="createOrderRequirementCommitment"> <auto-attributes entity-name="OrderRequirementCommitment" include="pk" mode="IN" optional="false"/> Index: applications/order/widget/ordermgr/OrderEntryForms.xml =================================================================== --- applications/order/widget/ordermgr/OrderEntryForms.xml (revision 10) +++ applications/order/widget/ordermgr/OrderEntryForms.xml (working copy) @@ -39,6 +39,7 @@ <service service-name="getRequirementsForSupplier" result-map-name="result" result-map-list-name="requirementsForSupplier"> <!--<field-map field-name="orderByList" env-name="resultConditions.orderByList"/>--> <field-map field-name="requirementConditions" env-name="resultConditions.entityConditionList"/> + <field-map field-name="partyId" env-name="requestParameters.partyId"/> </service> </actions> <field name="requirementId"><display/></field> Index: applications/order/webapp/ordermgr/entry/orderShortcuts.ftl =================================================================== --- applications/order/webapp/ordermgr/entry/orderShortcuts.ftl (revision 10) +++ applications/order/webapp/ordermgr/entry/orderShortcuts.ftl (working copy) @@ -46,7 +46,7 @@ <#if shoppingCart.getOrderType() == "PURCHASE_ORDER"> <tr> <td> - <a href="<@ofbizUrl>RequirementsForSupplier</@ofbizUrl>" class="buttontext">${uiLabelMap.Requirements}</a> + <a href="<@ofbizUrl>RequirementsForSupplier?partyId=${partyId}</@ofbizUrl>" class="buttontext">${uiLabelMap.Requirements}</a> </td> </tr> </#if> _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Fred,
thanks for your work. I think you should add the incoming requirementConditions as they are to the other conditions of your service. You should also remove the productId parameter (that is not even declared in the service definition); if the user has selected a productId to filter out requirements, this condition will be in the requirementConditions. Does it make sense? Jacopo Fred Forester wrote: > > Jacopo, > > the patch is attached and based on 7445 > > I wasnt sure how to merge the incomming requirementConditions with the > conditions being built by the code. comments welcome. > > Thanx > Fred > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Jacopo, it makes sense that the productId is part of the incoming requirementConditions. however, how do I merge or combine the requirementConditions with the mainCond? thanx Fred Jacopo Cappellato wrote: > Fred, > > thanks for your work. > > I think you should add the incoming requirementConditions as they are to > the other conditions of your service. > > You should also remove the productId parameter (that is not even > declared in the service definition); if the user has selected a > productId to filter out requirements, this condition will be in the > requirementConditions. > > Does it make sense? > > Jacopo > > Fred Forester wrote: > >>Jacopo, >> >>the patch is attached and based on 7445 >> >>I wasnt sure how to merge the incomming requirementConditions with the >>conditions being built by the code. comments welcome. >> >>Thanx >>Fred >> >> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Fred,
did you try something like this? andExprs.add(requirementConditions); Jacopo Fred Forester wrote: > Jacopo, > > it makes sense that the productId is part of the incoming > requirementConditions. however, how do I merge or combine the > requirementConditions with the mainCond? > > thanx > Fred > > > > > Jacopo Cappellato wrote: >> Fred, >> >> thanks for your work. >> >> I think you should add the incoming requirementConditions as they are to >> the other conditions of your service. >> >> You should also remove the productId parameter (that is not even >> declared in the service definition); if the user has selected a >> productId to filter out requirements, this condition will be in the >> requirementConditions. >> >> Does it make sense? >> >> Jacopo >> >> Fred Forester wrote: >> >>> Jacopo, >>> >>> the patch is attached and based on 7445 >>> >>> I wasnt sure how to merge the incomming requirementConditions with the >>> conditions being built by the code. comments welcome. >>> >>> Thanx >>> Fred >>> >>> >> >> >> _______________________________________________ >> Users mailing list >> [hidden email] >> http://lists.ofbiz.org/mailman/listinfo/users >> >> > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
In reply to this post by Fred Forester-2
Fred,
why not simply patching the existing minilang service: Index: applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml =================================================================== --- applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml (revision 7548) +++ applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml (working copy) @@ -74,10 +74,11 @@ <simple-method method-name="getRequirementsForSupplier" short-description="Get the requirements applicable to a given supplier"> <make-value value-name="newEntity" entity-name="Requirement"/> - <entity-condition entity-name="Requirement" list-name="requirementsForSupplier"> + <entity-condition entity-name="RequirementAndProductSupplier" list-name="requirementsForSupplier"> <condition-list> <condition-object field-name="parameters.requirementConditions"/> <condition-expr field-name="statusId" value="REQ_APPROVED"/> + <condition-expr field-name="partyId" env-name="parameters.partyId"/> <condition-list combine="or"> <condition-expr field-name="requirementTypeId" value="MRP_PRO_PURCH_ORDER"/> <condition-expr field-name="requirementTypeId" value="PRODUCT_REQUIREMENT"/> ? You'll have to define the RequirementAndProductSupplier view-entity to make the abve code work correctly. Jacopo Fred Forester wrote: > Jacopo, > > it makes sense that the productId is part of the incoming > requirementConditions. however, how do I merge or combine the > requirementConditions with the mainCond? > > thanx > Fred > > > > > Jacopo Cappellato wrote: >> Fred, >> >> thanks for your work. >> >> I think you should add the incoming requirementConditions as they are to >> the other conditions of your service. >> >> You should also remove the productId parameter (that is not even >> declared in the service definition); if the user has selected a >> productId to filter out requirements, this condition will be in the >> requirementConditions. >> >> Does it make sense? >> >> Jacopo >> >> Fred Forester wrote: >> >>> Jacopo, >>> >>> the patch is attached and based on 7445 >>> >>> I wasnt sure how to merge the incomming requirementConditions with the >>> conditions being built by the code. comments welcome. >>> >>> Thanx >>> Fred >>> >>> >> >> >> _______________________________________________ >> Users mailing list >> [hidden email] >> http://lists.ofbiz.org/mailman/listinfo/users >> >> > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
In reply to this post by Jacopo Cappellato
thanx.
Jacopo Cappellato wrote: > Fred, > > did you try something like this? > > andExprs.add(requirementConditions); > > Jacopo > > > Fred Forester wrote: > >>Jacopo, >> >>it makes sense that the productId is part of the incoming >>requirementConditions. however, how do I merge or combine the >>requirementConditions with the mainCond? >> >>thanx >>Fred >> >> >> >> >>Jacopo Cappellato wrote: >> >>>Fred, >>> >>>thanks for your work. >>> >>>I think you should add the incoming requirementConditions as they are to >>>the other conditions of your service. >>> >>>You should also remove the productId parameter (that is not even >>>declared in the service definition); if the user has selected a >>>productId to filter out requirements, this condition will be in the >>>requirementConditions. >>> >>>Does it make sense? >>> >>>Jacopo >>> >>>Fred Forester wrote: >>> >>> >>>>Jacopo, >>>> >>>>the patch is attached and based on 7445 >>>> >>>>I wasnt sure how to merge the incomming requirementConditions with the >>>>conditions being built by the code. comments welcome. >>>> >>>>Thanx >>>>Fred >>>> >>>> >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >>> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
In reply to this post by Jacopo Cappellato
I only used a dynamic view cause I did something similar with purchase order "Quick Lookup" where the dynamic view selects only products for the selected supplier so I used a modified version of that. Jacopo Cappellato wrote: > Fred, > > why not simply patching the existing minilang service: > > Index: > applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml > =================================================================== > --- > applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml > (revision 7548) > +++ > applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml > (working copy) > @@ -74,10 +74,11 @@ > > <simple-method method-name="getRequirementsForSupplier" > short-description="Get the requirements applicable to a given supplier"> > <make-value value-name="newEntity" entity-name="Requirement"/> > - <entity-condition entity-name="Requirement" > list-name="requirementsForSupplier"> > + <entity-condition entity-name="RequirementAndProductSupplier" > list-name="requirementsForSupplier"> > <condition-list> > <condition-object > field-name="parameters.requirementConditions"/> > <condition-expr field-name="statusId" > value="REQ_APPROVED"/> > + <condition-expr field-name="partyId" > env-name="parameters.partyId"/> > <condition-list combine="or"> > <condition-expr field-name="requirementTypeId" > value="MRP_PRO_PURCH_ORDER"/> > <condition-expr field-name="requirementTypeId" > value="PRODUCT_REQUIREMENT"/> > > > ? > > You'll have to define the RequirementAndProductSupplier view-entity to > make the abve code work correctly. > > Jacopo > > Fred Forester wrote: > >>Jacopo, >> >>it makes sense that the productId is part of the incoming >>requirementConditions. however, how do I merge or combine the >>requirementConditions with the mainCond? >> >>thanx >>Fred >> >> >> >> >>Jacopo Cappellato wrote: >> >>>Fred, >>> >>>thanks for your work. >>> >>>I think you should add the incoming requirementConditions as they are to >>>the other conditions of your service. >>> >>>You should also remove the productId parameter (that is not even >>>declared in the service definition); if the user has selected a >>>productId to filter out requirements, this condition will be in the >>>requirementConditions. >>> >>>Does it make sense? >>> >>>Jacopo >>> >>>Fred Forester wrote: >>> >>> >>>>Jacopo, >>>> >>>>the patch is attached and based on 7445 >>>> >>>>I wasnt sure how to merge the incomming requirementConditions with the >>>>conditions being built by the code. comments welcome. >>>> >>>>Thanx >>>>Fred >>>> >>>> >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >>> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
I have the static view. at least it seems to be correct. I'll try to swap (back) in the minilang service later on today. <view-entity entity-name="RequirementAndProductSupplier" package-name="org.ofbiz.product.inventory" title="Suppliers and Requirements"> <member-entity entity-alias="RE" entity-name="Requirement"/> <member-entity entity-alias="SP" entity-name="SupplierProduct"/> <member-entity entity-alias="PE" entity-name="Person"/> <alias-all entity-alias="RE"/> <alias-all entity-alias="SP"/> <alias entity-alias="PE" name="lastName"/> <alias entity-alias="PE" name="firstName"/> <alias entity-alias="PE" name="partyId"/> <view-link entity-alias="RE" rel-entity-alias="SP" rel-optional="false"> <key-map field-name="productId"/> </view-link> <view-link entity-alias="SP" rel-entity-alias="PE" rel-optional="false"> <key-map field-name="partyId"/> </view-link> <relation type="one-nofk" rel-entity-name="SupplierProduct"> <key-map field-name="productId"/> <key-map field-name="partyId"/> <key-map field-name="currencyUomId"/> <key-map field-name="minimumOrderQuantity"/> <key-map field-name="availableFromDate"/> </relation> <relation type="one-nofk" rel-entity-name="Person"> <key-map field-name="partyId"/> </relation> </view-entity> Fred Forester wrote: > I only used a dynamic view cause I did something similar with purchase > order "Quick Lookup" where the dynamic view selects only products for > the selected supplier so I used a modified version of that. > > > > Jacopo Cappellato wrote: > >>Fred, >> >>why not simply patching the existing minilang service: >> >>Index: >>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>=================================================================== >>--- >>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>(revision 7548) >>+++ >>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>(working copy) >>@@ -74,10 +74,11 @@ >> >> <simple-method method-name="getRequirementsForSupplier" >>short-description="Get the requirements applicable to a given supplier"> >> <make-value value-name="newEntity" entity-name="Requirement"/> >>- <entity-condition entity-name="Requirement" >>list-name="requirementsForSupplier"> >>+ <entity-condition entity-name="RequirementAndProductSupplier" >>list-name="requirementsForSupplier"> >> <condition-list> >> <condition-object >>field-name="parameters.requirementConditions"/> >> <condition-expr field-name="statusId" >>value="REQ_APPROVED"/> >>+ <condition-expr field-name="partyId" >>env-name="parameters.partyId"/> >> <condition-list combine="or"> >> <condition-expr field-name="requirementTypeId" >>value="MRP_PRO_PURCH_ORDER"/> >> <condition-expr field-name="requirementTypeId" >>value="PRODUCT_REQUIREMENT"/> >> >> >>? >> >>You'll have to define the RequirementAndProductSupplier view-entity to >>make the abve code work correctly. >> >>Jacopo >> >>Fred Forester wrote: >> >> >>>Jacopo, >>> >>>it makes sense that the productId is part of the incoming >>>requirementConditions. however, how do I merge or combine the >>>requirementConditions with the mainCond? >>> >>>thanx >>>Fred >>> >>> >>> >>> >>>Jacopo Cappellato wrote: >>> >>> >>>>Fred, >>>> >>>>thanks for your work. >>>> >>>>I think you should add the incoming requirementConditions as they are to >>>>the other conditions of your service. >>>> >>>>You should also remove the productId parameter (that is not even >>>>declared in the service definition); if the user has selected a >>>>productId to filter out requirements, this condition will be in the >>>>requirementConditions. >>>> >>>>Does it make sense? >>>> >>>>Jacopo >>>> >>>>Fred Forester wrote: >>>> >>>> >>>> >>>>>Jacopo, >>>>> >>>>>the patch is attached and based on 7445 >>>>> >>>>>I wasnt sure how to merge the incomming requirementConditions with the >>>>>conditions being built by the code. comments welcome. >>>>> >>>>>Thanx >>>>>Fred >>>>> >>>>> >>>> >>>> >>>>_______________________________________________ >>>>Users mailing list >>>>[hidden email] >>>>http://lists.ofbiz.org/mailman/listinfo/users >>>> >>>> >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Hi Fred,
it's good but, I'd not use the Person entity because a supplier could be a Person or a PartyGroup. Or at least use a view entity instead of Person: I think there is one called PartyNameView Jacopo Fred Forester wrote: > I have the static view. at least it seems to be correct. I'll try to > swap (back) in the minilang service later on today. > > <view-entity entity-name="RequirementAndProductSupplier" > package-name="org.ofbiz.product.inventory" > title="Suppliers and Requirements"> > <member-entity entity-alias="RE" entity-name="Requirement"/> > <member-entity entity-alias="SP" entity-name="SupplierProduct"/> > <member-entity entity-alias="PE" entity-name="Person"/> > <alias-all entity-alias="RE"/> > <alias-all entity-alias="SP"/> > <alias entity-alias="PE" name="lastName"/> > <alias entity-alias="PE" name="firstName"/> > <alias entity-alias="PE" name="partyId"/> > <view-link entity-alias="RE" rel-entity-alias="SP" > rel-optional="false"> > <key-map field-name="productId"/> > </view-link> > <view-link entity-alias="SP" rel-entity-alias="PE" > rel-optional="false"> > <key-map field-name="partyId"/> > </view-link> > <relation type="one-nofk" rel-entity-name="SupplierProduct"> > <key-map field-name="productId"/> > <key-map field-name="partyId"/> > <key-map field-name="currencyUomId"/> > <key-map field-name="minimumOrderQuantity"/> > <key-map field-name="availableFromDate"/> > </relation> > <relation type="one-nofk" rel-entity-name="Person"> > <key-map field-name="partyId"/> > </relation> > </view-entity> > > > Fred Forester wrote: >> I only used a dynamic view cause I did something similar with purchase >> order "Quick Lookup" where the dynamic view selects only products for >> the selected supplier so I used a modified version of that. >> >> >> >> Jacopo Cappellato wrote: >> >>> Fred, >>> >>> why not simply patching the existing minilang service: >>> >>> Index: >>> applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>> =================================================================== >>> --- >>> applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>> (revision 7548) >>> +++ >>> applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>> (working copy) >>> @@ -74,10 +74,11 @@ >>> >>> <simple-method method-name="getRequirementsForSupplier" >>> short-description="Get the requirements applicable to a given supplier"> >>> <make-value value-name="newEntity" entity-name="Requirement"/> >>> - <entity-condition entity-name="Requirement" >>> list-name="requirementsForSupplier"> >>> + <entity-condition entity-name="RequirementAndProductSupplier" >>> list-name="requirementsForSupplier"> >>> <condition-list> >>> <condition-object >>> field-name="parameters.requirementConditions"/> >>> <condition-expr field-name="statusId" >>> value="REQ_APPROVED"/> >>> + <condition-expr field-name="partyId" >>> env-name="parameters.partyId"/> >>> <condition-list combine="or"> >>> <condition-expr field-name="requirementTypeId" >>> value="MRP_PRO_PURCH_ORDER"/> >>> <condition-expr field-name="requirementTypeId" >>> value="PRODUCT_REQUIREMENT"/> >>> >>> >>> ? >>> >>> You'll have to define the RequirementAndProductSupplier view-entity to >>> make the abve code work correctly. >>> >>> Jacopo >>> >>> Fred Forester wrote: >>> >>> >>>> Jacopo, >>>> >>>> it makes sense that the productId is part of the incoming >>>> requirementConditions. however, how do I merge or combine the >>>> requirementConditions with the mainCond? >>>> >>>> thanx >>>> Fred >>>> >>>> >>>> >>>> >>>> Jacopo Cappellato wrote: >>>> >>>> >>>>> Fred, >>>>> >>>>> thanks for your work. >>>>> >>>>> I think you should add the incoming requirementConditions as they are to >>>>> the other conditions of your service. >>>>> >>>>> You should also remove the productId parameter (that is not even >>>>> declared in the service definition); if the user has selected a >>>>> productId to filter out requirements, this condition will be in the >>>>> requirementConditions. >>>>> >>>>> Does it make sense? >>>>> >>>>> Jacopo >>>>> >>>>> Fred Forester wrote: >>>>> >>>>> >>>>> >>>>>> Jacopo, >>>>>> >>>>>> the patch is attached and based on 7445 >>>>>> >>>>>> I wasnt sure how to merge the incomming requirementConditions with the >>>>>> conditions being built by the code. comments welcome. >>>>>> >>>>>> Thanx >>>>>> Fred >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Users mailing list >>>>> [hidden email] >>>>> http://lists.ofbiz.org/mailman/listinfo/users >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Users mailing list >>>> [hidden email] >>>> http://lists.ofbiz.org/mailman/listinfo/users >>>> >>> >>> >>> _______________________________________________ >>> Users mailing list >>> [hidden email] >>> http://lists.ofbiz.org/mailman/listinfo/users >>> >>> >> >> _______________________________________________ >> Users mailing list >> [hidden email] >> http://lists.ofbiz.org/mailman/listinfo/users >> >> > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
so it is possible to use the PartyNameView inside the RequirementAndProductSupplier view? Jacopo Cappellato wrote: > Hi Fred, > > it's good but, I'd not use the Person entity because a supplier could be > a Person or a PartyGroup. > Or at least use a view entity instead of Person: I think there is one > called PartyNameView > > Jacopo > > > Fred Forester wrote: > >>I have the static view. at least it seems to be correct. I'll try to >>swap (back) in the minilang service later on today. >> >><view-entity entity-name="RequirementAndProductSupplier" >> package-name="org.ofbiz.product.inventory" >> title="Suppliers and Requirements"> >> <member-entity entity-alias="RE" entity-name="Requirement"/> >> <member-entity entity-alias="SP" entity-name="SupplierProduct"/> >> <member-entity entity-alias="PE" entity-name="Person"/> >> <alias-all entity-alias="RE"/> >> <alias-all entity-alias="SP"/> >> <alias entity-alias="PE" name="lastName"/> >> <alias entity-alias="PE" name="firstName"/> >> <alias entity-alias="PE" name="partyId"/> >> <view-link entity-alias="RE" rel-entity-alias="SP" >>rel-optional="false"> >> <key-map field-name="productId"/> >> </view-link> >> <view-link entity-alias="SP" rel-entity-alias="PE" >>rel-optional="false"> >> <key-map field-name="partyId"/> >> </view-link> >> <relation type="one-nofk" rel-entity-name="SupplierProduct"> >> <key-map field-name="productId"/> >> <key-map field-name="partyId"/> >> <key-map field-name="currencyUomId"/> >> <key-map field-name="minimumOrderQuantity"/> >> <key-map field-name="availableFromDate"/> >> </relation> >> <relation type="one-nofk" rel-entity-name="Person"> >> <key-map field-name="partyId"/> >> </relation> >> </view-entity> >> >> >>Fred Forester wrote: >> >>>I only used a dynamic view cause I did something similar with purchase >>>order "Quick Lookup" where the dynamic view selects only products for >>>the selected supplier so I used a modified version of that. >>> >>> >>> >>>Jacopo Cappellato wrote: >>> >>> >>>>Fred, >>>> >>>>why not simply patching the existing minilang service: >>>> >>>>Index: >>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>=================================================================== >>>>--- >>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>(revision 7548) >>>>+++ >>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>(working copy) >>>>@@ -74,10 +74,11 @@ >>>> >>>> <simple-method method-name="getRequirementsForSupplier" >>>>short-description="Get the requirements applicable to a given supplier"> >>>> <make-value value-name="newEntity" entity-name="Requirement"/> >>>>- <entity-condition entity-name="Requirement" >>>>list-name="requirementsForSupplier"> >>>>+ <entity-condition entity-name="RequirementAndProductSupplier" >>>>list-name="requirementsForSupplier"> >>>> <condition-list> >>>> <condition-object >>>>field-name="parameters.requirementConditions"/> >>>> <condition-expr field-name="statusId" >>>>value="REQ_APPROVED"/> >>>>+ <condition-expr field-name="partyId" >>>>env-name="parameters.partyId"/> >>>> <condition-list combine="or"> >>>> <condition-expr field-name="requirementTypeId" >>>>value="MRP_PRO_PURCH_ORDER"/> >>>> <condition-expr field-name="requirementTypeId" >>>>value="PRODUCT_REQUIREMENT"/> >>>> >>>> >>>>? >>>> >>>>You'll have to define the RequirementAndProductSupplier view-entity to >>>>make the abve code work correctly. >>>> >>>>Jacopo >>>> >>>>Fred Forester wrote: >>>> >>>> >>>> >>>>>Jacopo, >>>>> >>>>>it makes sense that the productId is part of the incoming >>>>>requirementConditions. however, how do I merge or combine the >>>>>requirementConditions with the mainCond? >>>>> >>>>>thanx >>>>>Fred >>>>> >>>>> >>>>> >>>>> >>>>>Jacopo Cappellato wrote: >>>>> >>>>> >>>>> >>>>>>Fred, >>>>>> >>>>>>thanks for your work. >>>>>> >>>>>>I think you should add the incoming requirementConditions as they are to >>>>>>the other conditions of your service. >>>>>> >>>>>>You should also remove the productId parameter (that is not even >>>>>>declared in the service definition); if the user has selected a >>>>>>productId to filter out requirements, this condition will be in the >>>>>>requirementConditions. >>>>>> >>>>>>Does it make sense? >>>>>> >>>>>>Jacopo >>>>>> >>>>>>Fred Forester wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Jacopo, >>>>>>> >>>>>>>the patch is attached and based on 7445 >>>>>>> >>>>>>>I wasnt sure how to merge the incomming requirementConditions with the >>>>>>>conditions being built by the code. comments welcome. >>>>>>> >>>>>>>Thanx >>>>>>>Fred >>>>>>> >>>>>>> >>>>>> >>>>>>_______________________________________________ >>>>>>Users mailing list >>>>>>[hidden email] >>>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>>> >>>>>> >>>>> >>>>>_______________________________________________ >>>>>Users mailing list >>>>>[hidden email] >>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>> >>>> >>>> >>>>_______________________________________________ >>>>Users mailing list >>>>[hidden email] >>>>http://lists.ofbiz.org/mailman/listinfo/users >>>> >>>> >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >>> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
yes it does. I changed Party to PartyNameView and it works. thanx Jacopo. Fred Fred Forester wrote: > so it is possible to use the PartyNameView inside the > RequirementAndProductSupplier view? > > > > Jacopo Cappellato wrote: > >>Hi Fred, >> >>it's good but, I'd not use the Person entity because a supplier could be >>a Person or a PartyGroup. >>Or at least use a view entity instead of Person: I think there is one >>called PartyNameView >> >>Jacopo >> >> >>Fred Forester wrote: >> >> >>>I have the static view. at least it seems to be correct. I'll try to >>>swap (back) in the minilang service later on today. >>> >>><view-entity entity-name="RequirementAndProductSupplier" >>> package-name="org.ofbiz.product.inventory" >>> title="Suppliers and Requirements"> >>> <member-entity entity-alias="RE" entity-name="Requirement"/> >>> <member-entity entity-alias="SP" entity-name="SupplierProduct"/> >>> <member-entity entity-alias="PE" entity-name="Person"/> >>> <alias-all entity-alias="RE"/> >>> <alias-all entity-alias="SP"/> >>> <alias entity-alias="PE" name="lastName"/> >>> <alias entity-alias="PE" name="firstName"/> >>> <alias entity-alias="PE" name="partyId"/> >>> <view-link entity-alias="RE" rel-entity-alias="SP" >>>rel-optional="false"> >>> <key-map field-name="productId"/> >>> </view-link> >>> <view-link entity-alias="SP" rel-entity-alias="PE" >>>rel-optional="false"> >>> <key-map field-name="partyId"/> >>> </view-link> >>> <relation type="one-nofk" rel-entity-name="SupplierProduct"> >>> <key-map field-name="productId"/> >>> <key-map field-name="partyId"/> >>> <key-map field-name="currencyUomId"/> >>> <key-map field-name="minimumOrderQuantity"/> >>> <key-map field-name="availableFromDate"/> >>> </relation> >>> <relation type="one-nofk" rel-entity-name="Person"> >>> <key-map field-name="partyId"/> >>> </relation> >>> </view-entity> >>> >>> >>>Fred Forester wrote: >>> >>> >>>>I only used a dynamic view cause I did something similar with purchase >>>>order "Quick Lookup" where the dynamic view selects only products for >>>>the selected supplier so I used a modified version of that. >>>> >>>> >>>> >>>>Jacopo Cappellato wrote: >>>> >>>> >>>> >>>>>Fred, >>>>> >>>>>why not simply patching the existing minilang service: >>>>> >>>>>Index: >>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>>=================================================================== >>>>>--- >>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>>(revision 7548) >>>>>+++ >>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>>(working copy) >>>>>@@ -74,10 +74,11 @@ >>>>> >>>>> <simple-method method-name="getRequirementsForSupplier" >>>>>short-description="Get the requirements applicable to a given supplier"> >>>>> <make-value value-name="newEntity" entity-name="Requirement"/> >>>>>- <entity-condition entity-name="Requirement" >>>>>list-name="requirementsForSupplier"> >>>>>+ <entity-condition entity-name="RequirementAndProductSupplier" >>>>>list-name="requirementsForSupplier"> >>>>> <condition-list> >>>>> <condition-object >>>>>field-name="parameters.requirementConditions"/> >>>>> <condition-expr field-name="statusId" >>>>>value="REQ_APPROVED"/> >>>>>+ <condition-expr field-name="partyId" >>>>>env-name="parameters.partyId"/> >>>>> <condition-list combine="or"> >>>>> <condition-expr field-name="requirementTypeId" >>>>>value="MRP_PRO_PURCH_ORDER"/> >>>>> <condition-expr field-name="requirementTypeId" >>>>>value="PRODUCT_REQUIREMENT"/> >>>>> >>>>> >>>>>? >>>>> >>>>>You'll have to define the RequirementAndProductSupplier view-entity to >>>>>make the abve code work correctly. >>>>> >>>>>Jacopo >>>>> >>>>>Fred Forester wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>Jacopo, >>>>>> >>>>>>it makes sense that the productId is part of the incoming >>>>>>requirementConditions. however, how do I merge or combine the >>>>>>requirementConditions with the mainCond? >>>>>> >>>>>>thanx >>>>>>Fred >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>Jacopo Cappellato wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Fred, >>>>>>> >>>>>>>thanks for your work. >>>>>>> >>>>>>>I think you should add the incoming requirementConditions as they are to >>>>>>>the other conditions of your service. >>>>>>> >>>>>>>You should also remove the productId parameter (that is not even >>>>>>>declared in the service definition); if the user has selected a >>>>>>>productId to filter out requirements, this condition will be in the >>>>>>>requirementConditions. >>>>>>> >>>>>>>Does it make sense? >>>>>>> >>>>>>>Jacopo >>>>>>> >>>>>>>Fred Forester wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Jacopo, >>>>>>>> >>>>>>>>the patch is attached and based on 7445 >>>>>>>> >>>>>>>>I wasnt sure how to merge the incomming requirementConditions with the >>>>>>>>conditions being built by the code. comments welcome. >>>>>>>> >>>>>>>>Thanx >>>>>>>>Fred >>>>>>>> >>>>>>>> >>>>>>> >>>>>>>_______________________________________________ >>>>>>>Users mailing list >>>>>>>[hidden email] >>>>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>>>> >>>>>>> >>>>>> >>>>>>_______________________________________________ >>>>>>Users mailing list >>>>>>[hidden email] >>>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>>> >>>>> >>>>> >>>>>_______________________________________________ >>>>>Users mailing list >>>>>[hidden email] >>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>> >>>>> >>>> >>>> >>>>_______________________________________________ >>>>Users mailing list >>>>[hidden email] >>>>http://lists.ofbiz.org/mailman/listinfo/users >>>> >>>> >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Jacopo,
attached is the new patch. the patch actually contains all the work I've done on ofbiz so far. quick ship in stock items (that I posted on Jira) plus the enhancements to allow instock quantites of an item to be shipped leaving the remaining backordered. the orderlist now shows totalcount/backorderedcount/shippedcount The Quick Lookup (LookupBulkAddProducts) on the orderenty is functional with correct scrolling. Purcase orders will show only the products for that supplier. added a product search form on top of the list. I will eventually convert the dynamic view I used for this to a static one also. the requirements link on the purchase order shorcuts show only requirements for that supplier. an ordermgr report showing all requirements by supplier name. there are prrobably some uilabel changes you do not want. again the diff is based on 7445. Thanx for all your help. Fred Fred Forester wrote: > yes it does. I changed Party to PartyNameView and it works. > > thanx Jacopo. > > Fred > > > Fred Forester wrote: > >>so it is possible to use the PartyNameView inside the >>RequirementAndProductSupplier view? >> >> >> >>Jacopo Cappellato wrote: >> >> >>>Hi Fred, >>> >>>it's good but, I'd not use the Person entity because a supplier could be >>>a Person or a PartyGroup. >>>Or at least use a view entity instead of Person: I think there is one >>>called PartyNameView >>> >>>Jacopo >>> >>> >>>Fred Forester wrote: >>> >>> >>> >>>>I have the static view. at least it seems to be correct. I'll try to >>>>swap (back) in the minilang service later on today. >>>> >>>><view-entity entity-name="RequirementAndProductSupplier" >>>> package-name="org.ofbiz.product.inventory" >>>> title="Suppliers and Requirements"> >>>> <member-entity entity-alias="RE" entity-name="Requirement"/> >>>> <member-entity entity-alias="SP" entity-name="SupplierProduct"/> >>>> <member-entity entity-alias="PE" entity-name="Person"/> >>>> <alias-all entity-alias="RE"/> >>>> <alias-all entity-alias="SP"/> >>>> <alias entity-alias="PE" name="lastName"/> >>>> <alias entity-alias="PE" name="firstName"/> >>>> <alias entity-alias="PE" name="partyId"/> >>>> <view-link entity-alias="RE" rel-entity-alias="SP" >>>>rel-optional="false"> >>>> <key-map field-name="productId"/> >>>> </view-link> >>>> <view-link entity-alias="SP" rel-entity-alias="PE" >>>>rel-optional="false"> >>>> <key-map field-name="partyId"/> >>>> </view-link> >>>> <relation type="one-nofk" rel-entity-name="SupplierProduct"> >>>> <key-map field-name="productId"/> >>>> <key-map field-name="partyId"/> >>>> <key-map field-name="currencyUomId"/> >>>> <key-map field-name="minimumOrderQuantity"/> >>>> <key-map field-name="availableFromDate"/> >>>> </relation> >>>> <relation type="one-nofk" rel-entity-name="Person"> >>>> <key-map field-name="partyId"/> >>>> </relation> >>>> </view-entity> >>>> >>>> >>>>Fred Forester wrote: >>>> >>>> >>>> >>>>>I only used a dynamic view cause I did something similar with purchase >>>>>order "Quick Lookup" where the dynamic view selects only products for >>>>>the selected supplier so I used a modified version of that. >>>>> >>>>> >>>>> >>>>>Jacopo Cappellato wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>Fred, >>>>>> >>>>>>why not simply patching the existing minilang service: >>>>>> >>>>>>Index: >>>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>>>=================================================================== >>>>>>--- >>>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>>>(revision 7548) >>>>>>+++ >>>>>>applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml >>>>>>(working copy) >>>>>>@@ -74,10 +74,11 @@ >>>>>> >>>>>> <simple-method method-name="getRequirementsForSupplier" >>>>>>short-description="Get the requirements applicable to a given supplier"> >>>>>> <make-value value-name="newEntity" entity-name="Requirement"/> >>>>>>- <entity-condition entity-name="Requirement" >>>>>>list-name="requirementsForSupplier"> >>>>>>+ <entity-condition entity-name="RequirementAndProductSupplier" >>>>>>list-name="requirementsForSupplier"> >>>>>> <condition-list> >>>>>> <condition-object >>>>>>field-name="parameters.requirementConditions"/> >>>>>> <condition-expr field-name="statusId" >>>>>>value="REQ_APPROVED"/> >>>>>>+ <condition-expr field-name="partyId" >>>>>>env-name="parameters.partyId"/> >>>>>> <condition-list combine="or"> >>>>>> <condition-expr field-name="requirementTypeId" >>>>>>value="MRP_PRO_PURCH_ORDER"/> >>>>>> <condition-expr field-name="requirementTypeId" >>>>>>value="PRODUCT_REQUIREMENT"/> >>>>>> >>>>>> >>>>>>? >>>>>> >>>>>>You'll have to define the RequirementAndProductSupplier view-entity to >>>>>>make the abve code work correctly. >>>>>> >>>>>>Jacopo >>>>>> >>>>>>Fred Forester wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>Jacopo, >>>>>>> >>>>>>>it makes sense that the productId is part of the incoming >>>>>>>requirementConditions. however, how do I merge or combine the >>>>>>>requirementConditions with the mainCond? >>>>>>> >>>>>>>thanx >>>>>>>Fred >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>Jacopo Cappellato wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Fred, >>>>>>>> >>>>>>>>thanks for your work. >>>>>>>> >>>>>>>>I think you should add the incoming requirementConditions as they are to >>>>>>>>the other conditions of your service. >>>>>>>> >>>>>>>>You should also remove the productId parameter (that is not even >>>>>>>>declared in the service definition); if the user has selected a >>>>>>>>productId to filter out requirements, this condition will be in the >>>>>>>>requirementConditions. >>>>>>>> >>>>>>>>Does it make sense? >>>>>>>> >>>>>>>>Jacopo >>>>>>>> >>>>>>>>Fred Forester wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>Jacopo, >>>>>>>>> >>>>>>>>>the patch is attached and based on 7445 >>>>>>>>> >>>>>>>>>I wasnt sure how to merge the incomming requirementConditions with the >>>>>>>>>conditions being built by the code. comments welcome. >>>>>>>>> >>>>>>>>>Thanx >>>>>>>>>Fred >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>>_______________________________________________ >>>>>>>>Users mailing list >>>>>>>>[hidden email] >>>>>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>>>>> >>>>>>>> >>>>>>> >>>>>>>_______________________________________________ >>>>>>>Users mailing list >>>>>>>[hidden email] >>>>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>>>> >>>>>> >>>>>> >>>>>>_______________________________________________ >>>>>>Users mailing list >>>>>>[hidden email] >>>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>>> >>>>>> >>>>> >>>>> >>>>>_______________________________________________ >>>>>Users mailing list >>>>>[hidden email] >>>>>http://lists.ofbiz.org/mailman/listinfo/users >>>>> >>>>> >>>> >>>> >>>>_______________________________________________ >>>>Users mailing list >>>>[hidden email] >>>>http://lists.ofbiz.org/mailman/listinfo/users >>>> >>> >>> >>> >>>_______________________________________________ >>>Users mailing list >>>[hidden email] >>>http://lists.ofbiz.org/mailman/listinfo/users >>> >>> >> >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > Index: applications/product/servicedef/services_shipment.xml =================================================================== --- applications/product/servicedef/services_shipment.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/servicedef/services_shipment.xml (.../customofbiz/trunk) (revision 17) @@ -65,6 +65,19 @@ <!-- A List of Maps, each with a shipmentId,a facilityId, and a shipGroupSeqId for each shipment created --> <attribute name="shipmentShipGroupFacilityList" type="List" mode="OUT" optional="false"/> </service> + + <service name="quickShipInstockItems" engine="simple" + location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="quickShipInstockItems" auth="true"> + <description> + quick ship instock items + </description> + <attribute name="orderId" type="String" mode="IN" optional="false"/> + <attribute name="originFacilityId" type="String" mode="IN" optional="true"/> + <attribute name="setPackedOnly" type="String" mode="IN" optional="true"/> + <!-- A List of Maps, each with a shipmentId,a facilityId, and a shipGroupSeqId for each shipment created --> + <attribute name="shipmentShipGroupFacilityList" type="List" mode="OUT" optional="false"/> + </service> + <service name="quickShipOrderByItem" engine="simple" location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="quickShipOrderByItem" auth="true"> <description>Quick Ships An Order By Item</description> Index: applications/product/servicedef/services_view.xml =================================================================== --- applications/product/servicedef/services_view.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/servicedef/services_view.xml (.../customofbiz/trunk) (revision 17) @@ -101,6 +101,20 @@ <attribute type="java.util.Collection" mode="OUT" name="convertedProductFeatures"/> </service> + <service name="getProductSupplierInventory" engine="java" + location="org.ofbiz.product.supplier.SupplierProductServices" invoke="getProductSupplierInventory" auth="false"> + <description> + find the products inventory info by supplier + </description> + <attribute name="partyId" type="String" mode="IN" optional="true"/> + <attribute name="productId" type="String" mode="IN" optional="true"/> + <!-- A List of Maps, each with a shipmentId,a facilityId, and a shipGroupSeqId for each shipment created --> + <!-- disable for testing --> + <!-- <attribute name="supplierProductList" type="org.ofbiz.entity.util.EntityListIterator" mode="OUT" optional="true"/> --> + <attribute name="supplierProductList" type="java.util.List" mode="OUT" optional="true"/> + </service> + + <!-- Category View Services --> <service name="getProductCategoryMembers" engine="java" location="org.ofbiz.product.category.CategoryServices" invoke="getCategoryMembers"> Index: applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml =================================================================== --- applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (.../customofbiz/trunk) (revision 17) @@ -1131,6 +1131,133 @@ <check-errors/> </simple-method> + <!-- quick ship entire order in one package per facility & ship group --> + <simple-method method-name="quickShipInstockItems" short-description="Quick ships an entire order from multiple facilities"> + <!-- first get the order header; make sure we have a product store --> + <entity-one entity-name="OrderHeader" value-name="orderHeader"/> + <if-empty field-name="productStoreId" map-name="orderHeader"> + <!-- no store cannot use quick ship; throw error --> + <add-error><fail-message message="No ProductStore associated with order; cannot use Quick Ship"/></add-error> + <check-errors/> + </if-empty> + + <!-- get the product store entity --> + <entity-one entity-name="ProductStore" value-name="productStore" auto-field-map="false"> + <field-map field-name="productStoreId" env-name="orderHeader.productStoreId"/> + </entity-one> + + <if-compare field-name="reserveInventory" map-name="productStore" operator="not-equals" value="Y"> + <!-- no reservations; no shipment; cannot use quick ship --> + <add-error><fail-message message="ProductStore [${productStore.productStoreId}] does not reserve inventory; cannot use Quick Ship for Multiple Facilities"/></add-error> + </if-compare> + <if-compare field-name="explodeOrderItems" map-name="productStore" operator="equals" value="Y"> + <!-- can't insert duplicate rows in shipmentPackageContent --> + <add-error><fail-message message="ProductStore [${productStore.productStoreId}] explodes order items; cannot use Quick Ship for Multiple Facilities"/></add-error> + </if-compare> + <log level="info" message="QuickshipInstockItems for Order ${orderHeader.orderId}"/> + <!-- locate shipping facilities associated with order item rez's for instock items only--> + <entity-condition entity-name="OrderItemAndShipGrpInvResAndItem" list-name="orderItemAndShipGrpInvResAndItemList"> + <condition-list> + <condition-expr field-name="orderId" env-name="orderHeader.orderId"/> + <condition-expr field-name="statusId" value="ITEM_APPROVED"/> + <!-- <condition-expr field-name="quantityNotAvailable" env-name="null"/> --> + </condition-list> + </entity-condition> + <iterate list-name="orderItemAndShipGrpInvResAndItemList" entry-name="orderItemAndShipGrpInvResAndItem"> + <log level="info" message="quantityNotAvailable ${orderItemAndShipGrpInvResAndItem.quantityNotAvailable}"/> + <log level="info" message="quantity ${orderItemAndShipGrpInvResAndItem.quantity}"/> + <set from-field="orderItemAndShipGrpInvResAndItem.facilityId" field="facilityId"/> + <if-empty field-name="orderItemAndShipGrpInvResAndItem.quantityNotAvailable"> + <log level="info" message="Nothing to backorder"/> + <!-- nothing backordered so ship the entire item --> + <field-to-list field-name="orderItemAndShipGrpInvResAndItem.orderItemSeqId" list-name="orderItemSeqIdList"/> + <if> + <condition> + <not> + <if-compare-field field-name="orderItemShipGrpInvResFacilityIds" operator="contains" to-field-name="facilityId"/> + </not> + </condition> + <then> + <field-to-list field-name="facilityId" list-name="orderItemShipGrpInvResFacilityIds"/> + </then> + </if> + </if-empty> + <if-not-empty field-name="orderItemAndShipGrpInvResAndItem.quantityNotAvailable"> + <!-- some items backordered --> + <log level="info" message="Some items backordered"/> + <calculate field-name="qtyToShip"> + <calcop operator="subtract"> + <calcop operator="get" field-name="orderItemAndShipGrpInvResAndItem.quantity"/> + <calcop operator="get" field-name="orderItemAndShipGrpInvResAndItem.quantityNotAvailable"/> + </calcop> + </calculate> + <log level="info" message="qtyToShip ${qtyToShip}"/> + <if> + <!-- ship the available quantity in this item --> + <condition> + <if-compare field-name="qtyToShip" operator="greater" value="0"/> + </condition> + <then> + <log level="info" message="Shipping qtyToShip ${qtyToShip}"/> + <field-to-list field-name="orderItemAndShipGrpInvResAndItem.orderItemSeqId" list-name="orderItemSeqIdList"/> + <if> + <condition> + <not> + <if-compare-field field-name="orderItemShipGrpInvResFacilityIds" operator="contains" to-field-name="facilityId"/> + </not> + </condition> + <then> + <field-to-list field-name="facilityId" list-name="orderItemShipGrpInvResFacilityIds"/> + </then> + </if> + </then> + </if> + </if-not-empty> + </iterate> + <!-- get OrderItemAndShipGroupAssoc for the instock orderItemSeqIdList --> + <entity-condition entity-name="OrderItemAndShipGroupAssoc" list-name="orderItemAndShipGroupAssocList"> + <condition-list> + <condition-expr field-name="orderId" env-name="orderHeader.orderId"/> + <condition-expr field-name="orderItemSeqId" operator="in" env-name="orderItemSeqIdList"/> + </condition-list> + </entity-condition> + + <!-- make sure we have something to ship --> + <if-empty field-name="orderItemAndShipGroupAssocList"> + <add-error><fail-message message="No items available to ship at this time"/></add-error> + <check-errors/> + </if-empty> + + <get-related relation-name="OrderItemShipGroup" value-name="orderHeader" list-name="orderItemShipGroupList"/> + + <!-- group orderItems (actually OrderItemAndShipGroupAssocs) by shipGroupSeqId in a Map with List values + This Map is actually used only for sales orders' shipments right now. --> + <iterate list-name="orderItemAndShipGroupAssocList" entry-name="orderItemAndShipGroupAssoc"> + <field-to-list field-name="orderItemAndShipGroupAssoc" list-name="orderItemListByShGrpMap.${orderItemAndShipGroupAssoc.shipGroupSeqId}"/> + </iterate> + + <!-- traverse facilities, instantiate shipment for each --> + <iterate list-name="orderItemShipGrpInvResFacilityIds" entry-name="orderItemShipGrpInvResFacilityId"> + <!-- sanity check for valid facility --> + <entity-one entity-name="Facility" value-name="facility"> + <field-map field-name="facilityId" env-name="orderItemShipGrpInvResFacilityId"/> + </entity-one> + <!-- should never be empty - referential integrity enforced --> + <log level="info" message="Calling createShipmentForFacilityAndShipGroup" /> + <call-simple-method method-name="createShipmentForFacilityAndShipGroup"/> + </iterate> + + <log level="info" message="Finished QuickshipInstockItems for Order ${orderHeader.orderId}"/> + <!-- <log level="info" message="Finished quickShipEntireOrder:\nshipmentShipGroupFacilityList=${shipmentShipGroupFacilityList}\nsuccessMessageList=${successMessageList}"/> --> + <field-to-result field-name="shipmentShipGroupFacilityList"/> + <field-to-result field-name="successMessageList"/> + + <if-empty field-name="shipmentShipGroupFacilityList"> + <add-error><fail-message message="Warning: no shipments created; could not find anything ready and needing to be shipped."/></add-error> + </if-empty> + <check-errors/> + </simple-method> + <simple-method method-name="quickShipPurchaseOrder" short-description="Quick ships an entire purchase order to a facility"> <entity-one entity-name="OrderHeader" value-name="orderHeader"/> <call-simple-method method-name="getOrderItemShipGroupLists"/> @@ -1174,6 +1301,7 @@ </entity-and> <set from-field="orderItemListByShGrpMap.${orderItemShipGroup.shipGroupSeqId}" field="perShipGroupItemList"/> + <log level="info" message="createShipmentForFacilityAndShipGroup orderItemListByShGrpMap.${orderItemShipGroup.shipGroupSeqId}"/> <!-- make sure we have something to ship --> <if-empty field-name="perShipGroupItemList"> @@ -1210,9 +1338,35 @@ <set from-field="shipment.shipmentId" field="issueContext.shipmentId"/> <set from-field="itemRes.orderId" field="issueContext.orderId"/> <set from-field="itemRes.orderItemSeqId" field="issueContext.orderItemSeqId"/> + <log level="info" message="itemRes.orderItemSeqId ${itemRes.orderItemSeqId}" /> <set from-field="itemRes.shipGroupSeqId" field="issueContext.shipGroupSeqId"/> <set from-field="itemRes.inventoryItemId" field="issueContext.inventoryItemId"/> <set from-field="itemRes.quantity" field="issueContext.quantity"/> + <if-not-empty field-name="itemRes.quantityNotAvailable"> + <if> + <condition> + <if-compare-field field-name="itemRes.quantity" operator="greater" to-field-name="itemRes.quantityNotAvailable"/> + </condition> + <then> + <!-- calc qtyToShip equals itemRes.quantity minus itemRes.quantityNotAvailable --> + <calculate field-name="qtyToShip"> + <calcop operator="subtract"> + <calcop operator="get" field-name="itemRes.quantity"/> + <calcop operator="get" field-name="itemRes.quantityNotAvailable"/> + </calcop> + </calculate> + <set from-field="qtyToShip" field="issueContext.quantity"/> + <log level="info" message="qtyToShip ${qtyToShip}"/> + </then> + <else> + <!-- else ship the entire quantity --> + <log level="info" message="all items instock and shippable"/> + <set from-field="itemRes.quantity" field="issueContext.quantity"/> + </else> + </if> + </if-not-empty> + <log level="info" message="issueContext quantity ${issueContext.quantity}" /> + <log level="info" message="itemRes quantity ${itemRes.quantity}" /> <call-service service-name="issueOrderItemShipGrpInvResToShipment" in-map-name="issueContext"/> </iterate> </iterate> Index: applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java =================================================================== --- applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (.../customofbiz/trunk) (revision 17) @@ -3,9 +3,11 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; +import javolution.util.FastList; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; @@ -13,8 +15,16 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.condition.EntityFieldValue; +import org.ofbiz.entity.condition.EntityFunction; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.util.EntityFindOptions; +import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.model.DynamicViewEntity; +import org.ofbiz.entity.model.ModelKeyMap; import org.ofbiz.product.product.ProductWorker; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; @@ -137,4 +147,134 @@ } return results; } + + /* + * Parameters: partyId of a supplier optionally a productId,ATP,QOH + * will return a list of productids with atp,qoh and product description + */ + public static Map getProductSupplierInventory(DispatchContext dctx, Map context) { + + Debug.logInfo("Enter performFindProductSupplierInventory", module); + Map results = ServiceUtil.returnSuccess(); + LinkedList dataList = new LinkedList(); + GenericDelegator delegator = dctx.getDelegator(); + + String productId = (String) context.get("productId"); + String partyId = (String) context.get("partyId"); + + // create the dynamic view entity + DynamicViewEntity dynamicView = new DynamicViewEntity(); + + // default view settings + dynamicView.addMemberEntity("SP", "SupplierProduct"); + dynamicView.addMemberEntity("PR", "Product"); + dynamicView.addMemberEntity("II", "InventoryItem"); + dynamicView.addAlias("SP", "partyId"); + dynamicView.addAlias("SP", "productId"); + dynamicView.addAlias("SP", "minimumOrderQuantity"); + dynamicView.addAlias("SP", "lastPrice"); + dynamicView.addAlias("PR", "internalName"); + dynamicView.addAlias("PR", "brandName"); + dynamicView.addAlias("PR", "isVirtual"); + dynamicView.addAlias("II", "quantityOnHandTotal"); + dynamicView.addAlias("II", "availableToPromiseTotal"); + dynamicView.addRelation("one", "", "Product", ModelKeyMap.makeKeyMapList("productId")); + dynamicView.addRelation("many", "", "InventoryItem", ModelKeyMap.makeKeyMapList("productId")); + + dynamicView.addViewLink("SP", "PR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + dynamicView.addViewLink("SP", "II", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId")); + + // define the main condition & expression list + List andExprs = FastList.newInstance(); + EntityCondition mainCond = null; + + List orderBy = FastList.newInstance(); + List fieldsToSelect = FastList.newInstance(); + // fields we need to select; will be used to set distinct + fieldsToSelect.add("productId"); + fieldsToSelect.add("internalName"); + fieldsToSelect.add("brandName"); + fieldsToSelect.add("quantityOnHandTotal"); + fieldsToSelect.add("availableToPromiseTotal"); + fieldsToSelect.add("minimumOrderQuantity"); + fieldsToSelect.add("lastPrice"); + + //andExprs.add(new EntityExpr("isVirtual", EntityOperator.NOT_EQUAL, "Y")); + //andExprs.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, "N")); + //andExprs.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, null)); + + EntityExpr eqN = new EntityExpr("isVirtual", EntityOperator.EQUALS, "N"); + EntityExpr eqNull = new EntityExpr("isVirtual", EntityOperator.EQUALS, null); + andExprs.add(new EntityExpr(eqN,EntityOperator.OR,eqNull)); + + if (partyId != null && partyId.length() > 0) { + andExprs.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId)); + } + else + { + Debug.logInfo("No PartyId",module); + results.put("supplierProductList",null); + } + + if (productId != null && productId.length() > 0) { + //andExprs.add(new EntityExpr("productId", EntityOperator.EQUALS, productId)); + andExprs.add(new EntityExpr( + new EntityFunction.UPPER(new EntityFieldValue("productId")), + EntityOperator.LIKE, productId.toUpperCase() + "%")); + } + else + { + Debug.logInfo("No productId",module); + results.put("supplierProductList",null); + } + + if (productId != null && productId.length() > 0) + orderBy.add("productId"); + else + orderBy.add("availableToPromiseTotal"); + + if (andExprs.size() > 0) mainCond = new EntityConditionList(andExprs, EntityOperator.AND); + Debug.logInfo("Calling dynaview", module); + if (mainCond != null) + { + Debug.logInfo("Have mainCond", module); + try + { + // set distinct on so we only get one row per order + EntityFindOptions findOpts = new EntityFindOptions(true, + EntityFindOptions.TYPE_SCROLL_INSENSITIVE, + EntityFindOptions.CONCUR_READ_ONLY, + true); + Debug.logInfo("Have EntityFindOptions", module); + // using list iterator + EntityListIterator pli = delegator.findListIteratorByCondition(dynamicView, + mainCond, + null, + fieldsToSelect, + orderBy, + findOpts); + Debug.logInfo("Have EntityListIterator", module); + GenericValue gv = null; + while ((gv = (GenericValue) pli.next()) != null) + { + //Debug.logInfo("Row: " + gv.get("productId") + " " + gv.get("internalName"), module); + dataList.add(gv); + } + pli.close(); + //results.put("supplierProductList",pli); + results.put("supplierProductList",dataList); + } + catch (GenericEntityException e) + { + String errMsg = "Failure in party find operation, rolling back transaction: " + e.toString(); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); + } + } + + Debug.logInfo("Exiting performFindProductSupplierInventory", module); + return results; + + } + } Index: applications/product/entitydef/entitygroup.xml =================================================================== --- applications/product/entitydef/entitygroup.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/entitydef/entitygroup.xml (.../customofbiz/trunk) (revision 17) @@ -100,6 +100,7 @@ <entity-group group="org.ofbiz" entity="InventoryItem" /> <entity-group group="org.ofbiz" entity="InventoryItemAndLocation" /> + <entity-group group="org.ofbiz" entity="RequirementAndProductSupplier" /> <entity-group group="org.ofbiz" entity="InventoryItemAttribute" /> <entity-group group="org.ofbiz" entity="InventoryItemDetail" /> <entity-group group="org.ofbiz" entity="InventoryItemDetailSummary" /> Index: applications/product/entitydef/entitymodel.xml =================================================================== --- applications/product/entitydef/entitymodel.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/entitydef/entitymodel.xml (.../customofbiz/trunk) (revision 17) @@ -1048,6 +1048,34 @@ <key-map field-name="currencyUomId" rel-field-name="uomId"/> </relation> </entity> + <view-entity entity-name="RequirementAndProductSupplier" + package-name="org.ofbiz.product.inventory" + title="Suppliers and Requirements"> + <member-entity entity-alias="RE" entity-name="Requirement"/> + <member-entity entity-alias="SP" entity-name="SupplierProduct"/> + <member-entity entity-alias="PE" entity-name="PartyNameView"/> + <alias-all entity-alias="RE"/> + <alias-all entity-alias="SP"/> + <alias entity-alias="PE" name="lastName"/> + <alias entity-alias="PE" name="firstName"/> + <alias entity-alias="PE" name="partyId"/> + <view-link entity-alias="RE" rel-entity-alias="SP" rel-optional="false"> + <key-map field-name="productId"/> + </view-link> + <view-link entity-alias="SP" rel-entity-alias="PE" rel-optional="false"> + <key-map field-name="partyId"/> + </view-link> + <relation type="one-nofk" rel-entity-name="SupplierProduct"> + <key-map field-name="productId"/> + <key-map field-name="partyId"/> + <key-map field-name="currencyUomId"/> + <key-map field-name="minimumOrderQuantity"/> + <key-map field-name="availableFromDate"/> + </relation> + <relation type="one-nofk" rel-entity-name="PartyNameView"> + <key-map field-name="partyId"/> + </relation> + </view-entity> <view-entity entity-name="InventoryItemAndLocation" package-name="org.ofbiz.product.inventory" title="InventoryItem And FacilityLocation View Entity"> Index: applications/product/webapp/facility/WEB-INF/controller.xml =================================================================== --- applications/product/webapp/facility/WEB-INF/controller.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/product/webapp/facility/WEB-INF/controller.xml (.../customofbiz/trunk) (revision 17) @@ -665,6 +665,12 @@ <security https="true" auth="true"/> <response name="success" type="view" value="QuickShipOrder"/> </request-map> + <request-map uri="quickShipInstockItems"> + <security https="true" auth="true"/> + <event type="service" invoke="quickShipInstockItems"/> + <response name="success" type="view" value="QuickShipOrder"/> + <response name="error" type="view" value="QuickShipOrder"/> + </request-map> <request-map uri="quickShipPurchaseOrder"> <security https="true" auth="true"/> <event type="service" invoke="quickShipPurchaseOrder"/> Index: applications/order/servicedef/services_requirement.xml =================================================================== --- applications/order/servicedef/services_requirement.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/servicedef/services_requirement.xml (.../customofbiz/trunk) (revision 17) @@ -84,6 +84,7 @@ <attribute mode="IN" name="currencyUomId" type="String" optional="true"/> <attribute mode="OUT" name="requirementsForSupplier" type="java.util.List" optional="true"/> </service> + <service name="createOrderRequirementCommitment" engine="simple" auth="true" location="org/ofbiz/order/order/OrderServices.xml" invoke="createOrderRequirementCommitment"> <auto-attributes entity-name="OrderRequirementCommitment" include="pk" mode="IN" optional="false"/> Index: applications/order/widget/ordermgr/ReportForms.xml =================================================================== --- applications/order/widget/ordermgr/ReportForms.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/widget/ordermgr/ReportForms.xml (.../customofbiz/trunk) (revision 17) @@ -77,6 +77,10 @@ <field name="submitButton" title="Run Payment Report" widget-style="smallSubmit"><submit button-type="button"/></field> </form> + <form name="RequirementsBySupplier" type="single" target="RequirementsBySupplier.pdf" title=""> + <field name="submitButton" title="Run Report" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> + <!-- form for generating a report of total product sales (quantity and value) --> <form name="SalesByStoreReport" type="single" target="SalesByStoreReport.pdf" title="" default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext"> Index: applications/order/widget/ordermgr/OrderEntryCartScreens.xml =================================================================== --- applications/order/widget/ordermgr/OrderEntryCartScreens.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/widget/ordermgr/OrderEntryCartScreens.xml (.../customofbiz/trunk) (revision 17) @@ -151,11 +151,14 @@ <section> <actions> <set field="title" value="Bulk Add Product"/> + <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/> + <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="40"/> <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh"/> </actions> <widgets> <decorator-screen name="CommonOrderEntryDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml"> <decorator-section name="body"> + <include-form name="SearchBulkAddProductsList" location="component://order/widget/ordermgr/OrderEntryForms.xml"/> <include-form name="LookupBulkAddProducts" location="component://order/widget/ordermgr/OrderEntryForms.xml"/> </decorator-section> </decorator-screen> Index: applications/order/widget/ordermgr/ReportScreens.xml =================================================================== --- applications/order/widget/ordermgr/ReportScreens.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/widget/ordermgr/ReportScreens.xml (.../customofbiz/trunk) (revision 17) @@ -39,6 +39,10 @@ <label style="head1" text="Order Reports"/> </container> <container> + <label style="head2" text="Requirements By Supplier"/> + <include-form name="RequirementsBySupplier" location="component://order/widget/ordermgr/ReportForms.xml"/> + </container> + <container> <label style="head2" text="Sales by Store Report"/> <include-form name="SalesByStoreReport" location="component://order/widget/ordermgr/ReportForms.xml"/> </container> @@ -93,6 +97,38 @@ </widgets> </section> </screen> + <screen name="RequirementsBySupplier"> + <section> + <actions> + <set field="title" value="Requirements by Supplier"/> + <entity-condition entity-name="RequirementAndProductSupplier" list-name="requirementsForSupplier"> + <condition-list> + <condition-object field-name="parameters.requirementConditions"/> + <condition-expr field-name="statusId" value="REQ_APPROVED"/> + <condition-list combine="or"> + <condition-expr field-name="requirementTypeId" value="MRP_PRO_PURCH_ORDER"/> + <condition-expr field-name="requirementTypeId" value="PRODUCT_REQUIREMENT"/> + </condition-list> + </condition-list> + <select-field field-name="lastName"/> + <select-field field-name="firstName"/> + <select-field field-name="partyId"/> + <select-field field-name="productId"/> + <select-field field-name="description"/> + <select-field field-name="quantity"/> + <order-by field-name="lastName"/> + <order-by field-name="productId"/> + </entity-condition> + <!-- <script location="component://order/webapp/ordermgr/WEB-INF/actions/reports/getRequirementsBySupplier.bsh"/> --> + </actions> + <widgets> + <platform-specific> + <!-- NOTE: this is really generating XSL:FO, but the HTML oriented renderer should do fine, the screen will need to be called differently though to get binary output from it --> + <html><html-template location="component://order/webapp/ordermgr/reports/RequirementsBySupplier.fo.ftl"/></html> + </platform-specific> + </widgets> + </section> + </screen> <screen name="OrderPurchaseReportProduct"> <section> <actions> Index: applications/order/widget/ordermgr/OrderEntryForms.xml =================================================================== --- applications/order/widget/ordermgr/OrderEntryForms.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/widget/ordermgr/OrderEntryForms.xml (.../customofbiz/trunk) (revision 17) @@ -23,6 +23,7 @@ <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-form.xsd"> <form name="FindRequirements" type="single" target="RequirementsForSupplier" title="" default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext"> + <field name="partyId"><hidden value="${parameters.partyId}"/></field> <field name="hideSearch"><hidden value="Y"/></field> <field name="requirementId"><text-find/></field> <field name="productId" title="${uiLabelMap.ProductProductId}"><lookup target-form-name="LookupProduct"/></field> @@ -39,6 +40,7 @@ <service service-name="getRequirementsForSupplier" result-map-name="result" result-map-list-name="requirementsForSupplier"> <!--<field-map field-name="orderByList" env-name="resultConditions.orderByList"/>--> <field-map field-name="requirementConditions" env-name="resultConditions.entityConditionList"/> + <field-map field-name="partyId" env-name="requestParameters.partyId"/> </service> </actions> <field name="requirementId"><display/></field> @@ -136,12 +138,15 @@ </form> <form name="LookupBulkAddProducts" type="multi" use-row-submit="true" list-name="productList" title="" - target="BulkAddProducts" default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext"> + target="BulkAddProducts" paginate-target="LookupBulkAddProducts" default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext"> <field name="productId" title="${uiLabelMap.ProductProductId}" widget-style="buttontext"> <hyperlink description="${productId}" target="/catalog/control/EditProductInventoryItems?productId=${productId}" target-type="inter-app"/> </field> <field name="brandName" widget-style="tabletext"><display/></field> - <field name="internalName" widget-style="tabletext"><display/></field> + <field name="internalName" widget-style="tabletext" use-when=""${quantityOnHandTotal}".length()>0"> + <display description="${internalName} <br><br> QOH ${quantityOnHandTotal} ATP ${availableToPromiseTotal} MinOrderQty ${minimumOrderQuantity} Price ${lastPrice}"/> + </field> + <field name="internalName" widget-style="tabletext" use-when=""${quantityOnHandTotal}".length()==0"><display/></field> <field name="quantity" title="${uiLabelMap.OrderQuantity}"> <text size="5" maxlength="10"/> </field> @@ -156,4 +161,14 @@ </field> </form> + <form name="SearchBulkAddProductsList" type="single" target="LookupBulkAddProducts" default-title-style="tableheadtext" + default-widget-style="inputBox" default-tooltip-style="tabletext"> + <field name="productId" title="${uiLabelMap.ProductProductId}"> + <text size="15" maxlength="15"/> + </field> + <field name="submitButton" title="${uiLabelMap.Search}" widget-style="smallSubmit"> + <submit/> + </field> + </form> + </forms> Index: applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml =================================================================== --- applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/script/org/ofbiz/order/requirement/RequirementServices.xml (.../customofbiz/trunk) (revision 17) @@ -36,6 +36,9 @@ <if-empty field-name="statusId" map-name="parameters"> <string-to-field string="REQ_CREATED" field-name="statusId" map-name="newEntity"/> </if-empty> + <if-compare field-name="requirementTypeId" map-name="parameters" operator="equals" value="PRODUCT_REQUIREMENT"> + <string-to-field string="REQ_APPROVED" field-name="statusId" map-name="newEntity"/> + </if-compare> <now-timestamp-to-env env-name="nowTimestamp"/> <env-to-field env-name="nowTimestamp" field-name="createdDate" map-name="newEntity"/> <create-value value-name="newEntity"/> @@ -74,10 +77,11 @@ <simple-method method-name="getRequirementsForSupplier" short-description="Get the requirements applicable to a given supplier"> <make-value value-name="newEntity" entity-name="Requirement"/> - <entity-condition entity-name="Requirement" list-name="requirementsForSupplier"> + <entity-condition entity-name="RequirementAndProductSupplier" list-name="requirementsForSupplier"> <condition-list> <condition-object field-name="parameters.requirementConditions"/> <condition-expr field-name="statusId" value="REQ_APPROVED"/> + <condition-expr field-name="partyId" env-name="parameters.partyId"/> <condition-list combine="or"> <condition-expr field-name="requirementTypeId" value="MRP_PRO_PURCH_ORDER"/> <condition-expr field-name="requirementTypeId" value="PRODUCT_REQUIREMENT"/> Index: applications/order/config/OrderUiLabels.properties =================================================================== --- applications/order/config/OrderUiLabels.properties (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/config/OrderUiLabels.properties (.../customofbiz/trunk) (revision 17) @@ -150,8 +150,8 @@ OrderOfflineCheckMoney = Offline: Check/Money Order OrderOnOrder = On Order OrderOrder = Order -OrderOrderBillFromParty = Bill From Party -OrderOrderBillToParty = Bill To Party +OrderOrderBillFromParty = Bill From +OrderOrderBillToParty = Bill To OrderOrderConfirmation = Order Confirmation OrderOrderDate = Order Date OrderOrdered = Ordered @@ -238,7 +238,7 @@ OrderOrderTermValue = Term Value OrderOrderTerms = Order Terms OrderOrderTotal = Order Total -OrderOrderType = Order Type +OrderOrderType = Type OrderOriginFacility = Origin Facility OrderOtherOrders = Other Orders OrderOutstanding = Outstanding @@ -365,7 +365,8 @@ OrderTotalQuantityNotReceived = Total quantity not received OrderTotalSalesTax = Total Sales Tax OrderTotalShippingAndHandling = Total Shipping and Handling -OrderTrackingCode=Tracking Code +OrderTrackingCode=Tracking +OrderBackOrderQuantity=Tot/BO/Shp OrderTrackingNumber = Tracking Number OrderUnitList = Unit / List OrderUnitPrice = Unit Price Index: applications/order/src/org/ofbiz/order/order/OrderReadHelper.java =================================================================== --- applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (.../customofbiz/trunk) (revision 17) @@ -2481,4 +2481,34 @@ } return invoiced; } + + public double getOrderItemBackorderQuantity(GenericValue orderItem) + { + double backorder = 0.0; + List reses = this.getOrderItemShipGrpInvResList(orderItem); + if (reses != null) { + Iterator ri = reses.iterator(); + while (ri.hasNext()) { + GenericValue res = (GenericValue) ri.next(); + Double nav = res.getDouble("quantityNotAvailable"); + if (nav != null) { + backorder += nav.doubleValue(); + } + } + } + return backorder; + } + + public double getOrderShippedQuantity() { + double quantityShipped = 0.0; + List items = this.getValidOrderItems(); + if (items != null) { + Iterator ii = items.iterator(); + while (ii.hasNext()) { + GenericValue item = (GenericValue) ii.next(); + quantityShipped += this.getItemShippedQuantity(item); + } + } + return quantityShipped; + } } Index: applications/order/webapp/ordermgr/entry/orderShortcuts.ftl =================================================================== --- applications/order/webapp/ordermgr/entry/orderShortcuts.ftl (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/webapp/ordermgr/entry/orderShortcuts.ftl (.../customofbiz/trunk) (revision 17) @@ -46,7 +46,7 @@ <#if shoppingCart.getOrderType() == "PURCHASE_ORDER"> <tr> <td> - <a href="<@ofbizUrl>RequirementsForSupplier</@ofbizUrl>" class="buttontext">${uiLabelMap.Requirements}</a> + <a href="<@ofbizUrl>RequirementsForSupplier?partyId=${partyId}</@ofbizUrl>" class="buttontext">${uiLabelMap.Requirements}</a> </td> </tr> </#if> Index: applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh =================================================================== --- applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.bsh (.../customofbiz/trunk) (revision 17) @@ -31,32 +31,64 @@ import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.base.util.UtilMisc; -productId = request.getParameter("productId"); +import org.ofbiz.order.shoppingcart.*; -conditionList = new LinkedList(); -orConditionList = new LinkedList(); -mainConditionList = new LinkedList(); +shoppingCart = ShoppingCartEvents.getCartObject(request); +dispatcher = request.getAttribute("dispatcher"); -//make sure the look up is case insensitive -conditionList.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("productId")), - EntityOperator.LIKE, productId.toUpperCase() + "%")); +if ("PURCHASE_ORDER".equals(shoppingCart.getOrderType())) { + partyId = shoppingCart.getPartyId(); + productId = request.getParameter("productId"); + print(request); + if (partyId != null && partyId.equals("_NA_")) partyId = null; + if (partyId != null && productId != null) + { + spl = dispatcher.runSync("getProductSupplierInventory",UtilMisc.toMap("partyId",partyId,"productId",productId)); + List productList = (List)spl.get("supplierProductList"); + context.put("productList",productList); + } + else + if (partyId != null) + { + spl = dispatcher.runSync("getProductSupplierInventory",UtilMisc.toMap("partyId",partyId)); + List productList = (List)spl.get("supplierProductList"); + context.put("productList",productList); + } +} -// do not include configurabl products -conditionList.add(new EntityExpr("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); +if (!"PURCHASE_ORDER".equals(shoppingCart.getOrderType())) { -// no virtual products: note that isVirtual could be null, which in some databases is different than isVirtual != "Y". -// we consider those products to be non-virtual and hence addable to the order in bulk -orConditionList.add(new EntityExpr("isVirtual", EntityOperator.NOT_EQUAL, "Y")); -orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, "N")); -orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, null)); -orConditions = new EntityConditionList(orConditionList, EntityOperator.OR); -conditions = new EntityConditionList(conditionList, EntityOperator.AND); + productId = request.getParameter("productId"); -mainConditionList.add(orConditions); -mainConditionList.add(conditions); -mainConditions = new EntityConditionList(mainConditionList, EntityOperator.AND); + conditionList = new LinkedList(); + orConditionList = new LinkedList(); + mainConditionList = new LinkedList(); -productList = delegator.findByCondition("Product", mainConditions, UtilMisc.toList("productId", "brandName", "internalName"), UtilMisc.toList("productId")); -context.put("productList",productList); + //make sure the look up is case insensitive + if (productId != null) + { + conditionList.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("productId")), + EntityOperator.LIKE, productId.toUpperCase() + "%")); + } + // do not include configurabl products + conditionList.add(new EntityExpr("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); + + // no virtual products: note that isVirtual could be null, which in some databases is different than isVirtual != "Y". + // we consider those products to be non-virtual and hence addable to the order in bulk + orConditionList.add(new EntityExpr("isVirtual", EntityOperator.NOT_EQUAL, "Y")); + orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, "N")); + orConditionList.add(new EntityExpr("isVirtual", EntityOperator.EQUALS, null)); + + orConditions = new EntityConditionList(orConditionList, EntityOperator.OR); + conditions = new EntityConditionList(conditionList, EntityOperator.AND); + + mainConditionList.add(orConditions); + mainConditionList.add(conditions); + mainConditions = new EntityConditionList(mainConditionList, EntityOperator.AND); + + productList = delegator.findByCondition("Product", mainConditions, UtilMisc.toList("productId", "brandName", "internalName"), UtilMisc.toList("productId")); + context.put("productList",productList); +} + Index: applications/order/webapp/ordermgr/WEB-INF/actions/reports/getRequirementsBySupplier.bsh =================================================================== --- applications/order/webapp/ordermgr/WEB-INF/actions/reports/getRequirementsBySupplier.bsh (.../ofbiz/ofbiz-7445) (revision 0) +++ applications/order/webapp/ordermgr/WEB-INF/actions/reports/getRequirementsBySupplier.bsh (.../customofbiz/trunk) (revision 17) @@ -0,0 +1,38 @@ +/* + * copyright (c) 2003-2005 The Open For Business Project - www.ofbiz.org + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @author Fred Forester ([hidden email]) + * + */ + +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityFunction; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.condition.EntityFieldValue; +import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.base.util.UtilMisc; + +dispatcher = request.getAttribute("dispatcher"); + +rfs = dispatcher.runSync("getRequirementsForSupplier",UtilMisc.toMap("partyId",null)); +List rfsList = (List)rfs.get("requirementsForSupplier"); +print(rfsList); +context.put("requirementsForSupplier",rfsList); Index: applications/order/webapp/ordermgr/WEB-INF/controller.xml =================================================================== --- applications/order/webapp/ordermgr/WEB-INF/controller.xml (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/webapp/ordermgr/WEB-INF/controller.xml (.../customofbiz/trunk) (revision 17) @@ -266,6 +266,12 @@ <response name="success" type="request-redirect" value="orderview"/> <response name="error" type="request-redirect" value="orderview"/> </request-map> + <request-map uri="quickShipInstockItems"> + <security https="true" auth="true"/> + <event type="service" invoke="quickShipInstockItems"/> + <response name="success" type="request-redirect" value="orderview"/> + <response name="error" type="request-redirect" value="orderview"/> + </request-map> <request-map uri="editOrderItems"> <security https="true" auth="true"/> <response name="success" type="view" value="editorderitems"/> @@ -869,6 +875,9 @@ <request-map uri="OrderPurchaseReportPayment.pdf"><security https="true" auth="true"/> <response name="success" type="view" value="OrderPurchaseReportPayment"/> </request-map> + <request-map uri="RequirementsBySupplier.pdf"><security https="true" auth="true"/> + <response name="success" type="view" value="RequirementsBySupplier"/> + </request-map> <request-map uri="OrderPurchaseReportProduct.pdf"><security https="true" auth="true"/> <response name="success" type="view" value="OrderPurchaseReportProduct"/> </request-map> @@ -1306,6 +1315,7 @@ <view-map name="OrderPurchaseReportOptions" type="screen" page="component://order/widget/ordermgr/ReportScreens.xml#OrderPurchaseReportOptions"/> <view-map name="OrderPurchaseReportPayment" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#OrderPurchaseReportPayment" content-type="application/pdf" encoding="none"/> + <view-map name="RequirementsBySupplier" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#RequirementsBySupplier" content-type="application/pdf" encoding="none"/> <view-map name="OrderPurchaseReportProduct" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#OrderPurchaseReportProduct" content-type="application/pdf" encoding="none"/> <view-map name="SalesByStoreReport" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#SalesByStoreReport" content-type="application/pdf" encoding="none"/> <view-map name="PurchasesByOrganizationReport" type="screenfop" page="component://order/widget/ordermgr/ReportScreens.xml#PurchasesByOrganizationReport" content-type="application/pdf" encoding="none"/> Index: applications/order/webapp/ordermgr/order/orderlist.ftl =================================================================== --- applications/order/webapp/ordermgr/order/orderlist.ftl (.../ofbiz/ofbiz-7445) (revision 17) +++ applications/order/webapp/ordermgr/order/orderlist.ftl (.../customofbiz/trunk) (revision 17) @@ -98,6 +98,9 @@ <div class="tabletext"><b>${uiLabelMap.CommonAmount}</b></div> </td> <td width="10%"> + <div class="tabletext"><b>${uiLabelMap.OrderBackOrderQuantity}</b></div> + </td> + <td width="10%"> <div class="tabletext"><b>${uiLabelMap.OrderTrackingCode}</b></div> </td> <td width="15%"> @@ -107,6 +110,9 @@ <#list orderHeaderList as orderHeader> <#assign status = orderHeader.getRelatedOneCache("StatusItem")> <#assign orh = Static["org.ofbiz.order.order.OrderReadHelper"].getHelper(orderHeader)> + <#assign backOrderQty = orh.getOrderBackorderQuantity()> + <#assign totOrderQty = orh.getTotalOrderItemsOrderedQuantity()> + <#assign totShippedQty = orh.getOrderShippedQuantity()> <#assign billToParty = orh.getBillToParty()?if_exists> <#assign billFromParty = orh.getBillFromParty()?if_exists> <#if billToParty?has_content> |
Fred,
I'll look at it as soon as possible. In the meantime, could you please sign and post to the Apache Software Foundation the following iCLA? http://www.apache.org/licenses/icla.txt It is very important for us to be sure that the new developers/contributors like you are willing to license their code with the Apache Software License 2.0. Thanks for all your work and for your patience! Jacopo Fred Forester wrote: > Jacopo, > > attached is the new patch. the patch actually contains all the work I've > done on ofbiz so far. > > quick ship in stock items (that I posted on Jira) plus the enhancements > to allow instock quantites of an item to be shipped leaving the > remaining backordered. > > the orderlist now shows totalcount/backorderedcount/shippedcount > > The Quick Lookup (LookupBulkAddProducts) on the orderenty is functional > with correct scrolling. Purcase orders will show only the products for > that supplier. added a product search form on top of the list. I will > eventually convert the dynamic view I used for this to a static one also. > > the requirements link on the purchase order shorcuts show only > requirements for that supplier. > > an ordermgr report showing all requirements by supplier name. > > there are prrobably some uilabel changes you do not want. > > again the diff is based on 7445. > > Thanx for all your help. > Fred > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Jacopo, I just printed it and signed it. I'll fax it in on Monday. Thanx for all your help Fred Jacopo Cappellato wrote: > Fred, > > I'll look at it as soon as possible. > > In the meantime, could you please sign and post to the Apache Software > Foundation the following iCLA? > > http://www.apache.org/licenses/icla.txt > > It is very important for us to be sure that the new > developers/contributors like you are willing to license their code with > the Apache Software License 2.0. > > Thanks for all your work and for your patience! > > Jacopo > > Fred Forester wrote: > >>Jacopo, >> >>attached is the new patch. the patch actually contains all the work I've >>done on ofbiz so far. >> >>quick ship in stock items (that I posted on Jira) plus the enhancements >>to allow instock quantites of an item to be shipped leaving the >>remaining backordered. >> >>the orderlist now shows totalcount/backorderedcount/shippedcount >> >>The Quick Lookup (LookupBulkAddProducts) on the orderenty is functional >>with correct scrolling. Purcase orders will show only the products for >>that supplier. added a product search form on top of the list. I will >>eventually convert the dynamic view I used for this to a static one also. >> >>the requirements link on the purchase order shorcuts show only >>requirements for that supplier. >> >>an ordermgr report showing all requirements by supplier name. >> >>there are prrobably some uilabel changes you do not want. >> >>again the diff is based on 7445. >> >>Thanx for all your help. >>Fred >> > > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |