add ticket original end and original price

add helper links to related object in admin
This commit is contained in:
2017-09-06 12:14:12 +02:00
parent bacfc36487
commit 90d19d17b6
19 changed files with 481 additions and 81 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace frontend\models;
use common\components\DateUtil;
use common\models\Ticket;
use common\models\TicketType;
use common\models\Account;
@@ -156,6 +157,13 @@ class TicketCreate extends Ticket{
}else{
$this->part_count = 0;
}
if ( isset($ticketType )){
$this->original_price = $ticketType->price_brutto;
$start = DateUtil::parseDate($this->start);
$original_end = Helper::getTicketExpirationDate($start,$ticketType);
$this->original_end = DateUtil::formatDateUtc($original_end);
}
}
}
return $result;

View File

@@ -13,4 +13,37 @@ $this->params['breadcrumbs'][] = $this->title;
<p>This is the About page. You may modify the following file to customize its content:</p>
<code><?= __FILE__ ?></code>
<p>
<?php
$dt = new DateTime();
$dt->setTimezone(new DateTimeZone('UTC'));
$dt->sub( new DateInterval( 'P2D') );
echo \common\components\DateUtil::formatUtc($dt);
echo " - ";
$ticketType = new \common\models\TicketType();
$ticketType->time_unit_type = \common\models\TicketType::TIME_UNIT_DAY;
$ticketType->time_unit_count = 3;
$dt2 = \common\components\Helper::getTicketExpirationDate($dt, $ticketType);
echo \common\components\DateUtil::formatUtc($dt2);
// $dt2 = \common\components\Helper::getTicketExpirationDate($dt, $ticketType);
// echo \common\components\DateUtil::formatUtc($dt2);
// $dt = \common\components\DateUtil::addMonth($dt,1);
// echo \common\components\DateUtil::formatUtc($dt);
// $dt = \common\components\DateUtil::addMonth($dt,1);
// echo \common\components\DateUtil::formatUtc($dt);
?>
</p>
</div>