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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1152 - (show annotations)
Wed Jul 1 22:25:11 2009 UTC (14 years, 10 months ago) by dpavlin
File size: 1758 byte(s)
send verification message from single place
1 package App::RoomReservation::Messages;
2 use Moose::Role;
3
4 sub seat_confirmation_message {
5 my ( $self, $col, $value ) = @_;
6
7 $col =~ s{token}{md5(id||email};
8
9 my $sth = $self->dbh->prepare(qq{
10 select
11 ime||' '||prezime,
12 _seat_number,
13 email,
14 md5(id||email) as token,
15 _confirmed
16 from reservation
17 where
18 $col = ?
19 });
20
21 $sth->execute( $value );
22
23 die "can't find user $col = $value" if $sth->rows == 0;
24
25 my ( $name, $seat, $email, $token, $confirmed ) = $sth->fetchrow_array;
26
27 if ( $confirmed ) {
28
29 my $url = $self->url_for( 'Confirmation/cancel_as_markup?token=' . $token );
30
31 my $html =
32 qq|
33 $name, <em>reservation has been confirmed</em>
34 |
35 . ( $seat
36 ? qq|
37 and seat number <big>$seat</big> is waiting for you.
38 <br>
39 Please print this notice and show it when entering lecture.
40 | : qq|
41 we <big>currently don't have any seats available</big>,
42 but you will be notified if we get some vacancies for this lecture!
43 | )
44 ;
45
46 $self->send( $email,
47 "Lecture confirmation" . $seat ? " [seat $seat]" : " [wating for vacancy]",
48 $html . <<__EMAIL__
49
50 If you wish to cancel your reservation please click on link below:
51
52 $url
53
54 __EMAIL__
55 );
56
57 return $html;
58
59 } else { # not verified
60
61 my $url = $self->url_for( 'Confirmation/verify_as_markup?token=' . $token );
62
63 $self->send( $self->email,
64 'Confirm your reservation for lecture', <<__EMAIL__
65
66 Please click following link to confirm your reservation for lecture
67 and get seat assigned to you.
68
69 $url
70
71 __EMAIL__
72 );
73
74 return qq|
75
76 $name we have accepted your registration!
77
78 <div style="color:red">
79 You have to confirm your e-mail address and registration
80 by clicking on link which should be in your e-mail INBOX shortly
81 </div>
82 |;
83
84 }
85
86 }
87
88 1;

  ViewVC Help
Powered by ViewVC 1.1.26