kohabug 2139 Fixes C4::Aquisition::NewOrder so that it saves the branchcode

&NewOrder did not save the branchcode posted with a new order. This patch adds that param.

Added code to select the branch the order is for in the branch dropdown list on
acqui/orderreceive.pl

Updating POD and tests

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Chris Nighswonger 2008-07-24 13:44:19 -05:00 committed by Joshua Ferraro
parent 880c1335f6
commit af970db232
4 changed files with 14 additions and 8 deletions

View File

@ -370,7 +370,7 @@ sub GetOrder {
&NewOrder($basket, $biblionumber, $title, $quantity, $listprice,
$booksellerid, $who, $notes, $bookfund, $biblioitemnumber, $rrp,
$ecost, $gst, $budget, $unitprice, $subscription,
$booksellerinvoicenumber, $purchaseorder);
$booksellerinvoicenumber, $purchaseorder, $branchcode);
Adds a new order to the database. Any argument that isn't described
below is the new value of the field with the same name in the aqorders
@ -398,7 +398,8 @@ sub NewOrder {
$listprice, $booksellerid, $authorisedby, $notes,
$bookfund, $bibitemnum, $rrp, $ecost,
$gst, $budget, $cost, $sub,
$invoice, $sort1, $sort2, $purchaseorder
$invoice, $sort1, $sort2, $purchaseorder,
$branchcode
)
= @_;
@ -454,11 +455,11 @@ sub NewOrder {
#get ordnum MYSQL dependant, but $dbh->last_insert_id returns null
my $ordnum = $dbh->{'mysql_insertid'};
$query = "
INSERT INTO aqorderbreakdown (ordernumber,bookfundid)
VALUES (?,?)
INSERT INTO aqorderbreakdown (ordernumber,bookfundid, branchcode)
VALUES (?,?,?)
";
$sth = $dbh->prepare($query);
$sth->execute( $ordnum, $bookfund );
$sth->execute( $ordnum, $bookfund, $branchcode );
$sth->finish;
return ( $basketno, $ordnum );
}

View File

@ -216,7 +216,8 @@ if ( $quantity ne '0' ) {
$listprice, $booksellerid, $loggedinuser, $notes,
$bookfund, $bibitemnum, $rrp, $ecost,
$gst, $budget, $cost, $sub,
$invoice, $sort1, $sort2, $purchaseorder
$invoice, $sort1, $sort2, $purchaseorder,
$branch
);
}
}

View File

@ -82,6 +82,7 @@ my $gst = $input->param('gst');
my @results = SearchOrder( $search, $supplierid, $biblionumber, $catview );
my $count = scalar @results;
my $order = GetOrder($search);
my $bookseller = GetBookSellerFromId( $results[0]->{'booksellerid'} );
@ -144,6 +145,7 @@ if ( $count == 1 ) {
value => $thisbranch,
description => $branches->{$thisbranch}->{'branchname'},
);
$row{'selected'} = 1 if( $thisbranch eq $order->{branchcode}) ;
push @branchloop, \%row;
}

View File

@ -44,7 +44,8 @@ sub new_order_no_budget : Test( 4 ) {
$invoice, # $invoice,
undef, # $sort1,
undef, # $sort2,
undef, # $purchaseorder
undef, # $purchaseorder,
undef, # $branchcode
);
ok( $basketno, "my basket number is $basketno" );
ok( $ordnum, "my order number is $ordnum" );
@ -91,7 +92,8 @@ sub new_order_set_budget : Test( 4 ) {
$invoice, # $invoice,
undef, # $sort1,
undef, # $sort2,
undef, # $purchaseorder
undef, # $purchaseorder,
undef, # $branchcode
);
ok( $basketno, "my basket number is $basketno" );
ok( $ordnum, "my order number is $ordnum" );