[WTF CVS] wtf/lib/WTF/Pages Input.pm,1.10,1.11
Brought to you by:
gryphonshafer
|
From: Gryphon S. <gry...@us...> - 2006-12-21 16:36:10
|
Update of /cvsroot/wtf-tracker/wtf/lib/WTF/Pages In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19349/lib/WTF/Pages Modified Files: Input.pm Log Message: Patch to add feature request 1618511: Populate Yesterday's Input Data Index: Input.pm =================================================================== RCS file: /cvsroot/wtf-tracker/wtf/lib/WTF/Pages/Input.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Input.pm 20 Dec 2006 00:04:31 -0000 1.10 --- Input.pm 21 Dec 2006 16:36:04 -0000 1.11 *************** *** 23,28 **** $tmpl_obj->param( ! 'title' => TITLE, ! 'nav_bar' => WTF::Utils::nav_bar_data( $r, 'input' ), ); --- 23,29 ---- $tmpl_obj->param( ! 'title' => TITLE, ! 'hide_preface' => 1, ! 'nav_bar' => WTF::Utils::nav_bar_data( $r, 'input' ), ); *************** *** 120,129 **** } my $display_date = $req->param('display_date') || $dates[0]->{'value'}; for ( qw( work_sel notes_sel ) ) { $sth->{$_}->execute( $r->pnotes('user_id'), ! $display_date, ) or die $dbh->errstr(); } --- 121,146 ---- } + # set $display_date to be what the user selected in the date select + # drop-down field; set $data_date to be the same thing, but we might + # change it in the next paragraph my $display_date = $req->param('display_date') || $dates[0]->{'value'}; + my $data_date = $display_date; + + # if the user clicked on the "Copy Last Data" button, then find the last + # date where they entered data that's before the $display_date and use + # that as the place from which to grab data to populate the page + if ( $req->param('copy_last_data') and $req->param('copy_last_data') eq 'on' ) { + $sth->{'max_work_day'}->execute( + $r->pnotes('user_id'), $display_date, + $r->pnotes('user_id'), $display_date, + ); + $data_date = $sth->{'max_work_day'}->fetchrow_array() || $display_date; + $sth->{'max_work_day'}->finish(); + } for ( qw( work_sel notes_sel ) ) { $sth->{$_}->execute( $r->pnotes('user_id'), ! $data_date, ) or die $dbh->errstr(); } *************** *** 132,136 **** $sth->{'activity_data'}->execute( $r->pnotes('user_id'), ! $display_date, ) or die $dbh->errstr(); --- 149,153 ---- $sth->{'activity_data'}->execute( $r->pnotes('user_id'), ! $data_date, ) or die $dbh->errstr(); *************** *** 166,169 **** --- 183,189 ---- }, ), + 'show_copy_last_data' => ( + $req->param('copy_last_data') and $req->param('copy_last_data') eq 'on' + ) ? 0 : 1, ); $sth->{'notes_sel'}->finish(); *************** *** 273,277 **** $r->headers_out->set( 'Location' => ROOT_URL . '/view/input/tracking' . ! '?display_date=' . $req->param('display_date'), ); return $r->status( Apache2::Const::REDIRECT ); --- 293,299 ---- $r->headers_out->set( 'Location' => ROOT_URL . '/view/input/tracking' . ! '?display_date=' . $req->param('display_date') . ( ( ! $req->param('copy_last_data') and $req->param('copy_last_data') eq 'on' ! ) ? '©_last_data=on' : '' ), ); return $r->status( Apache2::Const::REDIRECT ); |