Author: jleroux
Date: Thu Jan 29 21:56:53 2009 New Revision: 739039 URL: http://svn.apache.org/viewvc?rev=739039&view=rev Log: A patch from Leon Torres "Update UPSServices.java to pass UPS Certification Requirements" '(https://issues.apache.org/jira/browse/OFBIZ-2141) - OFBIZ-2141 Committed after review but not tested as I don't use USPS, sounds good anyway. Modified: ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Modified: ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml?rev=739039&r1=739038&r2=739039&view=diff ============================================================================== --- ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml (original) +++ ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml Thu Jan 29 21:56:53 2009 @@ -1138,6 +1138,7 @@ <field name="thirdPartyAccountNumber" type="id"></field> <field name="thirdPartyPostalCode" type="id"></field> <field name="thirdPartyCountryGeoCode" type="id"></field> + <field name="upsHighValueReport" type="blob"></field> <prim-key field="shipmentId"/> <prim-key field="shipmentRouteSegmentId"/> <relation type="one" fk-name="SHPMT_RTSEG_SHPMT" rel-entity-name="Shipment"> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=739039&r1=739038&r2=739039&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Thu Jan 29 21:56:53 2009 @@ -1011,7 +1011,7 @@ if (shipmentUpsSaveCertificationInfo) { if (labelImageBytes != null) { - String outFileName = shipmentUpsSaveCertificationPath + "/UpsShipmentLabelImage" + shipmentRouteSegment.getString("shipmentId") + "_" + shipmentRouteSegment.getString("shipmentRouteSegmentId") + "_" + shipmentPackageRouteSeg.getString("shipmentPackageSeqId") + ".gif"; + String outFileName = shipmentUpsSaveCertificationPath + "/label" + trackingNumber + ".gif"; try { FileOutputStream fileOut = new FileOutputStream(outFileName); fileOut.write(labelImageBytes); @@ -1022,7 +1022,7 @@ } } if (labelInternationalSignatureGraphicImageBytes != null) { - String outFileName = shipmentUpsSaveCertificationPath + "/UpsShipmentLabelIntlSignImage" + shipmentRouteSegment.getString("shipmentId") + "_" + shipmentRouteSegment.getString("shipmentRouteSegmentId") + "_" + shipmentPackageRouteSeg.getString("shipmentPackageSeqId") + ".gif"; + String outFileName = shipmentUpsSaveCertificationPath + "/UpsShipmentLabelIntlSignImage" + "label" + trackingNumber + ".gif"; try { FileOutputStream fileOut = new FileOutputStream(outFileName); fileOut.write(labelInternationalSignatureGraphicImageBytes); @@ -1055,6 +1055,26 @@ errorList.add("Error: No PackageResults were returned for the Package [" + shipmentPackageRouteSeg.getString("shipmentPackageSeqId") + "]"); } } + + // save the High Value Report image if it exists + Element controlLogReceiptElement = UtilXml.firstChildElement(shipmentResultsElement, "ControlLogReceipt"); + if (controlLogReceiptElement != null) { + String fileString = UtilXml.childElementValue(controlLogReceiptElement, "GraphicImage"); + String fileStringDecoded = Base64.base64Decode(fileString); + if (fileStringDecoded != null) { + shipmentRouteSegment.set("upsHighValueReport", fileStringDecoded); + shipmentRouteSegment.store(); + String outFileName = shipmentUpsSaveCertificationPath + "/HighValueReport" + shipmentRouteSegment.getString("shipmentId") + "_" + shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".html"; + try { + FileOutputStream fileOut = new FileOutputStream(outFileName); + fileOut.write(fileStringDecoded.getBytes()); + fileOut.flush(); + fileOut.close(); + } catch (IOException e) { + Debug.log(e, "Could not save UPS High Value Report data: [[[" + fileStringDecoded + "]]] to file: " + outFileName, module); + } + } + } // -=-=-=- Okay, now done with that, just return any extra info... StringBuilder successString = new StringBuilder("The UPS ShipmentAccept succeeded"); |
Free forum by Nabble | Edit this page |