Skip to content

Commit

Permalink
Merge pull request #937 from inbaz/develop
Browse files Browse the repository at this point in the history
added comment field to order; changed session validation to not use h…
  • Loading branch information
BigAndini authored Mar 6, 2017
2 parents ce0b74c + 60ddf1e commit 10684cc
Show file tree
Hide file tree
Showing 40 changed files with 141 additions and 58 deletions.
Binary file modified data/ers.mwb
Binary file not shown.
1 change: 1 addition & 0 deletions module/Admin/src/Admin/Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public function detailAction()
return new ViewModel(array(
'order' => $order,
'paymentDetails' => $paymentDetails,
'order_search_form' => new Form\SearchOrder(),
));
}
public function changePaymentTypeAction() {
Expand Down
16 changes: 12 additions & 4 deletions module/Admin/src/Admin/Controller/StatisticController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,36 @@ public function ordersAction() {

$paymentStatusStats = $em->createQueryBuilder()
#->select(array_merge(array('o.payment_status AS label'), $orderSelectFields))
->select(array_merge(array('s status, s.value label'), $orderSelectFields))
->select(array_merge(array('s status, s.value label', 'o.currency_id'), $orderSelectFields))
->from('ErsBase\Entity\Status', 's')
->leftJoin('s.orders', 'o')
#->groupBy('o.payment_status')
->groupBy('s.value', 's.id')
->groupBy('s.value', 's.id', 'o.currency_id')
->orderBy('s.position')
->getQuery()->getResult();


$currencies = $em->getRepository('ErsBase\Entity\Currency')->findAll();
$factor = array();
foreach($currencies as $currency) {
$factor[$currency->getId()] = $currency->getFactor();
}

$byStatusGroups = array('active' => array(), 'inactive' => array());
foreach($paymentStatusStats AS $statusData) {
error_log($statusData['ordersum'].' '.$statusData['currency_id']);
$statusData['ordersum'] = $statusData['ordersum'] * $factor[$statusData['currency_id']];
$statusData['totalsum'] = $statusData['totalsum'] * $factor[$statusData['currency_id']];
$group = ($statusData['status']->getActive() ? 'active' : 'inactive');
$byStatusGroups[$group][] = $statusData;
}

$paymentTypeStats = $em->createQueryBuilder()
->select(array_merge(array('pt.name AS label'), $orderSelectFields))
->select(array_merge(array('pt.name AS label', 'c.short as currency'), $orderSelectFields))
->from('ErsBase\Entity\PaymentType', 'pt')
#->join('pt.orders', 'o', 'WITH', "o.payment_status != 'cancelled' AND o.payment_status != 'refund'")
->join('pt.orders', 'o')
->join('o.status', 's', 'WITH', "s.active = 1")
->join('pt.currency', 'c')
->groupBy('pt.id')
->getQuery()->getResult();

Expand Down
14 changes: 12 additions & 2 deletions module/Admin/view/admin/order/change-payment-type.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@ $this->headTitle($title);
$checked = false;
endif; ?>
<label class="payment-type">
<input style="display: inline;" <?php echo $checked ? 'checked="checked"' : ''; ?> type='radio' name='paymenttype_id' value='<?php echo $paymenttype->getId(); ?>' />
<?php echo $paymenttype->getName(); ?>
<?php if($order->getPaymentType()->getCurrency()->getShort() == $paymenttype->getCurrency()->getShort()): ?>
<input style="display: inline;" <?php echo $checked ? 'checked="checked"' : ''; ?> type='radio' name='paymenttype_id' value='<?php echo $paymenttype->getId(); ?>' />
<?php else: ?>
<input disabled="disabled" style="display: inline;" <?php echo $checked ? 'checked="checked"' : ''; ?> type='radio' name='paymenttype_id' value='<?php echo $paymenttype->getId(); ?>' />
<?php endif; ?>
<?php echo $paymenttype->getName(); ?>
</label>
<?php if($order->getPaymentType()->getCurrency()->getShort() != $paymenttype->getCurrency()->getShort()): ?>
<div class="alert alert-info">
<i class="fa fa-warning"></i>
The currencies of order and payment type do not fit.
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
Expand Down
54 changes: 42 additions & 12 deletions module/Admin/view/admin/order/detail.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,38 @@ endif;

$this->headTitle($title);
?>
<div class="clear-both">
<a href="<?php echo $this->url('admin/order', array('action' => 'search')); ?>">back to Search</a>
<div class="clear-both"></div>
<div class="row">
<div class="col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
<?php
$form = $this->order_search_form;
$form->setAttribute('action', $this->url('admin/order',
array('action' => 'search')
));
$form->prepare();

echo $this->form()->openTag($form); ?>
<div class="input-group input-group-lg">
<?php echo $this->formRow($form->get('q')); ?>
<span class="input-group-btn">
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i></button>
</span>
</div><!-- /input-group -->
<?php echo $this->form()->closeTag(); ?>
</div>
</div>

<h1 class="page-header"><?php echo $this->escapeHtml($title); ?></h1>
<?php if($order): ?>
<h3>Order date: <?php echo $order->getCreated()->format('d.m.Y H:i:s'); ?></h3>
<div class="row">
<div class="col-md-6">
<h3>Order date: <?php echo $order->getCreated()->format('d.m.Y H:i:s'); ?></h3>
</div>
<div class="col-md-6">
<h3>Comment</h3>
<?php echo $order->getComment(); ?>
</div>
</div>

<div class="navbar">
<ul class="nav nav-pills">
Expand Down Expand Up @@ -181,10 +207,10 @@ $this->headTitle($title);
<?php if(count($package->getAllItems()) != 0): ?>
<table class="table">
<tr>
<th>Product</th>
<th class="cart-amount">Amount</th>
<th class="cart-price">Price</th>
<th>Status</th>
<th class="col-md-8 col-xs-7">Product</th>
<th class="cart-amount col-md-1 col-xs-1">Amount</th>
<th class="cart-price col-md-1 col-xs-2">Price</th>
<th class="col-md-2 col-xs-2">Status</th>
</tr>
<?php
$subtotal = 0;
Expand All @@ -201,13 +227,17 @@ $this->headTitle($title);
<tr>
<td></td>
<td>Subtotal:</td>
<td><?php echo $this->currencyFormat($subtotal, 'EUR', null, 'de_DE'); ?></td>
<td><?php echo $this->currencyFormat($subtotal, $order->getCurrency()->getShort(), null, 'de_DE'); ?></td>
<td></td>
</tr>
</table>
<?php endif; ?>
<div class="row">
<div class="col-md-12 text-right">
<div class="col-md-5">
<h4>Comment</h4>
<?php echo $package->getComment(); ?>
</div>
<div class="col-md-7 text-right">
<ul class="list-inline">
<li data-toggle="tooltip" data-placement="bottom" title="there is no match for this item, yet">
<i class="fa fa-shopping-cart primary-color"></i> ordered
Expand Down Expand Up @@ -240,15 +270,15 @@ $this->headTitle($title);
<table class="table sum-table">
<tr>
<td>Order amount:</td>
<td class="text-right"><?php echo $this->currencyFormat($order->getPrice(), 'EUR', null, 'de_DE'); ?></td>
<td class="text-right"><?php echo $this->currencyFormat($order->getPrice(), $order->getCurrency()->getShort(), null, 'de_DE'); ?></td>
</tr>
<tr>
<td>Payment Charge:</td>
<td class="text-right"><?php echo $this->currencyFormat(($order->getSum()-$order->getPrice()), 'EUR', null, 'de_DE'); ?></td>
<td class="text-right"><?php echo $this->currencyFormat(($order->getSum()-$order->getPrice()), $order->getCurrency()->getShort(), null, 'de_DE'); ?></td>
</tr>
<tr>
<th><span style="font-size: 18px;">Total amount:</span></th>
<th class="text-right"><span style="font-size: 18px;"><?php echo $this->currencyFormat($order->getSum(), 'EUR', null, 'de_DE'); ?></span></th>
<th class="text-right"><span style="font-size: 18px;"><?php echo $this->currencyFormat($order->getSum(), $order->getCurrency()->getShort(), null, 'de_DE'); ?></span></th>
</tr>
</table>
</div>
Expand Down
1 change: 1 addition & 0 deletions module/Admin/view/admin/product-variant-value/add.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ echo $this->form()->openTag($form);
echo $this->formHidden($form->get('id'));
echo $this->formRow($form->get('position'));
echo $this->formRow($form->get('value'));
echo $this->formRow($form->get('visible'));
echo $this->formRow($form->get('disabled'));
echo $this->formRow($form->get('ProductVariant_id'));
echo $this->formSubmit($form->get('submit'));
Expand Down
6 changes: 3 additions & 3 deletions module/Admin/view/admin/statistic/orders.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ $this->headTitle($title);
<td><?php echo $this->escapeHtml($value['label']); ?></td>
<td><?php echo $value['ordercount']; ?></td>
<td class="text-right">
<?php echo $this->currencyFormat($value['ordersum'], 'EUR', null, 'de_DE'); ?>
<?php echo $this->currencyFormat($value['ordersum'], $value['currency'], null, 'de_DE'); ?>
</td>
<td class="text-right">
<?php echo $this->currencyFormat($value['totalsum'] - $value['ordersum'], 'EUR', null, 'de_DE'); ?>
<?php echo $this->currencyFormat($value['totalsum'] - $value['ordersum'], $value['currency'], null, 'de_DE'); ?>
</td>
<td class="text-right">
<?php echo $this->currencyFormat($value['totalsum'], 'EUR', null, 'de_DE'); ?>
<?php echo $this->currencyFormat($value['totalsum'], $value['currency'], null, 'de_DE'); ?>
</td>
</tr>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion module/Admin/view/partial/order-detail-item.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<?php endif; ?>
</td>
<td><?php echo $item->getAmount(); ?></td>
<td><?php echo $this->currencyFormat($item->getPrice(), 'EUR', null, 'de_DE'); ?></td>
<td><?php echo $this->currencyFormat($item->getPrice(), $item->getCurrency()->getShort(), null, 'de_DE'); ?></td>
<td class="text-nowrap">
<span class="h3 color-primary">
<?php switch($item->getStatus()->getValue()):
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Agegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/BankAccountCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/BankStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Counter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Deadline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ItemPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/ItemVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
2 changes: 1 addition & 1 deletion module/ErsBase/src/ErsBase/Entity/Base/Match.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Auto generated by MySQL Workbench Schema Exporter.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-05 16:29:23.
* Version 2.1.6-dev (doctrine2-mappedsuperclass) on 2017-03-06 16:58:38.
* Goto https://github.com/johmue/mysql-workbench-schema-exporter for more
* information.
*/
Expand Down
Loading

0 comments on commit 10684cc

Please sign in to comment.