@@ -, +, @@ - execute the DB entry. - add a new order to a basket. - the select "library" value should be the library of the connected librarian. - save. - close the basket. - edit/show the order and verify the library value is the same as selected before. - receive the order. - search invoices by library and verify results are consistent. --- acqui/neworderempty.pl | 8 +++++++- installer/data/mysql/kohastructure.sql | 4 +++- installer/data/mysql/updatedatabase.pl | 18 +++++++++++++++++ .../prog/en/modules/acqui/neworderempty.tt | 21 ++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) --- a/acqui/neworderempty.pl +++ a/acqui/neworderempty.pl @@ -240,7 +240,13 @@ foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$ value => $thisbranch, branchname => $branches->{$thisbranch}->{'branchname'}, ); - $row{'selected'} = 1 if( $thisbranch && $data->{branchcode} && $thisbranch eq $data->{branchcode}) ; + if ( $data->{branchcode} ) { + $row{'selected'} = 1 + if $thisbranch && $thisbranch eq $data->{branchcode}; + } else { + $row{selected} = 1 + if $thisbranch && $thisbranch eq C4::Context->userenv->{branch}; + } push @branchloop, \%row; } $template->param( branchloop => \@branchloop ); --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2934,6 +2934,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items `claimed_date` date default NULL, -- last date a claim was generated `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid) parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent + branchcode varchar(10) default NULL, -- library where the order will be sent PRIMARY KEY (`ordernumber`), KEY `basketno` (`basketno`), KEY `biblionumber` (`biblionumber`), @@ -2941,7 +2942,8 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES `subscription` (`subscriptionid`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `aqorders_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -7169,6 +7169,24 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } + + + +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q| + ALTER TABLE aqorders ADD COLUMN branchcode VARCHAR(10) + |); + $dbh->do(q| + ALTER TABLE aqorders ADD CONSTRAINT aqorders_branchcode FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE + |); + print "Upgrade to $DBversion done (Bug 11001 - Add column aqorders.branchcode)\n"; + SetVersion($DBversion); +} + + + +>>>>>>> Bug 11001: aqorders.branchcode is missing =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Basket [% basketno %] › [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %] [% INCLUDE 'doc-head-close.inc' %] @@ -430,6 +431,26 @@ $(document).ready(function() [% END %] + +
  • + [% IF close %] + Library: + [% Branches.GetName( branchcode ) %] + [% ELSE %] + + + [% END %] +
  • +
  • [% IF ( close ) %] Currency: --