[jira] Created: (OFBIZ-203) Freemarker postal address formatter macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
Freemarker postal address formatter macro
-----------------------------------------

                 Key: OFBIZ-203
                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
             Project: OFBiz (The Open for Business Project)
          Issue Type: New Feature
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Leon Torres
            Priority: Minor
         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl

Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.

I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12432625 ]
           
Leon Torres commented on OFBIZ-203:
-----------------------------------

Apply the ofbizPostalAddress.patch to framework/webapp/.

I'd like to note futher that this feature can be backported to older versions with ease.  I think that the ofbiz specific freemarker macros should have their own package or build area.

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434238 ]
           
Si Chen commented on OFBIZ-203:
-------------------------------

Hi everybody -

I think this would be very good to re-factor all the FTL code found throughout OFBiz right now for rendering addresses, especially since much of the existing code does not handle things like using country and province abbreviation codes instead of just geoId, etc.  If there are no objections, we'd like to commit this and then over time re-factor the existing code to use this new ofbizPostalAddress transform.

Si

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434243 ]
           
Jacopo Cappellato commented on OFBIZ-203:
-----------------------------------------

I vote for it (even if I've not reviewed the code).
Just one comment: framework/webapp is a lower level component than the party component (where the PostalAddress entity is defined) so we should probably put there these artifacts.



> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434244 ]
           
David E. Jones commented on OFBIZ-203:
--------------------------------------

This is interesting. I'm guessing that you're asking for review because there is something about it you're not comfortable with...

There are a few things I can see that are small issues with it as I read through the patch, but the one big issue I see is that it's a bit of a pain to change and perhaps a bit of overkill as a solution to this problem. The easiest way to have a common address formatting mechanism would be to drop a screen definition into the common component that renders an FTL file that could support all of the formatting now done in the Java code in this patch.

I can see that this must have required a fair amount of work, and that's exactly my concern. For those wanting different formatting it is quite a bit to dig through and requires a larger skill set than would be required to change an FTL file that does common formatting.

Those are my thoughts on it... I'd really rather hear the thoughts of other OFBiz users and committers though...

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434248 ]
           
David E. Jones commented on OFBIZ-203:
--------------------------------------

Good point about the component Jacopo. After reading that I realized that in my comments I mis-wrote saying a screen/template could go in the common component, such a thing really should go in the party component.

This patch working mostly as-is should be the same way, ie all in the party component. Now that we have nearly eliminated dependencies from the framework to the applications this would be a big step backwards in that ongoing effort.

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434275 ]
           
Leon Torres commented on OFBIZ-203:
-----------------------------------

In response to:  "I can see that this must have required a fair amount of work, and that's exactly my concern."

Well, if you look at the capabilities of the formatter, you'll note that it only takes one format method to generate all kinds of output:  text-only, html, as a list, inline, whatever.  It uses simple, straightforward functions to abstract out the format details.   This allows us to easily add more format modes without requiring users to re-write their formatters.  For instance, if we want to add XSL:FO capability, we only need to insert this capabiility into AddressFormatter and all the custom AddressFormatter classes will automagically support it.

Replicating this ability in FTL is impractical, given that it would require tons of conditions, hard to debug situations with certain formats (text mode) and so on.  For those wanting different formatting, the increase in complexity and verbosity using this approach requires a larger skill set than would be required to write or rewrite a simple Java method.  

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434279 ]
           
Leon Torres commented on OFBIZ-203:
-----------------------------------

I recommend giving the ftl and bsh files a shot to see what output it can generate.  It's pretty neat the way it currently works and probably needs some API documentation for those wishing to use it.

I guess another benefit of a java method formatter is speed.  The intent was to support large lists of address in inline mode.  We need it for display purposes and maybe dropdown lists.  (Using HTML with CSS to display UL lists as inline slows things down a lot.)

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434332 ]
           
David E. Jones commented on OFBIZ-203:
--------------------------------------

I'm not going to try to convince you of this Leon, and what I was trying to express is that while I have objections, your job is not to convince me.

My guess is that the reaction of OFBiz users who are customizing templates that have this transform in them will be to first figure out what it is doing, then mutter for a few minutes as they comment it out and drop in some quick HTML tags to format it the way they want. I say this because this feature is a complex solution to a not so complex problem. We've had enough push back for complex solutions to more complex problems, like the form widget, and given that we have FTL templates so that people can easily customize them, this goes a bit in the other direction.

I have no problem with this going in if:

1. it is moved to the party component to resolve the framework dependency discussed
2. we get some positive feedback from OFBiz users, which you can solicit on the mailing list and just point people to this issue

-David


> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434342 ]
           
Leon Torres commented on OFBIZ-203:
-----------------------------------

Hi David,  I wanted only to present counterarguments for the benefit of other readers.  :-)

I'll post to the list about my approach after I review for the above concerns.  However, I wish to address the complexity argument above.

Presently, the supported features of this macro are,

1.  Format according to country postal formats
2.  Output in HTML or text.
3.  Easily support any future output modes (XSL:FO).
4.  For formats that need it, offer an inline option (text and XSL:FO, HTML can use CSS)
5.  As a bonus, print the country name on the last line if the address' country does not match the user's country locale

If a user wanted to support France, he'd just copy one of the existing AddressFormatter classes and tweak it a little. There's really nothing much going on in them.  The present examples for ENGL, USA and DEU span nearly all possible use cases. If I then write the rules to generate XSL:FO output, none of the existing formatters need to be updated!  How neat is that?  :-)

I'd also like to point out this approach is no different from @ofbizCurrency, which uses an external API to handle the locale specific formatting.  The only difference is the API for formatting addresses is homebrew.

