/[Frey]/trunk/lib/App/RoomReservation/Reservation/Confirmation.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

Contents of /trunk/lib/App/RoomReservation/Reservation/Confirmation.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1098 - (show annotations)
Sun Jun 28 22:14:22 2009 UTC (14 years, 10 months ago) by dpavlin
File size: 936 byte(s)
added verification and cancelation of reservation
1 package App::RoomReservation::Reservation::Confirmation;
2 use Moose;
3
4 extends 'App::RoomReservation';
5
6 has token => (
7 is => 'ro',
8 isa => 'Str',
9 required => 1,
10 );
11
12 sub verify_as_markup {
13 my ($self) = @_;
14
15 my $sth = $self->dbh->prepare(qq{
16 update reservation set _confirmed = true
17 where md5(id||email) = ? and _confirmed is false
18 });
19 $sth->execute( $self->token );
20
21 if ( $sth->rows == 1 ) {
22 qq|Your <em>reservation has been confirmed</em> and seat is waiting for you|;
23 } else {
24 qq|We have problem with your confirmation|
25 }
26 }
27
28 sub cancel_as_markup {
29 my ($self) = @_;
30
31 my $sth = $self->dbh->prepare(qq{
32 update reservation set _confirmed = false
33 where md5(id||email) = ? and _confirmed is true
34 });
35 $sth->execute( $self->token );
36
37 if ( $sth->rows == 1 ) {
38 qq|Your <em>reservation is canceled</em>, thanks for your effort to provide seat to somebody else|;
39 } else {
40 qq|We have problem with cancelation|
41 }
42 }
43
44 1;

  ViewVC Help
Powered by ViewVC 1.1.26