On 08.04.2010 20:38, Alberto Berti wrote:
I will continue to backport new features from trunk to
"GetPaidForPlone4-multipaymentprocessors" branches until then.

Thanks a lot. I've already been using multipaymentprocessors on Plone3 so this is very news for me.

On 08.04.2010 23:23, Mikko Ohtamaa wrote:
>>> And after that there's a nice awaiting Sales Tax
>>> implementation (for us Europeans) in Mikko's
>>> "miohtama-taxes"-branches, but those again are based on
>>> Brandon's branches... :)
>
> I can help to backport it to (Plone 4?) branch. It was not too many
> files. The work was done on Brandon's branch as it was enjoying the
> most of the development by the time.

Now, when I look at it, it doesn't seem to have any dependencies on Brandon's changes, so it should be trivial to backport.

On the other hand, it did have the controversial approach of replacing built-in (but not really used) "TaxUtility-framework"... I think, I'll still have to try the built-in tax framework myself first, and only then come to the same conclusion and backport Mikko's approach of simple built-in SalesTaxOptions (replacing TaxUtility) and a PriceValuAdjuster-adapter.

I think, it's relevant to add here a link to Mikko's original post on his taxes implementation: http://groups.google.com/group/getpaid-dev/browse_thread/thread/e477909168a9ef2a

>>>  Finally, I'd be personally interested to enhance the current
>>>  Currency Options with "currency_formatting" option (should the
>>>  currency symbol be rendered before or after the currency
>>>  value) from hannesc's branch.
>
> I think there are getpaid.core options for more rich formatting, we
> just lack the settings interface to enter then.

I don't recall seeing any support in getpaid.core, but Products.PloneGetPaid.interfaces.IGetPaidManagementCurrencyOptions indeed defines a few options I don't understand:

* positive_currency_format, TextLine, "Positive Currency Format"
* negative_currency_format, TextLine, "Negative Currency Format"
* us_currency_formatting, TextLine, "US Currency Formatting"

Does anyone know, how those should be used?

Anyway, I'm open to any ideas, how to configure the formatting of price from "$ 10.00" to "10.00 €", but without new ideas, I'm continuing to use Hannes' approach (http://groups.google.com/group/getpaid-dev/browse_thread/thread/1956c8017245532a, diff included as an attachment, if those get through).

Of course, if those existing currency settings are necessary for some add-ons, it's not necessary to remove them as Hannes has done, but just add a one new setting (Hannes' "currency_format")... :)

Best Regards,
Asko

--
GetPaid for Plone: http://www.plonegetpaid.com (overview info) | 
http://code.google.com/p/getpaid (code and issue tracker)
You received this message because you are subscribed to the Google Groups 
"getpaid-dev" group.
To post to this group, send email to getpaid-dev@googlegroups.com
To unsubscribe from this group, send email to 
getpaid-dev+unsubscr...@googlegroups.com

For more options, visit this group at
http://groups.google.com/group/getpaid-dev?hl=en?hl=en

To unsubscribe, reply using "remove me" as the subject.
Index: Products/PloneGetPaid/browser/templates/portlet-content-shippable.pt
===================================================================
--- Products/PloneGetPaid/browser/templates/portlet-content-shippable.pt	(revision 3272)
+++ Products/PloneGetPaid/browser/templates/portlet-content-shippable.pt	(revision 3269)
@@ -27,20 +27,11 @@
                <i tal:content="field" />
             </p>
 
-            <tal:before condition="view/symbol_before">
             <p tal:define="field python: '%.2f' % (getattr(view.payable,'price',0) or 0)"
                tal:condition="field"
 	       i18n:translate="text_price">
                  Price: <span tal:content="view/currency" /> <span tal:content="field" i18n:name="value_price" />
             </p>
-	    </tal:before>
-	    <tal:after condition="not:view/symbol_before">
-            <p tal:define="field python: '%.2f' % (getattr(view.payable,'price',0) or 0)"
-               tal:condition="field"
-	       i18n:translate="text_price">
-                 Price: <span tal:content="field" i18n:name="value_price" /> <span tal:content="view/currency" />
-            </p>
-	    </tal:after>
 
           </div>
         </dd>
