fixes _createSharedOffers in Sales demo data
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 18 Aug 2016 07:47:20 +0000 (09:47 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 18 Aug 2016 09:30:32 +0000 (11:30 +0200)
Change-Id: I27e4b1535460902bb58b4b0b739dadbb0adf1444
Reviewed-on: http://gerrit.tine20.com/customers/3455
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Sales/Setup/DemoData.php

index 5a8c99d..b0be1d6 100644 (file)
@@ -441,7 +441,7 @@ class Sales_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
         $customers          = Sales_Controller_Customer::getInstance()->getAll('number');
         $orderconfirmations = Sales_Controller_OrderConfirmation::getInstance()->getAll('number');
 
-        foreach($customers as $customer) {
+        foreach ($customers as $customer) {
             $oc = $orderconfirmations->getByIndex($i);
             $i++;
             $relations = array(array(
@@ -463,16 +463,15 @@ class Sales_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
                 'related_id'             => $oc->getId(),
                 'type'                   => 'OFFER'
             ));
-            $customer = $customers->getById($relation->own_id);
-            $offer = Sales_Controller_Offer::getInstance()->create(new Sales_Model_Offer(array(
+            Sales_Controller_Offer::getInstance()->create(new Sales_Model_Offer(array(
                 'number' => $i,
                 'title'  => self::$_de ? ('Angebot für Kunde ' . $customer->name) : ('Offer for Customer' . $customer->name),
                 'description' => 'Created by Tine 2.0 DemoData',
                 'relations' => $relations
             )));
         }
-        
     }
+
     /**
      * returns a new product
      * return Sales_Model_Product