PlanificationLivraison : on avance sur les templates d'email
This commit is contained in:
@@ -2,19 +2,15 @@
|
||||
|
||||
namespace PointRetrait;
|
||||
|
||||
use PlanificationLivraison\PlanificationLivraison;
|
||||
use PointRetrait\Model\PdrPlacesQuery;
|
||||
use PointRetrait\Model\PdrScheduleQuery;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Install\Database;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
use DateInterval;
|
||||
|
||||
|
||||
|
||||
@@ -24,13 +20,6 @@ class PointRetrait extends AbstractDeliveryModule
|
||||
const DOMAIN_NAME = 'pointretrait';
|
||||
const MESSAGE_DOMAIN = 'pointretrait';
|
||||
const MODULE_URL = '/admin/module/PointRetrait';
|
||||
const FORMAT_DATES = 'd/m/Y';
|
||||
const PDR_PLACE_SCHEDULE_ID = 'pdr_place_schedule_id';
|
||||
const PDR_CHOSEN_PLACE = 'pdr_chosen_place';
|
||||
const PDR_DELIVERY_DATE = 'pdr_delivery_date';
|
||||
const PDR_DELIVERY_BEGIN_TIME = 'pdr_begin_time';
|
||||
const PDR_DELIVERY_END_TIME = 'pdr_end_time';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -86,59 +75,4 @@ class PointRetrait extends AbstractDeliveryModule
|
||||
}
|
||||
|
||||
|
||||
static public function getDayLabel($int)
|
||||
{
|
||||
$translator = Translator::getInstance();
|
||||
|
||||
$days = [
|
||||
$translator->trans("Monday", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
$translator->trans("Tuesday", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
$translator->trans("Wednesday", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
$translator->trans("Thursday", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
$translator->trans("Friday", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
$translator->trans("Saturday", [], PointRetrait::MESSAGE_DOMAIN),
|
||||
$translator->trans("Sunday", [], PointRetrait::MESSAGE_DOMAIN)
|
||||
];
|
||||
|
||||
if ($int === null)
|
||||
return $days;
|
||||
else
|
||||
return $days[$int];
|
||||
}
|
||||
|
||||
static public function calculateRelativeDate($baseDay)
|
||||
{
|
||||
$minimumDelayBeforeOrder = PlanificationLivraison::getConfigValue(PlanificationLivraison::CONFIG_PREPARATION_DELAY, 0, "en_US");
|
||||
|
||||
$date = new \DateTime();
|
||||
$date->add(new DateInterval('P'. $minimumDelayBeforeOrder . 'D'));
|
||||
|
||||
$nextPossibleDay = '';
|
||||
switch ($baseDay) {
|
||||
case 0 :
|
||||
$nextPossibleDay = $date->modify('next monday');
|
||||
break;
|
||||
case 1 :
|
||||
$nextPossibleDay = $date->modify('next tuesday');
|
||||
break;
|
||||
case 2 :
|
||||
$nextPossibleDay = $date->modify('next wednesday');
|
||||
break;
|
||||
case 3 :
|
||||
$nextPossibleDay = $date->modify('next thursday');
|
||||
break;
|
||||
case 4 :
|
||||
$nextPossibleDay = $date->modify('next friday');
|
||||
break;
|
||||
case 5 :
|
||||
$nextPossibleDay = $date->modify('next saturday');
|
||||
break;
|
||||
case 6 :
|
||||
$nextPossibleDay = $date->modify('next sunday');
|
||||
break;
|
||||
}
|
||||
|
||||
return $nextPossibleDay;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user