From 34725b306401ffce0760d20d7d64c5605a3e9789 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 23 Mar 2012 12:43:25 -0400 Subject: [PATCH] Bug 7757 - Edit basket vendor after it has been created --- C4/Acquisition.pm | 12 ++++++++---- acqui/basketheader.pl | 11 ++++++----- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 2 +- .../prog/en/modules/acqui/basketheader.tt | 8 ++++++++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 4fd5cc2..eebbbf1 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -385,7 +385,7 @@ sub ModBasket { =head3 ModBasketHeader - &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber); + &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid); Modifies a basket's header. @@ -401,16 +401,20 @@ Modifies a basket's header. =item C<$contractnumber> is the "contractnumber" (foreign) key in the "aqbasket" table. +=item C<$booksellerid> is the id (foreign) key in the "aqbooksellers" table for the vendor. + =back =cut sub ModBasketHeader { - my ($basketno, $basketname, $note, $booksellernote, $contractnumber) = @_; - my $query = "UPDATE aqbasket SET basketname=?, note=?, booksellernote=? WHERE basketno=?"; + my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid) = @_; + + my $query = "UPDATE aqbasket SET basketname=?, note=?, booksellernote=?, booksellerid=? WHERE basketno=?"; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare($query); - $sth->execute($basketname,$note,$booksellernote,$basketno); + $sth->execute($basketname,$note,$booksellernote,$booksellerid,$basketno); + if ( $contractnumber ) { my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; my $sth2 = $dbh->prepare($query2); diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index b33e4ef..08b38eb 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -52,7 +52,7 @@ use C4::Context; use C4::Auth; use C4::Output; use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/; -use C4::Bookseller qw/GetBookSellerFromId/; +use C4::Bookseller qw/GetBookSellerFromId GetBookSeller/; my $input = new CGI; @@ -68,8 +68,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); #parameters: -my $booksellerid; -$booksellerid = $input->param('booksellerid'); +my $booksellerid = $input->param('booksellerid'); my $basketno = $input->param('basketno'); my $basket; my $op = $input ->param('op'); @@ -101,13 +100,15 @@ if ( $op eq 'add_form' ) { $template->param(contractloop => \@contractloop, basketcontractnumber => $basket->{'contractnumber'}); } + my @booksellers = GetBookSeller(); $template->param( add_form => 1, basketname => $basket->{'basketname'}, basketnote => $basket->{'note'}, basketbooksellernote => $basket->{'booksellernote'}, booksellername => $bookseller->{'name'}, booksellerid => $booksellerid, - basketno => $basketno + basketno => $basketno, + booksellers => \@booksellers, ); #End Edit } elsif ( $op eq 'add_validate' ) { @@ -115,7 +116,7 @@ if ( $op eq 'add_form' ) { my $basketno; if ( $is_an_edit ) { $basketno = $input->param('basketno'); - ModBasketHeader($input->param('basketno'),$input->param('basketname'),$input->param('basketnote'),$input->param('basketbooksellernote'),$input->param('basketcontractnumber')); + ModBasketHeader( $input->param('basketno'), $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber') || undef, $input->param('basketbooksellerid') ); } else { #New basket $basketno = NewBasket($booksellerid, $loggedinuser, $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber')); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 401e484..f7b2df9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -111,7 +111,7 @@