--- trunk/lib/App/RoomReservation/Reservation.pm 2009/06/28 14:21:10 1086 +++ trunk/lib/App/RoomReservation/Reservation.pm 2009/06/28 22:14:22 1098 @@ -1,9 +1,10 @@ package App::RoomReservation::Reservation; use Moose; -extends 'Frey'; -with 'Frey::Web'; -#with 'Frey::Storage'; +extends 'App::RoomReservation'; + +use lib 'lib'; +use Frey::PPI; has ime => ( is => 'rw', @@ -72,10 +73,63 @@ default => sub { 0 }, ); -sub as_markup { +my @cols = Frey::PPI->new( class => __PACKAGE__ )->attribute_order; +warn "# cols = ",join(',', @cols), $/; + +sub token { + my ( $self ) = @_; + my $self = shift; + my $sth = $self->dbh->prepare(qq{ + select md5( id || email ) from reservation where email = ? + }); + $sth->execute( $self->email ); + $sth->fetchrow_array; +} + +sub create_as_markup { my ($self) = @_; - $self->ime; + my @vals; + my @p; + + map { + push @vals, $self->$_; + push @p, '?'; + } @cols; + + my $n = $#cols + 1; + + my $sql + = 'insert into reservation (' + . join(',', @cols) + . ') values (' + . join(',', map { '?' } @cols ) + . ')' + ; + + warn "sql: $sql\n"; + + my $sth = $self->dbh->prepare( $sql ); + $sth->execute( @vals ); + + return + $self->ime . ' ' . $self->prezime + . qq| we have accepted your registration!| + . qq| +
+ You have to confirm your e-mail address and registration + by clicking on link which should be in your e-mail INBOX shortly +
+ | + . qq|verify| + . ' or ' + . qq|cancel| + ; } + 1;