@@ -585,12 +589,15 @@ function buildcollapseFooter(group) {
function buildDebug(debug) {
$('#calcValues, #formels, #flatPrice, #price').html('');
-
if(debug && debug.calcValues) {
$.each(debug.calcValues, function (index, element) {
$('#calcValues').append('
')
});
}
+ if(debug && debug.graphJson) {
+ $('#json').val(debug.graphJson);
+ }
+
if(debug && debug.formels) {
$.each(debug.formels, function (index, element) {
$('#formels').append('
')
diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/custom.phtml b/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/custom.phtml
index 5494b9a0e..215e4688c 100644
--- a/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/custom.phtml
+++ b/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/custom.phtml
@@ -1,4 +1,4 @@
\ No newline at end of file
+
diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/done.phtml b/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/done.phtml
index 9a3d8f7eb..87d250444 100644
--- a/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/done.phtml
+++ b/src/old/application/design/vorlagen/tailwindcss_wp/templates/basket/done.phtml
@@ -1,9 +1,16 @@
-
+
translate('Vielen Dank für Ihre Bestellung') ?>
-
translate('Sie erhalten in Kürze eine Bestätigungsmail Ihrer Bestellung.')?>
+
translate('Sie erhalten in Kürze eine Bestätigungsmail Ihrer Bestellung.')
+ ?>
diff --git a/src/old/application/design/vorlagen/tailwindcss_wp/templates/user/clogin.phtml b/src/old/application/design/vorlagen/tailwindcss_wp/templates/user/clogin.phtml
index a998cd89c..3774d0e84 100644
--- a/src/old/application/design/vorlagen/tailwindcss_wp/templates/user/clogin.phtml
+++ b/src/old/application/design/vorlagen/tailwindcss_wp/templates/user/clogin.phtml
@@ -1,3 +1,9 @@
+mode != null): ?>
+
+
\ No newline at end of file
+
+
diff --git a/src/old/application/modules/default/controllers/BasketController.php b/src/old/application/modules/default/controllers/BasketController.php
index 01317ab87..9b12b6e04 100755
--- a/src/old/application/modules/default/controllers/BasketController.php
+++ b/src/old/application/modules/default/controllers/BasketController.php
@@ -7,10 +7,12 @@ class BasketController extends TP_Controller_Action
parent::init();
$contextSwitch = $this->_helper->contextSwitch();
- $contextSwitch->addActionContext('saveinfo', 'json')
+ $contextSwitch
+ ->addActionContext('saveinfo', 'json')
->addActionContext('getdeliverydata', 'json')
->addActionContext('savedeliverydata', 'json')
- ->setAutoJsonSerialization(true)->initContext();
+ ->setAutoJsonSerialization(true)
+ ->initContext();
}
public function getdeliverydataAction()
@@ -42,7 +44,6 @@ class BasketController extends TP_Controller_Action
$this->view->success = true;
}
-
public function saveinfoAction()
{
$this->view->clearVars();
@@ -56,22 +57,20 @@ class BasketController extends TP_Controller_Action
public function rebuyAction()
{
-
if (!Zend_Auth::getInstance()->hasIdentity()) {
- $this->forwardSpeak(
- 'login', 'user', 'default', array(
- 'mode' => 'basket'
- )
- );
+ $this->forwardSpeak('login', 'user', 'default', array(
+ 'mode' => 'basket',
+ ));
return;
}
- if ($this->_getParam("pos_uuid", false)) {
- $orderspos = Doctrine_Query::create()->from('Orderspos c')->where(
- 'c.uuid = ?', array(
- $this->_getParam("pos_uuid", false)
- )
- )->fetchOne();
+ if ($this->_getParam('pos_uuid', false)) {
+ $orderspos = Doctrine_Query::create()
+ ->from('Orderspos c')
+ ->where('c.uuid = ?', array(
+ $this->_getParam('pos_uuid', false),
+ ))
+ ->fetchOne();
$basket = new TP_Basket();
@@ -79,12 +78,13 @@ class BasketController extends TP_Controller_Action
$basket->setTempProductClass($data);
-
-
- if ($orderspos->layouter_mode == 4 && $data->getLayouterId() != "") {
-
-
- $dataCopy = json_decode(file_get_contents($this->view->basepath . "/apps/component/steplayouter/store/copy/" . $data->getLayouterId()), true);
+ if ($orderspos->layouter_mode == 4 && $data->getLayouterId() != '') {
+ $dataCopy = json_decode(
+ file_get_contents(
+ $this->view->basepath . '/apps/component/steplayouter/store/copy/' . $data->getLayouterId(),
+ ),
+ true,
+ );
$articleSess = new LayouterSession();
$articleSess->contact_id = $orderspos->Orders->contact_id;
$articleSess->setOrgArticleId($orderspos->Article->uuid);
@@ -96,10 +96,10 @@ class BasketController extends TP_Controller_Action
$data->setLayouterId($articleSess->getArticleId());
$basket->setTempProductClass($data);
$basket->addProduct(false, $orderspos->Article->uuid);
- $this->redirectSpeak("/basket");
+ $this->redirectSpeak('/basket');
}
- if ($orderspos->layouter_mode == 3 && $data->getLayouterId() != "") {
+ if ($orderspos->layouter_mode == 3 && $data->getLayouterId() != '') {
$articleSession = new TP_Layoutersession();
$articleSess = $articleSession->getLayouterArticle($orderspos->Article->uuid);
$articleSess->setDesignerXML($orderspos->a9_designer_data);
@@ -109,7 +109,7 @@ class BasketController extends TP_Controller_Action
$basket->setTempProductClass($data);
}
- if ($orderspos->layouter_mode == 2 && $data->getTemplatePrintId() != "") {
+ if ($orderspos->layouter_mode == 2 && $data->getTemplatePrintId() != '') {
$data->setTemplatePrintId(TP_Util::uuid());
$articleSession = new TP_Layoutersession();
$articleSess = $articleSession->getLayouterArticle($orderspos->Article->uuid);
@@ -120,34 +120,35 @@ class BasketController extends TP_Controller_Action
$basket->setTempProductClass($data);
}
-
$basket->addProduct(false, $data->getArticleId());
if ($orderspos->shop_id == 212 || $orderspos->shop_id == 257 || $orderspos->shop_id == 261) {
- $this->redirectSpeak("/basket/index");
+ $this->redirectSpeak('/basket/index');
return;
}
- } elseif ($this->_getParam("uuid", false)) {
+ } elseif ($this->_getParam('uuid', false)) {
+ $order = Doctrine_Query::create()
+ ->from('Orders c')
+ ->where('c.uuid = ?', array(
+ $this->_getParam('uuid', false),
+ ))
+ ->fetchOne();
- $order = Doctrine_Query::create()->from('Orders c')->where(
- 'c.uuid = ?', array(
- $this->_getParam("uuid", false)
- )
- )->fetchOne();
-
- $orders = Doctrine_Query::create()->from('Orderspos c')->leftJoin("c.Orders a")->where(
- 'a.uuid = ?', array(
- $this->_getParam("uuid", false)
- )
- )->execute();
+ $orders = Doctrine_Query::create()
+ ->from('Orderspos c')
+ ->leftJoin('c.Orders a')
+ ->where('a.uuid = ?', array(
+ $this->_getParam('uuid', false),
+ ))
+ ->execute();
if ($order->shop_id == 212) {
-
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.id = ?', array(
- $order->delivery_address
- )
- )->fetchOne();
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.id = ?', array(
+ $order->delivery_address,
+ ))
+ ->fetchOne();
$this->user->self_anrede = $contactaddress->anrede;
$this->user->self_department = $contactaddress->company;
@@ -175,7 +176,7 @@ class BasketController extends TP_Controller_Action
$basket->setTempProductClass($data);
- if ($orderspos->layouter_mode == 3 && $data->getLayouterId() != "") {
+ if ($orderspos->layouter_mode == 3 && $data->getLayouterId() != '') {
$articleSession = new TP_Layoutersession();
$articleSess = $articleSession->getLayouterArticle($orderspos->Article->uuid);
$articleSess->setDesignerXML($orderspos->a9_designer_data);
@@ -185,7 +186,7 @@ class BasketController extends TP_Controller_Action
$basket->setTempProductClass($data);
}
- if ($orderspos->layouter_mode == 2 && $data->getTemplatePrintId() != "") {
+ if ($orderspos->layouter_mode == 2 && $data->getTemplatePrintId() != '') {
$data->setTemplatePrintId(TP_Util::uuid());
$articleSession = new TP_Layoutersession();
$articleSess = $articleSession->getLayouterArticle($orderspos->Article->uuid);
@@ -199,19 +200,17 @@ class BasketController extends TP_Controller_Action
$basket->addProduct(false, $orderspos->Article->uuid);
}
-
if ($order->shop_id == 212 || $order->shop_id == 257 || $order->shop_id == 261) {
- $this->redirectSpeak("/basket/index");
+ $this->redirectSpeak('/basket/index');
return;
}
}
- $this->redirectSpeak("/basket/simple");
+ $this->redirectSpeak('/basket/simple');
}
public function customAction()
{
-
}
public function simpleAction()
@@ -262,11 +261,12 @@ class BasketController extends TP_Controller_Action
$gewicht = 0;
$gewichtpos = 0;
foreach ($articles as $uuid => $art) {
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $art->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $art->getArticleId(),
+ ))
+ ->fetchOne();
if ($article->typ != '9') {
$field = 'a1_xml';
@@ -279,117 +279,183 @@ class BasketController extends TP_Controller_Action
}
$gewicht += $art->getWeight();
$gewichtpos = $art->getWeight();
- if (($this->getRequest()->isPost() && $this->_request->getParam('ref_' . $uuid) != '')) {
+ if ($this->getRequest()->isPost() && $this->_request->getParam('ref_' . $uuid) != '') {
$art->setRef($this->_request->getParam('ref_' . $uuid));
$this->view->priorityMessenger('Erfolgreich gesetzt', 'success');
}
- if (($this->getRequest()->isPost() && $this->_request->getParam('kst_' . $uuid) != '')) {
+ if ($this->getRequest()->isPost() && $this->_request->getParam('kst_' . $uuid) != '') {
$art->setKst($this->_request->getParam('kst_' . $uuid));
$this->view->priorityMessenger('Erfolgreich gesetzt', 'success');
}
- if (($this->getRequest()->isPost() && $this->_request->getParam('count_' . $uuid) != '')) {
+ if ($this->getRequest()->isPost() && $this->_request->getParam('count_' . $uuid) != '') {
$art->setCount($this->_request->getParam('count_' . $uuid));
}
/**
- Versandart Berechnung
+ * Versandart Berechnung
**/
$shippingtype_pos = array();
if ($this->shop->shipping_mode >= 2) {
- if (($this->getRequest()->isPost() && $this->_request->getParam('shippingtype_' . $uuid) != '') || $art->getShippingtype() != 0) {
-
+ if (
+ $this->getRequest()->isPost() && $this->_request->getParam('shippingtype_' . $uuid) != '' ||
+ $art->getShippingtype() != 0
+ ) {
if ($this->getRequest()->isPost() && $this->_request->getParam('shippingtype_' . $uuid) != '') {
$shippingtype = $this->_request->getParam('shippingtype_' . $uuid);
} else {
$shippingtype = $art->getShippingtype();
}
- $shippingtype_pos = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.id = ?', array(
- $shippingtype
- )
- )->fetchOne();
+ $shippingtype_pos = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where('c.id = ?', array(
+ $shippingtype,
+ ))
+ ->fetchOne();
$art->setShippingType($shippingtype_pos['id']);
- $art->setShippingPrice($shippingtype_pos->calcVersand(($art->getnetto() * $art->getCount()), $gewichtpos, $gewichtpos, 'de', $this->user));
- $art->setShippingPriceMWert($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
+ $art->setShippingPrice($shippingtype_pos->calcVersand(
+ $art->getnetto() * $art->getCount(),
+ $gewichtpos,
+ $gewichtpos,
+ 'de',
+ $this->user,
+ ));
+ $art->setShippingPriceMWert(
+ ($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']),
+ );
$versand = $art->getShippingPrice() + $versand;
$mwert = $mwert + $art->getShippingPriceMWert();
- $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] + ($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] +
+ (($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']));
} else {
if ($this->shop->id == $this->shop->Install->defaultmarket) {
- $shippingtype_pos = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )', array(
- $this->shop->id, $art->getWeight(), $art->getWeight()
+ $shippingtype_pos = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )',
+ array(
+ $this->shop->id,
+ $art->getWeight(),
+ $art->getWeight(),
+ ),
)
- )->orderBy('c.pos ASC')->fetchOne();
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
} else {
- $shippingtype_pos = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )', array(
- $this->shop->Install->defaultmarket, $art->getWeight(), $art->getWeight()
+ $shippingtype_pos = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )',
+ array(
+ $this->shop->Install->defaultmarket,
+ $art->getWeight(),
+ $art->getWeight(),
+ ),
)
- )->orderBy('c.pos ASC')->fetchOne();
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
}
$art->setShippingType($shippingtype_pos['id']);
- $art->setShippingPrice($shippingtype_pos->calcVersand(($art->getnetto() * $art->getCount()), $gewichtpos, $gewichtpos, 'de', $this->user));
+ $art->setShippingPrice($shippingtype_pos->calcVersand(
+ $art->getnetto() * $art->getCount(),
+ $gewichtpos,
+ $gewichtpos,
+ 'de',
+ $this->user,
+ ));
$versand = $art->getShippingPrice() + $versand;
- $mwert = $mwert + ($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
- $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] + ($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
+ $mwert =
+ $mwert +
+ (($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] +
+ (($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']));
}
}
/**
- Ende
+ * Ende
**/
- array_push(
- $temp, array(
+ array_push($temp, array(
'uuid' => $uuid,
'article' => $article,
'basketarticle' => $art,
'shippingtype' => $shippingtype_pos,
- 'options' => $options
- )
- );
+ 'options' => $options,
+ ));
if ($article['versand'] == 'Fix') {
$versandpos = $versandpos + $article['versandwert'];
} elseif ($article['versand'] == 'Position') {
}
$art->setHasGutschein(false);
- if ($this->_getParam('gutscheincode') != "" || $basket->getGutschein() != "") {
- $articleGroups = array_keys($article->ArticleGroupArticle->toKeyValueArray('articlegroup_id', 'article_id'));
+ if ($this->_getParam('gutscheincode') != '' || $basket->getGutschein() != '') {
+ $articleGroups = array_keys($article->ArticleGroupArticle->toKeyValueArray(
+ 'articlegroup_id',
+ 'article_id',
+ ));
Zend_Registry::get('log')->debug(print_r($articleGroups, true));
- $articlegroup = "";
+ $articlegroup = '';
if (count($articleGroups)) {
unset($articleGroups[0]);
- if (trim($articleGroups) != "") {
+ if (trim($articleGroups) != '') {
$articlegroup = 'OR a.articlegroup_id IN (' . implode(',', $articleGroups) . ')';
}
}
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->andWhere(
- '(a.product_id IN (' . $article->id . ',' . $article->a6_org_article . ') ' . $articlegroup . ') AND a.install_id = ? AND a.product_id != 0 AND c.uuid = ? AND a.f <= ? AND a.t >= ?', array(
- $this->install->id,
- ($basket->getGutschein() != "" && !$this->_getParam('gutscheincode', false)) ? $basket->getGutschein() : $this->_getParam('gutscheincode'), date('Y-m-d'), date('Y-m-d')
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->andWhere(
+ '(a.product_id IN (' .
+ $article->id .
+ ',' .
+ $article->a6_org_article .
+ ') ' .
+ $articlegroup .
+ ') AND a.install_id = ? AND a.product_id != 0 AND c.uuid = ? AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->install->id,
+ $basket->getGutschein() != '' && !$this->_getParam('gutscheincode', false)
+ ? $basket->getGutschein()
+ : $this->_getParam('gutscheincode'),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
if ($gutscheincode && $gutscheincode->used == true && $gutscheincode->CreditSystem->more == false) {
$this->view->errorGutscheincode = true;
- $basket->setGutschein("");
+ $basket->setGutschein('');
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
} elseif ($gutscheincode && $gutscheincode->CreditSystem->more == true) {
- $gutscheincodee = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->addWhere(
- '(a.product_id IN (' . $article->id . ',' . $article->a6_org_article . ') ' . $articlegroup . ') AND a.install_id = ? AND a.product_id != 0 AND c.contact_id = ? AND c.uuid = ? AND a.f <= ? AND a.t >= ?', array(
- $this->install->id,
- $this->user->id,
- $basket->getGutschein(), date('Y-m-d'), date('Y-m-d')
+ $gutscheincodee = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->addWhere(
+ '(a.product_id IN (' .
+ $article->id .
+ ',' .
+ $article->a6_org_article .
+ ') ' .
+ $articlegroup .
+ ') AND a.install_id = ? AND a.product_id != 0 AND c.contact_id = ? AND c.uuid = ? AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->install->id,
+ $this->user->id,
+ $basket->getGutschein(),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
if ($gutscheincodee) {
$this->view->errorGutscheincode = true;
- $basket->setGutschein("");
+ $basket->setGutschein('');
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
} else {
$this->view->errorGutscheincode = false;
@@ -399,11 +465,18 @@ class BasketController extends TP_Controller_Action
}
if ($gutscheincode && $this->view->errorGutscheincode == false) {
-
$this->view->errorGutscheincode = false;
$basket->setGutschein($gutscheincode->uuid);
if ($gutscheincode->CreditSystem->percent == true) {
- $abzug = (($art->getnetto() * $art->getCount()) + (($art->getNetto() / 100 * $prozent) * $art->getCount())) / 100 * $gutscheincode->CreditSystem->wert;
+ $abzug =
+ (
+ (
+ ($art->getnetto() * $art->getCount()) +
+ (($art->getNetto() / 100) * $prozent * $art->getCount())
+ ) /
+ 100
+ ) *
+ $gutscheincode->CreditSystem->wert;
$basket->setGutscheinAbzug($abzug);
} else {
$basket->setGutscheinAbzug($gutscheincode->CreditSystem->wert);
@@ -418,39 +491,49 @@ class BasketController extends TP_Controller_Action
$netto = $netto + ($art->getnetto() * $art->getCount()) + $art->getShippingPrice();
$prozent = str_replace('%', '', $article->mwert);
- $mwert = $mwert + (($art->getNetto() / 100 * $prozent) * $art->getCount());
- $mwertalle[$prozent] = $mwertalle[$prozent] + (($art->getNetto() / 100 * $prozent) * $art->getCount());
+ $mwert = $mwert + (($art->getNetto() / 100) * $prozent * $art->getCount());
+ $mwertalle[$prozent] =
+ $mwertalle[$prozent] + (($art->getNetto() / 100) * $prozent * $art->getCount());
$art->setHasGutschein(true);
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + ($art->getnetto() * $art->getCount()) + (($art->getNetto() / 100 * $prozent) * $art->getCount());
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ ($art->getnetto() * $art->getCount()) +
+ (($art->getNetto() / 100) * $prozent * $art->getCount());
} else {
$netto = $netto + ($art->getnetto() * $art->getCount()) + $art->getShippingPrice();
$prozent = str_replace('%', '', $article->mwert);
- $mwert = $mwert + (($art->getNetto() / 100 * $prozent) * $art->getCount());
- $mwertalle[$prozent] = $mwertalle[$prozent] + (($art->getNetto() / 100 * $prozent) * $art->getCount());
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + ($art->getnetto() * $art->getCount()) + (($art->getNetto() / 100 * $prozent) * $art->getCount());
+ $mwert = $mwert + (($art->getNetto() / 100) * $prozent * $art->getCount());
+ $mwertalle[$prozent] =
+ $mwertalle[$prozent] + (($art->getNetto() / 100) * $prozent * $art->getCount());
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ ($art->getnetto() * $art->getCount()) +
+ (($art->getNetto() / 100) * $prozent * $art->getCount());
}
} else {
$netto = $netto + ($art->getnetto() * $art->getCount()) + $art->getShippingPrice();
$prozent = str_replace('%', '', $article->mwert);
- $mwert = $mwert + (($art->getNetto() / 100 * $prozent) * $art->getCount());
+ $mwert = $mwert + (($art->getNetto() / 100) * $prozent * $art->getCount());
if (!isset($mwertalle[$prozent])) {
$mwertalle[$prozent] = 0;
}
if (!isset($summewarenwert[$prozent])) {
$summewarenwert[$prozent] = 0;
}
- $mwertalle[$prozent] = $mwertalle[$prozent] + (($art->getNetto() / 100 * $prozent) * $art->getCount());
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + ($art->getnetto() * $art->getCount()) + (($art->getNetto() / 100 * $prozent) * $art->getCount());
+ $mwertalle[$prozent] =
+ $mwertalle[$prozent] + (($art->getNetto() / 100) * $prozent * $art->getCount());
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ ($art->getnetto() * $art->getCount()) +
+ (($art->getNetto() / 100) * $prozent * $art->getCount());
}
} else {
- array_push(
- $temp, array(
+ array_push($temp, array(
'uuid' => $uuid,
'article' => $article,
- 'basketarticle' => $art
- )
- );
+ 'basketarticle' => $art,
+ ));
if ($article['versand'] == 'Fix') {
$versand = $versand + $article['versandwert'];
@@ -458,37 +541,68 @@ class BasketController extends TP_Controller_Action
}
$art->setHasGutschein(false);
- if ($this->_getParam('gutscheincode') != "" || $basket->getGutschein() != "") {
- $articleGroups = array_keys($article->ArticleGroupArticle->toKeyValueArray('articlegroup_id', 'article_id'));
- $articlegroup = "";
+ if ($this->_getParam('gutscheincode') != '' || $basket->getGutschein() != '') {
+ $articleGroups = array_keys($article->ArticleGroupArticle->toKeyValueArray(
+ 'articlegroup_id',
+ 'article_id',
+ ));
+ $articlegroup = '';
if (count($articleGroups)) {
- if (trim($articleGroups) != "") {
+ if (trim($articleGroups) != '') {
$articlegroup = 'OR a.articlegroup_id IN (' . implode(',', $articleGroups) . ')';
}
}
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->addWhere(
- '(a.product_id IN (' . $article->id . ',' . $article->a6_org_article . ') ' . $articlegroup . ') AND a.install_id = ? AND a.product_id != 0 AND c.uuid = ? AND a.f <= ? AND a.t >= ?', array(
- $this->install->id,
- ($basket->getGutschein() != "" && !$this->_getParam('gutscheincode', false)) ? $basket->getGutschein() : $this->_getParam('gutscheincode'), date('Y-m-d'), date('Y-m-d')
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->addWhere(
+ '(a.product_id IN (' .
+ $article->id .
+ ',' .
+ $article->a6_org_article .
+ ') ' .
+ $articlegroup .
+ ') AND a.install_id = ? AND a.product_id != 0 AND c.uuid = ? AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->install->id,
+ $basket->getGutschein() != '' && !$this->_getParam('gutscheincode', false)
+ ? $basket->getGutschein()
+ : $this->_getParam('gutscheincode'),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
if ($gutscheincode && $gutscheincode->used == true && $gutscheincode->CreditSystem->more == false) {
$this->view->errorGutscheincode = true;
$basket->setGutschein();
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
} elseif ($gutscheincode && $gutscheincode->CreditSystem->more == true) {
- $gutscheincodee = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->addWhere(
- '(a.product_id IN (' . $article->id . ',' . $article->a6_org_article . ') ' . $articlegroup . ') AND a.install_id = ? AND a.product_id != 0 AND c.contact_id = ? AND c.uuid = ? AND a.f <= ? AND a.t >= ?', array(
- $this->install->id,
- $this->user->id,
- $basket->getGutschein(), date('Y-m-d'), date('Y-m-d')
+ $gutscheincodee = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->addWhere(
+ '(a.product_id IN (' .
+ $article->id .
+ ',' .
+ $article->a6_org_article .
+ ') ' .
+ $articlegroup .
+ ') AND a.install_id = ? AND a.product_id != 0 AND c.contact_id = ? AND c.uuid = ? AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->install->id,
+ $this->user->id,
+ $basket->getGutschein(),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
if ($gutscheincodee) {
$this->view->errorGutscheincode = true;
- $basket->setGutschein("");
+ $basket->setGutschein('');
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
} else {
$this->view->errorGutscheincode = false;
@@ -498,16 +612,15 @@ class BasketController extends TP_Controller_Action
}
if ($gutscheincode && $this->view->errorGutscheincode == false) {
-
$this->view->errorGutscheincode = false;
$basket->setGutschein($gutscheincode->uuid);
if ($gutscheincode->CreditSystem->percent == true) {
- $abzug = $art->getDesignerCost() / 100 * $gutscheincode->CreditSystem->wert;
+ $abzug = ($art->getDesignerCost() / 100) * $gutscheincode->CreditSystem->wert;
$basket->setGutscheinAbzug($abzug);
} else {
$basket->setGutscheinAbzug($gutscheincode->CreditSystem->wert);
}
- $netto = $netto + $art->getDesignerCost() - $basket->getGutscheinAbzug();
+ $netto = ($netto + $art->getDesignerCost()) - $basket->getGutscheinAbzug();
if ($basket->getPreisBrutto() < 0) {
$basket->setPreisBrutto(0);
}
@@ -517,41 +630,52 @@ class BasketController extends TP_Controller_Action
$basket->setGutscheinAbzugTyp(TP_Basket::GUTSCHEIN_PRODUCT);
$prozent = str_replace('%', '', $article->mwert);
- $mwert = $mwert + (($art->getDesignerCost() - $art->getDesignerCost()) / 100 * $prozent);
- $mwertalle[$prozent] = $mwertalle[$prozent] + (($art->getDesignerCost() - $art->getDesignerCost()) / 100 * $prozent);
+ $mwert = $mwert + ((($art->getDesignerCost() - $art->getDesignerCost()) / 100) * $prozent);
+ $mwertalle[$prozent] =
+ $mwertalle[$prozent] +
+ ((($art->getDesignerCost() - $art->getDesignerCost()) / 100) * $prozent);
if (!isset($mwertalle[$prozent])) {
$mwertalle[$prozent] = 0;
}
if (!isset($summewarenwert[$prozent])) {
$summewarenwert[$prozent] = 0;
}
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + $art->getDesignerCost() + ($art->getDesignerCost() / 100 * $prozent);
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ $art->getDesignerCost() +
+ (($art->getDesignerCost() / 100) * $prozent);
$art->setHasGutschein(true);
} else {
$netto = $netto + $art->getDesignerCost();
$prozent = str_replace('%', '', $article->mwert);
- $mwert = $mwert + ($art->getDesignerCost() / 100 * $prozent);
- $mwertalle[$prozent] = $mwertalle[$prozent] + ($art->getDesignerCost() / 100 * $prozent);
+ $mwert = $mwert + (($art->getDesignerCost() / 100) * $prozent);
+ $mwertalle[$prozent] = $mwertalle[$prozent] + (($art->getDesignerCost() / 100) * $prozent);
if (!isset($mwertalle[$prozent])) {
$mwertalle[$prozent] = 0;
}
if (!isset($summewarenwert[$prozent])) {
$summewarenwert[$prozent] = 0;
}
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + $art->getDesignerCost() + ($art->getDesignerCost() / 100 * $prozent);
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ $art->getDesignerCost() +
+ (($art->getDesignerCost() / 100) * $prozent);
}
} else {
$netto = $netto + $art->getDesignerCost();
$prozent = str_replace('%', '', $article->mwert);
- $mwert = $mwert + ($art->getDesignerCost() / 100 * $prozent);
- $mwertalle[$prozent] = $mwertalle[$prozent] + ($art->getDesignerCost() / 100 * $prozent);
+ $mwert = $mwert + (($art->getDesignerCost() / 100) * $prozent);
+ $mwertalle[$prozent] = $mwertalle[$prozent] + (($art->getDesignerCost() / 100) * $prozent);
if (!isset($mwertalle[$prozent])) {
$mwertalle[$prozent] = 0;
}
if (!isset($summewarenwert[$prozent])) {
$summewarenwert[$prozent] = 0;
}
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + $art->getDesignerCost() + ($art->getDesignerCost() / 100 * $prozent);
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ $art->getDesignerCost() +
+ (($art->getDesignerCost() / 100) * $prozent);
}
}
}
@@ -559,27 +683,34 @@ class BasketController extends TP_Controller_Action
$this->view->productmwert = $mwert;
$this->view->productbrutto = $netto + $mwert;
$this->view->productnetto = $netto;
- if ($this->_getParam('gutscheincode') != "" || $basket->getGutschein() != "") {
-
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->where(
- 'a.install_id = ? AND c.uuid = ? AND a.product_id = 0 AND a.articlegroup_id = 0 AND a.f <= ? AND a.t >= ?', array(
- $this->install->id,
- ($basket->getGutschein() != "") ? $basket->getGutschein() : $this->_getParam('gutscheincode'), date('Y-m-d'), date('Y-m-d')
+ if ($this->_getParam('gutscheincode') != '' || $basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->where(
+ 'a.install_id = ? AND c.uuid = ? AND a.product_id = 0 AND a.articlegroup_id = 0 AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->install->id,
+ $basket->getGutschein() != '' ? $basket->getGutschein() : $this->_getParam('gutscheincode'),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
if ($gutscheincode && $gutscheincode->used == true && $gutscheincode->CreditSystem->more == false) {
$this->view->errorGutscheincode = true;
$basket->setGutschein();
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
} elseif ($gutscheincode && $gutscheincode->CreditSystem->more == true) {
- $gutscheincodet = Doctrine_Query::create()->from('CreditSystemDetail c')->where(
- 'c.install_id = ? AND c.contact_id = ? AND c.uuid = ?', array(
- $this->install->id,
- $this->user->id,
- $basket->getGutschein()
- )
- )->fetchOne();
+ $gutscheincodet = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->where('c.install_id = ? AND c.contact_id = ? AND c.uuid = ?', array(
+ $this->install->id,
+ $this->user->id,
+ $basket->getGutschein(),
+ ))
+ ->fetchOne();
if ($gutscheincodet) {
$this->view->errorGutscheincode = true;
@@ -595,9 +726,9 @@ class BasketController extends TP_Controller_Action
if ($gutscheincode && $this->view->errorGutscheincode == false) {
$basket->setGutschein($gutscheincode->uuid);
if ($gutscheincode->CreditSystem->percent == true) {
- $abzug = ($netto + $mwert) / 100 * $gutscheincode->CreditSystem->wert;
+ $abzug = (($netto + $mwert) / 100) * $gutscheincode->CreditSystem->wert;
$basket->setGutscheinAbzug($abzug);
- if ($netto + $mwert - $abzug < 0) {
+ if ((($netto + $mwert) - $abzug) < 0) {
$netto = 0;
$brutto = 0;
$mwert = 0;
@@ -606,7 +737,7 @@ class BasketController extends TP_Controller_Action
}
} else {
$basket->setGutscheinAbzug($gutscheincode->CreditSystem->wert);
- if ($netto + $mwert - $gutscheincode->CreditSystem->wert < 0) {
+ if ((($netto + $mwert) - $gutscheincode->CreditSystem->wert) < 0) {
$gutscheincode->CreditSystem->wert = $netto + $mwert;
$basket->setGutscheinAbzug($netto + $mwert);
$mwertalle = array();
@@ -625,7 +756,7 @@ class BasketController extends TP_Controller_Action
}
$this->view->productbruttogutschein = 0;
if ($netto > 0) {
- $this->view->productbruttogutschein = $netto + $mwert - ($basket->getGutscheinAbzug() * 1);
+ $this->view->productbruttogutschein = ($netto + $mwert) - ($basket->getGutscheinAbzug() * 1);
}
/**
@@ -649,63 +780,77 @@ class BasketController extends TP_Controller_Action
$basket->setDeliveryIsSame(true);
$basket->setSender(0);
- //$this->redirectSpeak('/basket/finish');
- } elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's'
- && $this->getRequest()->getParam('sender') != '' && $this->getRequest()->getParam('invoice') != ''
- ) {
+ //$this->redirectSpeak('/basket/finish');
+ } elseif (
+ $this->getRequest()->getParam('delivery') != '' &&
+ $this->getRequest()->getParam('delivery') != 's' &&
+ $this->getRequest()->getParam('sender') != '' &&
+ $this->getRequest()->getParam('invoice') != ''
+ ) {
$basket->setDeliveryIsSame(false);
$basket->setDelivery($this->getRequest()->getParam('delivery'));
$basket->setInvoice($this->getRequest()->getParam('invoice'));
$basket->setSender($this->getRequest()->getParam('sender'));
- //$this->redirectSpeak('/basket/finish');
+ //$this->redirectSpeak('/basket/finish');
} elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's') {
$basket->setDeliveryIsSame(false);
$basket->setDelivery($this->getRequest()->getParam('delivery'));
+
//$this->redirectSpeak('/basket/finish');
}
-
if ($mode->over_ride_contact != false && $mode->over_ride_contact != 'new') {
- $this->view->addresses = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 2 AND contact_id = ? AND display = 1', array(
- $mode->over_ride_contact
- )
- )->execute();
- $this->view->addresses_invoice = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 1 AND contact_id = ? AND display = 1', array(
- $mode->over_ride_contact
- )
- )->execute();
- $this->view->addresses_sender = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 3 AND contact_id = ? AND display = 1', array(
- $mode->over_ride_contact
- )
- )->execute();
+ $this->view->addresses = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 2 AND contact_id = ? AND display = 1', array(
+ $mode->over_ride_contact,
+ ))
+ ->execute();
+ $this->view->addresses_invoice = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 1 AND contact_id = ? AND display = 1', array(
+ $mode->over_ride_contact,
+ ))
+ ->execute();
+ $this->view->addresses_sender = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 3 AND contact_id = ? AND display = 1', array(
+ $mode->over_ride_contact,
+ ))
+ ->execute();
} else {
- $this->view->addresses = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 2 AND contact_id = ? AND display = 1', array(
- $this->user->id
- )
- )->execute();
- $this->view->addresses_invoice = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 1 AND contact_id = ? AND display = 1', array(
- $this->user->id
- )
- )->execute();
- $this->view->addresses_sender = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 3 AND contact_id = ? AND display = 1', array(
- $this->user->id
- )
- )->execute();
+ $this->view->addresses = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 2 AND contact_id = ? AND display = 1', array(
+ $this->user->id,
+ ))
+ ->execute();
+ $this->view->addresses_invoice = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 1 AND contact_id = ? AND display = 1', array(
+ $this->user->id,
+ ))
+ ->execute();
+ $this->view->addresses_sender = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 3 AND contact_id = ? AND display = 1', array(
+ $this->user->id,
+ ))
+ ->execute();
}
$this->view->addresses_delivery = $this->view->addresses;
if ($basket->getDelivery() == 0) {
if ($this->user->standart_delivery == 0) {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND type = 2 AND display = 1', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND type = 2 AND display = 1', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_delivery = $cs->id;
@@ -737,12 +882,24 @@ class BasketController extends TP_Controller_Action
}
$basket->setDelivery($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.id = ?', array($this->user->id, $this->user->standart_delivery))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.id = ?', array(
+ $this->user->id,
+ $this->user->standart_delivery,
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setDelivery($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_delivery = $cs->id;
@@ -776,12 +933,24 @@ class BasketController extends TP_Controller_Action
}
}
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array(
+ $this->user->id,
+ $basket->getDelivery(),
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setDelivery($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_delivery = $cs->id;
@@ -817,7 +986,11 @@ class BasketController extends TP_Controller_Action
if ($basket->getSender() == 0) {
if ($this->user->standart_sender == 0) {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 3', array($this->user->id))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 3', array($this->user->id))
+ ->fetchOne();
if ($cs) {
$this->user->standart_sender = $cs->id;
$this->user->save();
@@ -825,14 +998,24 @@ class BasketController extends TP_Controller_Action
$basket->setSender($cs->uuid);
}
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.id = ?', array($this->user->id, $this->user->standart_sender))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.id = ?', array(
+ $this->user->id,
+ $this->user->standart_sender,
+ ))
+ ->fetchOne();
$basket->setSender($cs->uuid);
}
}
if ($basket->getInvoice() == 0) {
if ($this->user->standart_invoice == 0) {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))
+ ->fetchOne();
if ($cs) {
$this->user->standart_invoice = $cs->id;
$this->user->save();
@@ -863,12 +1046,23 @@ class BasketController extends TP_Controller_Action
}
$basket->setInvoice($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.id = ?', array($this->user->id, $this->user->standart_invoice))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.id = ?', array(
+ $this->user->id,
+ $this->user->standart_invoice,
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setInvoice($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))
+ ->fetchOne();
if ($cs) {
$this->user->standart_invoice = $cs->id;
$this->user->save();
@@ -901,13 +1095,24 @@ class BasketController extends TP_Controller_Action
}
}
} else {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array(
+ $this->user->id,
+ $basket->getInvoice(),
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setInvoice($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_invoice = $cs->id;
@@ -949,10 +1154,21 @@ class BasketController extends TP_Controller_Action
$this->view->invoice = $basket->getInvoice();
$this->view->delivery = $basket->getDelivery();
- $this->view->sender_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getSender()))->fetchOne();
- $this->view->invoice_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))->fetchOne();
- $this->view->delivery_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
-
+ $this->view->sender_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getSender()))
+ ->fetchOne();
+ $this->view->invoice_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))
+ ->fetchOne();
+ $this->view->delivery_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))
+ ->fetchOne();
if ($this->_getParam('basketfield1')) {
$basket->setBasketField1($this->_getParam('basketfield1'));
@@ -961,7 +1177,6 @@ class BasketController extends TP_Controller_Action
$basket->setBasketField2($this->_getParam('basketfield2'));
}
-
$this->view->senderIsSame = $basket->getSenderIsSame();
$this->view->deliveryIsSame = $basket->getDeliveryIsSame();
@@ -970,7 +1185,6 @@ class BasketController extends TP_Controller_Action
}
if (file_exists($this->_configPath . '/user/address.ini')) {
-
$config = new Zend_Config_Ini($this->_configPath . '/user/address.ini', 'add');
if ($config->global) {
$form = new EasyBib_Form($config->user);
@@ -985,30 +1199,27 @@ class BasketController extends TP_Controller_Action
if (isset($form->country)) {
$form->country->addMultiOptions($countrys->toArray());
- $form->country->setValue("DE");
+ $form->country->setValue('DE');
}
if (!$this->shop->display_sender && isset($form->type)) {
$form->type->removeMultiOption('3');
}
-
if (!$this->shop->display_delivery && isset($form->type)) {
$form->type->removeMultiOption('2');
}
if ($this->_request->isPost()) {
-
$formData = $this->getRequest()->getParams();
if ($form->isValid($formData)) {
-
$contactaddress = new ContactAddress();
$contactaddress->anrede = 1;
- $contactaddress->email = "";
- $contactaddress->mobil_phone = "";
- $contactaddress->company = "";
+ $contactaddress->email = '';
+ $contactaddress->mobil_phone = '';
+ $contactaddress->company = '';
if (isset($formData['anrede'])) {
$contactaddress->anrede = $formData['anrede'];
}
@@ -1046,21 +1257,21 @@ class BasketController extends TP_Controller_Action
if (!$this->_getParam('uuid')) {
if (in_array('1', $formData['type'])) {
$cs = $contactaddress->copy();
- $cs->uuid = "";
+ $cs->uuid = '';
$cs->type = 1;
$cs->save();
$basket->setInvoice($cs->uuid);
}
if (in_array('2', $formData['type'])) {
$cs = $contactaddress->copy();
- $cs->uuid = "";
+ $cs->uuid = '';
$cs->type = 2;
$cs->save();
$basket->setDelivery($cs->uuid);
}
if (in_array('3', $formData['type'])) {
$cs = $contactaddress->copy();
- $cs->uuid = "";
+ $cs->uuid = '';
$cs->type = 3;
$cs->save();
$basket->setSender($cs->uuid);
@@ -1088,7 +1299,7 @@ class BasketController extends TP_Controller_Action
if (isset($form->country)) {
$editform->country->addMultiOptions($countrys->toArray());
- $editform->country->setValue("DE");
+ $editform->country->setValue('DE');
$editform->anrede->setAttrib('id', 'update_anrede');
$editform->country->setAttrib('id', 'update_country');
}
@@ -1096,12 +1307,10 @@ class BasketController extends TP_Controller_Action
} else {
$config = new Zend_Config_Ini($this->_configPath . '/user/registercontact.ini', 'register');
$form = new Zend_Form();
- $form->addAttribs(
- array(
+ $form->addAttribs(array(
'class' => 'niceform',
- 'id' => 'userreg'
- )
- );
+ 'id' => 'userreg',
+ ));
$form->addSubForm(new Zend_Form_SubForm($config->user->liefer), 'liefer');
$form->addElement('submit', 'submit', $config->user->liefersubmit->elements->submit->options);
if ($this->_request->isPost()) {
@@ -1146,32 +1355,52 @@ class BasketController extends TP_Controller_Action
$this->view->paymenttype = 0;
$this->view->shippingtype = 0;
if ($this->shop->shipping_mode == 1) {
- if (($this->getRequest()->isPost() && $this->_request->getParam('shippingtype') != '') || $basket->getShippingtype() != 0) {
-
+ if (
+ $this->getRequest()->isPost() && $this->_request->getParam('shippingtype') != '' ||
+ $basket->getShippingtype() != 0
+ ) {
if ($this->getRequest()->isPost() && $this->_request->getParam('shippingtype') != '') {
$shippingtype = $this->_request->getParam('shippingtype');
} else {
$shippingtype = $basket->getShippingtype();
}
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $shippingtype, $gewicht, $gewicht
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $shippingtype,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->fetchOne();
+ ->fetchOne();
if (!$shippingtype) {
if ($this->shop->id == $this->shop->Install->defaultmarket || !$this->shop->market) {
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $this->shop->id, $gewicht, $gewicht
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $this->shop->id,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->fetchOne();
+ ->fetchOne();
} else {
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $this->shop->Install->defaultmarket, $gewicht, $gewicht
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $this->shop->Install->defaultmarket,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->fetchOne();
+ ->fetchOne();
}
}
@@ -1179,29 +1408,54 @@ class BasketController extends TP_Controller_Action
$this->view->shippingselected = $shippingtype['id'];
$this->view->shippingtypeselected = $shippingtype;
- $versand = $versand + $shippingtype->calcVersand($netto, $gewicht, $gewicht, $this->view->delivery_address->country, $this->user);
+ $versand =
+ $versand +
+ $shippingtype->calcVersand(
+ $netto,
+ $gewicht,
+ $gewicht,
+ $this->view->delivery_address->country,
+ $this->user,
+ );
if ($versand > 0 || $versandpos > 0) {
$versand = $versand + $versandpos;
}
- $mwert = $mwert + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
- $this->view->versandbrutto = $versand + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
+ $mwert = $mwert + (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] +
+ (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
+ $this->view->versandbrutto =
+ $versand + (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
if ($shippingtype['no_payment'] == 1) {
$this->view->no_payment = true;
}
} else {
if ($this->shop->id == $this->shop->Install->defaultmarket || !$this->shop->market) {
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.private=0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $this->shop->id, $gewicht, $gewicht
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.private=0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $this->shop->id,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->orderBy('c.pos ASC')->fetchOne();
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
} else {
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.private=0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $this->shop->Install->defaultmarket, $gewicht, $gewicht
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.private=0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $this->shop->Install->defaultmarket,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->orderBy('c.pos ASC')->fetchOne();
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
}
foreach ($this->shop->ShopShippingtype as $shipprivate) {
@@ -1213,11 +1467,12 @@ class BasketController extends TP_Controller_Action
if (Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
foreach ($user->Account->AccountShippingtype as $shipprivate) {
if ($shipprivate->Shippingtype->pos < $shippingtype->pos) {
@@ -1231,47 +1486,65 @@ class BasketController extends TP_Controller_Action
$this->view->shippingselected = $shippingtype['id'];
$this->view->shippingtypeselected = $shippingtype;
if ($shippingtype) {
- $versand = $versand + $shippingtype->calcVersand($netto, $gewicht, $gewicht, $this->view->delivery_address->country, $this->user);
+ $versand =
+ $versand +
+ $shippingtype->calcVersand(
+ $netto,
+ $gewicht,
+ $gewicht,
+ $this->view->delivery_address->country,
+ $this->user,
+ );
}
if ($versand > 0 || $versandpos > 0) {
$versand = $versand + $versandpos;
}
- $mwert = $mwert + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
- $this->view->versandbrutto = $versand + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
+ $mwert = $mwert + (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] +
+ (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
+ $this->view->versandbrutto =
+ $versand + (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
if ($shippingtype['no_payment'] == 1) {
$this->view->no_payment = true;
}
}
}
if ($this->view->no_payment != true) {
- if ($this->getRequest()->isPost() && $this->_request->getParam('paymenttype') != '' || $basket->getPaymentType() != 0) {
-
+ if (
+ $this->getRequest()->isPost() && $this->_request->getParam('paymenttype') != '' ||
+ $basket->getPaymentType() != 0
+ ) {
if ($this->getRequest()->isPost() && $this->_request->getParam('paymenttype') != '') {
$paymenttype = $this->_request->getParam('paymenttype');
} else {
$paymenttype = $basket->getPaymentType();
}
- $paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.id = ?', array(
- $paymenttype
- )
- )->fetchOne();
+ $paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.id = ?', array(
+ $paymenttype,
+ ))
+ ->fetchOne();
if (!$paymenttype) {
if ($this->shop->id == $this->shop->Install->defaultmarket || !$this->shop->market) {
- $paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ?', array(
- $this->shop->id
- )
- )->orderBy('c.pos ASC')->fetchOne();
+ $paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.shop_id = ?', array(
+ $this->shop->id,
+ ))
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
} else {
- $paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ?', array(
- $this->shop->Install->defaultmarket
- )
- )->orderBy('c.pos ASC')->fetchOne();
+ $paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.shop_id = ?', array(
+ $this->shop->Install->defaultmarket,
+ ))
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
}
}
@@ -1281,32 +1554,39 @@ class BasketController extends TP_Controller_Action
$this->view->paymentselected = $paymenttype['id'];
$this->view->paymenttypeselected = $paymenttype;
if ($paymenttype['prozent'] == 1) {
- $this->view->paymentwert = $netto / 100 * $paymenttype['wert'];
+ $this->view->paymentwert = ($netto / 100) * $paymenttype['wert'];
} else {
$this->view->paymentwert = $paymenttype['wert'];
}
} else {
if ($this->shop->id == $this->shop->Install->defaultmarket || !$this->shop->market) {
- $paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ? AND private = 0', array(
- $this->shop->id
- )
- )->orderBy('c.pos ASC')->fetchOne()->toArray();
+ $paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.shop_id = ? AND private = 0', array(
+ $this->shop->id,
+ ))
+ ->orderBy('c.pos ASC')
+ ->fetchOne()
+ ->toArray();
} else {
- $paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ? AND private = 0', array(
- $this->shop->Install->defaultmarket
- )
- )->orderBy('c.pos ASC')->fetchOne()->toArray();
+ $paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.shop_id = ? AND private = 0', array(
+ $this->shop->Install->defaultmarket,
+ ))
+ ->orderBy('c.pos ASC')
+ ->fetchOne()
+ ->toArray();
}
if (Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
foreach ($user->ContactPaymenttype as $payment) {
if ($payment->Paymenttype->pos < $paymenttype->pos) {
@@ -1320,45 +1600,65 @@ class BasketController extends TP_Controller_Action
$this->view->paymentselected = $paymenttype['id'];
$this->view->paymenttypeselected = $paymenttype;
if ($paymenttype['prozent'] == 1) {
- $this->view->paymentwert = $netto / 100 * $paymenttype['wert'];
+ $this->view->paymentwert = ($netto / 100) * $paymenttype['wert'];
} else {
$this->view->paymentwert = $paymenttype['wert'];
}
}
- $mwert = $mwert + ($this->view->paymentwert / 100 * $paymenttype['mwert']);
- $mwertalle[$paymenttype['mwert']] = $mwertalle[$paymenttype['mwert']] + ($this->view->paymentwert / 100 * $paymenttype['mwert']);
- $this->view->paymentwertbrutto = $this->view->paymentwert + ($this->view->paymentwert / 100 * $paymenttype['mwert']);
+ $mwert = $mwert + (($this->view->paymentwert / 100) * $paymenttype['mwert']);
+ $mwertalle[$paymenttype['mwert']] =
+ $mwertalle[$paymenttype['mwert']] + (($this->view->paymentwert / 100) * $paymenttype['mwert']);
+ $this->view->paymentwertbrutto =
+ $this->view->paymentwert + (($this->view->paymentwert / 100) * $paymenttype['mwert']);
} else {
$this->view->paymentwert = 0;
$this->view->paymentwertbrutto = 0;
}
- if (strtoupper($this->view->delivery_address->getCountry()) != "DE" && $this->shop->id == 176) {
+ if (strtoupper($this->view->delivery_address->getCountry()) != 'DE' && $this->shop->id == 176) {
$mwert = 0;
$mwertalle = array();
}
$this->view->articles = $temp;
if ($this->shop->market == true) {
- $this->view->paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ? AND c.private = 0', array(
- $this->shop->Install->defaultmarket
+ $this->view->paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.shop_id = ? AND c.private = 0', array(
+ $this->shop->Install->defaultmarket,
+ ))
+ ->orderBy('pos ASC')
+ ->fetchArray();
+ $this->view->shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.private = 0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $this->shop->Install->defaultmarket,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->orderBy('pos ASC')->fetchArray();
- $this->view->shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.private = 0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $this->shop->Install->defaultmarket, $gewicht, $gewicht
- )
- )->orderBy('pos ASC')->fetchArray();
+ ->orderBy('pos ASC')
+ ->fetchArray();
} else {
- $this->view->paymenttype = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ? AND c.private = 0', array(
- $this->shop->id
+ $this->view->paymenttype = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.shop_id = ? AND c.private = 0', array(
+ $this->shop->id,
+ ))
+ ->orderBy('pos ASC')
+ ->fetchArray();
+ $this->view->shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.private = 0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $this->shop->id,
+ $gewicht,
+ $gewicht,
+ ),
)
- )->orderBy('pos ASC')->fetchArray();
- $this->view->shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.private = 0 AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $this->shop->id, $gewicht, $gewicht
- )
- )->orderBy('pos ASC')->fetchArray();
+ ->orderBy('pos ASC')
+ ->fetchArray();
}
$this->_helper->layout->setLayout('default');
@@ -1374,22 +1674,32 @@ class BasketController extends TP_Controller_Action
$basket->setVersandkosten(0);
$basket->setZahlkosten(0);
} else {
-
$basket->setPreisNetto($netto);
if ($netto > 0) {
- $basket->setPreisBrutto(($netto + $versand + $mwert + $this->view->paymentwert) - ($basket->getGutscheinAbzug() * 1));
+ $basket->setPreisBrutto(
+ ($netto + $versand + $mwert + $this->view->paymentwert) - ($basket->getGutscheinAbzug() * 1),
+ );
} else {
- $basket->setPreisBrutto(($versand + $mwert + $this->view->paymentwert));
+ $basket->setPreisBrutto($versand + $mwert + $this->view->paymentwert);
}
$basket->setVersandkosten($versand);
$basket->setZahlkosten($this->view->paymentwert);
- if ($this->view->gutscheincode != "") {
+ if ($this->view->gutscheincode != '') {
$tempMwert = array();
$mwert = 0;
foreach ($mwertalle as $key => $mw) {
-
- $anteil = (((($summewarenwert[$key] / $this->view->productbrutto) * $this->view->gutscheincodeabzug) * 100) / (100 + $key)) * ($key * 0.01);
+ $anteil =
+ (
+ (
+ ($summewarenwert[$key] / $this->view->productbrutto) *
+ $this->view->gutscheincodeabzug *
+ 100
+ ) /
+ (100 + $key)
+ ) *
+ $key *
+ 0.01;
$tempMwert[$key] = $mw - $anteil;
$mwert = $mwert + ($mw - $anteil);
}
@@ -1402,7 +1712,13 @@ class BasketController extends TP_Controller_Action
unset($mwertalle['0']);
$this->view->mwertalle = $mwertalle;
$this->view->brutto = $basket->getPreisBrutto();
- $basket->setAdditional($this->view->productnetto, $this->view->productbrutto, $this->view->paymentwertbrutto, $this->view->versandbrutto, $mwertalle);
+ $basket->setAdditional(
+ $this->view->productnetto,
+ $this->view->productbrutto,
+ $this->view->paymentwertbrutto,
+ $this->view->versandbrutto,
+ $mwertalle,
+ );
}
$this->view->shippingtype_extra_label = $basket->getShippingtypeExtraLabel();
$this->view->paymenttypecontact = array();
@@ -1411,11 +1727,12 @@ class BasketController extends TP_Controller_Action
if (Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
foreach ($user->ContactPaymenttype as $Paymenttype) {
array_push($this->view->paymenttypecontact, $Paymenttype->Paymenttype->toArray());
@@ -1427,7 +1744,10 @@ class BasketController extends TP_Controller_Action
$mode = new Zend_Session_Namespace('adminmode');
if ($mode->over_ride_contact != false && $mode->over_ride_contact != 'new') {
- $contact = Doctrine_Query::create()->from('Contact c')->where('c.id = ?', array($mode->over_ride_contact))->fetchOne();
+ $contact = Doctrine_Query::create()
+ ->from('Contact c')
+ ->where('c.id = ?', array($mode->over_ride_contact))
+ ->fetchOne();
foreach ($contact->ContactPaymenttype as $Paymenttype) {
array_push($this->view->paymenttypecontact, $Paymenttype->Paymenttype->toArray());
@@ -1446,7 +1766,7 @@ class BasketController extends TP_Controller_Action
public function offerAction()
{
- if(!$this->_getParam('full_layout', false)) {
+ if (!$this->_getParam('full_layout', false)) {
$this->_helper->layout->setLayout('simple');
}
@@ -1463,34 +1783,39 @@ class BasketController extends TP_Controller_Action
$this->view->gutschein = false;
- if ($basket->getGutschein() != "") {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->where(
- 'a.shop_id = ? AND c.uuid = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?', array(
- $this->shop->id,
- $basket->getGutschein(), date('Y-m-d'), date('Y-m-d')
+ if ($basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->where(
+ 'a.shop_id = ? AND c.uuid = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->shop->id,
+ $basket->getGutschein(),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
$this->view->gutschein = $gutscheincode->CreditSystem;
}
if ($this->getRequest()->isPost()) {
- if($this->getRequest()->getParam('company', false)) {
- $basket->setOfferContact(
- array(
- 'company' => $this->getRequest()->getParam('company', ''),
- 'salutation' => $this->getRequest()->getParam('salutation', ''),
- 'firstname' => $this->getRequest()->getParam('firstname', ''),
- 'lastname' => $this->getRequest()->getParam('lastname', ''),
- 'street' => $this->getRequest()->getParam('street', ''),
- 'zip' => $this->getRequest()->getParam('zip', ''),
- 'city' => $this->getRequest()->getParam('city', ''),
- 'country' => $this->getRequest()->getParam('country', ''),
- 'ust_id' => $this->getRequest()->getParam('ust_id', ''),
- 'email' => $this->getRequest()->getParam('email', ''),
- 'title' => $this->getRequest()->getParam('title', '')
- )
- );
+ if ($this->getRequest()->getParam('company', false)) {
+ $basket->setOfferContact(array(
+ 'company' => $this->getRequest()->getParam('company', ''),
+ 'salutation' => $this->getRequest()->getParam('salutation', ''),
+ 'firstname' => $this->getRequest()->getParam('firstname', ''),
+ 'lastname' => $this->getRequest()->getParam('lastname', ''),
+ 'street' => $this->getRequest()->getParam('street', ''),
+ 'zip' => $this->getRequest()->getParam('zip', ''),
+ 'city' => $this->getRequest()->getParam('city', ''),
+ 'country' => $this->getRequest()->getParam('country', ''),
+ 'ust_id' => $this->getRequest()->getParam('ust_id', ''),
+ 'email' => $this->getRequest()->getParam('email', ''),
+ 'title' => $this->getRequest()->getParam('title', ''),
+ ));
}
if ($this->getRequest()->getParam('step') == 1) {
$basket->generateOfferNumber();
@@ -1500,7 +1825,6 @@ class BasketController extends TP_Controller_Action
if ($this->getRequest()->getParam('step') == 3) {
TP_Queue::process('basket_send_offer', 'global', $basket);
-
$order = new Orders();
$order->Shop = $this->shop;
$order->Account = $this->shop->Acc;
@@ -1512,30 +1836,27 @@ class BasketController extends TP_Controller_Action
$order->gutscheinabzug = $basket->getGutscheinAbzug();
$order->gutscheinabzugtyp = $basket->getGutscheinAbzugTyp();
-
$m = TP_Mongo::getInstance();
$obj = $m->Shop->findOne(array('uid' => $this->shop->id));
- if(!$obj) {
- $obj = $m->Shop->findOne(array('uid' => (string)$this->shop->id));
+ if (!$obj) {
+ $obj = $m->Shop->findOne(array('uid' => (string) $this->shop->id));
}
if ($obj !== null && $obj['offerOwnNumber']) {
-
$templates = array('template' => $obj['offerNumberPattern']);
$twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader($templates));
- $order->alias = $twig->render('template', array('number'=> $obj['offerNumberStart']));
- $obj['offerNumberStart'] +=1;
- $m->Shop->updateOne(array('uid' => $obj['uid']), [ '$set' => $obj]);
-
- }else{
- $obj = $m->Instance->findOne(array('appId' => "1"));
+ $order->alias = $twig->render('template', array('number' => $obj['offerNumberStart']));
+ $obj['offerNumberStart'] += 1;
+ $m->Shop->updateOne(array('uid' => $obj['uid']), ['$set' => $obj]);
+ } else {
+ $obj = $m->Instance->findOne(array('appId' => '1'));
$templates = array('template' => $obj['offerNumberPattern']);
$twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader($templates));
$order->alias = $twig->render('template', array('number' => $obj['offerNumberStart']));
$obj['offerNumberStart'] += 1;
- $m->Instance->updateOne(array('appId' => "1"), [ '$set' => $obj]);
+ $m->Instance->updateOne(array('appId' => '1'), ['$set' => $obj]);
}
$order->mongoLoaded = true;
$order->status = 10;
@@ -1558,7 +1879,7 @@ class BasketController extends TP_Controller_Action
$order->setInvoiceAddressSaved($contactAddress->getOrderSaveArray());
$order->setSenderAddressSaved($contactAddress->getOrderSaveArray());
- $order->preis = ($basket->getPreisNetto() + $basket->getZahlkosten() + $basket->getVersandkosten());
+ $order->preis = $basket->getPreisNetto() + $basket->getZahlkosten() + $basket->getVersandkosten();
$order->preissteuer = $basket->getPreisSteuer();
$order->preisbrutto = $basket->getPreisBrutto();
$order->zahlkosten = $basket->getZahlkosten();
@@ -1572,14 +1893,15 @@ class BasketController extends TP_Controller_Action
$posId = 1;
/**
- * @var TP_Basket_Item $artikel
-*/
+ * @var TP_Basket_Item $artikel
+ */
foreach ($basket->getAllArtikel() as $artikel) {
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $artikel->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $artikel->getArticleId(),
+ ))
+ ->fetchOne();
$art = new Orderspos();
$art->Shop = $this->shop;
@@ -1623,26 +1945,26 @@ class BasketController extends TP_Controller_Action
}
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "offer_create",
- "data" => ["order" => $order->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'offer_create',
+ 'data' => ['order' => $order->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
$this->view->step1 = false;
$this->view->step2 = true;
$this->view->send = true;
}
if ($this->getRequest()->getParam('step') == 2 || $this->view->step2) {
-
if ($this->_request->getParam('shippingtype') == 0 && $this->getRequest()->getParam('step') != 3) {
$basket->setShippingtype(0);
$basket->setPreisNetto($basket->getProduktPreisNetto());
$basket->setPreisSteuer($basket->getProduktPreisSteuer());
- $basket->setPreisBrutto($basket->getProduktPreisSteuer() + $basket->getProduktPreisNetto()- ($basket->getGutscheinAbzug() * 1));
+ $basket->setPreisBrutto(
+ ($basket->getProduktPreisSteuer() + $basket->getProduktPreisNetto()) -
+ ($basket->getGutscheinAbzug() * 1),
+ );
$basket->setVersandkosten(0);
$basket->setVersandBrutto(0);
} else {
@@ -1653,49 +1975,72 @@ class BasketController extends TP_Controller_Action
}
$versand = 0;
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )', array(
- $shippingtype, $basket->getWeight(), $basket->getWeight()
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.id = ? AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ?) )',
+ array(
+ $shippingtype,
+ $basket->getWeight(),
+ $basket->getWeight(),
+ ),
)
- )->fetchOne();
-
+ ->fetchOne();
$basket->setShippingtype($shippingtype['id']);
$this->view->shippingselected = $shippingtype['id'];
$this->view->shippingtypeselected = $shippingtype;
if ($shippingtype) {
if ($basket->getOfferContact()['zip'] == '') {
- $versand = $shippingtype->calcVersand($basket->getProduktPreisNetto(), $basket->getWeight(), $basket->getWeight(), $basket->getOfferContact()['country'], $this->user, 17506);
+ $versand = $shippingtype->calcVersand(
+ $basket->getProduktPreisNetto(),
+ $basket->getWeight(),
+ $basket->getWeight(),
+ $basket->getOfferContact()['country'],
+ $this->user,
+ 17506,
+ );
} else {
- $versand = $shippingtype->calcVersand($basket->getProduktPreisNetto(), $basket->getWeight(), $basket->getWeight(), $basket->getOfferContact()['country'], $this->user, $basket->getOfferContact()['zip']);
+ $versand = $shippingtype->calcVersand(
+ $basket->getProduktPreisNetto(),
+ $basket->getWeight(),
+ $basket->getWeight(),
+ $basket->getOfferContact()['country'],
+ $this->user,
+ $basket->getOfferContact()['zip'],
+ );
}
}
- $mwert = ($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert']));
+ $mwert = ($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert']));
$basket->setPreisNetto($basket->getProduktPreisNetto() + $versand);
$basket->setPreisSteuer($basket->getProduktPreisSteuer() + $mwert);
- $basket->setPreisBrutto($basket->getPreisNetto() + $basket->getPreisSteuer() - ($basket->getGutscheinAbzug() * 1));
+ $basket->setPreisBrutto(
+ ($basket->getPreisNetto() + $basket->getPreisSteuer()) - ($basket->getGutscheinAbzug() * 1),
+ );
$basket->setVersandkosten($versand);
$basket->setVersandBrutto($versand + $mwert);
}
- $cur = new Zend_Currency(Zend_Registry::get('locale')->getLanguage() . '_' . Zend_Registry::get('locale')->getRegion());
+ $cur = new Zend_Currency(
+ Zend_Registry::get('locale')->getLanguage() . '_' . Zend_Registry::get('locale')->getRegion(),
+ );
$this->view->contact = $basket->getOfferContact();
$this->view->positions = array();
-
/**
* @var String $uuid
* @var TP_Basket_Item $art
*/
foreach ($basket->getAllArtikel() as $uuid => $art) {
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $art->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $art->getArticleId(),
+ ))
+ ->fetchOne();
$options = array();
@@ -1708,8 +2053,7 @@ class BasketController extends TP_Controller_Action
}
$gewichtpos = $art->getWeight();
- array_push(
- $this->view->positions, array(
+ array_push($this->view->positions, array(
'uuid' => $uuid,
'article' => $article,
'basketarticle' => $art,
@@ -1719,21 +2063,17 @@ class BasketController extends TP_Controller_Action
'price' => array(
'netto' => $cur->toCurrency(1 * $art->getNetto()),
'steuer' => $cur->toCurrency(1 * $art->getSteuer()),
- 'brutto' => $cur->toCurrency(1 * $art->getBrutto())
- )
- )
- );
+ 'brutto' => $cur->toCurrency(1 * $art->getBrutto()),
+ ),
+ ));
}
-
-
$this->view->step1 = false;
$this->view->step2 = true;
}
}
}
-
public function printofferAction()
{
$this->view->success = true;
@@ -1742,11 +2082,13 @@ class BasketController extends TP_Controller_Action
$shop = $this->shop;
- $reportPath = Zend_Registry::get('shop_path') . "/reports/";
+ $reportPath = Zend_Registry::get('shop_path') . '/reports/';
$what = 'offer_basket';
- $currency = new Zend_Currency(Zend_Registry::get('locale')->getLanguage() . '_' . Zend_Registry::get('locale')->getRegion());
+ $currency = new Zend_Currency(
+ Zend_Registry::get('locale')->getLanguage() . '_' . Zend_Registry::get('locale')->getRegion(),
+ );
$tmpWert = array();
@@ -1755,15 +2097,13 @@ class BasketController extends TP_Controller_Action
}
$params = array(
- 'order' =>
- array(
+ 'order' => array(
'alias' => $this->view->shop->basket_offer_number,
'basketfield1' => $basket->getBasketField1(),
- 'basketfield2' => $basket->getBasketField2()
+ 'basketfield2' => $basket->getBasketField2(),
),
'netto' => $currency->toCurrency($basket->getPreisBrutto() - $basket->getPreisSteuer()),
- 'brutto' => $currency->toCurrency($basket->getPreisBrutto())
-
+ 'brutto' => $currency->toCurrency($basket->getPreisBrutto()),
);
$params['mwerttable'] = $tmpWert;
@@ -1794,46 +2134,54 @@ class BasketController extends TP_Controller_Action
$reportPath = APPLICATION_PATH . '/design/clients/' . $this->shop->uid . '/reports/';
}
- if ($this->shop->market == 1 && $this->shop->reportsite1 == "") {
+ if ($this->shop->market == 1 && $this->shop->reportsite1 == '') {
+ $shop = Doctrine_Query::create()
+ ->select()
+ ->from('Shop s')
+ ->where('s.id = ?', array($this->Install->defaultmarket))
+ ->fetchOne();
- $shop = Doctrine_Query::create()->select()->from('Shop s')->where('s.id = ?', array($this->Install->defaultmarket))->fetchOne();
-
- $reportPath = APPLICATION_PATH . "/design/clients/" . $shop->uid . "/reports/";
- } elseif (!file_exists(Zend_Registry::get('shop_path') . "/reports/" . $what . ".jrxml")) {
- if (!file_exists(Zend_Registry::get('shop_path') . "/reports")) {
- mkdir(Zend_Registry::get('shop_path') . "/reports", 0777, true);
+ $reportPath = APPLICATION_PATH . '/design/clients/' . $shop->uid . '/reports/';
+ } elseif (!file_exists(Zend_Registry::get('shop_path') . '/reports/' . $what . '.jrxml')) {
+ if (!file_exists(Zend_Registry::get('shop_path') . '/reports')) {
+ mkdir(Zend_Registry::get('shop_path') . '/reports', 0777, true);
}
- if (!file_exists(Zend_Registry::get('layout_path') . "/reports/" . $what . ".jrxml")) {
-
+ if (!file_exists(Zend_Registry::get('layout_path') . '/reports/' . $what . '.jrxml')) {
return false;
}
- copy(Zend_Registry::get('layout_path') . "/reports/" . $what . ".jrxml", Zend_Registry::get('shop_path') . "/reports/" . $what . ".jrxml");
+ copy(
+ Zend_Registry::get('layout_path') . '/reports/' . $what . '.jrxml',
+ Zend_Registry::get('shop_path') . '/reports/' . $what . '.jrxml',
+ );
}
- if ($basket->getDelivery() != "") {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getDelivery()
- )
- )->fetchOne();
+ if ($basket->getDelivery() != '') {
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getDelivery(),
+ ))
+ ->fetchOne();
$params['deliveryAddress'] = $contactaddress->toArray();
}
- if ($basket->getInvoice() != "") {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getInvoice()
- )
- )->fetchOne();
+ if ($basket->getInvoice() != '') {
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getInvoice(),
+ ))
+ ->fetchOne();
$params['invoiceAddress'] = $contactaddress->toArray();
}
- if ($basket->getSender() != "") {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getSender()
- )
- )->fetchOne();
+ if ($basket->getSender() != '') {
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getSender(),
+ ))
+ ->fetchOne();
$params['senderAddress'] = $contactaddress->toArray();
}
$i = 1;
@@ -1841,12 +2189,12 @@ class BasketController extends TP_Controller_Action
$helper = new TP_View_Helper_Article();
foreach ($basket->getAllArtikel() as $artikel) {
-
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $artikel->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $artikel->getArticleId(),
+ ))
+ ->fetchOne();
if ($article->a6_org_article != 0) {
$options = $article->OrgArticle->getOptArray($artikel, false);
@@ -1854,11 +2202,17 @@ class BasketController extends TP_Controller_Action
$options = $article->getOptArray($artikel, false);
}
- array_push(
- $data, array(
- 'article' => $article->toArray(), 'name' => $artikel->getArticleName(), 'count' => $artikel->getCount(), 'options' => implode(' | ', $options), 'options_array' => $options, 'pos' => $i, 'obj' => $artikel, 'priceall' => $currency->toCurrency($artikel->getNetto() * $artikel->getCount()), 'articletype' => $helper->getNearest($article, array(431))->title
- )
- );
+ array_push($data, array(
+ 'article' => $article->toArray(),
+ 'name' => $artikel->getArticleName(),
+ 'count' => $artikel->getCount(),
+ 'options' => implode(' | ', $options),
+ 'options_array' => $options,
+ 'pos' => $i,
+ 'obj' => $artikel,
+ 'priceall' => $currency->toCurrency($artikel->getNetto() * $artikel->getCount()),
+ 'articletype' => $helper->getNearest($article, array(431))->title,
+ ));
$i++;
if (!isset($params['shippingtype']) && $artikel->getShippingtype() != false) {
@@ -1875,86 +2229,99 @@ class BasketController extends TP_Controller_Action
$this->view->clearVars();
try {
- $file = new TP_Rdl(
- $reportPath,
- $what . ".jrxml",
- 1,
- $params,
- $data
- );
+ $file = new TP_Rdl($reportPath, $what . '.jrxml', 1, $params, $data);
$background = false;
- if ($what == "label" && $shop->report_background_label) {
+ if ($what == 'label' && $shop->report_background_label) {
$background = true;
- } elseif ($what == "jobtiket" && $shop->report_background_job) {
+ } elseif ($what == 'jobtiket' && $shop->report_background_job) {
$background = true;
- } elseif ($what == "invoice" && $shop->report_background_invoice) {
+ } elseif ($what == 'invoice' && $shop->report_background_invoice) {
$background = true;
- } elseif ($what == "delivery" && $shop->report_background_delivery) {
+ } elseif ($what == 'delivery' && $shop->report_background_delivery) {
$background = true;
- } elseif ($what == "offer" && $shop->report_background_offer) {
+ } elseif ($what == 'offer' && $shop->report_background_offer) {
$background = true;
- } elseif ($what == "order" && $shop->report_background_order) {
+ } elseif ($what == 'order' && $shop->report_background_order) {
$background = true;
}
- $host = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no'))) ? 'https' : 'http';
+ $host = isset($_SERVER['HTTPS']) &&
+ $_SERVER['HTTPS'] &&
+ !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no'))
+ ? 'https'
+ : 'http';
$host .= '://' . $_SERVER['HTTP_HOST'];
-
- if ($shop->reportsite1 != "" && $background) {
+ if ($shop->reportsite1 != '' && $background) {
$pdf = Doctrine_Query::create()
->from('Image as i')
- ->where('i.id = ?')->fetchOne(array($shop->reportsite1));
+ ->where('i.id = ?')
+ ->fetchOne(array($shop->reportsite1));
if (!file_exists(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite1 . '.jpg')) {
- $fileDownload = 'https://cdn.shopsrv.de/' . TP_Util::encode($host . '/' . $pdf->path) . '?w=2480&fm=jpg';
+ $fileDownload =
+ 'https://cdn.shopsrv.de/' . TP_Util::encode($host . '/' . $pdf->path) . '?w=2480&fm=jpg';
- file_put_contents(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite1 . '.jpg', file_get_contents($fileDownload));
+ file_put_contents(
+ PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite1 . '.jpg',
+ file_get_contents($fileDownload),
+ );
}
-
$file->addSubmittals(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite1 . '.jpg');
}
- if ($shop->reportsite2 != "" && $background) {
+ if ($shop->reportsite2 != '' && $background) {
$pdf = Doctrine_Query::create()
->from('Image as i')
- ->where('i.id = ?')->fetchOne(array($shop->reportsite2));
+ ->where('i.id = ?')
+ ->fetchOne(array($shop->reportsite2));
if (!file_exists(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite2 . '.jpg')) {
- $fileDownload = 'https://cdn.shopsrv.de/' . TP_Util::encode($host . '/' . $pdf->path) . '?w=2480&fm=jpg';
+ $fileDownload =
+ 'https://cdn.shopsrv.de/' . TP_Util::encode($host . '/' . $pdf->path) . '?w=2480&fm=jpg';
- file_put_contents(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite2 . '.jpg', file_get_contents($fileDownload));
+ file_put_contents(
+ PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite2 . '.jpg',
+ file_get_contents($fileDownload),
+ );
}
-
$file->addSubmittals(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->reportsite2 . '.jpg');
}
- if ($shop->report_agb != "" && $background) {
+ if ($shop->report_agb != '' && $background) {
$pdf = Doctrine_Query::create()
->from('Image as i')
- ->where('i.id = ?')->fetchOne(array($shop->report_agb));
-
+ ->where('i.id = ?')
+ ->fetchOne(array($shop->report_agb));
if (!file_exists(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->report_agb . '.jpg')) {
- $fileDownload = 'https://cdn.shopsrv.de/' . TP_Util::encode($host . '/' . $pdf->path) . '?w=2480&fm=jpg';
+ $fileDownload =
+ 'https://cdn.shopsrv.de/' . TP_Util::encode($host . '/' . $pdf->path) . '?w=2480&fm=jpg';
-
-
- file_put_contents(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->report_agb . '.jpg', file_get_contents($fileDownload));
+ file_put_contents(
+ PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->report_agb . '.jpg',
+ file_get_contents($fileDownload),
+ );
}
-
$file->setAgb(PUBLIC_PATH . '/temp/thumb/' . $shop->uid . '/' . $shop->report_agb . '.jpg');
}
- if (!file_exists(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id)) {
+ if (!file_exists(APPLICATION_PATH . '/../data/custom/' . $shop->id)) {
mkdir(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id);
}
$alias = Zend_Session::getId();
- $file->export(new TP_Rdl_Renderer_Pdf(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id . "/" . $alias . '_' . $what . '.pdf'));
+ $file->export(new TP_Rdl_Renderer_Pdf(APPLICATION_PATH .
+ '/../data/customerdocs/' .
+ $shop->id .
+ '/' .
+ $alias .
+ '_' .
+ $what .
+ '.pdf'));
} catch (Exception $e) {
Zend_Registry::get('log')->ERR($e->getMessage());
return false;
@@ -1966,31 +2333,32 @@ class BasketController extends TP_Controller_Action
header('Content-Disposition: attachment; filename="offer.pdf"');
// Die originale PDF Datei heißt original.pdf
- readfile(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id . "/" . $alias . '_' . $what . '.pdf');
- unlink(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id . "/" . $alias . '_' . $what . '.pdf');
+ readfile(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id . '/' . $alias . '_' . $what . '.pdf');
+ unlink(APPLICATION_PATH . '/../data/customerdocs/' . $shop->id . '/' . $alias . '_' . $what . '.pdf');
die();
}
public function doneAction()
{
if ($this->_getParam('uuid', false)) {
- $order = Doctrine_Query::create()->from('Orders c')->where(
- 'c.id = ?', array(
- $this->_getParam('uuid', false)
- )
- )->fetchOne();
-
+ $order = Doctrine_Query::create()
+ ->from('Orders c')
+ ->where('c.id = ?', array(
+ $this->_getParam('uuid', false),
+ ))
+ ->fetchOne();
$this->view->order = $order;
$this->view->contact = $order->Contact;
$this->view->payment = $order->Paymenttype;
}
if ($this->_getParam('id', false)) {
- $order = Doctrine_Query::create()->from('Orders c')->where(
- 'c.id = ?', array(
- $this->_getParam('id', false)
- )
- )->fetchOne();
+ $order = Doctrine_Query::create()
+ ->from('Orders c')
+ ->where('c.id = ?', array(
+ $this->_getParam('id', false),
+ ))
+ ->fetchOne();
$this->view->order = $order;
$this->view->contact = $order->Contact;
@@ -2089,54 +2457,65 @@ class BasketController extends TP_Controller_Action
$creditSystemArticleGroupId = [];
$creditSystemArticleId = [];
$creditSystemRecord = null;
- $creditSystemUUID = "";
+ $creditSystemUUID = '';
- if ($this->_getParam('gutscheincode') != "" || $basket->getGutschein() != "") {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->andWhere(
- 'a.shop_id = ? AND c.uuid = ? AND a.f <= ? AND a.t >= ?', array(
- $this->shop->id,
- ($basket->getGutschein() != "" && !$this->_getParam('gutscheincode', false)) ? $basket->getGutschein() : $this->_getParam('gutscheincode'), date('Y-m-d'), date('Y-m-d')
- )
- )->fetchOne();
+ if ($this->_getParam('gutscheincode') != '' || $basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->andWhere('a.shop_id = ? AND c.uuid = ? AND a.f <= ? AND a.t >= ?', array(
+ $this->shop->id,
+ $basket->getGutschein() != '' && !$this->_getParam('gutscheincode', false)
+ ? $basket->getGutschein()
+ : $this->_getParam('gutscheincode'),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ))
+ ->fetchOne();
- $gutscheincodeEverySame = Doctrine_Query::create()->from('CreditSystem a')->where(
- 'a.shop_id = ? AND a.pre_code = ? AND a.f <= ? AND a.t >= ?', array(
- $this->shop->id,
- ($basket->getGutschein() != "") ? $basket->getGutschein() : $this->_getParam('gutscheincode'), date('Y-m-d'), date('Y-m-d')
- )
- )->fetchOne();
+ $gutscheincodeEverySame = Doctrine_Query::create()
+ ->from('CreditSystem a')
+ ->where('a.shop_id = ? AND a.pre_code = ? AND a.f <= ? AND a.t >= ?', array(
+ $this->shop->id,
+ $basket->getGutschein() != '' ? $basket->getGutschein() : $this->_getParam('gutscheincode'),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ))
+ ->fetchOne();
- if (($gutscheincodeEverySame && $gutscheincodeEverySame == false) || ($gutscheincode && $gutscheincode->used == true && $gutscheincode->CreditSystem->more == false)) {
+ if (
+ $gutscheincodeEverySame && $gutscheincodeEverySame == false ||
+ $gutscheincode && $gutscheincode->used == true && $gutscheincode->CreditSystem->more == false
+ ) {
$this->view->errorGutscheincode = true;
- $basket->setGutschein("");
+ $basket->setGutschein('');
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
return $this->redirectSpeak('/basket');
}
- if($gutscheincodeEverySame && $gutscheincodeEverySame->more) {
+ if ($gutscheincodeEverySame && $gutscheincodeEverySame->more) {
$creditSystemRecord = $gutscheincodeEverySame;
- }elseif($gutscheincode) {
+ } elseif ($gutscheincode) {
$creditSystemRecord = $gutscheincode->CreditSystem;
}
$creditSystemUUID = $creditSystemRecord->id;
$creditSystemValue = $creditSystemRecord->wert;
$creditSystemMinBasketValue = $creditSystemRecord->min_basket_value;
- $creditSystemPercent = (bool)$creditSystemRecord->percent;
- $creditSystemPayment = (bool)$creditSystemRecord->payment;
- $creditSystemShipping = (bool)$creditSystemRecord->shipping;
- $creditSystemZeroPayment = (bool)$creditSystemRecord->zeroPayment;
- $creditSystemZeroShipping = (bool)$creditSystemRecord->zeroShipping;
- if($creditSystemRecord->product_id != null && trim($creditSystemRecord->product_id) != "") {
+ $creditSystemPercent = (bool) $creditSystemRecord->percent;
+ $creditSystemPayment = (bool) $creditSystemRecord->payment;
+ $creditSystemShipping = (bool) $creditSystemRecord->shipping;
+ $creditSystemZeroPayment = (bool) $creditSystemRecord->zeroPayment;
+ $creditSystemZeroShipping = (bool) $creditSystemRecord->zeroShipping;
+ if ($creditSystemRecord->product_id != null && trim($creditSystemRecord->product_id) != '') {
$creditSystemArticleId = explode(',', str_replace(' ', '', $creditSystemRecord->product_id));
}
- if($creditSystemRecord->articlegroup_id != null && trim($creditSystemRecord->articlegroup_id) != "") {
+ if ($creditSystemRecord->articlegroup_id != null && trim($creditSystemRecord->articlegroup_id) != '') {
$creditSystemArticleGroupId = explode(',', str_replace(' ', '', $creditSystemRecord->articlegroup_id));
}
$creditSystemRest = $creditSystemValue;
$basket->setGutscheinAbzugTyp(TP_Basket::GUTSCHEIN_ALL);
}
-
$basket->setGutscheinAbzug(0);
$basket->setGutscheinAbzugNetto(0);
$basket->setGutscheinAbzugMwSt([]);
@@ -2145,17 +2524,17 @@ class BasketController extends TP_Controller_Action
* @var TP_Basket_Item $art
*/
foreach ($articles as $uuid => $art) {
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $art->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $art->getArticleId(),
+ ))
+ ->fetchOne();
- if(isset($art->getRabatte()['calc_voucher'])) {
- $calcVoucher = $calcVoucher+$art->getRabatte()['calc_voucher'];
+ if (isset($art->getRabatte()['calc_voucher'])) {
+ $calcVoucher = $calcVoucher + $art->getRabatte()['calc_voucher'];
}
-
$field = 'a1_xml';
$options = array();
@@ -2165,94 +2544,127 @@ class BasketController extends TP_Controller_Action
$options = $article->getOptArray($art, false);
}
$gewicht += $art->getWeight();
- if($gewichtLargestOnRoll == 0 || $gewichtLargestOnRoll < $art->getWeight()) {
+ if ($gewichtLargestOnRoll == 0 || $gewichtLargestOnRoll < $art->getWeight()) {
$gewichtLargestOnRoll = $art->getWeight();
}
$gewichtpos = $art->getWeight();
- if (($this->getRequest()->isPost() && $this->_request->getParam('ref_' . $uuid) != '')) {
+ if ($this->getRequest()->isPost() && $this->_request->getParam('ref_' . $uuid) != '') {
$art->setRef($this->_request->getParam('ref_' . $uuid));
$this->view->priorityMessenger('Erfolgreich gesetzt', 'success');
}
- if (($this->getRequest()->isPost() && $this->_request->getParam('kst_' . $uuid) != '')) {
+ if ($this->getRequest()->isPost() && $this->_request->getParam('kst_' . $uuid) != '') {
$art->setKst($this->_request->getParam('kst_' . $uuid));
$this->view->priorityMessenger('Erfolgreich gesetzt', 'success');
}
- if (($this->getRequest()->isPost() && $this->_request->getParam('count_' . $uuid) != '')) {
+ if ($this->getRequest()->isPost() && $this->_request->getParam('count_' . $uuid) != '') {
$art->setCount($this->_request->getParam('count_' . $uuid));
}
-
/**
- Versandart Berechnung
+ * Versandart Berechnung
**/
$shippingtype_pos = array();
if ($this->shop->shipping_mode >= 2) {
- if (($this->getRequest()->isPost() && $this->_request->getParam('shippingtype_' . $uuid) != '') || $art->getShippingtype() != 0) {
-
+ if (
+ $this->getRequest()->isPost() && $this->_request->getParam('shippingtype_' . $uuid) != '' ||
+ $art->getShippingtype() != 0
+ ) {
if ($this->getRequest()->isPost() && $this->_request->getParam('shippingtype_' . $uuid) != '') {
$shippingtype = $this->_request->getParam('shippingtype_' . $uuid);
} else {
$shippingtype = $art->getShippingtype();
}
- $shippingtype_pos = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.id = ?', array(
- $shippingtype
- )
- )->fetchOne();
+ $shippingtype_pos = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where('c.id = ?', array(
+ $shippingtype,
+ ))
+ ->fetchOne();
$art->setShippingType($shippingtype_pos['id']);
- $art->setShippingPrice($shippingtype_pos->calcVersand(($art->getnetto() * $art->getCount()), $gewichtpos, $gewichtpos, 'de', $this->user));
- $art->setShippingPriceMWert($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
+ $art->setShippingPrice($shippingtype_pos->calcVersand(
+ $art->getnetto() * $art->getCount(),
+ $gewichtpos,
+ $gewichtpos,
+ 'de',
+ $this->user,
+ ));
+ $art->setShippingPriceMWert(
+ ($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']),
+ );
$versand = $art->getShippingPrice() + $versand;
$mwert = $mwert + $art->getShippingPriceMWert();
- $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] + ($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] +
+ (($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']));
} else {
if ($this->shop->id == $this->shop->Install->defaultmarket) {
- $shippingtype_pos = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )', array(
- $this->shop->id, $art->getWeight(), $art->getWeight()
+ $shippingtype_pos = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )',
+ array(
+ $this->shop->id,
+ $art->getWeight(),
+ $art->getWeight(),
+ ),
)
- )->orderBy('c.pos ASC')->fetchOne();
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
} else {
- $shippingtype_pos = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )', array(
- $this->shop->Install->defaultmarket, $art->getWeight(), $art->getWeight()
+ $shippingtype_pos = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND ( (c.weight_from = 0 AND c.weight_to = 0) OR (c.weight_from <= ? AND c.weight_to >= ?) )',
+ array(
+ $this->shop->Install->defaultmarket,
+ $art->getWeight(),
+ $art->getWeight(),
+ ),
)
- )->orderBy('c.pos ASC')->fetchOne();
+ ->orderBy('c.pos ASC')
+ ->fetchOne();
}
$art->setShippingType($shippingtype_pos['id']);
- $art->setShippingPrice($shippingtype_pos->calcVersand(($art->getnetto() * $art->getCount()), $gewichtpos, $gewichtpos, 'de', $this->user));
+ $art->setShippingPrice($shippingtype_pos->calcVersand(
+ $art->getnetto() * $art->getCount(),
+ $gewichtpos,
+ $gewichtpos,
+ 'de',
+ $this->user,
+ ));
$versand = $art->getShippingPrice() + $versand;
- $mwert = $mwert + ($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
- $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] + ($art->getShippingPrice() / 100 * str_replace('%', '', $shippingtype_pos['mwert']));
+ $mwert =
+ $mwert + (($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype_pos['mwert'])] +
+ (($art->getShippingPrice() / 100) * str_replace('%', '', $shippingtype_pos['mwert']));
}
}
/**
- Ende
+ * Ende
**/
$stockError = false;
$stockErrorCount = 1;
- if ($article->stock && $art->getAuflage() > $article->stock_count && $article->set_config == "") {
+ if ($article->stock && $art->getAuflage() > $article->stock_count && $article->set_config == '') {
$stockError = true;
$stockErrorCount = $article->stock_count;
$this->view->stockError = true;
}
- array_push(
- $temp, array(
+ array_push($temp, array(
'uuid' => $uuid,
'article' => $article,
'stockError' => $stockError,
'stockErrorCount' => $stockErrorCount,
'basketarticle' => $art,
'shippingtype' => $shippingtype_pos,
- 'options' => $options
- )
- );
+ 'options' => $options,
+ ));
if ($article['versand'] == 'Fix') {
if (!$pos_article_versand || $pos_article_versand != $article->id) {
@@ -2264,25 +2676,34 @@ class BasketController extends TP_Controller_Action
$art->setHasGutschein(false);
if ($basket->getGutschein() != '') {
+ $articleGroups = array_keys($article->ArticleGroupArticle->toKeyValueArray(
+ 'articlegroup_id',
+ 'article_id',
+ ));
- $articleGroups = array_keys($article->ArticleGroupArticle->toKeyValueArray('articlegroup_id', 'article_id'));
-
- if((count($creditSystemArticleGroupId) == 0 && count($creditSystemArticleId) == 0) || in_array($article->id, $creditSystemArticleId) || count(array_intersect($articleGroups, $creditSystemArticleGroupId)) > 0) {
+ if (
+ count($creditSystemArticleGroupId) == 0 && count($creditSystemArticleId) == 0 ||
+ in_array($article->id, $creditSystemArticleId) ||
+ count(array_intersect($articleGroups, $creditSystemArticleGroupId)) > 0
+ ) {
$this->view->errorGutscheincode = false;
$prozent = str_replace('%', '', $article->mwert);
if ($creditSystemPercent == true) {
- $abzugNetto = ($art->getNetto() * $art->getCount()) / 100 * $creditSystemValue;
- $abzugBrutto = ($art->getBrutto() * $art->getCount()) / 100 * $creditSystemValue;
+ $abzugNetto = (($art->getNetto() * $art->getCount()) / 100) * $creditSystemValue;
+ $abzugBrutto = (($art->getBrutto() * $art->getCount()) / 100) * $creditSystemValue;
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $abzugBrutto);
$basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $abzugNetto);
- $basket->setGutscheinAbzugMwStKey($prozent, $abzugBrutto-$abzugNetto);
+ $basket->setGutscheinAbzugMwStKey($prozent, $abzugBrutto - $abzugNetto);
} else {
- if($creditSystemRest > $art->getBrutto()) {
+ if ($creditSystemRest > $art->getBrutto()) {
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $art->getBrutto());
$basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $art->getNetto());
- $basket->setGutscheinAbzugMwStKey($prozent, round($art->getNetto()/100*(float)$prozent, 2));
+ $basket->setGutscheinAbzugMwStKey(
+ $prozent,
+ round(($art->getNetto() / 100) * ((float) $prozent), 2),
+ );
$creditSystemRest = $creditSystemRest - $art->getBrutto();
- }else{
+ } else {
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $creditSystemRest);
$creditSystemRest = 0;
}
@@ -2294,15 +2715,20 @@ class BasketController extends TP_Controller_Action
$netto = $netto + ($art->getnetto() * $art->getCount()) + $art->getShippingPrice();
$mwertalle[$prozent] = $mwertalle[$prozent] + ($art->getNetto() * $art->getCount());
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + ($art->getnetto() * $art->getCount()) + ($art->getNetto() * $art->getCount());
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ ($art->getnetto() * $art->getCount()) +
+ ($art->getNetto() * $art->getCount());
} else {
$basket->setGutscheinAbzug(0);
$netto = $netto + ($art->getnetto() * $art->getCount()) + $art->getShippingPrice();
$prozent = str_replace('%', '', $article->mwert);
$mwertalle[$prozent] = $mwertalle[$prozent] + ($art->getNetto() * $art->getCount());
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + ($art->getnetto() * $art->getCount()) + ($art->getNetto() * $art->getCount());
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ ($art->getnetto() * $art->getCount()) +
+ ($art->getNetto() * $art->getCount());
}
-
} else {
$netto = $netto + ($art->getnetto() * $art->getCount()) + $art->getShippingPrice();
$prozent = str_replace('%', '', $article->mwert);
@@ -2313,12 +2739,15 @@ class BasketController extends TP_Controller_Action
$summewarenwert[$prozent] = 0;
}
$mwertalle[$prozent] = $mwertalle[$prozent] + ($art->getNetto() * $art->getCount());
- $summewarenwert[$prozent] = $summewarenwert[$prozent] + ($art->getnetto() * $art->getCount()) + ($art->getNetto() * $art->getCount());
+ $summewarenwert[$prozent] =
+ $summewarenwert[$prozent] +
+ ($art->getnetto() * $art->getCount()) +
+ ($art->getNetto() * $art->getCount());
}
}
$mwert = 0;
- foreach($mwertalle as $key => $wert) {
- $mwert = $mwert + round($wert/100*(float)$key, 2);
+ foreach ($mwertalle as $key => $wert) {
+ $mwert = $mwert + round(($wert / 100) * ((float) $key), 2);
}
$basket->setProduktPreisSteuer($mwert);
$this->view->productmwert = $mwert;
@@ -2326,13 +2755,13 @@ class BasketController extends TP_Controller_Action
$this->view->productnetto = $netto;
$this->view->gutschein = false;
- if ($creditSystemMinBasketValue > 0 && $creditSystemMinBasketValue > ($netto+$mwert)) {
+ if ($creditSystemMinBasketValue > 0 && $creditSystemMinBasketValue > ($netto + $mwert)) {
$this->view->priorityMessenger('Warenwert zu niedrig', 'success');
- $basket->setGutschein("");
- $creditSystemValue=0;
+ $basket->setGutschein('');
+ $creditSystemValue = 0;
}
- if ($basket->getGutschein() != "") {
+ if ($basket->getGutschein() != '') {
$this->view->gutscheincode = $basket->getGutschein();
$this->view->gutschein = $creditSystemRecord;
}
@@ -2342,37 +2771,72 @@ class BasketController extends TP_Controller_Action
$basket->setPreisNetto($netto);
if ($this->shop->shipping_mode == 1) {
- if (($this->getRequest()->isPost() && $this->_request->getParam('shippingtype') != '') || $basket->getShippingtype() != 0) {
-
+ if (
+ $this->getRequest()->isPost() && $this->_request->getParam('shippingtype') != '' ||
+ $basket->getShippingtype() != 0
+ ) {
if ($this->getRequest()->isPost() && $this->_request->getParam('shippingtype') != '') {
$shippingtype = $this->_request->getParam('shippingtype');
} else {
$shippingtype = $basket->getShippingtype();
}
- $shippingtype = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.id = ? AND c.enable=1 AND ( (weight_from = 0 AND weight_to = 0)
- OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )', array(
- $shippingtype, $gewicht, $gewicht, $gewichtLargestOnRoll, $gewichtLargestOnRoll, $basket->getPreisNetto(), $basket->getPreisNetto()
+ $shippingtype = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.id = ? AND c.enable=1 AND ( (weight_from = 0 AND weight_to = 0)
+ OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )',
+ array(
+ $shippingtype,
+ $gewicht,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $gewichtLargestOnRoll,
+ $basket->getPreisNetto(),
+ $basket->getPreisNetto(),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
- if (!$shippingtype || ($basket->getDeliveryCountry() && count($shippingtype->getCountrys()) > 0 && !in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $shippingtype->getCountrys())))) {
-
- $results = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.enable=1 AND ( (weight_from = 0 AND weight_to = 0)
- OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )', array(
- $this->shop->id, $gewicht, $gewicht, $gewichtLargestOnRoll, $gewichtLargestOnRoll, $basket->getPreisNetto(), $basket->getPreisNetto()
+ if (
+ !$shippingtype ||
+ $basket->getDeliveryCountry() &&
+ count($shippingtype->getCountrys()) > 0 &&
+ !in_array(
+ strtolower($basket->getDeliveryCountry()),
+ array_map('strtolower', $shippingtype->getCountrys()),
+ )
+ ) {
+ $results = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.enable=1 AND ( (weight_from = 0 AND weight_to = 0)
+ OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )',
+ array(
+ $this->shop->id,
+ $gewicht,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $gewichtLargestOnRoll,
+ $basket->getPreisNetto(),
+ $basket->getPreisNetto(),
+ ),
)
- )->execute();
+ ->execute();
- foreach($results as $result) {
- if(!$basket->getDeliveryCountry() || count($result->getCountrys()) == 0 || in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $result->getCountrys()))) {
+ foreach ($results as $result) {
+ if (
+ !$basket->getDeliveryCountry() ||
+ count($result->getCountrys()) == 0 ||
+ in_array(
+ strtolower($basket->getDeliveryCountry()),
+ array_map('strtolower', $result->getCountrys()),
+ )
+ ) {
$shippingtype = $result;
break;
}
}
-
}
$basket->setShippingtype($shippingtype['id']);
@@ -2381,52 +2845,122 @@ class BasketController extends TP_Controller_Action
if ($shippingtype) {
$basket->setDeliveryPLZ($this->user->self_zip);
$basket->setDeliveryCountry($this->user->self_country);
- if ($basket->getDelivery() != "") {
- $delivery_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
+ if ($basket->getDelivery() != '') {
+ $delivery_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))
+ ->fetchOne();
$basket->setDeliveryPLZ($delivery_address->zip);
$basket->setDeliveryCountry($delivery_address->country);
}
if (Zend_Auth::getInstance()->hasIdentity()) {
- $versand = $versand + $shippingtype->calcVersand($netto, $gewicht, $gewichtLargestOnRoll, $basket->getDeliveryCountry(), $this->user);
+ $versand =
+ $versand +
+ $shippingtype->calcVersand(
+ $netto,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $basket->getDeliveryCountry(),
+ $this->user,
+ );
} else {
- $versand = $versand + $shippingtype->calcVersand($netto, $gewicht, $gewichtLargestOnRoll, $basket->getDeliveryCountry(), $this->user, 17506);
+ $versand =
+ $versand +
+ $shippingtype->calcVersand(
+ $netto,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $basket->getDeliveryCountry(),
+ $this->user,
+ 17506,
+ );
}
}
if ($versand > 0 || $versandpos > 0) {
$versand = $versand + $versandpos;
}
- if($creditSystemRest > 0 && $creditSystemShipping) {
- $mwert = $mwert + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
- if($creditSystemRest > (round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2) + $versand)) {
- $basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $versand + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2));
+ if ($creditSystemRest > 0 && $creditSystemShipping) {
+ $mwert =
+ $mwert + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
+ if (
+ $creditSystemRest >
+ (
+ round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2) +
+ $versand
+ )
+ ) {
+ $basket->setGutscheinAbzug(
+ $basket->getGutscheinAbzug() +
+ $versand +
+ round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2),
+ );
$basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $versand);
- $basket->setGutscheinAbzugMwStKey((float)str_replace('%', '', $shippingtype['mwert']), round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2));
- $creditSystemRest = $creditSystemRest - $mwert - $versand;
- }else{
+ $basket->setGutscheinAbzugMwStKey(
+ (float) str_replace('%', '', $shippingtype['mwert']),
+ round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2),
+ );
+ $creditSystemRest = ($creditSystemRest - $mwert) - $versand;
+ } else {
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $creditSystemRest);
- $basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $creditSystemRest - round($creditSystemRest/100*(float)str_replace('%', '', $shippingtype['mwert']), 2));
- $basket->setGutscheinAbzugMwStKey((float)str_replace('%', '', $shippingtype['mwert']), round($creditSystemRest/100*(float)str_replace('%', '', $shippingtype['mwert']), 2));
+ $basket->setGutscheinAbzugNetto(
+ ($basket->getGutscheinAbzugNetto() + $creditSystemRest) -
+ round(
+ ($creditSystemRest / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])),
+ 2,
+ ),
+ );
+ $basket->setGutscheinAbzugMwStKey(
+ (float) str_replace('%', '', $shippingtype['mwert']),
+ round(
+ ($creditSystemRest / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])),
+ 2,
+ ),
+ );
}
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand);
- $this->view->versandbrutto = $versand + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
- }else {
- $mwert = $mwert + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand);
- $this->view->versandbrutto = $versand + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + $versand;
+ $this->view->versandbrutto =
+ $versand + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
+ } else {
+ $mwert =
+ $mwert + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + $versand;
+ $this->view->versandbrutto =
+ $versand + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
}
if ($shippingtype['no_payment'] == 1) {
$this->view->no_payment = true;
}
} else {
- $results = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.enable=1 AND c.private=0
- AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )', array(
- $this->shop->id, $gewicht, $gewicht, $gewichtLargestOnRoll, $gewichtLargestOnRoll, $basket->getPreisNetto(), $basket->getPreisNetto()
+ $results = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.enable=1 AND c.private=0
+ AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )',
+ array(
+ $this->shop->id,
+ $gewicht,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $gewichtLargestOnRoll,
+ $basket->getPreisNetto(),
+ $basket->getPreisNetto(),
+ ),
)
- )->orderBy('c.pos ASC')->execute();
+ ->orderBy('c.pos ASC')
+ ->execute();
- foreach($results as $result) {
- if(!$basket->getDeliveryCountry() || count($result->getCountrys()) == 0 || in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $result->getCountrys()))) {
+ foreach ($results as $result) {
+ if (
+ !$basket->getDeliveryCountry() ||
+ count($result->getCountrys()) == 0 ||
+ in_array(
+ strtolower($basket->getDeliveryCountry()),
+ array_map('strtolower', $result->getCountrys()),
+ )
+ ) {
$shippingtype = $result;
break;
}
@@ -2441,11 +2975,12 @@ class BasketController extends TP_Controller_Action
if (Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
foreach ($user->ContactShippingtype as $shipprivate) {
if ($shipprivate->Shippingtype->pos < $shippingtype->pos || $shippingtype == null) {
$shippingtype = $shipprivate->Shippingtype;
@@ -2466,9 +3001,26 @@ class BasketController extends TP_Controller_Action
$this->view->shippingtypeselected = $shippingtype;
if ($shippingtype) {
if (Zend_Auth::getInstance()->hasIdentity()) {
- $versand = $versand + $shippingtype->calcVersand($netto, $gewicht, $gewichtLargestOnRoll, $this->user->self_country, $this->user);
+ $versand =
+ $versand +
+ $shippingtype->calcVersand(
+ $netto,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $this->user->self_country,
+ $this->user,
+ );
} else {
- $versand = $versand + $shippingtype->calcVersand($netto, $gewicht, $gewichtLargestOnRoll, $this->user->self_country, $this->user, 17506);
+ $versand =
+ $versand +
+ $shippingtype->calcVersand(
+ $netto,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $this->user->self_country,
+ $this->user,
+ 17506,
+ );
}
}
@@ -2476,24 +3028,55 @@ class BasketController extends TP_Controller_Action
$versand = $versand + $versandpos;
}
- if($creditSystemRest > 0 && $creditSystemShipping) {
- $mwert = $mwert + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
- if($creditSystemRest > (round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2) + $versand)) {
- $basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $versand + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2));
+ if ($creditSystemRest > 0 && $creditSystemShipping) {
+ $mwert =
+ $mwert + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
+ if (
+ $creditSystemRest >
+ (
+ round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2) +
+ $versand
+ )
+ ) {
+ $basket->setGutscheinAbzug(
+ $basket->getGutscheinAbzug() +
+ $versand +
+ round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2),
+ );
$basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $versand);
- $basket->setGutscheinAbzugMwStKey((float)str_replace('%', '', $shippingtype['mwert']), round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2));
- $creditSystemRest = $creditSystemRest - $mwert - $versand;
- }else{
+ $basket->setGutscheinAbzugMwStKey(
+ (float) str_replace('%', '', $shippingtype['mwert']),
+ round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2),
+ );
+ $creditSystemRest = ($creditSystemRest - $mwert) - $versand;
+ } else {
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $creditSystemRest);
- $basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $creditSystemRest - round($creditSystemRest/100*(float)str_replace('%', '', $shippingtype['mwert']), 2));
- $basket->setGutscheinAbzugMwStKey((float)str_replace('%', '', $shippingtype['mwert']), round($creditSystemRest/100*(float)str_replace('%', '', $shippingtype['mwert']), 2));
+ $basket->setGutscheinAbzugNetto(
+ ($basket->getGutscheinAbzugNetto() + $creditSystemRest) -
+ round(
+ ($creditSystemRest / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])),
+ 2,
+ ),
+ );
+ $basket->setGutscheinAbzugMwStKey(
+ (float) str_replace('%', '', $shippingtype['mwert']),
+ round(
+ ($creditSystemRest / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])),
+ 2,
+ ),
+ );
}
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand);
- $this->view->versandbrutto = $versand + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
- }else{
- $mwert = $mwert + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand);
- $this->view->versandbrutto = $versand + round(($versand / 100 * (float)str_replace('%', '', $shippingtype['mwert'])), 2);
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + $versand;
+ $this->view->versandbrutto =
+ $versand + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
+ } else {
+ $mwert =
+ $mwert + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + $versand;
+ $this->view->versandbrutto =
+ $versand + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
}
if ($shippingtype['no_payment'] == 1) {
@@ -2509,11 +3092,12 @@ class BasketController extends TP_Controller_Action
if (Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
foreach ($user->ContactPaymenttype as $Paymenttype) {
array_push($paymenttypeids, $Paymenttype->paymenttype_id);
@@ -2538,15 +3122,32 @@ class BasketController extends TP_Controller_Action
}
}
$this->view->shippingtype = [];
- $results = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in (' . implode(',', $shippingtypeids) . ')))
- AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )', array(
- $this->shop->id, $gewicht, $gewicht, $gewichtLargestOnRoll, $gewichtLargestOnRoll, $basket->getPreisNetto(), $basket->getPreisNetto()
+ $results = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where(
+ 'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in (' .
+ implode(',', $shippingtypeids) .
+ ')))
+ AND ( (weight_from = 0 AND weight_to = 0) OR (weight_from <= ? AND weight_to >= ? AND mode = 1) OR (weight_from <= ? AND weight_to >= ? AND mode = 2)) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )',
+ array(
+ $this->shop->id,
+ $gewicht,
+ $gewicht,
+ $gewichtLargestOnRoll,
+ $gewichtLargestOnRoll,
+ $basket->getPreisNetto(),
+ $basket->getPreisNetto(),
+ ),
)
- )->orderBy('pos ASC')->execute();
+ ->orderBy('pos ASC')
+ ->execute();
- foreach($results as $result) {
- if(!$basket->getDeliveryCountry() || count($result->getCountrys()) == 0 || in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $result->getCountrys()))) {
+ foreach ($results as $result) {
+ if (
+ !$basket->getDeliveryCountry() ||
+ count($result->getCountrys()) == 0 ||
+ in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $result->getCountrys()))
+ ) {
$this->view->shippingtype[] = $result->toArray();
}
}
@@ -2555,34 +3156,50 @@ class BasketController extends TP_Controller_Action
$this->view->paymenttype = [];
- $payments = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in (' . implode(',', $paymenttypeids) . '))) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )',
- array($this->shop->id, $basket->getPreisNetto(), $basket->getPreisNetto()
+ $payments = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where(
+ 'c.shop_id = ? AND c.enable = 1 AND (c.private = 0 OR (c.private = 1 AND c.id in (' .
+ implode(',', $paymenttypeids) .
+ '))) AND ( (price_from = 0 AND price_to = 0) OR (price_from <= ? AND price_to >= ?) )',
+ array($this->shop->id, $basket->getPreisNetto(), $basket->getPreisNetto()),
)
- )->orderBy('pos ASC')->execute();
+ ->orderBy('pos ASC')
+ ->execute();
foreach ($payments as $payment) {
- if ((count($payment->getShippings()) == 0 || in_array($this->view->shippingselected, (array)$payment->getShippings()))
- && (!$basket->getDeliveryCountry() || count($payment->getCountrys()) == 0 || in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $payment->getCountrys())))
+ if (
+ (
+ count($payment->getShippings()) == 0 ||
+ in_array($this->view->shippingselected, (array) $payment->getShippings())
+ ) &&
+ (
+ !$basket->getDeliveryCountry() ||
+ count($payment->getCountrys()) == 0 ||
+ in_array(
+ strtolower($basket->getDeliveryCountry()),
+ array_map('strtolower', $payment->getCountrys()),
+ )
+ )
) {
$this->view->paymenttype[] = $payment->toArray();
}
}
if ($this->view->no_payment != true) {
- if ($this->getRequest()->isPost() && $this->_request->getParam('paymenttype') != '' || $basket->getPaymentType() != 0) {
-
+ if (
+ $this->getRequest()->isPost() && $this->_request->getParam('paymenttype') != '' ||
+ $basket->getPaymentType() != 0
+ ) {
if ($this->getRequest()->isPost() && $this->_request->getParam('paymenttype') != '') {
$paymenttype = $this->_request->getParam('paymenttype');
} else {
$paymenttype = $basket->getPaymentType();
}
- $paymenttype = array_filter(
- $this->view->paymenttype, function ($obj) use ($paymenttype) {
- return $obj['id'] == $paymenttype;
- }
- );
+ $paymenttype = array_filter($this->view->paymenttype, function ($obj) use ($paymenttype) {
+ return $obj['id'] == $paymenttype;
+ });
if ($paymenttype == null) {
$paymenttype = $this->view->paymenttype[0];
@@ -2594,8 +3211,11 @@ class BasketController extends TP_Controller_Action
$this->view->paymentselected = $paymenttype['id'];
$this->view->paymenttypeselected = $paymenttype;
if ($paymenttype['prozent'] == 1) {
- $this->view->paymentwert = $netto / 100 * $paymenttype['wert'];
- if ($this->install->id == 7 && round($basket->getProduktPreisBrutto(), 2) == round($basket->getGutscheinAbzug(), 2)) {
+ $this->view->paymentwert = ($netto / 100) * $paymenttype['wert'];
+ if (
+ $this->install->id == 7 &&
+ round($basket->getProduktPreisBrutto(), 2) == round($basket->getGutscheinAbzug(), 2)
+ ) {
$this->view->paymentwert = 0;
}
} else {
@@ -2608,36 +3228,64 @@ class BasketController extends TP_Controller_Action
$this->view->paymentselected = $paymenttype['id'];
$this->view->paymenttypeselected = $paymenttype;
if ($paymenttype['prozent'] == 1) {
- $this->view->paymentwert = $netto / 100 * $paymenttype['wert'];
- if ($this->install->id == 7 && round($basket->getProduktPreisBrutto(), 2) == round($basket->getGutscheinAbzug(), 2)) {
+ $this->view->paymentwert = ($netto / 100) * $paymenttype['wert'];
+ if (
+ $this->install->id == 7 &&
+ round($basket->getProduktPreisBrutto(), 2) == round($basket->getGutscheinAbzug(), 2)
+ ) {
$this->view->paymentwert = 0;
}
} else {
$this->view->paymentwert = $paymenttype['wert'];
}
}
- if($creditSystemRest > 0 && $creditSystemPayment) {
- $mwert = ($mwert + round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2));
- if ($creditSystemRest > round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2)) {
- $basket->setGutscheinAbzug($basket->getGutscheinAbzug() + round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2) + $this->view->paymentwert);
+ if ($creditSystemRest > 0 && $creditSystemPayment) {
+ $mwert = $mwert + round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2);
+ if ($creditSystemRest > round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2)) {
+ $basket->setGutscheinAbzug(
+ $basket->getGutscheinAbzug() +
+ round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2) +
+ $this->view->paymentwert,
+ );
$basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $this->view->paymentwert);
- $basket->setGutscheinAbzugMwStKey($paymenttype['mwert'], round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2));
+ $basket->setGutscheinAbzugMwStKey(
+ $paymenttype['mwert'],
+ round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2),
+ );
} else {
$basket->setGutscheinAbzug($basket->getGutscheinAbzug() + $creditSystemRest);
- $basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $creditSystemRest - round($creditSystemRest / 100 * (float)str_replace('%', '', $paymenttype['mwert']), 2));
- $basket->setGutscheinAbzugMwStKey((float)str_replace('%', '', $paymenttype['mwert']), round($creditSystemRest / 100 * (float)str_replace('%', '', $paymenttype['mwert']), 2));
+ $basket->setGutscheinAbzugNetto(
+ ($basket->getGutscheinAbzugNetto() + $creditSystemRest) -
+ round(($creditSystemRest / 100) * ((float) str_replace('%', '', $paymenttype['mwert'])), 2),
+ );
+ $basket->setGutscheinAbzugMwStKey(
+ (float) str_replace('%', '', $paymenttype['mwert']),
+ round(($creditSystemRest / 100) * ((float) str_replace('%', '', $paymenttype['mwert'])), 2),
+ );
}
- $mwertalle[(string)$paymenttype['mwert']] = ($mwertalle[(string)$paymenttype['mwert']] + ($this->view->paymentwert));
- $this->view->paymentwertbrutto = $this->view->paymentwert + round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2);
- }elseif($creditSystemZeroPayment) {
- $basket->setGutscheinAbzug($basket->getGutscheinAbzug() + round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2) + $this->view->paymentwert);
+ $mwertalle[(string) $paymenttype['mwert']] =
+ $mwertalle[(string) $paymenttype['mwert']] + $this->view->paymentwert;
+ $this->view->paymentwertbrutto =
+ $this->view->paymentwert + round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2);
+ } elseif ($creditSystemZeroPayment) {
+ $basket->setGutscheinAbzug(
+ $basket->getGutscheinAbzug() +
+ round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2) +
+ $this->view->paymentwert,
+ );
$basket->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto() + $this->view->paymentwert);
- $basket->setGutscheinAbzugMwStKey($paymenttype['mwert'], round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2));
- $this->view->paymentwertbrutto = $this->view->paymentwert + round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2);
- }else{
- $mwert = round(($mwert + ($this->view->paymentwert / 100 * $paymenttype['mwert'])), 2);
- $mwertalle[(string)$paymenttype['mwert']] = ($mwertalle[(string)$paymenttype['mwert']] + ($this->view->paymentwert));
- $this->view->paymentwertbrutto = $this->view->paymentwert + round(($this->view->paymentwert / 100 * $paymenttype['mwert']), 2);
+ $basket->setGutscheinAbzugMwStKey(
+ $paymenttype['mwert'],
+ round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2),
+ );
+ $this->view->paymentwertbrutto =
+ $this->view->paymentwert + round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2);
+ } else {
+ $mwert = round($mwert + (($this->view->paymentwert / 100) * $paymenttype['mwert']), 2);
+ $mwertalle[(string) $paymenttype['mwert']] =
+ $mwertalle[(string) $paymenttype['mwert']] + $this->view->paymentwert;
+ $this->view->paymentwertbrutto =
+ $this->view->paymentwert + round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2);
}
} else {
$this->view->paymentwert = 0;
@@ -2647,12 +3295,12 @@ class BasketController extends TP_Controller_Action
$this->_helper->layout->setLayout('default');
$tmpMwertAlle = [];
- foreach($mwertalle as $key => $wert) {
- $tmpMwertAlle[$key] = round($wert/100*(float)$key, 2);
+ foreach ($mwertalle as $key => $wert) {
+ $tmpMwertAlle[$key] = round(($wert / 100) * ((float) $key), 2);
}
$mwertalle = $tmpMwertAlle;
- foreach($basket->getGutscheinAbzugMwSt() as $key => $value) {
+ foreach ($basket->getGutscheinAbzugMwSt() as $key => $value) {
$mwertalle[$key] = $mwertalle[$key] - $value;
}
$this->view->productbruttogutschein = 0;
@@ -2668,12 +3316,11 @@ class BasketController extends TP_Controller_Action
$basket->setVersandkosten(0);
$basket->setZahlkosten(0);
} else {
-
$basket->setPreisNetto($netto);
if ($netto > 0) {
- $basket->setPreisBrutto(($netto + $versand + $mwert + $this->view->paymentwert));
+ $basket->setPreisBrutto($netto + $versand + $mwert + $this->view->paymentwert);
} else {
- $basket->setPreisBrutto(($versand + $mwert + $this->view->paymentwert));
+ $basket->setPreisBrutto($versand + $mwert + $this->view->paymentwert);
}
$basket->setVersandkosten($versand);
$basket->setZahlkosten($this->view->paymentwert);
@@ -2684,7 +3331,13 @@ class BasketController extends TP_Controller_Action
unset($mwertalle['0']);
$this->view->mwertalle = $mwertalle;
$this->view->brutto = $basket->getPreisBrutto();
- $basket->setAdditional($this->view->productnetto, $this->view->productbrutto, $this->view->paymentwertbrutto, $this->view->versandbrutto, $mwertalle);
+ $basket->setAdditional(
+ $this->view->productnetto,
+ $this->view->productbrutto,
+ $this->view->paymentwertbrutto,
+ $this->view->versandbrutto,
+ $mwertalle,
+ );
}
if ($netto > 0) {
@@ -2697,7 +3350,7 @@ class BasketController extends TP_Controller_Action
$this->view->weight_brutto = $gewicht;
- if ($this->_getParam('mode', false) && $this->_getParam('mode', false) == "offer") {
+ if ($this->_getParam('mode', false) && $this->_getParam('mode', false) == 'offer') {
$this->redirectSpeak('/basket/offer');
return;
@@ -2706,11 +3359,12 @@ class BasketController extends TP_Controller_Action
public function simplereviewAction()
{
-
$tmp = array();
- if (Zend_Registry::get('locale')->getLanguage() . '_' . Zend_Registry::get('locale')->getRegion() != 'de_DE') {
-
+ if (
+ (Zend_Registry::get('locale')->getLanguage() . '_' . Zend_Registry::get('locale')->getRegion()) !=
+ 'de_DE'
+ ) {
$tmp['1'] = 'International';
$tmp['9037'] = '9037 Airport Seating Division';
$tmp['9035'] = '9035 Asien/Pazifik und Südafrika ';
@@ -2780,7 +3434,6 @@ class BasketController extends TP_Controller_Action
$tmp['8140'] = '8140 Human Resoure Department';
$tmp['8930'] = '8930 Project team Hallenberg';
} else {
-
$tmp['1'] = 'Ausland';
$tmp['9037'] = '9037 Airport Seating Division';
$tmp['9035'] = '9035 Asia/Pacific and South Africa ';
@@ -2806,7 +3459,7 @@ class BasketController extends TP_Controller_Action
$tmp['9300'] = '9300 Ressortleitung Vertrieb National';
$tmp['9310'] = '9310 Showroom Berlin';
$tmp['9160'] = '9160 Showroom Köln';
- $tmp["9390.1"] = '9390 Thomas Lange GmbH & Co KG, Hamburg';
+ $tmp['9390.1'] = '9390 Thomas Lange GmbH & Co KG, Hamburg';
$tmp['9432'] = '9432 Vertrieb Arndt, Gerd';
$tmp['9433'] = '9433 Vertrieb Becker, Jörg';
$tmp['9474'] = '9474 Vertrieb Becker, Petra';
@@ -2853,7 +3506,6 @@ class BasketController extends TP_Controller_Action
$this->view->kostenstellen = $tmp;
-
$this->view->countrys = Zend_Locale::getCountryTranslationList();
if (!Zend_Auth::getInstance()->hasIdentity()) {
@@ -2871,71 +3523,68 @@ class BasketController extends TP_Controller_Action
$this->view->basketfield1 = $basket->getBasketField1();
$this->view->basketfield2 = $basket->getBasketField2();
-
$errors = array();
- if ($this->_request->isPost() && !$this->_getParam("self_lastname", false)) {
- $errors['self_lastname'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_lastname', false)) {
+ $errors['self_lastname'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("self_street", false)) {
- $errors['self_street'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_street', false)) {
+ $errors['self_street'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("self_department", false)) {
- $errors['self_department'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_department', false)) {
+ $errors['self_department'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("self_zip", false)) {
- $errors['self_zip'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_zip', false)) {
+ $errors['self_zip'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("self_city", false)) {
- $errors['self_city'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_city', false)) {
+ $errors['self_city'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("ustid", false)) {
- $errors['ustid'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('ustid', false)) {
+ $errors['ustid'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("self_position", false)) {
- $errors['self_position'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_position', false)) {
+ $errors['self_position'] = 'No Value';
}
- if ($this->_request->isPost() && !$this->_getParam("self_email", false)) {
- $errors['self_email'] = "No Value";
+ if ($this->_request->isPost() && !$this->_getParam('self_email', false)) {
+ $errors['self_email'] = 'No Value';
}
-
- if (empty($errors) && $this->_request->isPost() && $this->_getParam("self_lastname", false)) {
-
- $this->user->ustid = $this->_getParam("ustid");
- $this->user->self_position = $this->_getParam("self_position");
- $this->user->self_anrede = $this->_getParam("self_anrede");
- $this->user->liefer_lastname = $this->_getParam("self_lastname");
- $this->user->liefer_firstname = $this->_getParam("self_firstname");
- $this->user->self_department = $this->_getParam("self_department");
- $this->user->self_street = $this->_getParam("self_street");
- $this->user->street = $this->_getParam("street");
- $this->user->phone_alternative = $this->_getParam("phone_alternative");
- $this->user->self_zip = $this->_getParam("self_zip");
- $this->user->self_city = $this->_getParam("self_city");
- $this->user->self_country = $this->_getParam("self_country");
- $this->user->self_phone = $this->_getParam("self_phone");
- $this->user->email = $this->_getParam("self_email");
+ if (empty($errors) && $this->_request->isPost() && $this->_getParam('self_lastname', false)) {
+ $this->user->ustid = $this->_getParam('ustid');
+ $this->user->self_position = $this->_getParam('self_position');
+ $this->user->self_anrede = $this->_getParam('self_anrede');
+ $this->user->liefer_lastname = $this->_getParam('self_lastname');
+ $this->user->liefer_firstname = $this->_getParam('self_firstname');
+ $this->user->self_department = $this->_getParam('self_department');
+ $this->user->self_street = $this->_getParam('self_street');
+ $this->user->street = $this->_getParam('street');
+ $this->user->phone_alternative = $this->_getParam('phone_alternative');
+ $this->user->self_zip = $this->_getParam('self_zip');
+ $this->user->self_city = $this->_getParam('self_city');
+ $this->user->self_country = $this->_getParam('self_country');
+ $this->user->self_phone = $this->_getParam('self_phone');
+ $this->user->email = $this->_getParam('self_email');
$this->user->save();
- $this->redirectSpeak("/basket/finish");
+ $this->redirectSpeak('/basket/finish');
} else {
if ($this->_request->isPost()) {
- $this->user->ustid = $this->_getParam("ustid");
- $this->user->self_position = $this->_getParam("self_position");
- $this->user->self_anrede = $this->_getParam("self_anrede");
- $this->user->liefer_lastname = $this->_getParam("self_lastname");
- $this->user->liefer_firstname = $this->_getParam("self_firstname");
- $this->user->self_department = $this->_getParam("self_department");
- $this->user->self_street = $this->_getParam("self_street");
- $this->user->street = $this->_getParam("street");
- $this->user->phone_alternative = $this->_getParam("phone_alternative");
- $this->user->self_zip = $this->_getParam("self_zip");
- $this->user->self_city = $this->_getParam("self_city");
- $this->user->self_country = $this->_getParam("self_country");
- $this->user->self_phone = $this->_getParam("self_phone");
- $this->user->email = $this->_getParam("self_email");
+ $this->user->ustid = $this->_getParam('ustid');
+ $this->user->self_position = $this->_getParam('self_position');
+ $this->user->self_anrede = $this->_getParam('self_anrede');
+ $this->user->liefer_lastname = $this->_getParam('self_lastname');
+ $this->user->liefer_firstname = $this->_getParam('self_firstname');
+ $this->user->self_department = $this->_getParam('self_department');
+ $this->user->self_street = $this->_getParam('self_street');
+ $this->user->street = $this->_getParam('street');
+ $this->user->phone_alternative = $this->_getParam('phone_alternative');
+ $this->user->self_zip = $this->_getParam('self_zip');
+ $this->user->self_city = $this->_getParam('self_city');
+ $this->user->self_country = $this->_getParam('self_country');
+ $this->user->self_phone = $this->_getParam('self_phone');
+ $this->user->email = $this->_getParam('self_email');
$this->user->save();
}
}
@@ -2943,10 +3592,8 @@ class BasketController extends TP_Controller_Action
$this->view->formErrors = $errors;
}
-
public function reviewAction()
{
-
$mode = new Zend_Session_Namespace('adminmode');
$basket = new TP_Basket();
if ($this->_getParam('basketfield1')) {
@@ -2962,42 +3609,49 @@ class BasketController extends TP_Controller_Action
$basket->setBic($this->_getParam('bic'));
}
if (!Zend_Auth::getInstance()->hasIdentity()) {
- $this->forwardSpeak(
- 'login', 'user', 'default', array(
- 'mode' => 'basket'
- )
- );
+ $this->forwardSpeak('login', 'user', 'default', array(
+ 'mode' => 'basket',
+ ));
return;
}
if ($mode->over_ride_contact == 'new') {
- $this->forwardSpeak(
- 'register', 'user', 'default', array(
- 'mode' => 'basket'
- )
- );
+ $this->forwardSpeak('register', 'user', 'default', array(
+ 'mode' => 'basket',
+ ));
return;
}
$this->view->basketInfo = $basket->getInfo();
- $this->view->addresses = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 2 AND contact_id = ? AND display = 1', array(
- $this->user->id
- )
- )->limit(100)->execute();
- $this->view->addresses_invoice = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 1 AND contact_id = ? AND display = 1', array(
- $this->user->id
- )
- )->limit(100)->execute();
- $this->view->addresses_sender = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'type = 3 AND contact_id = ? AND display = 1', array(
- $this->user->id
- )
- )->limit(100)->execute();
+ $this->view->addresses = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 2 AND contact_id = ? AND display = 1', array(
+ $this->user->id,
+ ))
+ ->limit(100)
+ ->execute();
+ $this->view->addresses_invoice = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 1 AND contact_id = ? AND display = 1', array(
+ $this->user->id,
+ ))
+ ->limit(100)
+ ->execute();
+ $this->view->addresses_sender = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('type = 3 AND contact_id = ? AND display = 1', array(
+ $this->user->id,
+ ))
+ ->limit(100)
+ ->execute();
$this->view->addresses_delivery = $this->view->addresses;
if ($basket->getDelivery() == 0) {
if ($this->user->standart_delivery == 0) {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND type = 2 AND display = 1', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND type = 2 AND display = 1', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_delivery = $cs->id;
@@ -3031,12 +3685,24 @@ class BasketController extends TP_Controller_Action
}
$basket->setDelivery($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 2 AND s.id = ?', array($this->user->id, $this->user->standart_delivery))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 2 AND s.id = ?', array(
+ $this->user->id,
+ $this->user->standart_delivery,
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setDelivery($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_delivery = $cs->id;
@@ -3072,14 +3738,24 @@ class BasketController extends TP_Controller_Action
}
}
} else {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array(
+ $this->user->id,
+ $basket->getDelivery(),
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setDelivery($cs->uuid);
} else {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 2', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_delivery = $cs->id;
@@ -3116,10 +3792,13 @@ class BasketController extends TP_Controller_Action
}
if ($basket->getInvoice() == 0) {
-
if ($this->user->standart_invoice == 0) {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_invoice = $cs->id;
$this->user->save();
@@ -3152,13 +3831,24 @@ class BasketController extends TP_Controller_Action
}
$basket->setInvoice($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.id = ?', array($this->user->id, $this->user->standart_invoice))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.id = ?', array(
+ $this->user->id,
+ $this->user->standart_invoice,
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setInvoice($cs->uuid);
} else {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_invoice = $cs->id;
$this->user->save();
@@ -3193,13 +3883,24 @@ class BasketController extends TP_Controller_Action
}
}
} else {
-
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array(
+ $this->user->id,
+ $basket->getInvoice(),
+ ))
+ ->fetchOne();
if ($cs) {
$basket->setInvoice($cs->uuid);
} else {
- $cs = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))->limit(1)->fetchOne();
+ $cs = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND type = 1', array($this->user->id))
+ ->limit(1)
+ ->fetchOne();
if ($cs) {
$this->user->standart_invoice = $cs->id;
@@ -3238,9 +3939,21 @@ class BasketController extends TP_Controller_Action
$this->view->invoice = $basket->getInvoice();
$this->view->delivery = $basket->getDelivery();
- $this->view->sender_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getSender()))->fetchOne();
- $this->view->invoice_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))->fetchOne();
- $this->view->delivery_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
+ $this->view->sender_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getSender()))
+ ->fetchOne();
+ $this->view->invoice_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))
+ ->fetchOne();
+ $this->view->delivery_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND display = 1 AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))
+ ->fetchOne();
if ($basket->getSender() == 0 || $this->view->sender_address == null) {
$this->view->sender_address = $this->shop->getOrderSenderSavedAsObject();
@@ -3261,7 +3974,7 @@ class BasketController extends TP_Controller_Action
$basket->setSender(0);
}
- if($this->getRequest()->getParam('delivery') == 'custom') {
+ if ($this->getRequest()->getParam('delivery') == 'custom') {
$basket->setDeliveryMode(TP_Basket::DELIVERY_MODE_CUSTOM);
$basket->setDeliveryAddress([
'country' => 'de',
@@ -3274,8 +3987,8 @@ class BasketController extends TP_Controller_Action
'company' => $this->getRequest()->getParam('delivery_company', false) ?? '',
'company2' => $this->getRequest()->getParam('delivery_company2', false) ?? '',
'email' => $this->getRequest()->getParam('delivery_email', false) ?? '',
- '_doctrine_class_name' => 'PSC\\Shop\\EntityBundle\\Document\\Embed\\ContactAddress'
- ]);
+ '_doctrine_class_name' => 'PSC\\Shop\\EntityBundle\\Document\\Embed\\ContactAddress',
+ ]);
}
if ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') == 's') {
if ($this->getRequest()->getParam('invoice', false)) {
@@ -3289,12 +4002,14 @@ class BasketController extends TP_Controller_Action
$basket->setDeliveryIsSame(true);
$basket->setDeliveryUstid($this->view->sender_address->ustid);
$basket->setDeliveryPLZ($this->view->sender_address->zip);
-//$basket->setSender(0);
+ //$basket->setSender(0);
$this->redirectSpeak('/basket/finish');
- } elseif ($this->getRequest()->getParam('delivery') != '' && $this->getRequest()->getParam('delivery') != 's'
- && $this->getRequest()->getParam('sender') != '' && $this->getRequest()->getParam('invoice') != ''
+ } elseif (
+ $this->getRequest()->getParam('delivery') != '' &&
+ $this->getRequest()->getParam('delivery') != 's' &&
+ $this->getRequest()->getParam('sender') != '' &&
+ $this->getRequest()->getParam('invoice') != ''
) {
-
$basket->setDeliveryIsSame(false);
$basket->setDelivery($this->getRequest()->getParam('delivery'));
$basket->setInvoice($this->getRequest()->getParam('invoice'));
@@ -3318,7 +4033,6 @@ class BasketController extends TP_Controller_Action
}
if (file_exists($this->_configPath . '/user/address.ini')) {
-
$config = new Zend_Config_Ini($this->_configPath . '/user/address.ini', 'add');
if ($config->global) {
$form = new EasyBib_Form($config->user);
@@ -3335,30 +4049,35 @@ class BasketController extends TP_Controller_Action
if (!$form->country->getMultiOptions()) {
$form->country->addMultiOptions($countrys);
}
- $form->country->setValue("DE");
+ $form->country->setValue('DE');
}
- if (!$this->shop->display_sender && isset($form->type) && $form->type instanceof Zend_Form_Element_MultiCheckbox) {
+ if (
+ !$this->shop->display_sender &&
+ isset($form->type) &&
+ $form->type instanceof Zend_Form_Element_MultiCheckbox
+ ) {
$form->type->removeMultiOption('3');
}
-
- if (!$this->shop->display_delivery && isset($form->type) && $form->type instanceof Zend_Form_Element_MultiCheckbox) {
+ if (
+ !$this->shop->display_delivery &&
+ isset($form->type) &&
+ $form->type instanceof Zend_Form_Element_MultiCheckbox
+ ) {
$form->type->removeMultiOption('2');
}
if ($this->_request->isPost()) {
-
$formData = $this->getRequest()->getParams();
if ($form->isValid($formData)) {
-
$contactaddress = new ContactAddress();
$contactaddress->anrede = 1;
- $contactaddress->email = "";
- $contactaddress->mobil_phone = "";
- $contactaddress->company = "";
+ $contactaddress->email = '';
+ $contactaddress->mobil_phone = '';
+ $contactaddress->company = '';
if (isset($formData['anrede'])) {
$contactaddress->anrede = $formData['anrede'];
}
@@ -3399,21 +4118,21 @@ class BasketController extends TP_Controller_Action
if (!$this->_getParam('uuid')) {
if (in_array('1', $formData['type'])) {
$cs = $contactaddress->copy();
- $cs->uuid = "";
+ $cs->uuid = '';
$cs->type = 1;
$cs->save();
$basket->setInvoice($cs->uuid);
}
if (in_array('2', $formData['type'])) {
$cs = $contactaddress->copy();
- $cs->uuid = "";
+ $cs->uuid = '';
$cs->type = 2;
$cs->save();
$basket->setDelivery($cs->uuid);
}
if (in_array('3', $formData['type'])) {
$cs = $contactaddress->copy();
- $cs->uuid = "";
+ $cs->uuid = '';
$cs->type = 3;
$cs->save();
$basket->setSender($cs->uuid);
@@ -3443,7 +4162,7 @@ class BasketController extends TP_Controller_Action
if (!$editform->country->getMultiOptions()) {
$editform->country->addMultiOptions($countrys);
}
- $editform->country->setValue("DE");
+ $editform->country->setValue('DE');
if (isset($editform->anrede)) {
$editform->anrede->setAttrib('id', 'update_anrede');
}
@@ -3453,12 +4172,10 @@ class BasketController extends TP_Controller_Action
} else {
$config = new Zend_Config_Ini($this->_configPath . '/user/registercontact.ini', 'register');
$form = new Zend_Form();
- $form->addAttribs(
- array(
+ $form->addAttribs(array(
'class' => 'niceform',
- 'id' => 'userreg'
- )
- );
+ 'id' => 'userreg',
+ ));
$form->addSubForm(new Zend_Form_SubForm($config->user->liefer), 'liefer');
$form->addElement('submit', 'submit', $config->user->liefersubmit->elements->submit->options);
if ($this->_request->isPost()) {
@@ -3500,50 +4217,81 @@ class BasketController extends TP_Controller_Action
public function finishAction()
{
-
-
- if (trim($this->shop->custom_agb) != "") {
+ if (trim($this->shop->custom_agb) != '') {
$this->view->agb_text = $this->shop->custom_agb;
} else {
$this->view->agb_text = $this->install->agb;
}
if (Zend_Auth::getInstance()->hasIdentity()) {
- if ($this->getRequest()->getParam('error') != "") {
+ if ($this->getRequest()->getParam('error') != '') {
$this->view->priorityMessenger($this->getRequest()->getParam('error'), 'error');
}
$basket = new TP_Basket();
- if ($basket->getDelivery() != "") {
- $delivery_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
+ if ($basket->getDelivery() != '') {
+ $delivery_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))
+ ->fetchOne();
$basket->setDeliveryPLZ($delivery_address->zip);
- $basket->setDeliveryCountry($delivery_address->country?? 'DE');
- $shippingtype = Doctrine_Query::create()->select()->from('Shippingtype s')->where('s.id = ?', array($basket->getShippingtype()))->fetchOne();
- $paymenttype = Doctrine_Query::create()->select()->from('Paymenttype s')->where('s.id = ?', array($basket->getPaymenttype()))->fetchOne();
+ $basket->setDeliveryCountry($delivery_address->country ?? 'DE');
+ $shippingtype = Doctrine_Query::create()
+ ->select()
+ ->from('Shippingtype s')
+ ->where('s.id = ?', array($basket->getShippingtype()))
+ ->fetchOne();
+ $paymenttype = Doctrine_Query::create()
+ ->select()
+ ->from('Paymenttype s')
+ ->where('s.id = ?', array($basket->getPaymenttype()))
+ ->fetchOne();
- if ($paymenttype && count($paymenttype->getCountrys()) > 0 && !in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $paymenttype->getCountrys()))) {
+ if (
+ $paymenttype &&
+ count($paymenttype->getCountrys()) > 0 &&
+ !in_array(
+ strtolower($basket->getDeliveryCountry()),
+ array_map('strtolower', $paymenttype->getCountrys()),
+ )
+ ) {
$this->view->priorityMessenger('Zahlart hat sich geändert', 'info');
return $this->redirectSpeak('/basket');
}
- if ($shippingtype && count($shippingtype->getCountrys()) > 0 && !in_array(strtolower($basket->getDeliveryCountry()), array_map('strtolower', $shippingtype->getCountrys()))) {
+ if (
+ $shippingtype &&
+ count($shippingtype->getCountrys()) > 0 &&
+ !in_array(
+ strtolower($basket->getDeliveryCountry()),
+ array_map('strtolower', $shippingtype->getCountrys()),
+ )
+ ) {
$this->view->priorityMessenger('Versandart hat sich geändert', 'info');
return $this->redirectSpeak('/basket');
}
- if ($shippingtype && $shippingtype->xml != "") {
- $versand = $shippingtype->calcVersand($basket->getPreisNetto(), $basket->getWeight(), $basket->getWeightLargestOnRoll(), $delivery_address->country, $this->user);
+ if ($shippingtype && $shippingtype->xml != '') {
+ $versand = $shippingtype->calcVersand(
+ $basket->getPreisNetto(),
+ $basket->getWeight(),
+ $basket->getWeightLargestOnRoll(),
+ $delivery_address->country,
+ $this->user,
+ );
$pos_article_versand = false;
$articles = $basket->getAllArtikel();
foreach ($articles as $uuid => $art) {
/**
- * @var Article $article
-*/
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $art->getArticleId()
- )
- )->fetchOne();
+ * @var Article $article
+ */
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $art->getArticleId(),
+ ))
+ ->fetchOne();
if ($article['versand'] == 'Fix') {
if (!$pos_article_versand || $pos_article_versand != $article->id) {
@@ -3557,32 +4305,44 @@ class BasketController extends TP_Controller_Action
if ($versand != $basket->getVersandkosten() && $this->install->id != 17) {
$mwert = $basket->getPreisSteuer();
- $mwert = $mwert - ($basket->getVersandkosten() / 100 * str_replace('%', '', $shippingtype['mwert']));
+ $mwert =
+ $mwert -
+ (($basket->getVersandkosten() / 100) * str_replace('%', '', $shippingtype['mwert']));
$mwertalle = $basket->getMWert();
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] - ($basket->getVersandkosten() / 100 * str_replace('%', '', $shippingtype['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] -
+ (($basket->getVersandkosten() / 100) * str_replace('%', '', $shippingtype['mwert']));
- $mwert = $mwert + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
- $mwertalle[str_replace('%', '', $shippingtype['mwert'])] = $mwertalle[str_replace('%', '', $shippingtype['mwert'])] + ($versand / 100 * str_replace('%', '', $shippingtype['mwert']));
+ $mwert = $mwert + (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] =
+ $mwertalle[str_replace('%', '', $shippingtype['mwert'])] +
+ (($versand / 100) * str_replace('%', '', $shippingtype['mwert']));
- $basket->setPreisBrutto(($basket->getPreisNetto() + $versand + $mwert + $basket->getZahlkosten() - ($basket->getGutscheinAbzug() * 1)));
+ $basket->setPreisBrutto(
+ ($basket->getPreisNetto() + $versand + $mwert + $basket->getZahlkosten()) -
+ ($basket->getGutscheinAbzug() * 1),
+ );
$basket->setVersandkosten($versand);
$basket->setPreisSteuer($mwert);
$basket->setMWert($mwertalle);
- $basket->setVersandBrutto($versand + ($versand / 100 * str_replace('%', '', $shippingtype['mwert'])));
+ $basket->setVersandBrutto(
+ $versand + (($versand / 100) * str_replace('%', '', $shippingtype['mwert'])),
+ );
$this->view->priorityMessenger('Versandpreis hat sich geändert', 'info');
}
}
}
- if ($basket->getGutschein() != "") {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->where(
- 'c.shop_id = ? AND c.uuid = ? AND c.contact_id = ?', array(
- $this->shop->id,
- $basket->getGutschein(),
- $this->user->id
- )
- )->fetchOne();
+ if ($basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->where('c.shop_id = ? AND c.uuid = ? AND c.contact_id = ?', array(
+ $this->shop->id,
+ $basket->getGutschein(),
+ $this->user->id,
+ ))
+ ->fetchOne();
if ($gutscheincode && $gutscheincode->used == true && $gutscheincode->CreditSystem->more == false) {
$this->view->priorityMessenger('Gutschein nicht mehr gültig', 'error');
@@ -3592,13 +4352,14 @@ class BasketController extends TP_Controller_Action
}
if ($this->install->only_de) {
- $deliveryAddress = Doctrine_Query::create()->from('ContactAddress a')->where(
- 'uuid = ?', array(
- $basket->getDelivery()
- )
- )->fetchOne();
+ $deliveryAddress = Doctrine_Query::create()
+ ->from('ContactAddress a')
+ ->where('uuid = ?', array(
+ $basket->getDelivery(),
+ ))
+ ->fetchOne();
- if (strtolower($deliveryAddress->country) != "de") {
+ if (strtolower($deliveryAddress->country) != 'de') {
$this->view->priorityMessenger('Lieferung nur innerhalb Deutschlands möglich', 'error');
$this->redirectSpeak('/basket/review');
}
@@ -3611,26 +4372,34 @@ class BasketController extends TP_Controller_Action
$basket->setBasketField2($this->_getParam('basketfield2'));
}
- if (($this->getRequest()->getParam('company', 1) && $this->getRequest()->getParam('payment', 1) && $this->getRequest()->getParam('person', 1) && $this->getRequest()->getParam('revocation', 1) && $this->getRequest()->getParam('agb') == '1' && $this->getRequest()->getParam('privacy', 1))
- || $this->getRequest()->getParam('hash') == 'Ja'
- || $this->getRequest()->getParam('Data') != ''
- || ($this->getRequest()->getParam('token') != "" && $this->getRequest()->getParam('token') == $basket->getToken())
+ if (
+ $this->getRequest()->getParam('company', 1) &&
+ $this->getRequest()->getParam('payment', 1) &&
+ $this->getRequest()->getParam('person', 1) &&
+ $this->getRequest()->getParam('revocation', 1) &&
+ $this->getRequest()->getParam('agb') == '1' &&
+ $this->getRequest()->getParam('privacy', 1) ||
+ $this->getRequest()->getParam('hash') == 'Ja' ||
+ $this->getRequest()->getParam('Data') != '' ||
+ $this->getRequest()->getParam('token') != '' &&
+ $this->getRequest()->getParam('token') == $basket->getToken()
) {
-
$user = Zend_Auth::getInstance()->getIdentity();
$mode = new Zend_Session_Namespace('adminmode');
if ($mode->over_ride_contact != false && $mode->over_ride_contact != 'new') {
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $mode->over_ride_contact
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $mode->over_ride_contact,
+ ));
} else {
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
}
if ($this->_getParam('basketfield1')) {
@@ -3659,25 +4428,23 @@ class BasketController extends TP_Controller_Action
$m = TP_Mongo::getInstance();
$obj = $m->Shop->findOne(array('uid' => $this->shop->id));
- if($obj == null) {
- $obj = $m->Shop->findOne(array('uid' => (string)$this->shop->id));
+ if ($obj == null) {
+ $obj = $m->Shop->findOne(array('uid' => (string) $this->shop->id));
}
if ($obj !== null && $obj['ownNumber']) {
-
$templates = array('template' => $obj['numberPattern']);
$twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader($templates));
- $order->alias = $twig->render('template', array('number'=> $obj['numberStart']));
- $obj['numberStart'] +=1;
- $m->Shop->updateOne(array('uid' => $obj['uid']), [ '$set' => $obj]);
-
- }else{
- $obj = $m->Instance->findOne(array('appId' => "1"));
+ $order->alias = $twig->render('template', array('number' => $obj['numberStart']));
+ $obj['numberStart'] += 1;
+ $m->Shop->updateOne(array('uid' => $obj['uid']), ['$set' => $obj]);
+ } else {
+ $obj = $m->Instance->findOne(array('appId' => '1'));
$install = $this->shop->Install;
if ($obj == null) {
$obj = [];
- $obj['appId'] = "1";
+ $obj['appId'] = '1';
$obj['numberStart'] = $install->order_number;
if ($install->order_number_date) {
@@ -3686,7 +4453,7 @@ class BasketController extends TP_Controller_Action
$obj['numberPattern'] = '{{number}}';
}
- $m->Instance->updateOne(array('appId' => "1"), [ '$set' => $obj]);
+ $m->Instance->updateOne(array('appId' => '1'), ['$set' => $obj]);
} else {
if (!isset($obj['numberStart']) || $obj['numberStart'] == '') {
$obj['numberStart'] = $install->order_number;
@@ -3699,17 +4466,15 @@ class BasketController extends TP_Controller_Action
}
}
- $m->Instance->updateOne(array('appId' => "1"), [ '$set' => $obj]);
+ $m->Instance->updateOne(array('appId' => '1'), ['$set' => $obj]);
}
$templates = array('template' => $obj['numberPattern']);
$twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader($templates));
$order->alias = $twig->render('template', array('number' => $obj['numberStart']));
$obj['numberStart'] += 1;
- $m->Instance->updateOne(array('appId' => "1"), [ '$set' => $obj]);
+ $m->Instance->updateOne(array('appId' => '1'), ['$set' => $obj]);
}
-
-
$order->Contact = $user;
$order->gutschein = $basket->getGutschein();
@@ -3725,7 +4490,7 @@ class BasketController extends TP_Controller_Action
$order->file1 = Zend_Registry::get('birch_Server');
}
- if ($this->_getParam("createNewDeliveryAddress", false)) {
+ if ($this->_getParam('createNewDeliveryAddress', false)) {
$contactaddress = new ContactAddress();
$contactaddress->anrede = $user->self_anrede;
$contactaddress->company = $user->self_department;
@@ -3756,52 +4521,78 @@ class BasketController extends TP_Controller_Action
}
$order->mongoLoaded = true;
- if ($basket->getDelivery() != "") {
- if($basket->getDeliveryMode() == TP_Basket::DELIVERY_MODE_CUSTOM) {
- $order->setDeliveryAddressSaved($basket->getDeliveryAddress());
+ if ($basket->getDelivery() != '') {
+ if ($basket->getDeliveryMode() == TP_Basket::DELIVERY_MODE_CUSTOM) {
+ $order->setDeliveryAddressSaved($basket->getDeliveryAddress());
} else {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getDelivery()
- )
- )->fetchOne();
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getDelivery(),
+ ))
+ ->fetchOne();
$order->delivery_address = $contactaddress->id;
if ($contactaddress) {
$order->setDeliveryAddressSaved($contactaddress->getOrderSaveArray());
}
};
+
+
}
- if ($basket->getInvoice() != "") {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getInvoice()
- )
- )->fetchOne();
+ if ($basket->getInvoice() != '') {
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getInvoice(),
+ ))
+ ->fetchOne();
$order->invoice_address = $contactaddress->id;
if ($contactaddress) {
$order->setInvoiceAddressSaved($contactaddress->getOrderSaveArray());
}
}
- if ($basket->getSender() != "") {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getSender()
- )
- )->fetchOne();
+ if ($basket->getSender() != '') {
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getSender(),
+ ))
+ ->fetchOne();
$order->sender_address = $contactaddress->id;
if ($contactaddress) {
$order->setSenderAddressSaved($contactaddress->getOrderSaveArray());
}
}
- if (($basket->getDelivery() === "s" || $basket->getDelivery() === 0 || $basket->getDelivery() === "" || $basket->getDelivery() === "0") && $basket->getInvoice() != "") {
+ if (
+ (
+ $basket->getDelivery() === 's' ||
+ $basket->getDelivery() === 0 ||
+ $basket->getDelivery() === '' ||
+ $basket->getDelivery() === '0'
+ ) &&
+ $basket->getInvoice() != ''
+ ) {
$order->setDeliveryAddressSaved($order->getInvoiceAddressSaved());
}
- if (($basket->getInvoice() === "s" || $basket->getInvoice() === 0 || $basket->getInvoice() === "" || $basket->getInvoice() === "0") && $basket->getDelivery() != "") {
+ if (
+ (
+ $basket->getInvoice() === 's' ||
+ $basket->getInvoice() === 0 ||
+ $basket->getInvoice() === '' ||
+ $basket->getInvoice() === '0'
+ ) &&
+ $basket->getDelivery() != ''
+ ) {
$order->setInvoiceAddressSaved($order->getDeliveryAddressSaved());
}
- if ($basket->getSender() === "s" || $basket->getSender() === 0 || $basket->getSender() == "" || $basket->getSender() === "0") {
+ if (
+ $basket->getSender() === 's' ||
+ $basket->getSender() === 0 ||
+ $basket->getSender() == '' ||
+ $basket->getSender() === '0'
+ ) {
$order->setSenderAddressSaved($this->shop->getOrderSenderSaveArray());
}
@@ -3811,7 +4602,7 @@ class BasketController extends TP_Controller_Action
$order->use_account_as_invoice = $user->Account->use_account_as_invoice;
- $order->preis = ($basket->getPreisNetto() + $basket->getZahlkosten() + $basket->getVersandkosten());
+ $order->preis = $basket->getPreisNetto() + $basket->getZahlkosten() + $basket->getVersandkosten();
$order->preissteuer = $basket->getPreisSteuer();
$order->preisbrutto = $basket->getPreisBrutto();
$order->paymenttype_id = $basket->getPaymenttype();
@@ -3822,8 +4613,8 @@ class BasketController extends TP_Controller_Action
$order->lang = strtolower(Zend_Registry::get('locale')->getLanguage());
$tmpArr = [];
- foreach($basket->getMWert() as $key => $value) {
- $tmpArr[] = ['name' => (float)$key*100, 'value' => (float)$value*100, 'type' => 3];
+ foreach ($basket->getMWert() as $key => $value) {
+ $tmpArr[] = ['name' => ((float) $key) * 100, 'value' => ((float) $value) * 100, 'type' => 3];
}
$order->mwertalle = Zend_Json::encode($tmpArr);
@@ -3834,7 +4625,6 @@ class BasketController extends TP_Controller_Action
}
if ($this->shop->uid == '0001-557e6b9d-531afcb3-9700-4e8b7d8a') {
-
$budget = json_decode($user->self_information, true);
$budget['budget_all'] = $budget['budget_all'] + $order->preis;
@@ -3844,27 +4634,32 @@ class BasketController extends TP_Controller_Action
$user->save();
}
- if ($basket->getGutschein() != "") {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->where(
- 'c.shop_id = ? and c.uuid = ?', array(
- $this->shop->id,
- $basket->getGutschein()
- )
- )->fetchOne();
-
- if(!$gutscheincode) {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystem a')->where(
- 'a.shop_id = ? AND a.pre_code = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?', array(
+ if ($basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->where('c.shop_id = ? and c.uuid = ?', array(
$this->shop->id,
- $basket->getGutschein(), date('Y-m-d'), date('Y-m-d')
- )
- )->fetchOne();
+ $basket->getGutschein(),
+ ))
+ ->fetchOne();
- }elseif($gutscheincode) {
+ if (!$gutscheincode) {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystem a')
+ ->where(
+ 'a.shop_id = ? AND a.pre_code = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->shop->id,
+ $basket->getGutschein(),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
+ )
+ ->fetchOne();
+ } elseif ($gutscheincode) {
$gutscheincode = $gutscheincode->CreditSystem;
}
-
if ($gutscheincode) {
$gcDetail = new CreditSystemDetail();
$gcDetail->install_id = $this->install->id;
@@ -3881,14 +4676,13 @@ class BasketController extends TP_Controller_Action
$order->setPaymentGateway($basket->getPaymentGateway());
$order->setPaymentToken($basket->getToken());
$order->setPackageExported(!$this->shop->isCreatePackageAfterBuy());
- $order->setSendDataToShipping((bool)$this->_getParam('sendDataToShipping', 1));
+ $order->setSendDataToShipping((bool) $this->_getParam('sendDataToShipping', 1));
$order->setWithTax($withTax);
$order->setGutscheinAbzugNetto($basket->getGutscheinAbzugNetto());
$order->setGutscheinAbzugMwSt($basket->getGutscheinAbzugMwSt());
$order->saveMongo();
-
$basePath = APPLICATION_PATH . '/../market/basket/' . $order->id . '/';
if (!file_exists($basePath)) {
@@ -3899,26 +4693,28 @@ class BasketController extends TP_Controller_Action
$adapter->setDestination($basePath);
- $adapter->addFilter('Rename', array('target' => $basePath . $adapter->getFileName(null, false), 'overwrite' => true));
+ $adapter->addFilter('Rename', array(
+ 'target' => $basePath . $adapter->getFileName(null, false),
+ 'overwrite' => true,
+ ));
if ($adapter->receive() && $adapter->isValid()) {
$order->file1 = $adapter->getFileName(null, false);
$order->save();
}
-
-
$posId = 1;
/**
- * @var TP_Basket_Item $artikel
-*/
+ * @var TP_Basket_Item $artikel
+ */
foreach ($basket->getAllArtikel() as $artikel) {
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $artikel->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $artikel->getArticleId(),
+ ))
+ ->fetchOne();
$article->used = $article->used + 1;
$article->save();
@@ -3943,53 +4739,52 @@ class BasketController extends TP_Controller_Action
$status = $artikel->getUploadMode();
switch ($status) {
- case "center":
- $art->status = $article->upload_center_status;
- break;
- case "weblayouter":
- $art->status = $article->upload_weblayouter_status;
- break;
- case "steplayouter":
- if ($art->layouter_mode == 2) {
- $art->status = $article->upload_templateprint_status;
- }
- if ($art->layouter_mode == 4) {
- $art->status = $article->upload_steplayouter2_status;
- }
- break;
- case "steplayouter2":
- if ($art->layouter_mode == 2) {
- $art->status = $article->upload_templateprint_status;
- }
- if ($art->layouter_mode == 4) {
- $art->status = $article->upload_steplayouter2_status;
- }
- break;
- case "post":
- $art->status = $article->upload_post_status;
- break;
- case "email":
- case "mail":
- $art->status = $article->upload_email_status;
- break;
- case "fromLatestOrder":
- $art->status = $article->getUploadFromLatestOrderInitalStatus();
- break;
- case "provided":
- $art->status = $article->getUploadProvidedInitalStatus();
- $article->copyProvidedFileToBasket($art);
- $art->setDownloadAllowed($article->isUploadProvidedDownload());
- break;
- case "collecting_orders":
- $art->status = $article->upload_collecting_orders_status;
- break;
- case "article":
- $art->status = $article->upload_article_status;
- break;
+ case 'center':
+ $art->status = $article->upload_center_status;
+ break;
+ case 'weblayouter':
+ $art->status = $article->upload_weblayouter_status;
+ break;
+ case 'steplayouter':
+ if ($art->layouter_mode == 2) {
+ $art->status = $article->upload_templateprint_status;
+ }
+ if ($art->layouter_mode == 4) {
+ $art->status = $article->upload_steplayouter2_status;
+ }
+ break;
+ case 'steplayouter2':
+ if ($art->layouter_mode == 2) {
+ $art->status = $article->upload_templateprint_status;
+ }
+ if ($art->layouter_mode == 4) {
+ $art->status = $article->upload_steplayouter2_status;
+ }
+ break;
+ case 'post':
+ $art->status = $article->upload_post_status;
+ break;
+ case 'email':
+ case 'mail':
+ $art->status = $article->upload_email_status;
+ break;
+ case 'fromLatestOrder':
+ $art->status = $article->getUploadFromLatestOrderInitalStatus();
+ break;
+ case 'provided':
+ $art->status = $article->getUploadProvidedInitalStatus();
+ $article->copyProvidedFileToBasket($art);
+ $art->setDownloadAllowed($article->isUploadProvidedDownload());
+ break;
+ case 'collecting_orders':
+ $art->status = $article->upload_collecting_orders_status;
+ break;
+ case 'article':
+ $art->status = $article->upload_article_status;
+ break;
}
-
- if ($artikel->getLayouterId() != "") {
+ if ($artikel->getLayouterId() != '') {
$articleSession = new TP_Layoutersession();
$articleSess = $articleSession->getLayouterArticle($artikel->getLayouterId());
@@ -4007,47 +4802,62 @@ class BasketController extends TP_Controller_Action
} elseif ($articleSess->getLayouterModus() == 12) {
$art->layouter_mode = 12;
$art->status = $article->getPluginSettings('pitchprint_r2', 'uploadPitchprintInitalStatus');
- $art->setDownloadAllowed((bool)$article->getPluginSettings('pitchprint_r2', 'uploadPitchprintDownload'));
+ $art->setDownloadAllowed((bool) $article->getPluginSettings(
+ 'pitchprint_r2',
+ 'uploadPitchprintDownload',
+ ));
} elseif ($articleSess->getLayouterModus() == 102) {
$art->layouter_mode = 102;
- $art->status = $article->getPluginSettings('collectlayouter', 'uploadCollectLayouterOrdersInitalStatus');
- $art->setDownloadAllowed((bool)$article->getPluginSettings('collectlayouter', 'uploadCollectLayouterDownload'));
+ $art->status = $article->getPluginSettings(
+ 'collectlayouter',
+ 'uploadCollectLayouterOrdersInitalStatus',
+ );
+ $art->setDownloadAllowed((bool) $article->getPluginSettings(
+ 'collectlayouter',
+ 'uploadCollectLayouterDownload',
+ ));
} elseif ($articleSess->getLayouterModus() == 101) {
$art->layouter_mode = 101;
$art->render_print = 1;
$art->status = $article->getPluginSettings('printess', 'uploadPrintessInitalStatus');
- $art->setDownloadAllowed((bool)$article->getPluginSettings('printess', 'uploadPitchprintDownload'));
- } elseif ($articleSess->getTemplatePrintId() != "") {
+ $art->setDownloadAllowed((bool) $article->getPluginSettings(
+ 'printess',
+ 'uploadPitchprintDownload',
+ ));
+ } elseif ($articleSess->getTemplatePrintId() != '') {
$art->layouter_mode = 2;
$articleSess->copyToBasket($order, $art, $articleSess->getTemplatePrintId());
} elseif ($articleSess->getLayouterModus() == 4) {
- $art->status = $article->getPluginSettings('creativelayouter', 'uploadSteplayouter2InitalStatus');
+ $art->status = $article->getPluginSettings(
+ 'creativelayouter',
+ 'uploadSteplayouter2InitalStatus',
+ );
}
if ($articleSess->getLayouterModus() == 5) {
$art->layouter_mode = 5;
- $contentCheck = json_decode(file_get_contents("http://localhost/apps/psc/component/configurationlayouter/store/check/" . $artikel->getLayouterId()), true);
-
+ $contentCheck = json_decode(
+ file_get_contents('http://localhost/apps/psc/component/configurationlayouter/store/check/' .
+ $artikel->getLayouterId()),
+ true,
+ );
if ($contentCheck['found'] == true) {
if (isset($contentCheck['data']['products'])) {
foreach ($contentCheck['data']['products'] as $art) {
-
$articleSet = Doctrine_Query::create()
->from('Article c')
->where('c.id = ?', array($art['uid']))
->fetchOne();
if ($articleSet) {
if ($articleSet->stock) {
- $articleSet->stock_count = $articleSet->stock_count - $artikel->getAuflage();
+ $articleSet->stock_count =
+ $articleSet->stock_count - $artikel->getAuflage();
$articleSet->save();
- if ($articleSet->set_config != "") {
-
+ if ($articleSet->set_config != '') {
$setConfig = array();
foreach ($articleSet->getSetProducts() as $setProduct) {
-
-
$anzahl = $artikel->getAuflage();
if ($setProduct->stock_count < $anzahl) {
$anzahl = $setProduct->stock_count;
@@ -4055,7 +4865,8 @@ class BasketController extends TP_Controller_Action
$setProduct->save();
$setConfig[$setProduct->id] = $anzahl;
} else {
- $setProduct->stock_count = $setProduct->stock_count - $anzahl;
+ $setProduct->stock_count =
+ $setProduct->stock_count - $anzahl;
$setProduct->save();
}
@@ -4063,14 +4874,12 @@ class BasketController extends TP_Controller_Action
$sb->uid = TP_Util::uuid();
$sb->contact_id = $user->id;
$sb->delivery = $order->alias;
- $sb->description = "Bestellung";
+ $sb->description = 'Bestellung';
$sb->amount = $anzahl * -1;
$sb->created = $order->created;
$sb->product_id = $setProduct->id;
$sb->save();
-
-
if ($setProduct->stock_count <= $setProduct->stock_count_min) {
TP_Queue::process('articlestockmin', 'global', $setProduct);
}
@@ -4083,26 +4892,25 @@ class BasketController extends TP_Controller_Action
$sb->uid = TP_Util::uuid();
$sb->contact_id = $user->id;
$sb->delivery = $order->alias;
- $sb->description = "Bestellung";
+ $sb->description = 'Bestellung';
$sb->amount = $artikel->getAuflage() * -1;
$sb->created = $order->created;
$sb->product_id = $articleSet->id;
$sb->save();
-
-
if ($articleSet->stock_count <= $articleSet->stock_count_min) {
TP_Queue::process('articlestockmin', 'global', $articleSet);
}
- if ($articleSet->stock_max_buy > 0 && $artikel->getCount() > $articleSet->stock_max_buy) {
- TP_Queue::process(
- 'maxstockbuy', 'global', array(
+ if (
+ $articleSet->stock_max_buy > 0 &&
+ $artikel->getCount() > $articleSet->stock_max_buy
+ ) {
+ TP_Queue::process('maxstockbuy', 'global', array(
'article' => $articleSet,
'count' => $artikel->getAuflage(),
'order' => $order,
- 'contact' => $user
- )
- );
+ 'contact' => $user,
+ ));
}
}
}
@@ -4112,8 +4920,11 @@ class BasketController extends TP_Controller_Action
}
}
$orgid = $article->id;
- if (($article->typ == 6 || $article->typ == 8 || $article->typ == 9) && $artikel->getLayouterId() != "" && !$article->not_edit) {
-
+ if (
+ ($article->typ == 6 || $article->typ == 8 || $article->typ == 9) &&
+ $artikel->getLayouterId() != '' &&
+ !$article->not_edit
+ ) {
Zend_Registry::set('target_shop', $this->shop->uid);
$uuid = $article->uuid;
if ($article->a6_org_article != 0) {
@@ -4123,18 +4934,18 @@ class BasketController extends TP_Controller_Action
}
$article = $article->copy();
- $article->uuid = "";
+ $article->uuid = '';
$article->a6_org_article = $orgid;
$article->contact_id = $user->id;
$article->private = true;
$article->used = 1;
- $article->url = $article->url . '_'.time();
- $article->file = "";
- $article->file1 = "";
+ $article->url = $article->url . '_' . time();
+ $article->file = '';
+ $article->file1 = '';
$article->render_new_preview_image = true;
$article->render_new_preview_gallery = true;
$article->render_new_preview_pdf = true;
- if ($artikel->getRef() != "") {
+ if ($artikel->getRef() != '') {
$article->title = $article->title . ' (' . $artikel->getRef() . ')';
}
$article->save();
@@ -4151,15 +4962,28 @@ class BasketController extends TP_Controller_Action
$articleObj->copyPreDispatch($article, $artikel->getLayouterId(), $art);
}
} elseif (($article->typ == 6 || $article->typ == 8) && $article->not_edit) {
-
$art->render_print = true;
$articles = Zend_Registry::get('articles');
$articleObj = new $articles[$article->typ]();
}
- if (file_exists(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/product.zip')) {
+ if (
+ file_exists(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/product.zip',
+ )
+ ) {
$path = str_split($article->id);
- if (!file_exists(APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '')) {
+ if (
+ !file_exists(APPLICATION_PATH .
+ '/../market/templateprint/orginal/' .
+ implode('/', $path) .
+ '')
+ ) {
$an = '';
foreach ($path as $pt) {
$an .= $pt . '/';
@@ -4169,14 +4993,74 @@ class BasketController extends TP_Controller_Action
}
}
- if (file_exists(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/preview.pdf')) {
- copy(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/preview.pdf', APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/preview.pdf');
+ if (
+ file_exists(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/preview.pdf',
+ )
+ ) {
+ copy(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/preview.pdf',
+ APPLICATION_PATH .
+ '/../market/templateprint/orginal/' .
+ implode('/', $path) .
+ '/preview.pdf',
+ );
}
- if (file_exists(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/product.zip')) {
- copy(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/product.zip', APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/product.zip');
+ if (
+ file_exists(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/product.zip',
+ )
+ ) {
+ copy(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/product.zip',
+ APPLICATION_PATH .
+ '/../market/templateprint/orginal/' .
+ implode('/', $path) .
+ '/product.zip',
+ );
}
- if (file_exists(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/final.pdf')) {
- copy(APPLICATION_PATH . '/../market/templateprint/basket/' . $art->orders_id . '/' . $art->pos . '/final.pdf', APPLICATION_PATH . '/../market/templateprint/orginal/' . implode('/', $path) . '/final.pdf');
+ if (
+ file_exists(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/final.pdf',
+ )
+ ) {
+ copy(
+ APPLICATION_PATH .
+ '/../market/templateprint/basket/' .
+ $art->orders_id .
+ '/' .
+ $art->pos .
+ '/final.pdf',
+ APPLICATION_PATH .
+ '/../market/templateprint/orginal/' .
+ implode('/', $path) .
+ '/final.pdf',
+ );
}
}
@@ -4190,7 +5074,7 @@ class BasketController extends TP_Controller_Action
$sb->uid = TP_Util::uuid();
$sb->contact_id = $user->id;
$sb->delivery = $order->alias;
- $sb->description = "Bestellung";
+ $sb->description = 'Bestellung';
$sb->amount = $artikel->getAuflage() * -1;
$sb->created = $order->created;
$sb->product_id = $article->id;
@@ -4198,40 +5082,34 @@ class BasketController extends TP_Controller_Action
if ($article->stock_count <= $article->stock_count_min) {
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "product_stock_min",
- "data" => ["product" => $article->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'product_stock_min',
+ 'data' => ['product' => $article->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
}
if ($article->stock_max_buy > 0 && $artikel->getAuflage() > $article->stock_max_buy) {
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "product_stock_buy_max",
- "data" => ["product" => $article->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'product_stock_buy_max',
+ 'data' => ['product' => $article->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
}
}
- if ($article->set_config != "") {
-
+ if ($article->set_config != '') {
foreach ($article->getSetProducts() as $setProduct) {
-
if ($setProduct['product']->stock) {
$countSet = $setProduct['count'] ?? 0;
- if($countSet === 0) {
+ if ($countSet === 0) {
$countSet = $artikel->getAuflage();
- }else{
- $countSet = $artikel->getAuflage() * (int)$countSet;
+ } else {
+ $countSet = $artikel->getAuflage() * ((int) $countSet);
}
$setProduct['product']->stock_count = $setProduct['product']->stock_count - $countSet;
@@ -4241,36 +5119,34 @@ class BasketController extends TP_Controller_Action
$sb->uid = TP_Util::uuid();
$sb->contact_id = $user->id;
$sb->delivery = $order->alias;
- $sb->description = "Bestellung";
+ $sb->description = 'Bestellung';
$sb->amount = $countSet * -1;
$sb->created = $order->created;
$sb->product_id = $setProduct['product']->id;
$sb->save();
-
if ($setProduct['product']->stock_count <= $setProduct['product']->stock_count_min) {
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "product_stock_min",
- "data" => ["product" => $setProduct->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'product_stock_min',
+ 'data' => ['product' => $setProduct->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
}
- if ($setProduct['product']->stock_max_buy > 0 && $countSet > $setProduct['product']->stock_max_buy) {
+ if (
+ $setProduct['product']->stock_max_buy > 0 &&
+ $countSet > $setProduct['product']->stock_max_buy
+ ) {
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "product_stock_buy_max",
- "data" => ["product" => $setProduct['product']->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'product_stock_buy_max',
+ 'data' => ['product' => $setProduct['product']->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
}
}
}
@@ -4314,7 +5190,7 @@ class BasketController extends TP_Controller_Action
$art->setCalcReferences($artikel->getCalcReferences());
$art->setUploadMode($artikel->getUploadMode());
$art->setAdditionalInfos($artikel->getAdditionalInfos());
- $art->setXmlProduct((string)$artikel->getXmlProduct());
+ $art->setXmlProduct((string) $artikel->getXmlProduct());
$art->setReOrder($artikel->getReOrder());
$art->setReOrderOrder($artikel->getReOrderOrder());
$art->setReOrderPos($artikel->getReOrderPos());
@@ -4337,13 +5213,12 @@ class BasketController extends TP_Controller_Action
$hasUploads = true;
}
-
if ($art->status == 0) {
$art->status = $article->init_status;
$art->save();
}
if ($article->typ == 2) {
- if ($article->init_status == "" || $article->init_status == 0) {
+ if ($article->init_status == '' || $article->init_status == 0) {
$art->status = 10;
} else {
$art->status = $article->init_status;
@@ -4361,57 +5236,54 @@ class BasketController extends TP_Controller_Action
$order->save();
$art->save();
- $contacts = Doctrine_Query::create()->from('ArticleConfirmContact c')->where(
- 'c.article_id = ?', array(
- $orgid
- )
- )->execute();
+ $contacts = Doctrine_Query::create()
+ ->from('ArticleConfirmContact c')
+ ->where('c.article_id = ?', array(
+ $orgid,
+ ))
+ ->execute();
$dbMongo = TP_Mongo::getInstance();
foreach ($contacts as $contact) {
-
$ordposconfirm = new OrdersposConfirmContact();
$ordposconfirm->orderspos_id = $art->id;
$ordposconfirm->contact_id = $contact->contact_id;
$ordposconfirm->save();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "position_contact_approval_request",
- "data" => ["contact" => $contact->Contact->uuid, "position" => $art->uuid, "order" => $order->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
-
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'position_contact_approval_request',
+ 'data' => [
+ 'contact' => $contact->Contact->uuid,
+ 'position' => $art->uuid,
+ 'order' => $order->uuid,
+ ],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
}
}
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "status" => $art->status,
- "event" => "position_status_change",
- "data" => ["status" => $art->status, "position" => $art->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'status' => $art->status,
+ 'event' => 'position_status_change',
+ 'data' => ['status' => $art->status, 'position' => $art->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
}
$dbMongo = TP_Mongo::getInstance();
- $dbMongo->Job->insertOne(
- array(
- "shop" => $this->shop->id,
- "event" => "order_create",
- "data" => ["order" => $order->uuid],
- "created" => new MongoDB\BSON\UTCDateTime(),
- "updated" => new MongoDB\BSON\UTCDateTime()
- )
- );
+ $dbMongo->Job->insertOne(array(
+ 'shop' => $this->shop->id,
+ 'event' => 'order_create',
+ 'data' => ['order' => $order->uuid],
+ 'created' => new MongoDB\BSON\UTCDateTime(),
+ 'updated' => new MongoDB\BSON\UTCDateTime(),
+ ));
$basket->clear();
@@ -4427,7 +5299,7 @@ class BasketController extends TP_Controller_Action
$conv->conv = $order->preisbrutto;
- if ($this->shop->getRedirectAfterBuy() != "") {
+ if ($this->shop->getRedirectAfterBuy() != '') {
$templates = array('template' => $this->shop->getRedirectAfterBuy());
$twig = new \Twig\Environment(new \Twig\Loader\ArrayLoader($templates));
@@ -4439,7 +5311,13 @@ class BasketController extends TP_Controller_Action
return;
}
- if (file_exists($this->_templatePath . '/basket/done.phtml') || file_exists(APPLICATION_PATH . '/design/vorlagen/' . $this->shop->layout . '/templates/basket/done.phtml')) {
+ if (
+ file_exists($this->_templatePath . '/basket/done.phtml') ||
+ file_exists(APPLICATION_PATH .
+ '/design/vorlagen/' .
+ $this->shop->layout .
+ '/templates/basket/done.phtml')
+ ) {
$this->redirectSpeak('/basket/done/' . $order->id);
return;
}
@@ -4455,8 +5333,8 @@ class BasketController extends TP_Controller_Action
$this->view->agb = true;
if ($this->getRequest()->isPost()) {
- if ($this->_getParam('template_mode', false) == "simple") {
- $this->redirectSpeak("/basket/simple");
+ if ($this->_getParam('template_mode', false) == 'simple') {
+ $this->redirectSpeak('/basket/simple');
return;
}
@@ -4492,11 +5370,9 @@ class BasketController extends TP_Controller_Action
}
}
} else {
- $this->forwardSpeak(
- 'login', 'user', 'default', array(
- 'mode' => 'basket'
- )
- );
+ $this->forwardSpeak('login', 'user', 'default', array(
+ 'mode' => 'basket',
+ ));
return;
}
@@ -4505,11 +5381,12 @@ class BasketController extends TP_Controller_Action
$articles = $basket->getAllArtikel();
$temp = array();
foreach ($articles as $uuid => $art) {
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $art->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $art->getArticleId(),
+ ))
+ ->fetchOne();
if ($article->typ != '9') {
$field = 'a1_xml';
@@ -4521,14 +5398,12 @@ class BasketController extends TP_Controller_Action
$options = $article->getOptArray($art, false);
}
- array_push(
- $temp, array(
+ array_push($temp, array(
'uuid' => $uuid,
'article' => $article,
'basketarticle' => $art,
- 'options' => $options
- )
- );
+ 'options' => $options,
+ ));
}
}
@@ -4543,23 +5418,35 @@ class BasketController extends TP_Controller_Action
$this->view->gutschein = false;
- if ($basket->getGutschein() != "") {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->leftJoin('c.CreditSystem a')->where(
- 'a.shop_id = ? AND c.uuid = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?', array(
- $this->shop->id,
- $basket->getGutschein(), date('Y-m-d'), date('Y-m-d')
+ if ($basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->leftJoin('c.CreditSystem a')
+ ->where(
+ 'a.shop_id = ? AND c.uuid = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->shop->id,
+ $basket->getGutschein(),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
+ ->fetchOne();
- if(!$gutscheincode) {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystem a')->where(
- 'a.shop_id = ? AND a.pre_code = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?', array(
- $this->shop->id,
- $basket->getGutschein(), date('Y-m-d'), date('Y-m-d')
+ if (!$gutscheincode) {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystem a')
+ ->where(
+ 'a.shop_id = ? AND a.pre_code = ? AND (a.product_id = 0 OR a.product_id IS NULL) AND (a.articlegroup_id = 0 OR a.articlegroup_id IS NULL) AND a.f <= ? AND a.t >= ?',
+ array(
+ $this->shop->id,
+ $basket->getGutschein(),
+ date('Y-m-d'),
+ date('Y-m-d'),
+ ),
)
- )->fetchOne();
-
- }elseif($gutscheincode) {
+ ->fetchOne();
+ } elseif ($gutscheincode) {
$gutscheincode = $gutscheincode->CreditSystem;
}
@@ -4569,35 +5456,37 @@ class BasketController extends TP_Controller_Action
$this->view->withTax = $basket->isWithTax();
- if(!$basket->isWithTax()) {
+ if (!$basket->isWithTax()) {
$basket->setVersandBrutto($basket->getVersandkosten());
- $basket->setPreisBrutto($basket->getPreisNetto()+$basket->getVersandkosten()+$basket->getZahlkosten());
+ $basket->setPreisBrutto($basket->getPreisNetto() + $basket->getVersandkosten() + $basket->getZahlkosten());
$basket->setPreisSteuer(0);
$basket->setMWert([]);
/**
- * @var TP_Basket_Item $art
-*/
- foreach($basket->getAllArtikel() as $art) {
+ * @var TP_Basket_Item $art
+ */
+ foreach ($basket->getAllArtikel() as $art) {
$art->setBrutto($art->getNetto());
$art->setSteuer(0);
}
$this->view->preis = $basket->getPreisNetto() + $basket->getVersandkosten() + $basket->getZahlkosten();
- $this->view->preiszu = ($basket->getVersandkosten() + $basket->getZahlkosten());
+ $this->view->preiszu = $basket->getVersandkosten() + $basket->getZahlkosten();
$this->view->preissteuer = $basket->getPreisSteuer();
- $this->view->preisbrutto = $basket->getPreisBrutto() + $basket->getVersandkosten() + $basket->getZahlkosten();
-
- }else{
+ $this->view->preisbrutto =
+ $basket->getPreisBrutto() + $basket->getVersandkosten() + $basket->getZahlkosten();
+ } else {
$this->view->preis = $basket->getPreisNetto();
- $this->view->preiszu = ($basket->getVersandkosten() + $basket->getZahlkosten());
+ $this->view->preiszu = $basket->getVersandkosten() + $basket->getZahlkosten();
$this->view->preissteuer = $basket->getPreisSteuer();
$this->view->preisbrutto = $basket->getPreisBrutto();
}
-
-
if (!$basket->getDeliveryIsSame()) {
- $this->view->liefer = Doctrine_Query::create()->select()->from('ContactAddress c')->where('c.uuid = ?', array($basket->getDelivery()))->fetchOne();
+ $this->view->liefer = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array($basket->getDelivery()))
+ ->fetchOne();
}
$this->view->paymenttype_id = $basket->getPaymenttype();
@@ -4605,17 +5494,19 @@ class BasketController extends TP_Controller_Action
$this->view->shippingtype_extra_label = $basket->getShippingtypeExtraLabel();
- $spt = Doctrine_Query::create()->from('Shippingtype c')->where(
- 'c.id = ?', array(
- $basket->getShippingtype()
- )
- )->fetchOne();
+ $spt = Doctrine_Query::create()
+ ->from('Shippingtype c')
+ ->where('c.id = ?', array(
+ $basket->getShippingtype(),
+ ))
+ ->fetchOne();
- $pmt = Doctrine_Query::create()->from('Paymenttype c')->where(
- 'c.id = ?', array(
- $basket->getPaymenttype()
- )
- )->fetchOne();
+ $pmt = Doctrine_Query::create()
+ ->from('Paymenttype c')
+ ->where('c.id = ?', array(
+ $basket->getPaymenttype(),
+ ))
+ ->fetchOne();
$this->view->paymenttype = new Paymenttype();
$this->view->shippingtype = new Shippingtype();
@@ -4626,19 +5517,27 @@ class BasketController extends TP_Controller_Action
$this->view->paymenttype = $pmt;
}
- if (trim($this->shop->custom_agb) != "") {
+ if (trim($this->shop->custom_agb) != '') {
$this->view->display_agb = $this->shop->custom_agb;
} else {
$this->view->display_agb = $this->install->agb;
}
- if ($basket->getSender() != "") {
- $this->view->sender_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getSender()))->fetchOne();
+ if ($basket->getSender() != '') {
+ $this->view->sender_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getSender()))
+ ->fetchOne();
}
- if ($basket->getInvoice() != "") {
- $this->view->invoice_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))->fetchOne();
+ if ($basket->getInvoice() != '') {
+ $this->view->invoice_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getInvoice()))
+ ->fetchOne();
}
- if ($basket->getDelivery() != "") {
- if($basket->getDeliveryMode() == TP_Basket::DELIVERY_MODE_CUSTOM) {
+ if ($basket->getDelivery() != '') {
+ if ($basket->getDeliveryMode() == TP_Basket::DELIVERY_MODE_CUSTOM) {
$this->view->delivery_address = new ContactAddress();
$this->view->delivery_address->firstname = $basket->getDeliveryAddress()['firstname'];
$this->view->delivery_address->lastname = $basket->getDeliveryAddress()['lastname'];
@@ -4651,8 +5550,12 @@ class BasketController extends TP_Controller_Action
$this->view->delivery_address->email = $basket->getDeliveryAddress()['email'];
$basket->setDeliveryUstId($this->view->delivery_address->ustid);
$basket->setDeliveryCountry($this->view->delivery_address->country);
- }else{
- $this->view->delivery_address = Doctrine_Query::create()->select()->from('ContactAddress s')->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))->fetchOne();
+ } else {
+ $this->view->delivery_address = Doctrine_Query::create()
+ ->select()
+ ->from('ContactAddress s')
+ ->where('s.contact_id = ? AND s.uuid = ?', array($this->user->id, $basket->getDelivery()))
+ ->fetchOne();
$basket->setDeliveryCountry($this->view->delivery_address->country);
$basket->setDeliveryUstId($this->view->delivery_address->ustid);
}
@@ -4670,28 +5573,27 @@ class BasketController extends TP_Controller_Action
public function anfrageAction()
{
-
$this->getHelper('layout')->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$basket = new TP_Basket();
foreach ($basket->getAllArtikel() as $artikel) {
-
if ($artikel->getSpecial()) {
-
$user = Zend_Auth::getInstance()->getIdentity();
- $user = Doctrine_Query::create()->from('Contact m')->where('id = ?')->fetchOne(
- array(
- $user['id']
- )
- );
+ $user = Doctrine_Query::create()
+ ->from('Contact m')
+ ->where('id = ?')
+ ->fetchOne(array(
+ $user['id'],
+ ));
- $article = Doctrine_Query::create()->from('Article c')->where(
- 'c.uuid = ?', array(
- $artikel->getArticleId()
- )
- )->fetchOne();
+ $article = Doctrine_Query::create()
+ ->from('Article c')
+ ->where('c.uuid = ?', array(
+ $artikel->getArticleId(),
+ ))
+ ->fetchOne();
$order = new Orders();
$order->Shop = $this->shop;
@@ -4719,11 +5621,12 @@ class BasketController extends TP_Controller_Action
$order->basketfield2 = $basket->getBasketField2();
$order->delivery_same = $basket->getDeliveryIsSame();
if (!$basket->getDeliveryIsSame()) {
- $contactaddress = Doctrine_Query::create()->from('ContactAddress c')->where(
- 'c.uuid = ?', array(
- $basket->getDelivery()
- )
- )->fetchOne();
+ $contactaddress = Doctrine_Query::create()
+ ->from('ContactAddress c')
+ ->where('c.uuid = ?', array(
+ $basket->getDelivery(),
+ ))
+ ->fetchOne();
$order->delivery_address = $contactaddress->id;
}
$order->status = 20;
@@ -4736,13 +5639,14 @@ class BasketController extends TP_Controller_Action
$order->zahlkosten = $basket->getZahlkosten();
$order->versandkosten = $basket->getVersandkosten();
- if ($basket->getGutschein() != "") {
- $gutscheincode = Doctrine_Query::create()->from('CreditSystemDetail c')->where(
- 'c.shop_id = ? AND c.used = 0 AND c.uuid = ?', array(
- $this->shop->id,
- $basket->getGutschein()
- )
- )->fetchOne();
+ if ($basket->getGutschein() != '') {
+ $gutscheincode = Doctrine_Query::create()
+ ->from('CreditSystemDetail c')
+ ->where('c.shop_id = ? AND c.used = 0 AND c.uuid = ?', array(
+ $this->shop->id,
+ $basket->getGutschein(),
+ ))
+ ->fetchOne();
if ($gutscheincode != false) {
$gutscheincode->used = true;
$gutscheincode->save();
@@ -4753,8 +5657,7 @@ class BasketController extends TP_Controller_Action
$art = new Orderspos();
$layouter_mode = false;
- if ($article->typ == 6 || ($article->typ == 8 && $artikel->getLayouterId() != "")) {
-
+ if ($article->typ == 6 || $article->typ == 8 && $artikel->getLayouterId() != '') {
$uuid = $article->uuid;
if ($article->a6_org_article != 0) {
$orgid = $article->a6_org_article;
@@ -4762,7 +5665,7 @@ class BasketController extends TP_Controller_Action
$orgid = $article->id;
}
$article = $article->copy();
- $article->uuid = "";
+ $article->uuid = '';
$article->a6_org_article = $orgid;
$article->url = $article->url . '_' . time();
$article->contact_id = $user->id;
@@ -4800,7 +5703,11 @@ class BasketController extends TP_Controller_Action
$motive = $artikel->getMotive();
if (!empty($motive)) {
- Doctrine_Query::create()->update('Motiv')->set('used', 'used + 1')->where('id IN (' . implode(',', array_keys($artikel->getMotive())) . ')')->execute();
+ Doctrine_Query::create()
+ ->update('Motiv')
+ ->set('used', 'used + 1')
+ ->where('id IN (' . implode(',', array_keys($artikel->getMotive())) . ')')
+ ->execute();
}
$article->used = $article->used + 1;
$article->save();
diff --git a/src/old/application/modules/default/controllers/UserController.php b/src/old/application/modules/default/controllers/UserController.php
index 80d097f5a..02c46aa60 100755
--- a/src/old/application/modules/default/controllers/UserController.php
+++ b/src/old/application/modules/default/controllers/UserController.php
@@ -4136,7 +4136,11 @@ class UserController extends TP_Controller_Action
$motivBasket->clearSession();
if (file_exists($this->_templatePath . '/user/clogin.phtml')) {
- $this->_redirect('/user/clogin');
+ if ($this->_getParam('mode') == 'basket') {
+ $this->_redirect('/user/clogin?mode=basket');
+ }else{
+ $this->_redirect('/user/clogin');
+ }
return;
}
@@ -4281,7 +4285,7 @@ class UserController extends TP_Controller_Action
}
public function cloginAction()
{
-
+ $this->view->mode = $this->_getParam('mode', null);
}
public function clogoutAction()
{
diff --git a/src/old/public/styles/vorlagen/tailwindcss_wp/js/saxoprint.js b/src/old/public/styles/vorlagen/tailwindcss_wp/js/saxoprint.js
index 422419f66..6c5de5fef 100644
--- a/src/old/public/styles/vorlagen/tailwindcss_wp/js/saxoprint.js
+++ b/src/old/public/styles/vorlagen/tailwindcss_wp/js/saxoprint.js
@@ -13,6 +13,10 @@ class Saxoprint {
init() {
this.getProduct();
+ var self = this;
+ $(".printOffer").click(function(event) {
+ window.open('/apps/product/offer/' + productUUId);
+ });
}
getProduct() {
@@ -122,14 +126,14 @@ class Saxoprint {
item.label +
"\n" +
'
\n' +
- '
" +
- '
\n" +
'