3 |
|
|
4 |
extends 'App::RoomReservation'; |
extends 'App::RoomReservation'; |
5 |
|
|
6 |
|
with 'App::RoomReservation::Email', 'App::RoomReservation::Messages'; |
7 |
|
|
8 |
has token => ( |
has token => ( |
9 |
is => 'ro', |
is => 'ro', |
10 |
isa => 'Str', |
isa => 'Str', |
30 |
order by seat.nr asc |
order by seat.nr asc |
31 |
limit 1 |
limit 1 |
32 |
) |
) |
33 |
where md5(id||email) = ? and _confirmed is false |
where |
34 |
|
md5(id||email) = ? |
35 |
|
and _confirmed is false |
36 |
}); |
}); |
37 |
|
|
38 |
$sth->execute( $self->token ); |
$sth->execute( $self->token ); |
39 |
|
|
40 |
if ( $sth->rows == 1 ) { |
if ( $sth->rows == 0 ) { |
41 |
|
warn "can't confirm ", $self->token, " check if it's allready confirmed"; |
42 |
$sth = $dbh->prepare(qq{ |
$sth = $dbh->prepare(qq{ |
43 |
select ime||' '||prezime,_seat_number |
select 1 |
44 |
from reservation |
from reservation |
45 |
where md5(id||email) = ? and _confirmed is true and _seat_number is not null |
where |
46 |
|
md5(id||email) = ? |
47 |
|
and _confirmed is true |
48 |
}); |
}); |
|
|
|
49 |
$sth->execute( $self->token ); |
$sth->execute( $self->token ); |
50 |
my ($name, $seat) = $sth->fetchrow_array; |
} |
51 |
|
|
52 |
|
if ( $sth->rows == 1 ) { |
53 |
|
|
54 |
|
die "can't find account associated with ", $self->token unless $sth->rows == 1; |
55 |
|
|
56 |
|
return $self->seat_confirmation_message( token => $self->token ); |
57 |
|
|
|
qq| |
|
|
$name, <em>reservation has been confirmed</em> and seat number <big>$seat</big> is waiting for you. |
|
|
<br> |
|
|
Please print this notice and show it when entering lecture. |
|
|
|; |
|
58 |
} else { |
} else { |
59 |
die "Problem with confirmation.\n"; |
die "Problem with confirmation.\n"; |
60 |
} |
} |
70 |
set |
set |
71 |
_confirmed = false, |
_confirmed = false, |
72 |
_seat_number = null |
_seat_number = null |
73 |
where md5(id||email) = ? and _confirmed is true |
where |
74 |
|
md5(id||email) = ? |
75 |
|
-- and _confirmed is true |
76 |
}); |
}); |
77 |
$sth->execute( $self->token ); |
$sth->execute( $self->token ); |
78 |
|
|
79 |
if ( $sth->rows == 1 ) { |
if ( $sth->rows == 1 ) { |
80 |
qq|Your <em>reservation is canceled</em>, thanks for your effort to provide seat to somebody else|; |
qq| |
81 |
|
Your <em>reservation is canceled</em>, thanks for your effort to provide seat to somebody else |
82 |
|
|; |
83 |
} else { |
} else { |
84 |
die "Problem with cancelation.\n"; |
die "Problem with cancelation.\n"; |
85 |
} |
} |