--- trunk/lib/App/RoomReservation/Reservation.pm 2009/06/30 09:42:37 1118
+++ trunk/lib/App/RoomReservation/Reservation.pm 2009/07/01 17:35:48 1147
@@ -11,6 +11,8 @@
extends 'App::RoomReservation';
+with 'App::RoomReservation::Email';
+
use lib 'lib';
use Frey::PPI;
@@ -81,9 +83,20 @@
default => sub { 0 },
);
+has _seat_number => (
+ is => 'rw',
+ isa => 'Int',
+);
+
sub BUILD {
my $self = shift;
die "e-mail not verified\n" unless $self->email eq $self->email_verify;
+ my $sth = $self->dbh->prepare(qq{
+ select count(*) from reservation where email = ?
+ });
+ $sth->execute( $self->email );
+ my ($registred) = $sth->fetchrow_array;
+ die "e-mail address ", $self->email, " allready registred\n" if $registred;
}
my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order;
@@ -124,6 +137,17 @@
my $sth = $self->dbh->prepare( $sql );
$sth->execute( @vals );
+ my $url = $self->url_for( 'Confirmation/verify_as_markup?token=' . $self->token );
+
+ $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!|
@@ -133,15 +157,11 @@
by clicking on link which should be in your e-mail INBOX shortly
|
- . qq|verify|
- . ' or '
- . qq|cancel|
;
}
+__PACKAGE__->meta->make_immutable;
+no Moose;
+no Moose::Util::TypeConstraints;
1;