frontend: send customer password
This commit is contained in:
25
common/mail/customer_password_change.php
Normal file
25
common/mail/customer_password_change.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use common\components\Helper;
|
||||
?>
|
||||
<h1 style="font-size: 12px;">Kedves <?php echo $model->customer->name?>!</h1>
|
||||
<p style="font-size: 12px;">
|
||||
Az Ön új jelszava:
|
||||
</p>
|
||||
<ul style="font-size: 12px;">
|
||||
<li>
|
||||
"<?php echo $model->plainPassword ?>"
|
||||
</li>
|
||||
</ul>
|
||||
<p style="font-size: 12px;">
|
||||
Üdvözlettel:
|
||||
</p>
|
||||
<p style="font-size: 12px;">
|
||||
<?php echo $model->companyName ?>
|
||||
</p>
|
||||
<p>
|
||||
Ez egy automatikus e-mail üzenet, amelyre nem tud válaszolni.
|
||||
</p>
|
||||
<?php
|
||||
?>
|
||||
@@ -75,10 +75,10 @@ class EventRegistrationManager extends BaseObject
|
||||
throw new NotFoundHttpException('Customer not found', self::CUSTOMER_NOT_FOUND);
|
||||
}
|
||||
|
||||
// $activeTickets = $card->getActiveTickets();
|
||||
// if (count($activeTickets) === 0) {
|
||||
// throw new NotFoundHttpException('Ticket not found', self::TICKET_NOT_FOUND);
|
||||
// }
|
||||
$activeTickets = $card->getActiveTickets();
|
||||
if (count($activeTickets) === 0) {
|
||||
throw new NotFoundHttpException('Ticket not found', self::TICKET_NOT_FOUND);
|
||||
}
|
||||
|
||||
/** @var Event $event */
|
||||
$event = Event::find()->andWhere(['id' => $cardEventForm->event_id])->one();
|
||||
@@ -100,26 +100,35 @@ class EventRegistrationManager extends BaseObject
|
||||
throw new ServerErrorHttpException('Event type not found', self::EVENT_TYPE_NOT_FOUND);
|
||||
}
|
||||
|
||||
// $selectedTicket = $eventType->findTicketAllowingEventType($activeTickets);
|
||||
//
|
||||
//
|
||||
// if (!isset($selectedTicket)) {
|
||||
// throw new NotFoundHttpException('Ticket not found', self::TICKET_INSUFFICIENT);
|
||||
// }
|
||||
//
|
||||
// if ($selectedTicket->hasOpenReservationCount()) {
|
||||
// $selectedTicket->consumeReservationCount(1);
|
||||
// }
|
||||
// $selectedTicket->save();
|
||||
//detect if customer is already registered to event
|
||||
$registrations = $event->getActiveEventRegistrations()->all();
|
||||
|
||||
foreach ($registrations as $registration ){
|
||||
if ($registration->customer_id == $card->customer->id_customer){
|
||||
throw new BadRequestHttpException("Already registered");
|
||||
}
|
||||
}
|
||||
|
||||
$selectedTicket = $eventType->findTicketAllowingEventType($activeTickets);
|
||||
|
||||
|
||||
if (!isset($selectedTicket)) {
|
||||
throw new NotFoundHttpException('Ticket not found', self::TICKET_INSUFFICIENT);
|
||||
}
|
||||
|
||||
if ($selectedTicket->hasOpenReservationCount()) {
|
||||
$selectedTicket->consumeReservationCount(1);
|
||||
}
|
||||
$selectedTicket->save();
|
||||
|
||||
$registration = new EventRegistration();
|
||||
$registration->id_event = $event->id;
|
||||
$registration->id_card = $card->id_card;
|
||||
// $registration->id_ticket = $selectedTicket->id_ticket;
|
||||
$registration->id_ticket = $selectedTicket->id_ticket;
|
||||
$registration->id_customer = $card->customer->id_customer;
|
||||
try {
|
||||
$registration->save(false);
|
||||
} catch (Throwable $exception) {
|
||||
} catch (\yii\db\Exception $exception) {
|
||||
throw new ServerErrorHttpException('Failed to save', self::UNKNOWN_ERROR);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user