Index: Products/PloneGetPaid/browser/templates/portlet-content-buyable.pt
===================================================================
--- Products/PloneGetPaid/browser/templates/portlet-content-buyable.pt	(revision 3272)
+++ Products/PloneGetPaid/browser/templates/portlet-content-buyable.pt	(revision 3269)
@@ -26,20 +26,12 @@
                tal:condition="field">
                <i tal:content="field" />
             </p>
-            <tal:before condition="view/symbol_before">
+
             <p tal:define="field python: '%.2f' % (getattr(view.payable,'price',0) or 0)"
                tal:condition="field"
 	       i18n:translate="text_price">
                  Price: <span tal:content="view/currency" /> <span tal:content="field" i18n:name="value_price" />
             </p>
-	    </tal:before>
-	    <tal:after condition="not:view/symbol_before">
-            <p tal:define="field python: '%.2f' % (getattr(view.payable,'price',0) or 0)"
-               tal:condition="field"
-	       i18n:translate="text_price">
-                 Price: <span tal:content="field" i18n:name="value_price" /> <span tal:content="view/currency" />
-            </p>
-	    </tal:after>
 
           </div>
         </dd>
Index: Products/PloneGetPaid/browser/templates/portlet-content-donatable.pt
===================================================================
--- Products/PloneGetPaid/browser/templates/portlet-content-donatable.pt	(revision 3272)
+++ Products/PloneGetPaid/browser/templates/portlet-content-donatable.pt	(revision 3269)
@@ -27,20 +27,11 @@
                <i tal:content="field" />
             </p>
 
-            <tal:before condition="view/symbol_before">
             <p tal:define="field python: '%.2f' % (getattr(view.payable,'price',0) or 0)"
                tal:condition="field"
 	       i18n:translate="text_price">
                  Price: <span tal:content="view/currency" /> <span tal:content="field" i18n:name="value_price" />
             </p>
-	    </tal:before>
-	    <tal:after condition="not:view/symbol_before">
-            <p tal:define="field python: '%.2f' % (getattr(view.payable,'price',0) or 0)"
-               tal:condition="field"
-	       i18n:translate="text_price">
-                 Price: <span tal:content="field" i18n:name="value_price" /> <span tal:content="view/currency" />
-            </p>
-	    </tal:after>
 
           </div>
         </dd>
Index: Products/PloneGetPaid/browser/portlets/donate.py
===================================================================
--- Products/PloneGetPaid/browser/portlets/donate.py	(revision 3272)
+++ Products/PloneGetPaid/browser/portlets/donate.py	(revision 3269)
@@ -37,11 +37,3 @@
         context = self.context.aq_inner
         formatter = getUtility(ICurrencyFormatter)
         return formatter.currency(context)
-
-    def symbol_before(self):
-        context = self.context.aq_inner
-        pos = getUtility(ICurrencyFormatter)
-        if pos.order(context) == "before_value":
-            return True
-        else:
-            return False
\ No newline at end of file
Index: Products/PloneGetPaid/browser/portlets/premium.py
===================================================================
--- Products/PloneGetPaid/browser/portlets/premium.py	(revision 3272)
+++ Products/PloneGetPaid/browser/portlets/premium.py	(revision 3269)
@@ -37,11 +37,3 @@
         context = self.context.aq_inner
         formatter = getUtility(ICurrencyFormatter)
         return formatter.currency(context)
-
-    def symbol_before(self):
-        context = self.context.aq_inner
-        pos = getUtility(ICurrencyFormatter)
-        if pos.order(context) == "before_value":
-            return True
-        else:
-            return False
\ No newline at end of file
Index: Products/PloneGetPaid/browser/portlets/buy.py
===================================================================
--- Products/PloneGetPaid/browser/portlets/buy.py	(revision 3272)
+++ Products/PloneGetPaid/browser/portlets/buy.py	(revision 3269)
@@ -36,12 +36,4 @@
     def currency(self):
         context = self.context.aq_inner
         formatter = getUtility(ICurrencyFormatter)