Replicating all this in FTL would be challenging, although I would welcome any suggestions on how it would work.

Again, for people interested in this, I would recommend looking at the test files.  Add some German, British and French postal addresses and see what happens. :-)

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Daniel Kunkel
Vote +1  (with the caveat that I haven't actually tried the patch)

We, and our postman who doesn't understand the current 3 letter codes
that OFBiz normally uses would welcome an improved address generator.

Thanks for working on this.



On Tue, 2006-09-12 at 19:04 -0700, Leon Torres (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434342 ]
>            
> Leon Torres commented on OFBIZ-203:
> -----------------------------------
>
> Hi David,  I wanted only to present counterarguments for the benefit of other readers.  :-)
>
> I'll post to the list about my approach after I review for the above concerns.  However, I wish to address the complexity argument above.
>
> Presently, the supported features of this macro are,
>
> 1.  Format according to country postal formats
> 2.  Output in HTML or text.
> 3.  Easily support any future output modes (XSL:FO).
> 4.  For formats that need it, offer an inline option (text and XSL:FO, HTML can use CSS)
> 5.  As a bonus, print the country name on the last line if the address' country does not match the user's country locale
>
> If a user wanted to support France, he'd just copy one of the existing AddressFormatter classes and tweak it a little. There's really nothing much going on in them.  The present examples for ENGL, USA and DEU span nearly all possible use cases. If I then write the rules to generate XSL:FO output, none of the existing formatters need to be updated!  How neat is that?  :-)
>
> I'd also like to point out this approach is no different from @ofbizCurrency, which uses an external API to handle the locale specific formatting.  The only difference is the API for formatting addresses is homebrew.
>
> Replicating all this in FTL would be challenging, although I would welcome any suggestions on how it would work.
>
> Again, for people interested in this, I would recommend looking at the test files.  Add some German, British and French postal addresses and see what happens. :-)
>
> > Freemarker postal address formatter macro
> > -----------------------------------------
> >
> >                 Key: OFBIZ-203
> >                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
> >             Project: OFBiz (The Open for Business Project)
> >          Issue Type: New Feature
> >          Components: framework
> >    Affects Versions: SVN trunk
> >            Reporter: Leon Torres
> >            Priority: Minor
> >         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
> >
> >
> > Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> > I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.
>

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434981 ]
           
John Martin commented on OFBIZ-203:
-----------------------------------

FYI - here is a good reference to properly formatted international addresses:

http://www.bitboost.com/ref/international-address-formats.html

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12435163 ]
           
Si Chen commented on OFBIZ-203:
-------------------------------

I thought about this further and think these are the issues:

1.  We have FTL/HTML code all over the place for postal addresses, and they're starting to diverge and become a mess.  Some use the Geo.abbreviationName, some use Geo._geoId.  Some are for US formats, some are for European formats.  It would be nicer to standardize them all.

2.  David's suggestion of using screen widget + FTL is simpler than the FTL transform macro of Leon's, and at first I thought it was the better idea.  However, it suffers from two issues.  One is that screen widget requires more overhead, and on a page with lots of addresses, it could become a perform problem.  The second issue is that we need postal addresses for HTML, XSL:FO, and plain text, plus all the different national formats, it could end up being a lot of little FTL files.

3.  Of course, using a transform like <@ofbizPostalAddress> does make it less modifiable, in the same way that <@ofbizCurrency> makes it less modifiable should you want to change or using the form-widget makes it less flexible to change the format of a form.  The reverse is that these tools make writing postal addresses, currency numbers, or forms more efficient, standardized, and streamlined.  (The same can be said of the icu4j library for currencies and Java DateFormat class)  After some thinking, I feel that postal addresses is a pretty standardized thing, perhaps a little less so than currencies or dates, but definitely more so than say an html form.  So I personally feel that it is better to have a standard transform than to have different html/ftl code on every page.

4.  The syntax at this point looks like this:
<@ofbizPostalAddress address=[postal address GenericEntity or Map] format="text|html" inline="true|false" delimiter=";"/>

so you can pass in a GenericEntity or Map, format it as plain text or html, compress it on one line or on separate lines, and if on one line, specifies a separator.

Please give us your feedback on the syntax for using this transform.

5.  I agree with David and Jacopo that this transform belongs in party instead of in framework.

Please give us your thoughts on this--even if you don't like it!!

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12435165 ]
           
Si Chen commented on OFBIZ-203:
-------------------------------

Of course, I recognize that what might work in one place might not work in another.  For example, it might be good to use a transform like this in back end warehouse, manufacturing, or partymgr applications but not use it on say, the ecommerce front end store.

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-203) Freemarker postal address formatter macro

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12435334 ]
           
BJ Freeman commented on OFBIZ-203:
----------------------------------

In the http://issues.apache.org/jira/browse/OFBIZ-100 I proposed some Address verifications.
This has a lot of address correction to the correct format, at least for
the US.
I think the transform should be linked to the countries Postal Code format.
This should be extracted from the address verification, since that has
to be setup for correct evaluation anyway.

> Freemarker postal address formatter macro
> -----------------------------------------
>
>                 Key: OFBIZ-203
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-203
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Leon Torres
>            Priority: Minor
>         Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
>
>
> Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/>  to format postal addresses in a consistent, flexible way with attention to country postal formats.  The output should support both HTML and Text formats.  It should be easily extensible, with future XSL:Fo support in mind.
> I created an implementation as an exercise to learn the freemarker template system.  It was designed with future macros in mind.  Currently implemented are rules for generating US, German and Royal Mail format postal addresses.  (The address country determines the format.)  Also provided are test.bsh and test.ftl so people may try them out.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira