Esempio n. 1
0
 /**
  * Downloads action method
  *
  * Read last downloads
  */
 public function downloadsAction()
 {
     $destinationPage = (int) $this->Request()->sPage;
     $orderData = $this->admin->sGetDownloads($destinationPage);
     $this->View()->sDownloads = $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::sGetDownloads
  */
 public function testsGetDownloads()
 {
     $customer = $this->createDummyCustomer();
     $this->session->offsetSet('sUserId', $customer->getId());
     // New customers don't have available downloads
     $downloads = $this->module->sGetDownloads();
     $this->assertCount(0, $downloads['orderData']);
     // Inject demo data
     $orderData = array('ordernumber' => uniqid(), 'userID' => $customer->getId(), 'invoice_amount' => '37.99', 'invoice_amount_net' => '31.92', 'invoice_shipping' => '0', 'invoice_shipping_net' => '0', 'ordertime' => '2014-03-14 10:26:20', 'status' => '0', 'cleared' => '17', 'paymentID' => '4', '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' => '127.0.0.1');
     Shopware()->Db()->insert('s_order', $orderData);
     $orderId = Shopware()->Db()->lastInsertId();
     $orderDetailsData = array('orderID' => $orderId, 'ordernumber' => '20003', 'articleID' => '98765', 'articleordernumber' => 'SW10196', 'price' => '34.99', 'quantity' => '1', 'name' => 'ESD download article', 'status' => '0', 'shipped' => '0', 'shippedgroup' => '0', 'releasedate' => '0000-00-00', 'modus' => '0', 'esdarticle' => '1', 'taxID' => '1', 'tax_rate' => '19', 'config' => '');
     Shopware()->Db()->insert('s_order_details', $orderDetailsData);
     $orderDetailId = Shopware()->Db()->lastInsertId();
     $orderEsdData = array('serialID' => '8', 'esdID' => '2', 'userID' => $customer->getId(), 'orderID' => $orderId, 'orderdetailsID' => $orderDetailId, 'datum' => '2014-03-14 10:26:20');
     Shopware()->Db()->insert('s_order_esd', $orderEsdData);
     // Mock a login
     $orderEsdId = Shopware()->Db()->lastInsertId();
     // Calling the method should now return the expected data
     $downloads = $this->module->sGetDownloads();
     $result = $downloads['orderData'];
     $this->assertCount(1, $result);
     $esd = end($result);
     $this->assertArrayHasKey('id', $esd);
     $this->assertArrayHasKey('ordernumber', $esd);
     $this->assertArrayHasKey('invoice_amount', $esd);
     $this->assertArrayHasKey('invoice_amount_net', $esd);
     $this->assertArrayHasKey('invoice_shipping', $esd);
     $this->assertArrayHasKey('invoice_shipping_net', $esd);
     $this->assertArrayHasKey('datum', $esd);
     $this->assertArrayHasKey('status', $esd);
     $this->assertArrayHasKey('cleared', $esd);
     $this->assertArrayHasKey('comment', $esd);
     $this->assertArrayHasKey('details', $esd);
     $this->assertEquals($orderData['ordernumber'], $esd['ordernumber']);
     $this->assertEquals('37,99', $esd['invoice_amount']);
     $this->assertEquals($orderData['invoice_amount_net'], $esd['invoice_amount_net']);
     $this->assertEquals($orderData['invoice_shipping'], $esd['invoice_shipping']);
     $this->assertEquals($orderData['invoice_shipping_net'], $esd['invoice_shipping_net']);
     $this->assertEquals('14.03.2014 10:26', $esd['datum']);
     $this->assertEquals($orderData['status'], $esd['status']);
     $this->assertEquals($orderData['cleared'], $esd['cleared']);
     $this->assertEquals($orderData['comment'], $esd['comment']);
     $this->assertCount(1, $esd['details']);
     $esdDetail = end($esd['details']);
     $this->assertArrayHasKey('id', $esdDetail);
     $this->assertArrayHasKey('orderID', $esdDetail);
     $this->assertArrayHasKey('ordernumber', $esdDetail);
     $this->assertArrayHasKey('articleID', $esdDetail);
     $this->assertArrayHasKey('articleordernumber', $esdDetail);
     $this->assertArrayHasKey('serial', $esdDetail);
     $this->assertArrayHasKey('esdLink', $esdDetail);
     $this->assertNotNull($esdDetail['esdLink']);
     return array('customer' => $customer, 'orderEsdId' => $orderEsdId, 'orderDetailId' => $orderDetailId, 'orderId' => $orderId, 'orderData' => $orderData);
 }
Esempio n. 3
0
	/**
	 * Downloads action method
	 *
	 * Read last downloads
	 */
	public function downloadsAction()
	{
		$this->View()->sDownloads = $this->admin->sGetDownloads();
	}