11 |
|
|
12 |
extends 'App::RoomReservation'; |
extends 'App::RoomReservation'; |
13 |
|
|
14 |
|
with 'App::RoomReservation::Email', 'App::RoomReservation::Messages'; |
15 |
|
|
16 |
use lib 'lib'; |
use lib 'lib'; |
17 |
use Frey::PPI; |
use Frey::PPI; |
18 |
|
|
83 |
default => sub { 0 }, |
default => sub { 0 }, |
84 |
); |
); |
85 |
|
|
86 |
|
has _seat_number => ( |
87 |
|
is => 'rw', |
88 |
|
isa => 'Int', |
89 |
|
); |
90 |
|
|
91 |
sub BUILD { |
sub BUILD { |
92 |
my $self = shift; |
my $self = shift; |
93 |
die "e-mail not verified\n" unless $self->email eq $self->email_verify; |
my $email = $self->email; |
94 |
|
die "e-mail not verified\n" unless $email eq $self->email_verify; |
95 |
my $sth = $self->dbh->prepare(qq{ |
my $sth = $self->dbh->prepare(qq{ |
96 |
select count(*) from reservation where email = ? |
select count(*) from reservation where email = ? |
97 |
}); |
}); |
98 |
$sth->execute( $self->email ); |
$sth->execute( $email ); |
99 |
my ($registred) = $sth->fetchrow_array; |
my ($registred) = $sth->fetchrow_array; |
100 |
die "e-mail address ", $self->email, " allready registred\n" if $registred; |
if ( $registred ) { |
101 |
|
die qq| |
102 |
|
<big>e-mail address $email allready registred</big> |
103 |
|
| . $self->seat_confirmation_message( email => $email ) |
104 |
|
; |
105 |
|
} |
106 |
} |
} |
107 |
|
|
108 |
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; |
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; |
109 |
warn "# cols = ",join(',', @cols), $/; |
warn "# cols = ",join(',', @cols), $/; |
110 |
|
|
|
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; |
|
|
} |
|
|
|
|
111 |
sub create_as_markup { |
sub create_as_markup { |
112 |
my ($self) = @_; |
my ($self) = @_; |
113 |
|
|
134 |
my $sth = $self->dbh->prepare( $sql ); |
my $sth = $self->dbh->prepare( $sql ); |
135 |
$sth->execute( @vals ); |
$sth->execute( @vals ); |
136 |
|
|
137 |
return |
return $self->seat_confirmation_message( email => $self->email ); |
138 |
$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> |
|
|
| |
|
|
. qq|<a href="/App::RoomReservation::Reservation::Confirmation/verify_as_markup?token=| |
|
|
. $self->token |
|
|
. qq|">verify</a>| |
|
|
. ' or ' |
|
|
. qq|<a href="/App::RoomReservation::Reservation::Confirmation/cancel_as_markup?token=| |
|
|
. $self->token |
|
|
. qq|">cancel</a>| |
|
|
; |
|
139 |
} |
} |
140 |
|
|
141 |
|
__PACKAGE__->meta->make_immutable; |
142 |
|
no Moose; |
143 |
|
no Moose::Util::TypeConstraints; |
144 |
|
|
145 |
1; |
1; |