11 |
|
|
12 |
extends 'App::RoomReservation'; |
extends 'App::RoomReservation'; |
13 |
|
|
14 |
with 'App::RoomReservation::Email'; |
with 'App::RoomReservation::Email', 'App::RoomReservation::Messages'; |
15 |
|
|
16 |
use lib 'lib'; |
use lib 'lib'; |
17 |
use Frey::PPI; |
use Frey::PPI; |
88 |
isa => 'Int', |
isa => 'Int', |
89 |
); |
); |
90 |
|
|
91 |
|
has _canceled => ( |
92 |
|
is => 'rw', |
93 |
|
isa => 'Bool', |
94 |
|
default => sub { 0 }, |
95 |
|
); |
96 |
|
|
97 |
sub BUILD { |
sub BUILD { |
98 |
my $self = shift; |
my $self = shift; |
99 |
die "e-mail not verified\n" unless $self->email eq $self->email_verify; |
my $email = $self->email; |
100 |
|
die "e-mail not verified\n" unless $email eq $self->email_verify; |
101 |
my $sth = $self->dbh->prepare(qq{ |
my $sth = $self->dbh->prepare(qq{ |
102 |
select count(*) from reservation where email = ? |
select count(*) from reservation where email = ? |
103 |
}); |
}); |
104 |
$sth->execute( $self->email ); |
$sth->execute( $email ); |
105 |
my ($registred) = $sth->fetchrow_array; |
my ($registred) = $sth->fetchrow_array; |
106 |
die "e-mail address ", $self->email, " allready registred\n" if $registred; |
if ( $registred ) { |
107 |
|
die qq| |
108 |
|
<big>e-mail address $email allready registred</big> |
109 |
|
| . $self->seat_confirmation_message( email => $email ) |
110 |
|
; |
111 |
|
} |
112 |
} |
} |
113 |
|
|
114 |
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; |
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; |
115 |
warn "# cols = ",join(',', @cols), $/; |
warn "# cols = ",join(',', @cols), $/; |
116 |
|
|
|
sub token { |
|
|
my $self = shift; |
|
|
my $sth = $self->dbh->prepare(qq{ |
|
|
select md5( id || email ) from reservation where email = ? |
|
|
}); |
|
|
$sth->execute( $self->email ); |
|
|
$sth->fetchrow_array; |
|
|
} |
|
|
|
|
117 |
sub create_as_markup { |
sub create_as_markup { |
118 |
my ($self) = @_; |
my ($self) = @_; |
119 |
|
|
140 |
my $sth = $self->dbh->prepare( $sql ); |
my $sth = $self->dbh->prepare( $sql ); |
141 |
$sth->execute( @vals ); |
$sth->execute( @vals ); |
142 |
|
|
143 |
my $url = $self->url_for( 'Confirmation/verify_as_markup?token=' . $self->token ); |
return $self->seat_confirmation_message( email => $self->email ); |
144 |
|
|
|
$self->send( $self->email, |
|
|
'Confirm your reservation for lecture', <<__EMAIL__ |
|
|
Please click following link to confirm your reservation for lecture |
|
|
and get seat assigned to you. |
|
|
|
|
|
$url |
|
|
__EMAIL__ |
|
|
); |
|
|
|
|
|
return |
|
|
$self->ime . ' ' . $self->prezime |
|
|
. qq| we have accepted your registration!| |
|
|
. qq| |
|
|
<div style="color:red"> |
|
|
You have to confirm your e-mail address and registration |
|
|
by clicking on link which should be in your e-mail INBOX shortly |
|
|
</div> |
|
|
| |
|
|
; |
|
145 |
} |
} |
146 |
|
|
147 |
__PACKAGE__->meta->make_immutable; |
__PACKAGE__->meta->make_immutable; |