Skip to content

Commit

Permalink
cherry-pick: Fix order export date interval thelia#2129
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Perriere authored and gillesbourgeat committed May 18, 2016
1 parent d4d42f1 commit 77eef27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# 2.3.1

- (related to #2129) Fix order export date interval
- (related to #2128) Fix address state check in delivery cost estimation and fix login error due to symfony update
- (related to #2127) Fix 2.3.0 major BC break in Thelia\Core\Event\Order\OrderPaymentEvent
- (related to #2125) Fix construct in GenerateRewrittenUrlEvent
Expand Down
30 changes: 17 additions & 13 deletions core/lib/Thelia/ImportExport/Export/Type/OrderExport.php
Expand Up @@ -30,7 +30,6 @@

/**
* Class OrderExport
* @author Benjamin Perche <bperche@openstudio.fr>
* @author Jérôme Billiras <jbilliras@openstudio.fr>
*/
class OrderExport extends AbstractExport
Expand Down Expand Up @@ -87,7 +86,20 @@ class OrderExport extends AbstractExport

public function current()
{
$order = parent::current();
do {
$order = parent::current();

$getNext = false;
if ($this->rangeDate !== null
&& (
$order[OrderTableMap::CREATED_AT] < $this->rangeDate['start']
|| $order[OrderTableMap::CREATED_AT] > $this->rangeDate['end']
)
) {
$this->next();
$getNext = true;
}
} while ($getNext && $this->valid());

$locale = $this->language->getLocale();

Expand Down Expand Up @@ -274,17 +286,9 @@ public function current()
$locale
);


// if ($this->rangeDate !== null) {
// $start_date = \DateTime::createFromFormat('Y-n-d', $this->rangeDate['start']['year'].'-'.$this->rangeDate['start']['month'].'-'.$this->rangeDate['start']['day']);
// $end_date = \DateTime::createFromFormat('Y-n-d', $this->rangeDate['end']['year'].'-'.$this->rangeDate['end']['month'].'-'.$this->rangeDate['start']['day']);
//
// $query
// ->filterByCreatedAt(sprintf('%s 00:00:00', $start_date->format('Y-m-d')), Criteria::GREATER_EQUAL)
// ->filterByCreatedAt(sprintf('%s 23:59:59', $end_date->format('Y-m-d')), Criteria::LESS_EQUAL);
// }

$data = $query->findPk($order[OrderTableMap::ID]);
$data = $query
->filterById($order[OrderTableMap::ID])
->findOne();

$order = (new Order)
->setId($order[OrderTableMap::ID])
Expand Down

0 comments on commit 77eef27

Please sign in to comment.