Prise en charge du mode d'enregistrement anonyme avec mot de passe.
[photoprint.git] / order.py
index ea48483..db19cc0 100755 (executable)
--- a/order.py
+++ b/order.py
@@ -45,7 +45,11 @@ from price import Price
 from xml.dom.minidom import Document
 from tool import COPIES_COUNTERS
 from App.config import getConfiguration
 from xml.dom.minidom import Document
 from tool import COPIES_COUNTERS
 from App.config import getConfiguration
-from paypal.interface import PayPalInterface
+try :
+    from paypal.interface import PayPalInterface
+    paypalAvailable = True
+except ImportError :
+    paypalAvailable = False
 from logging import getLogger
 console = getLogger('Products.photoprint.order')
 
 from logging import getLogger
 console = getLogger('Products.photoprint.order')
 
@@ -333,12 +337,12 @@ class PrintOrder(PortalContent, DefaultDublinCoreImpl) :
                    }
         
         if len(self.items) > 1 :
                    }
         
         if len(self.items) > 1 :
-            quantitySum = reduce(lambda a, b : a['quantity'] + b['quantity'], self.items)
+            quantitySum = reduce(lambda a, b : a + b, [item['quantity'] for item in self.items])
         else :
             quantitySum = self.items[0]['quantity']
         total = round(self.amountWithFees.getValues()['taxed'], 2)
         
         else :
             quantitySum = self.items[0]['quantity']
         total = round(self.amountWithFees.getValues()['taxed'], 2)
         
-        options['L_PAYMENTREQUEST_0_NAME0'] = 'Commande realis photo ref. %s' % self.getId()
+        options['L_PAYMENTREQUEST_0_NAME0'] = 'Commande photo ref. %s' % self.getId()
         if quantitySum == 1 :
             options['L_PAYMENTREQUEST_0_DESC0'] = "Commande d'un tirage photographique"
         else :
         if quantitySum == 1 :
             options['L_PAYMENTREQUEST_0_DESC0'] = "Commande d'un tirage photographique"
         else :