From 669c590c301eb466efa626720fa8c015f0e31578 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 23 Mar 2012 12:43:25 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 7757 - Edit basket vendor after it has been created Content-Type: text/plain; charset="utf-8" Signed-off-by: mveron --- 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 0a96a02..ea8cf5c 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -384,7 +384,7 @@ sub ModBasket { =head3 ModBasketHeader - &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber); + &ModBasketHeader($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid); Modifies a basket's header. @@ -400,16 +400,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 88578b2..61cf10f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -110,7 +110,7 @@