7 |
subtype 'Email', |
subtype 'Email', |
8 |
as 'Str', |
as 'Str', |
9 |
where { /^$RE{Email}{Address}$/ }, |
where { /^$RE{Email}{Address}$/ }, |
10 |
message { "$_ is not valid e-mail" }; |
message { qq|<error>$_ is not valid e-mail address</error>| }; |
11 |
|
|
12 |
extends 'App::RoomReservation'; |
extends 'App::RoomReservation'; |
13 |
|
|
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 |
|
submit => 'Pošalji', # submit button |
109 |
|
}} |
110 |
|
|
111 |
sub BUILD { |
sub BUILD { |
112 |
my $self = shift; |
my $self = shift; |
113 |
my $email = $self->email; |
my $email = $self->email; |
114 |
die "e-mail not verified\n" unless $email eq $self->email_verify; |
die qq|<error>e-mail addresses not same</error>| unless $email eq $self->email_verify; |
115 |
my $sth = $self->dbh->prepare(qq{ |
my $sth = $self->dbh->prepare(qq{ |
116 |
select count(*) from reservation where email = ? |
select count(*) from reservation where email = ? |
117 |
}); |
}); |
118 |
$sth->execute( $email ); |
$sth->execute( $email ); |
119 |
my ($registred) = $sth->fetchrow_array; |
my ($registred) = $sth->fetchrow_array; |
120 |
if ( $registred ) { |
if ( $registred ) { |
121 |
die qq| |
die |
122 |
|
qq| |
123 |
|
<error> |
124 |
<big>e-mail address $email allready registred</big> |
<big>e-mail address $email allready registred</big> |
125 |
| . $self->seat_confirmation_message( email => $email ) |
| |
126 |
|
. $self->seat_confirmation_message( email => $email ) |
127 |
|
. qq| |
128 |
|
</error> |
129 |
|
| |
130 |
; |
; |
131 |
} |
} |
132 |
} |
} |