Bugzilla – Attachment 21843 Details for
Bug 11001
The aqorders.branchcode field is missing in the DB
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11001: aqorders.branchcode is missing
Bug-11001-aqordersbranchcode-is-missing.patch (text/plain), 6.20 KB, created by
Jonathan Druart
on 2013-10-07 07:48:03 UTC
(
hide
)
Description:
Bug 11001: aqorders.branchcode is missing
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-10-07 07:48:03 UTC
Size:
6.20 KB
patch
obsolete
>From 555a7fb6d180c642ce9fd94673c7e53b6235a630 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 7 Oct 2013 09:37:26 +0200 >Subject: [PATCH] Bug 11001: aqorders.branchcode is missing > >Some BibLibre developments have been taken into account a >aqorders.branchcode field but not one adds it (cf bug 5335, 5339, etc.). > >This patch adds this new field in the DB and the ability to fill it >from the new order empty form. > >Test plan: >- 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 | 17 ++++++++++++++++ > .../prog/en/modules/acqui/neworderempty.tt | 21 ++++++++++++++++++++ > 4 files changed, 48 insertions(+), 2 deletions(-) > >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 9c9eed3..a5e56ae 100755 >--- a/acqui/neworderempty.pl >+++ b/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 ); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 3b21470..339f9a2 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2933,6 +2933,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`), >@@ -2940,7 +2941,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; > > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d88b258..322dc42 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7162,6 +7162,23 @@ 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 XXXXX - Add column aqorders.branchcode)\n"; >+ SetVersion($DBversion); >+} >+ >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index c261530..64ad216 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -1,4 +1,5 @@ > [% USE KohaDates %] >+[% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Acquisitions › Basket [% basketno %] › [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -430,6 +431,26 @@ $(document).ready(function() > <input type="checkbox" id="showallbudgets" /> > [% END %] > </li> >+ >+ <li> >+ [% IF close %] >+ <span class="label required">Library: </span> >+ <input type="hidden" name="branchcode" id="branchcode" value="[% branchcode %]" />[% Branches.GetName( branchcode ) %] >+ [% ELSE %] >+ <label for="branchcode">Library: </label> >+ <select id="branchcode" size="1" name="branchcode"> >+ <option value="">Select a library</option> >+ [% FOREACH branch IN branchloop %] >+ [% IF branch.selected %] >+ <option value="[% branch.value %]" selected="selected">[% branch.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branch.value %]">[% branch.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ [% END %] >+ </li> >+ > <li> > [% IF ( close ) %] > <span class="label">Currency: </span> >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11001
:
21843
|
21844
|
21850