Administrator
|
Thanks Bilgin for the i18n reminder :o)
Jacques From: <[hidden email]> > Author: bibryam > Date: Mon Aug 18 06:30:35 2008 > New Revision: 686748 > > URL: http://svn.apache.org/viewvc?rev=686748&view=rev > Log: > Add possibility for entering comments for configurable product options. The comments are attached to production runs as notes. > Thanks to Jacopo and BJ for their comments. > Internationalization note: this commit contains new UI labels. > > Modified: > ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml > ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java > ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy > ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml > ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml > ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl > ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java > ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java > > Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml (original) > +++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml Mon Aug 18 06:30:35 2008 > @@ -1379,6 +1379,9 @@ > <value > xml:lang="th">รายà¸à¸²à¸£à¸à¸à¸à¸à¸²à¸£à¸à¸¥à¸´à¸à¸ªà¸´à¸à¸à¹à¸²à¸à¸²à¸à¸ªà¸´à¸à¸à¸£à¸±à¸à¸¢à¹à¹à¸¡à¹à¸à¸²à¸§à¸£</value> > <value xml:lang="zh">ç产è¿è¡åºå®èµäº§å表</value> > </property> > + <property key="ManufacturingListOfProductionRunNotes"> > + <value xml:lang="en">List Of Production Run Notes</value> > + </property> > <property key="ManufacturingListOfProductionRunRoutingTasks"> > <value xml:lang="en">Tasks</value> > <value xml:lang="es">Lista de tareas de la corrida de producción</value> > > Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) > +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Mon Aug 18 06:30:35 > 2008 > @@ -2196,6 +2196,25 @@ > componentQuantity = new Double(totalQuantity.doubleValue() + componentQuantity.doubleValue()); > } > components.put(componentProductId, componentQuantity); > + > + // create production run notes from comments > + String comments = co.getComments(); > + if (UtilValidate.isNotEmpty(comments)) { > + resultService.clear(); > + serviceContext.clear(); > + serviceContext.put("workEffortId", productionRunId); > + serviceContext.put("internalNote", "Y"); > + serviceContext.put("noteInfo", comments); > + serviceContext.put("noteName", co.getDescription()); > + serviceContext.put("userLogin", userLogin); > + serviceContext.put("noteParty", userLogin.getString("partyId")); > + try { > + resultService = dispatcher.runSync("createWorkEffortNote", serviceContext); > + } catch (GenericServiceException e) { > + Debug.logWarning(e.getMessage(), module); > + return ServiceUtil.returnError(e.getMessage()); > + } > + } > } > } > > > Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy (original) > +++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy Mon Aug 18 > 06:30:35 2008 > @@ -63,5 +63,11 @@ > context.quantity = productionRun.getQuantity(); // this is useful to compute the total estimates runtime in the form > // Product component/parts list > context.productionRunComponents = productionRun.getProductionRunComponents();; > + > + // Find all the notes linked to this production run. > + productionRunNoteData = delegator.findByAnd("WorkEffortNoteAndData", [workEffortId : productionRunId]); > + if (productionRunNoteData) { > + context.productionRunNoteData = productionRunNoteData; > + } > } > } > > Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml (original) > +++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml Mon Aug 18 06:30:35 2008 > @@ -520,6 +520,15 @@ > <display-entity entity-name="StatusItem" /> > </field> > </form> > + <form name="ListProductionRunNotes" type="list" title="" list-name="productionRunNoteData" > + odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> > + <auto-fields-entity entity-name="WorkEffortNoteAndData" default-field-type="display" /> > + <field name="workEffortId"><hidden/></field> > + <field name="internalNote"><hidden/></field> > + <field name="noteId"><hidden/></field> > + <field name="noteParty"><hidden/></field> > + <field name="noteDateTime"><hidden/></field> > + </form> > <form name="EditProductionRunTaskFixedAsset" type="single" target="EditProductionRun" title="" > default-map-name="fixedAssetData" > header-row-style="header-row" default-table-style="basic-table"> > <alt-target use-when="declarationScreen.equals("Y")" target="ProductionRunDeclaration" /> > > Modified: ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml (original) > +++ ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml Mon Aug 18 06:30:35 2008 > @@ -177,7 +177,21 @@ > </widgets> > </section> > </container> > - </container> > + </container> > + <container style="screenlet"> > + <container style="screenlet-title-bar"> > + <container style="h3"> > + <label text="${uiLabelMap.ManufacturingListOfProductionRunNotes}"/> > + </container> > + </container> > + <container style="screenlet-body"> > + <section> > + <widgets> > + <include-form name="ListProductionRunNotes" > location="component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml"/> > + </widgets> > + </section> > + </container> > + </container> > </decorator-section> > </decorator-screen> > </widgets> > > Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl (original) > +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl Mon Aug 18 06:30:35 2008 > @@ -140,7 +140,13 @@ > }); > > function getConfigDetails(event) { > - new Ajax.Request('/ordermgr/control/getConfigDetailsEvent',{parameters: $('configFormId').serialize(), requestHeaders: > {Accept: 'application/json'}, > + var element = Event.element(event); > + if (element.identify().startsWith('comments_')) { > + // don't update the price for comment change > + return; > + } > + > + new Ajax.Request('/ordermgr/control/getConfigDetailsEvent',{parameters: $('configFormId').serialize(), requestHeaders: > {Accept: 'application/json'}, > > onSuccess: function(transport){ > var data = transport.responseText.evalJSON(true); > @@ -477,8 +483,11 @@ > <#if question.isStandard()> > <#-- Standard item: all the options are always included --> > <#assign options = question.options> > + <#assign optionCounter = 0> > <#list options as option> > <div>${option.description} <#if !option.isAvailable()> (*)</#if></div> > + <div>${uiLabelMap.CommonComments}: <input type='text' name='comments_${counter}_${optionCounter}' > id='comments_${counter}_${optionCounter}' value='${option.comments?if_exists}' ></div> > + <#assign optionCounter = optionCounter + 1> > </#list> > <#else> > <#if question.isSingleChoice()> > @@ -495,6 +504,7 @@ > <#if !question.isMandatory()> > <div><input type="radio" name='${counter}' value='<#if !question.isSelected()>checked</#if>'> No option</div> > </#if> > + <#assign optionComment = ""> > <#assign optionCounter = 0> > <#list options as option> > <#assign componentCounter = 0> > @@ -503,6 +513,9 @@ > <#else> > <#assign shownPrice = option.price> > </#if> > + <#if option.isSelected()> > + <#assign optionComment = option.getComments()?if_exists> > + </#if> > <#-- Render virtual compoennts --> > <#if option.hasVirtualComponent()> > <div > > @@ -530,6 +543,7 @@ > </#if> > <#assign optionCounter = optionCounter + 1> > </#list> > + <div>${uiLabelMap.CommonComments}: <input type="text" name='comments_${counter}_0' id='comments_${counter}_0' > value='${optionComment?if_exists}' /></div> > <#else> > <#-- And this is the select box implementation --> > <select name='${counter}'> > @@ -538,6 +552,7 @@ > </#if> > <#assign options = question.options> > <#assign optionCounter = 0> > + <#assign optionComment = ""> > <#list options as option> > <#if showOffsetPrice?exists && "Y" == showOffsetPrice> > <#assign shownPrice = option.price - selectedPrice> > @@ -545,6 +560,7 @@ > <#assign shownPrice = option.price> > </#if> > <#if option.isSelected()> > + <#assign optionComment = option.getComments()> > <#assign optionCounter = optionCounter + 1> > </#if> > <option value='${optionCounter}' <#if option.isSelected()>selected</#if>> > @@ -556,6 +572,7 @@ > <#assign optionCounter = optionCounter + 1> > </#list> > </select> > + <div>${uiLabelMap.CommonComments}: <input type="text" name='comments_${counter}_0' id='comments_${counter}_0' > value='${optionComment?if_exists}' /></div> > </#if> > <#else> > <#-- Multi choice question --> > @@ -585,13 +602,16 @@ > ${option.description} +<@ofbizCurrency amount=option.price isoCode=price.currencyUsed/><#if > !option.isAvailable()> (*)</#if> > </div> > </#if> > + <div>${uiLabelMap.CommonComments}: <input type="text" name='comments_${counter}_${optionCounter}' > id='comments_${counter}_${optionCounter}' value='${option.comments?if_exists}'></div> > <#assign optionCounter = optionCounter + 1> > </#list> > </#if> > </#if> > </td> > </tr> > - <tr><td><hr/></td></tr> > + <#if question_has_next> > + <tr><td><hr/></td></tr> > + </#if> > <#assign counter = counter + 1> > </#list> > </table> > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java (original) > +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java Mon Aug 18 06:30:35 2008 > @@ -87,13 +87,41 @@ > for (int k = 0; k < numOfQuestions; k++) { > String[] opts = request.getParameterValues("" + k); > if (opts == null) { > + > + // check for standard item comments > + ProductConfigWrapper.ConfigItem question = (ProductConfigWrapper.ConfigItem) configWrapper.getQuestions().get(k); > + if (question.isStandard()) { > + int i = 0; > + while (i <= (question.getOptions().size() -1)) { > + String comments = request.getParameter("comments_" + k + "_" + i); > + if (UtilValidate.isNotEmpty(comments)) { > + try { > + configWrapper.setSelected(k, i, comments); > + } catch(Exception e) { > + Debug.logWarning(e.getMessage(), module); > + } > + } > + i++; > + } > + } > continue; > } > for (int h = 0; h < opts.length; h++) { > int cnt = -1; > try { > cnt = Integer.parseInt(opts[h]); > + String comments = null; > + ProductConfigWrapper.ConfigItem question = (ProductConfigWrapper.ConfigItem) > configWrapper.getQuestions().get(k); > + if (question.isSingleChoice()) { > + comments = request.getParameter("comments_" + k + "_" + "0"); > + } else { > + comments = request.getParameter("comments_" + k + "_" + cnt); > + } > + > + configWrapper.setSelected(k, cnt, comments); > ProductConfigWrapper.ConfigOption option = configWrapper.getItemOtion(k, cnt); > + > + // set selected variant products > if (UtilValidate.isNotEmpty(option) && (option.hasVirtualComponent())) { > List components = option.getComponents(); > int variantIndex = 0; > @@ -105,7 +133,8 @@ > if (UtilValidate.isEmpty(selectedProdcutId)) { > Debug.logWarning("ERROR: Request param [" + productParamName + "] not found!", module); > } else { > - // handle both types of virtual variant methods > + > + // handle also feature tree virtual variant methods > if (ProductWorker.isVirtual((GenericDelegator)request.getAttribute("delegator"), > selectedProdcutId)) { > if > ("VV_FEATURETREE".equals(ProductWorker.getProductvirtualVariantMethod((GenericDelegator)request.getAttribute("delegator"), > selectedProdcutId))) { > // get the selected features > @@ -136,10 +165,7 @@ > variantIndex ++; > } > } > - } else { > - configWrapper.setSelected(k, cnt); > - } > - > + } > } catch(Exception e) { > Debug.logWarning(e.getMessage(), module); > } > @@ -190,9 +216,12 @@ > Iterator selOpIt = selectedOptions.iterator(); > while (selOpIt.hasNext()) { > ConfigOption oneOption = (ConfigOption)selOpIt.next(); > - String configOptionId = oneOption.configOption.getString("configOptionId"); > + String configOptionId = oneOption.configOption.getString("configOptionId"); > if (productConfigConfig.getString("configOptionId").equals(configOptionId)) { > - configsToCheck.add(productConfigConfig); > + String comments = oneOption.getComments() != null ? oneOption.getComments() : ""; > + if ((UtilValidate.isEmpty(comments) && > UtilValidate.isEmpty(productConfigConfig.getString("description"))) || > comments.equals(productConfigConfig.getString("description"))) { > + configsToCheck.add(productConfigConfig); > + } > } > } > } > @@ -315,11 +344,13 @@ > List toBeStored = new LinkedList(); > ConfigOption oneOption = (ConfigOption)selOpIt.next(); > String configOptionId = oneOption.configOption.getString("configOptionId"); > + String description = oneOption.getComments(); > GenericValue productConfigConfig = delegator.makeValue("ProductConfigConfig"); > productConfigConfig.put("configId", configId); > productConfigConfig.put("configItemId", configItemId); > productConfigConfig.put("sequenceNum", sequenceNum); > productConfigConfig.put("configOptionId", configOptionId); > + productConfigConfig.put("description", description); > toBeStored.add(productConfigConfig); > > if (oneOption.hasVirtualComponent()) { > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java?rev=686748&r1=686747&r2=686748&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java (original) > +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java Mon Aug 18 06:30:35 2008 > @@ -145,13 +145,14 @@ > String configItemId = pcc.getString("configItemId"); > String configOptionId = pcc.getString("configOptionId"); > Long sequenceNum = pcc.getLong("sequenceNum"); > - this.setSelected(configItemId, sequenceNum, configOptionId); > + String comments = pcc.getString("description"); > + this.setSelected(configItemId, sequenceNum, configOptionId, comments); > } > } > } > } > > - public void setSelected(String configItemId, Long sequenceNum, String configOptionId) throws Exception { > + public void setSelected(String configItemId, Long sequenceNum, String configOptionId, String comments) throws Exception { > for (int i = 0; i < questions.size(); i++) { > ConfigItem ci = (ConfigItem)questions.get(i); > if (ci.configItemAssoc.getString("configItemId").equals(configItemId) && > ci.configItemAssoc.getLong("sequenceNum").equals(sequenceNum)) { > @@ -159,7 +160,7 @@ > for (int j = 0; j < avalOptions.size(); j++) { > ConfigOption oneOption = (ConfigOption)avalOptions.get(j); > if (oneOption.configOption.getString("configOptionId").equals(configOptionId)) { > - setSelected(i, j); > + setSelected(i, j, comments); > break; > } > } > @@ -175,6 +176,7 @@ > for (int j = 0; j < options.size(); j++) { > ConfigOption co = (ConfigOption)options.get(j); > co.setSelected(false); > + co.setComments(null); > } > } > } > @@ -233,13 +235,14 @@ > return product; > } > > - public void setSelected(int question, int option) throws Exception { > + public void setSelected(int question, int option, String comments) throws Exception { > ConfigItem ci = (ConfigItem)questions.get(question); > List avalOptions = ci.getOptions(); > if (ci.isSingleChoice()) { > for (int j = 0; j < avalOptions.size(); j++) { > ConfigOption oneOption = (ConfigOption)avalOptions.get(j); > oneOption.setSelected(false); > + oneOption.setComments(null); > } > } > ConfigOption theOption = null; > @@ -248,11 +251,11 @@ > } > if (theOption != null) { > theOption.setSelected(true); > + theOption.setComments(comments); > } > } > > public void setSelected(int question, int option, int component, String componentOption) throws Exception { > - setSelected(question, option); > // set variant products > ConfigOption theOption = getItemOtion(question, option); > List components = theOption.getComponents(); > @@ -527,6 +530,7 @@ > boolean selected = false; > boolean available = true; > ConfigItem parentConfigItem = null; > + String comments = null; // comments for production run entered during ordering > > public ConfigOption(GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue option, ConfigItem configItem, > String catalogId, String webSiteId, String currencyUomId, GenericValue autoUserLogin) throws Exception { > configOption = option; > @@ -572,6 +576,7 @@ > optionPrice = co.optionPrice; > available = co.available; > selected = co.selected; > + comments = co.getComments(); > } > > public void recalculateOptionPrice(ProductConfigWrapper pcw) throws Exception { > @@ -621,6 +626,14 @@ > return configOption.getString("configOptionId"); > } > > + public String getComments() { > + return comments; > + } > + > + public void setComments(String comments) { > + this.comments = comments; > + } > + > public double getPrice() { > return optionPrice; > } > > |
Free forum by Nabble | Edit this page |