details: https://code.openbravo.com/erp/devel/pi/rev/1e8894508f46 changeset: 14142:1e8894508f46 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Oct 27 16:57:46 2011 +0200 summary: Fixes issue 18586: Extend grid linking to include filter settings
details: https://code.openbravo.com/erp/devel/pi/rev/3da1eced48b2 changeset: 14143:3da1eced48b2 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Oct 27 19:44:08 2011 +0200 summary: Fixes issue 18913 New-in-grid + save fails in Sales Order if optional details: https://code.openbravo.com/erp/devel/pi/rev/bbf8582fbc5d changeset: 14144:bbf8582fbc5d user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Oct 27 19:45:57 2011 +0200 summary: Fixes issue 18889 Add an excel mode to the XML webservices details: https://code.openbravo.com/erp/devel/pi/rev/086ba370d09e changeset: 14145:086ba370d09e user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Oct 27 20:33:21 2011 +0200 summary: Fixes issue 18586: Extend grid linking to include filter settings details: https://code.openbravo.com/erp/devel/pi/rev/490e626bad98 changeset: 14146:490e626bad98 user: Martin Taal <martin.taal <at> openbravo.com> date: Thu Oct 27 20:34:21 2011 +0200 summary: Fixes issue 18889: Add an excel mode to the XML webservices Fixes issue 18913: New-in-grid + save fails in Sales Orde diffstat: modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml | 3 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js | 22 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js | 28 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js | 10 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js | 6 +- modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java | 5 +- src-db/database/model/functions/M_INOUT_CREATE.xml | 8 +- src/org/openbravo/dal/xml/EntityExcelXMLConverter.java | 247 ++++++++++ src/org/openbravo/service/rest/DalWebService.java | 30 +- 9 files changed, 329 insertions(+), 30 deletions(-) diffs (truncated from 532 to 300 lines): diff -r 14a8bd01a613 -r 490e626bad98 modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml Thu Oct 27 13:28:47 2011 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml Thu Oct 27 20:34:21 2011 +0200 @@ -3066,8 +3066,7 @@ <!--82EFB8E4045119C9E040007F01003778--> <HELP><![CDATA[Print Detailed]]></HELP> <!--82EFB8E4045119C9E040007F01003778--> <COLUMNNAME><![CDATA[Printdetailed]]></COLUMNNAME> <!--82EFB8E4045119C9E040007F01003778--> <AD_TABLE_ID><![CDATA[0DFF5BACFB964FDABAA5042C8809C813]]></AD_TABLE_ID> -<!--82EFB8E4045119C9E040007F01003778--> <AD_REFERENCE_ID><![CDATA[FF8080813123BF670131241C2BB30012]]></AD_REFERENCE_ID> -<!--82EFB8E4045119C9E040007F01003778--> <AD_REFERENCE_VALUE_ID><![CDATA[FF80808133186ADD01331B465E32002D]]></AD_REFERENCE_VALUE_ID> +<!--82EFB8E4045119C9E040007F01003778--> <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID> <!--82EFB8E4045119C9E040007F01003778--> <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH> <!--82EFB8E4045119C9E040007F01003778--> <ISKEY><![CDATA[N]]></ISKEY> <!--82EFB8E4045119C9E040007F01003778--> <ISPARENT><![CDATA[N]]></ISPARENT> diff -r 14a8bd01a613 -r 490e626bad98 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js Thu Oct 27 13:28:47 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js Thu Oct 27 20:34:21 2011 +0200 @@ -290,6 +290,25 @@ hasAdvancedCriteria: function() { return this.singleDateMode || (this.rangeItem !== null && this.rangeItem.hasAdvancedCriteria()); }, + + setCriterion: function(criterion) { + if (!criterion) { + return; + } + + if (criterion.operator === 'equals') { + this.setSingleDateValue(criterion.value); + return; + } + + if (this.rangeItem) { + this.rangeItem.setCriterion(criterion); + this.singleDateMode = false; + this.singleDateValue = null; + this.rangeItemValue = this.rangeItem.getValue(); + this.displayValue(); + } + }, getCriterion: function() { if (this.singleDateValue) { @@ -303,9 +322,6 @@ return criteria; }, - setCriterion: function(criterion) { - }, - canEditCriterion: function(criterion) { if (this.singleDateMode && criterion.fieldName === this.name) { return true; diff -r 14a8bd01a613 -r 490e626bad98 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js Thu Oct 27 13:28:47 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js Thu Oct 27 20:34:21 2011 +0200 @@ -452,13 +452,24 @@ if (localState.noFilterClause) { this.filterClause = null; this.view.messageBar.hide(); - } - if (localState.filter) { + } + + // and no additional filter clauses passed in + if (localState.filter && + this.view.tabId !== this.view.standardWindow.additionalCriteriaTabId && + this.view.tabId !== this.view.standardWindow.additionalFilterTabId) { this.delayCall('storeViewFilter', [localState.filter], 100, this); } }, - storeViewFilter: function(filter) { + storeViewFilter: function(filter, counter) { + // wait until the filter editor is there, but not indefinitely + if (!this.getFilterEditor() || !this.getFilterEditor().getEditForm()) { + if (!counter || counter < 1000) { + this.delayCall('storeViewFilter', [filter, (counter ? ++counter : 1)], 100, this); + } + return; + } var i, length; this.setCriteria(filter); @@ -471,10 +482,12 @@ this.filterEditor.storeUpdatedEditorValue(false, i); } } + + this.checkShowFilterFunnelIcon(filter); }, setView: function(view){ - var dataPageSizeaux, length, i; + var dataPageSizeaux, length, i, crit; this.view = view; this.editFormDefaults.view = view; @@ -495,7 +508,12 @@ } } //// Ends.. - + if (this.view.tabId === this.view.standardWindow.additionalCriteriaTabId && + this.view.standardWindow.additionalCriteria) { + crit = isc.JSON.decode(unescape(this.view.standardWindow.additionalCriteria)); + this.delayCall('fetchData', [crit], 100, this); + delete this.view.standardWindow.additionalCriteria; + } // if there is no autoexpand field then just divide the space if (!this.getAutoFitExpandField()) { length = this.fields.length; diff -r 14a8bd01a613 -r 490e626bad98 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Thu Oct 27 13:28:47 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Thu Oct 27 20:34:21 2011 +0200 @@ -498,7 +498,7 @@ }, getDirectLinkUrl: function() { - var url = window.location.href; + var url = window.location.href, crit; var qIndex = url.indexOf('?'); var dIndex = url.indexOf('#'); var index = -1; @@ -523,7 +523,13 @@ } else if (this.viewGrid.getSelectedRecords() && this.viewGrid.getSelectedRecords().length === 1) { url = url + '&recordId=' + this.viewGrid.getSelectedRecord().id; } - + if (!this.isShowingForm) { + crit = this.viewGrid.getCriteria(); + if (crit && crit.criteria && crit.criteria.length > 0) { + url = url + '&criteria=' + escape(isc.JSON.encode(crit, {prettyPrint: false, dateFormat: 'dateConstructor'})); + } + } + return url; }, diff -r 14a8bd01a613 -r 490e626bad98 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js Thu Oct 27 13:28:47 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js Thu Oct 27 20:34:21 2011 +0200 @@ -312,7 +312,11 @@ //URL example:http://localhost:8080/openbravo/?tabId=186&filterClause=e.businessPartner.searchKey%3D%27mcgiver%27&replaceDefaultFilter=true& if (urlParams.filterClause) { view.additionalFilterTabId = data.tabId; - view.additionalFilterClause = urlParams.filterClause; + view.additionalFilterClause = urlParams.filterClause; + } + if (urlParams.criteria) { + view.additionalCriteriaTabId = data.tabId; + view.additionalCriteria = urlParams.criteria; } if (urlParams.replaceDefaultFilter) { diff -r 14a8bd01a613 -r 490e626bad98 modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java --- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java Thu Oct 27 13:28:47 2011 +0200 +++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java Thu Oct 27 20:34:21 2011 +0200 @@ -146,6 +146,9 @@ try { if (property.getDomainType() instanceof TimestampDomainType) { String strValue = (String) value; + if (strValue.equals("null")) { + return null; + } // there are cases that also the date part is sent in, get rid of it if (strValue.indexOf("T") != -1) { final int index = strValue.indexOf("T"); @@ -355,7 +358,7 @@ // just use a random entity to get the name of the updated property if (jsonObject.has(Organization.PROPERTY_UPDATED) && obObject instanceof Traceable) { final String jsonDateStr = jsonObject.getString(Organization.PROPERTY_UPDATED); - if (jsonDateStr != null) { + if (jsonDateStr != null && !jsonDateStr.equals("null")) { try { final String repairedString = JsonUtils.convertFromXSDToJavaFormat(jsonDateStr); final Date jsonDate = new Timestamp(xmlDateTimeFormat.parse(repairedString).getTime()); diff -r 14a8bd01a613 -r 490e626bad98 src-db/database/model/functions/M_INOUT_CREATE.xml --- a/src-db/database/model/functions/M_INOUT_CREATE.xml Thu Oct 27 13:28:47 2011 +0200 +++ b/src-db/database/model/functions/M_INOUT_CREATE.xml Thu Oct 27 20:34:21 2011 +0200 @@ -60,7 +60,6 @@ v_ResultStr VARCHAR2(2000):=''; v_result NUMBER(1):=1; v_PostResult NUMBER; - v_logMessageLength NUMBER:= 2000; v_logLines NUMBER:=0; v_isWholeLog BOOLEAN := true; v_Message VARCHAR2(2000):=''; @@ -592,7 +591,7 @@ v_order_delivered_count := v_order_delivered_count +1; result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ' @InoutDocumentno@ ' || v_DocumentNo || ': @ShipmentSuccess@.' ; END IF; - IF (LENGTH(v_Message || result_String || '<br><br>') <= v_logMessageLength + 3 ) THEN + IF (LENGTH(v_Message || result_String || '<br><br>') <= 1800 ) THEN v_Message:=v_Message || result_String || '<br><br>'; v_logLines := v_logLines + 1; ELSE @@ -603,7 +602,6 @@ v_hasPartial := false; IF(NOT Next_Order) THEN IF(v_lines=0) THEN - DBMS_OUTPUT.PUT_LINE('v_lines!!!!!!!!!!!!!!!!!' || v_lines) ; DELETE FROM M_INOUTLINE WHERE M_INOUT_ID = p_InOut_ID; DELETE FROM M_INOUT @@ -820,8 +818,8 @@ --<<FINISH_PROCESS>> IF(p_PInstance_ID IS NOT NULL) THEN -- Update AD_PInstance - IF (v_isWholeLog <> true) THEN - v_Message := 'First ' || v_logLines || ' result(s):' || '<br>' || v_Message; + IF (NOT v_isWholeLog) THEN + v_Message := 'First ' || v_logLines || ' result(s):' || '<br>' || v_Message || '...'; END IF; DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ; diff -r 14a8bd01a613 -r 490e626bad98 src/org/openbravo/dal/xml/EntityExcelXMLConverter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/openbravo/dal/xml/EntityExcelXMLConverter.java Thu Oct 27 20:34:21 2011 +0200 @@ -0,0 +1,247 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.1 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo SLU + * All portions are Copyright (C) 2011 Openbravo SLU + * All Rights Reserved. + * Contributor(s): ______________________________________. + ************************************************************************ + */ + +package org.openbravo.dal.xml; + +import java.io.Writer; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; + +import org.apache.log4j.Logger; +import org.openbravo.base.model.Entity; +import org.openbravo.base.model.Property; +import org.openbravo.base.model.domaintype.EnumerateDomainType; +import org.openbravo.base.model.domaintype.PrimitiveDomainType; +import org.openbravo.base.provider.OBNotSingleton; +import org.openbravo.base.provider.OBProvider; +import org.openbravo.base.session.OBPropertiesProvider; +import org.openbravo.base.structure.BaseOBObject; +import org.openbravo.dal.core.DalUtil; +import org.openbravo.dal.core.OBContext; +import org.openbravo.dal.service.OBDal; +import org.openbravo.model.ad.domain.ListTrl; +import org.openbravo.model.ad.domain.Reference; +import org.openbravo.model.ad.utility.TreeNode; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; + +/** + * Converts one or more business objects to a XML presentation which can easily be read into Excel. + * + * @author mtaal + */ +public class EntityExcelXMLConverter implements OBNotSingleton { + private static final Logger log = Logger.getLogger(EntityExcelXMLConverter.class); + + public static EntityExcelXMLConverter newInstance() { + return OBProvider.getInstance().get(EntityExcelXMLConverter.class); + } + + private final Map<String, String> listRefTranslations = new HashMap<String, String>(); + + private TransformerHandler xmlHandler; + private Writer output; + + private DateFormat dateFormat; + private DateFormat dateTimeFormat; + + // initialize the sax handlers + private void initialize() throws Exception { + listRefTranslations.clear(); + + String dateFormatStr = OBPropertiesProvider.getInstance().getOpenbravoProperties() + .getProperty("dateFormat.java"); + dateFormatStr = dateFormatStr.replace("MM", "M"); + dateFormatStr = dateFormatStr.replace("dd", "d"); + ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