-        return formatter.currency(context)
-    
-    def symbol_before(self):
-        context = self.context.aq_inner
-        pos = getUtility(ICurrencyFormatter)
-        if pos.order(context) == "before_value":
-            return True
-        else:
-            return False
+        return formatter.currency(context)
\ No newline at end of file
Index: Products/PloneGetPaid/browser/portlets/ship.py
===================================================================
--- Products/PloneGetPaid/browser/portlets/ship.py	(revision 3272)
+++ Products/PloneGetPaid/browser/portlets/ship.py	(revision 3269)
@@ -37,11 +37,3 @@
         context = self.context.aq_inner
         formatter = getUtility(ICurrencyFormatter)
         return formatter.currency(context)
-
-    def symbol_before(self):
-        context = self.context.aq_inner
-        pos = getUtility(ICurrencyFormatter)
-        if pos.order(context) == "before_value":
-            return True
-        else:
-            return False
\ No newline at end of file
Index: Products/PloneGetPaid/currencyformatter.py
===================================================================
--- Products/PloneGetPaid/currencyformatter.py	(revision 3272)
+++ Products/PloneGetPaid/currencyformatter.py	(revision 3269)
@@ -10,23 +10,10 @@
         portal = context.portal_url.getPortalObject()
         
 
-        # 1. read the settings
+        # 1. read the setting
         options = interfaces.IGetPaidManagementOptions(portal)
 
         # 2. format the string
         currency = options.currency_symbol
 
-        return currency
-    
-    def order(self, context):
-        """
-        @return: Wether the currency symbol is before or after the amount.
-        """
-        
-        portal = context.portal_url.getPortalObject()
-        
-        # Read the settings
-        options = interfaces.IGetPaidManagementOptions(portal)
-        
-        # Return the setting as string
-        return options.currency_formatting
\ No newline at end of file
+        return currency
\ No newline at end of file
Index: Products/PloneGetPaid/interfaces.py
===================================================================
--- Products/PloneGetPaid/interfaces.py	(revision 3272)
+++ Products/PloneGetPaid/interfaces.py	(revision 3269)
@@ -3,7 +3,6 @@
 """
 
 from zope import schema
-from zope.schema.vocabulary import SimpleVocabulary
 from zope.interface import Interface
 from zope.schema import Iterable
 from zope.app.container.interfaces import IContainer
@@ -18,10 +17,6 @@
 
 from Products.PloneGetPaid.i18n import _
 
-CURRENCY_FORMAT = SimpleVocabulary.fromItems((
-    (u"Before Value", "before_value"),
-    (u"After Value", "after_value")))
-
 class IBeforeCheckoutEvent( IObjectEvent ):
     """
     an event fired before the checkout process begins
@@ -307,9 +302,39 @@
                                    default = u"$"
                                  )
 
-    currency_formatting = schema.Choice( title = _(u"Currency Formatting"),
-                                          vocabulary=CURRENCY_FORMAT,
-                                          default = "before_value"
+    positive_currency_format = schema.TextLine( title = _(u"Positive Currency Format"),
+                                   required = False,
+                                   default = u""
+                                 )
+
+    negative_currency_format = schema.TextLine( title = _(u"Negative Currency Format"),
+                                   required = False,
+                                   default = u""
+                                 )
+
+    digit_grouping_symbol = schema.TextLine( title = _(u"Digit Grouping Symbol"),
+                                   required = False,
+                                   default = u""
+                                 )
+
+    digit_grouping_symbol = schema.TextLine( title = _(u"Number of Digits in Group"),
+                                   required = False,
+                                   default = u""
+                                 )
+
+    digit_grouping_symbol = schema.TextLine( title = _(u"Decimal Symbol"),
+                                   required = False,
+                                   default = u""
+                                 )
+
+    digits_after_decimal = schema.TextLine( title = _(u"Number of Digits After Decimal"),
+                                   required = False,
+                                   default = u"2"
+                                 )
+
+    us_currency_formatting = schema.TextLine( title = _(u"US Currency Formatting"),
+                                   required = False,
+                                   default = u""
                                  )
 
 # Emails

Reply via email to