/[Frey]/trunk/lib/App/RoomReservation/Reservation.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/App/RoomReservation/Reservation.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1118 by dpavlin, Tue Jun 30 09:42:37 2009 UTC revision 1147 by dpavlin, Wed Jul 1 17:35:48 2009 UTC
# Line 11  subtype 'Email', Line 11  subtype 'Email',
11    
12  extends 'App::RoomReservation';  extends 'App::RoomReservation';
13    
14    with 'App::RoomReservation::Email';
15    
16  use lib 'lib';  use lib 'lib';
17  use Frey::PPI;  use Frey::PPI;
18    
# Line 81  has _confirmed => ( Line 83  has _confirmed => (
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;          die "e-mail not verified\n" unless $self->email eq $self->email_verify;
94            my $sth = $self->dbh->prepare(qq{
95                    select count(*) from reservation where email = ?
96            });
97            $sth->execute( $self->email );
98            my ($registred) = $sth->fetchrow_array;
99            die "e-mail address ", $self->email, " allready registred\n" if $registred;
100  }  }
101    
102  my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order;  my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order;
# Line 124  sub create_as_markup { Line 137  sub create_as_markup {
137          my $sth = $self->dbh->prepare( $sql );          my $sth = $self->dbh->prepare( $sql );
138          $sth->execute( @vals );          $sth->execute( @vals );
139    
140            my $url = $self->url_for( 'Confirmation/verify_as_markup?token=' . $self->token );
141    
142            $self->send( $self->email,
143                    'Confirm your reservation for lecture', <<__EMAIL__
144    Please click following link to confirm your reservation for lecture
145    and get seat assigned to you.
146    
147    $url
148    __EMAIL__
149            );
150    
151          return          return
152                  $self->ime . ' ' . $self->prezime                  $self->ime . ' ' . $self->prezime
153                  . qq| we have accepted your registration!|                  . qq| we have accepted your registration!|
# Line 133  sub create_as_markup { Line 157  sub create_as_markup {
157                          by clicking on link which should be in your e-mail INBOX shortly                          by clicking on link which should be in your e-mail INBOX shortly
158                          </div>                          </div>
159                  |                  |
                 . 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>|  
160                  ;                  ;
161  }  }
162    
163    __PACKAGE__->meta->make_immutable;
164    no Moose;
165    no Moose::Util::TypeConstraints;
166    
167  1;  1;

Legend:
Removed from v.1118  
changed lines
  Added in v.1147

  ViewVC Help
Powered by ViewVC 1.1.26