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 |
|
|
61 |
has mobitel => ( |
has mobitel => ( |
62 |
is => 'rw', |
is => 'rw', |
63 |
isa => 'Str', |
isa => 'Str', |
64 |
required => 1, |
default => '', # FIXME without this we get undef in form |
65 |
); |
); |
66 |
|
|
67 |
has email => ( |
has email => ( |
88 |
isa => 'Int', |
isa => 'Int', |
89 |
); |
); |
90 |
|
|
91 |
|
has _canceled => ( |
92 |
|
is => 'rw', |
93 |
|
isa => 'Bool', |
94 |
|
default => sub { 0 }, |
95 |
|
); |
96 |
|
|
97 |
|
sub form_labels {{ |
98 |
|
ime => 'Ime', |
99 |
|
prezime => 'Prezime', |
100 |
|
institucija => 'Institucija', |
101 |
|
zanimanje => 'Zanimanje', |
102 |
|
grad => 'Grad', |
103 |
|
drzava => 'Država', |
104 |
|
telefon => 'Telefon', |
105 |
|
mobitel => 'Mobitel', |
106 |
|
email => 'e-mail adresa', |
107 |
|
verify => 'unesite ponovo', |
108 |
|
}} |
109 |
|
|
110 |
sub BUILD { |
sub BUILD { |
111 |
my $self = shift; |
my $self = shift; |
112 |
die "e-mail not verified\n" unless $self->email eq $self->email_verify; |
my $email = $self->email; |
113 |
|
die "e-mail not verified\n" unless $email eq $self->email_verify; |
114 |
my $sth = $self->dbh->prepare(qq{ |
my $sth = $self->dbh->prepare(qq{ |
115 |
select count(*) from reservation where email = ? |
select count(*) from reservation where email = ? |
116 |
}); |
}); |
117 |
$sth->execute( $self->email ); |
$sth->execute( $email ); |
118 |
my ($registred) = $sth->fetchrow_array; |
my ($registred) = $sth->fetchrow_array; |
119 |
die "e-mail address ", $self->email, " allready registred\n" if $registred; |
if ( $registred ) { |
120 |
|
die qq| |
121 |
|
<big>e-mail address $email allready registred</big> |
122 |
|
| . $self->seat_confirmation_message( email => $email ) |
123 |
|
; |
124 |
|
} |
125 |
} |
} |
126 |
|
|
127 |
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; |
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; |
128 |
warn "# cols = ",join(',', @cols), $/; |
warn "# cols = ",join(',', @cols), $/; |
129 |
|
|
|
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; |
|
|
} |
|
|
|
|
130 |
sub create_as_markup { |
sub create_as_markup { |
131 |
my ($self) = @_; |
my ($self) = @_; |
132 |
|
|
153 |
my $sth = $self->dbh->prepare( $sql ); |
my $sth = $self->dbh->prepare( $sql ); |
154 |
$sth->execute( @vals ); |
$sth->execute( @vals ); |
155 |
|
|
156 |
return |
return $self->seat_confirmation_message( email => $self->email ); |
157 |
$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::Confirmation/verify_as_markup?token=| |
|
|
. $self->token |
|
|
. qq|">verify</a>| |
|
|
. ' or ' |
|
|
. qq|<a href="/App::RoomReservation::Confirmation/cancel_as_markup?token=| |
|
|
. $self->token |
|
|
. qq|">cancel</a>| |
|
|
; |
|
158 |
} |
} |
159 |
|
|
160 |
__PACKAGE__->meta->make_immutable; |
__PACKAGE__->meta->make_immutable; |