Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

should fix deliverudate #820

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function build(Orders $order)
'shipping_title' => $shippingTitle,
'shipping_cost' => $shippingCost,
'shipping_fee' => $shippingFee,
'expected_at' => $order->getExpectedDeliveryDate('d-m-Y', true),
'expected_at' => $order->getExpectedDeliveryDate('d-m-Y', $attributes->global->domain_key),
'username' => $order->getCustomers($this->dbConn)->getEmail(),
'password' => $order->getCustomers($this->dbConn)->getPasswordClear(),
'event_id' => $eventId,
Expand Down
19 changes: 14 additions & 5 deletions src/Hanzo/Model/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -1208,27 +1208,35 @@ public function hasProduct($productId)
* returns latest delivery date.
*
* @param string $format
* @param bool $override
* @param string $domainKey
*
* @throws Exception
* @throws PropelException
* @return mixed|string
*/
public function getExpectedDeliveryDate($format = 'Y-m-d', $override = false)
public function getExpectedDeliveryDate($format = 'Y-m-d', $domainKey = false)
{
$now = date('Ymd');
$latest = 0;
$expectedAt = '';

if (false == $override) {
if (false === $domainKey) {
$result = Hanzo::getInstance()->get('HD.expected_delivery_date');
$expectedAt = $result ?: '';
} else {
$setting = SettingsQuery::create()
->filterByNs('HD')
$setting = DomainsSettingsQuery::create()
->filterByDomainKey($domainKey)
->filterByCKey('expected_delivery_date')
->filterByNs('HD')
->findOne($this->getDBConnection());

if (empty($setting)) {
$setting = SettingsQuery::create()
->filterByNs('HD')
->filterByCKey('expected_delivery_date')
->findOne($this->getDBConnection());
}

if ($setting && $setting->getCValue()) {
$expectedAt = $setting->getCValue();
}
Expand All @@ -1245,6 +1253,7 @@ public function getExpectedDeliveryDate($format = 'Y-m-d', $override = false)
return $expectedAt;
}


/**
* @param bool $v
*/
Expand Down