Esempio n. 1
0
 /**
  * Orders action method
  *
  * Read last orders
  */
 public function ordersAction()
 {
     $destinationPage = (int) $this->Request()->sPage;
     $orderData = $this->admin->sGetOpenOrderData($destinationPage);
     $this->View()->sOpenOrders = $orderData["orderData"];
     $this->View()->sNumberPages = $orderData["numberOfPages"];
     $this->View()->sPages = $orderData["pages"];
     //this has to be assigned here because the config method in smarty can't handle array structures
     $this->View()->sDownloadAvailablePaymentStatus = Shopware()->Config()->get('downloadAvailablePaymentStatus');
 }
Esempio n. 2
0
 /**
  * @covers sAdmin::sGetOpenOrderData
  * @depends testsGetDownloads
  * @ticket SW-5653
  */
 public function testsGetOpenOrderData($demoData)
 {
     // Inherit data from previous test
     $customer = $demoData['customer'];
     $oldOrderId = $demoData['orderId'];
     $orderEsdId = $demoData['orderEsdId'];
     $orderNumber = uniqid();
     // Add another order to the customer
     $orderData = array('ordernumber' => $orderNumber, 'userID' => $customer->getId(), 'invoice_amount' => '16.89', 'invoice_amount_net' => '14.2', 'invoice_shipping' => '3.9', 'invoice_shipping_net' => '3.28', 'ordertime' => '2013-04-08 17:39:30', 'status' => '0', 'cleared' => '17', 'paymentID' => '5', 'transactionID' => '', 'comment' => '', 'customercomment' => '', 'internalcomment' => '', 'net' => '0', 'taxfree' => '0', 'partnerID' => '', 'temporaryID' => '', 'referer' => '', 'cleareddate' => NULL, 'trackingcode' => '', 'language' => '2', 'dispatchID' => '9', 'currency' => 'EUR', 'currencyFactor' => '1', 'subshopID' => '1', 'remote_addr' => '172.16.10.71');
     Shopware()->Db()->insert('s_order', $orderData);
     $orderId = Shopware()->Db()->lastInsertId();
     Shopware()->Db()->query("\n            INSERT IGNORE INTO `s_order_details` (`orderID`, `ordernumber`, `articleID`, `articleordernumber`, `price`, `quantity`, `name`, `status`, `shipped`, `shippedgroup`, `releasedate`, `modus`, `esdarticle`, `taxID`, `tax_rate`, `config`) VALUES\n            (?, ?, 12, 'SW10012', 9.99, 1, 'Kobra Vodka 37,5%', 0, 0, 0, '0000-00-00', 0, 0, 1, 19, ''),\n            (?, ?, 0, 'SHIPPINGDISCOUNT', -2, 1, 'Warenkorbrabatt', 0, 0, 0, '0000-00-00', 4, 0, 0, 19, ''),\n            (?, ?, 0, 'sw-surcharge', 5, 1, 'Mindermengenzuschlag', 0, 0, 0, '0000-00-00', 4, 0, 0, 19, '');\n        ", array($orderId, $orderNumber, $orderId, $orderNumber, $orderId, $orderNumber));
     // At this point, the user is not logged in so we should have no data
     $data = $this->module->sGetOpenOrderData();
     $this->assertCount(0, $data['orderData']);
     // Mock a login
     $this->session->offsetSet('sUserId', $customer->getId());
     // Calling the method should now return the expected data
     $result = $this->module->sGetOpenOrderData();
     $result = $result['orderData'];
     $this->assertCount(2, $result);
     foreach ($result as $order) {
         $this->assertArrayHasKey('id', $order);
         $this->assertArrayHasKey('ordernumber', $order);
         $this->assertArrayHasKey('invoice_amount', $order);
         $this->assertArrayHasKey('invoice_amount_net', $order);
         $this->assertArrayHasKey('invoice_shipping', $order);
         $this->assertArrayHasKey('invoice_shipping_net', $order);
         $this->assertArrayHasKey('datum', $order);
         $this->assertArrayHasKey('status', $order);
         $this->assertArrayHasKey('cleared', $order);
         $this->assertArrayHasKey('comment', $order);
         $this->assertArrayHasKey('details', $order);
         foreach ($order['details'] as $detail) {
             $this->assertArrayHasKey('id', $detail);
             $this->assertArrayHasKey('orderID', $detail);
             $this->assertArrayHasKey('ordernumber', $detail);
             $this->assertArrayHasKey('articleID', $detail);
             $this->assertArrayHasKey('articleordernumber', $detail);
         }
         // This tests SW-5653
         if ($order['id'] == $orderId) {
             $this->assertNotEmpty($order);
             $this->assertEquals($orderNumber, $order["ordernumber"]);
             $this->assertEquals($customer->getId(), $order["userID"]);
             break;
         }
     }
     Shopware()->Db()->delete('s_order_esd', 'id = ' . $orderEsdId);
     Shopware()->Db()->delete('s_order_details', 'orderID = ' . $orderId);
     Shopware()->Db()->delete('s_order_details', 'orderID = ' . $oldOrderId);
     Shopware()->Db()->delete('s_order', 'id = ' . $orderId);
     Shopware()->Db()->delete('s_order', 'id = ' . $oldOrderId);
     $this->deleteDummyCustomer($customer);
 }
Esempio n. 3
0
	/**
	 * Orders action method
	 *
	 * Read last orders
	 */
	public function ordersAction()
	{
		$this->View()->sOpenOrders = $this->admin->sGetOpenOrderData();
	}