Bugzilla – Attachment 28388 Details for
Bug 7290
New permission for receiving all (independent of library)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7290: Use basket branch instead of order line branch
Bug-7290-Use-basket-branch-instead-of-order-line-b.patch (text/plain), 8.86 KB, created by
Julian Maurice
on 2014-05-21 09:12:48 UTC
(
hide
)
Description:
Bug 7290: Use basket branch instead of order line branch
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2014-05-21 09:12:48 UTC
Size:
8.86 KB
patch
obsolete
>From d96ed01a3c1d8cc1b604509ac19020111acb94dc Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 28 Mar 2014 10:55:11 +0100 >Subject: [PATCH] Bug 7290: Use basket branch instead of order line branch > >and remove aqorders.branch from updatedatabase.pl and kohastructure.sql >--- > C4/Acquisition.pm | 13 +++---- > acqui/addorder.pl | 1 - > installer/data/mysql/kohastructure.sql | 3 -- > installer/data/mysql/updatedatabase.pl | 6 --- > .../prog/en/modules/acqui/neworderempty.tt | 19 --------- > t/Acquisition/CanUserReceiveBasket.t | 41 +------------------- > 6 files changed, 7 insertions(+), 76 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index b865623..3ad3485 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -824,7 +824,7 @@ sub CanUserManageBasket { > my $bool = CanUserReceiveOrder($borrowernumber, $orderno[, $userflags]); > > Check if a borrower can receive a order, according to user permissions, current >-working branch and order and basket branches. >+working branch and basket branches. > > First parameter can be either a borrowernumber or a hashref as returned by > C4::Members::GetMember. >@@ -871,18 +871,15 @@ sub CanUserReceiveOrder { > if (!ref $userflags->{acquisition} && !$userflags->{acquisition}) { > return 0; > } >+ > if (ref $userflags->{acquisition} && !$userflags->{acquisition}->{order_receive}) { > return 0; > } >- if (defined $order->{branch} && $order->{branch} ne $branch) { >+ >+ my $basket = GetBasket($order->{basketno}); >+ if (!$basket || (defined $basket->{branch} && $basket->{branch} ne $branch)) { > return 0; > } >- if (!defined $order->{branch}) { >- my $basket = GetBasket($order->{basketno}); >- if (!$basket || (defined $basket->{branch} && $basket->{branch} ne $branch)) { >- return 0; >- } >- } > } > > return 1; >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index 69d9fdb..1b05f07 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -226,7 +226,6 @@ my $orderinfo = $input->Vars; > $orderinfo->{'list_price'} ||= 0; > $orderinfo->{'uncertainprice'} ||= 0; > $orderinfo->{subscriptionid} ||= undef; >-$orderinfo->{branch} = undef if (defined $orderinfo->{branch} and $orderinfo->{branch} eq ''); > > my $user = $input->remote_user; > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 4ad0325..92ab713 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3024,18 +3024,15 @@ 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 >- branch varchar(10) default NULL, -- order line branch > `orderstatus` varchar(16) default 'new', -- the current status for this line item. Can be 'new', 'ordered', 'partial', 'complete' or 'cancelled' > PRIMARY KEY (`ordernumber`), > KEY `basketno` (`basketno`), > KEY `biblionumber` (`biblionumber`), > KEY `budget_id` (`budget_id`), >- KEY branch (branch), > 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_branch FOREIGN KEY (branch) REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE SET NULL > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index e780039..12f8bbb 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8474,12 +8474,6 @@ if ( CheckVersion($DBversion) ) { > $DBversion = "XXX"; > if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > $dbh->do(" >- ALTER TABLE aqorders >- ADD COLUMN branch VARCHAR(10) DEFAULT NULL, >- ADD CONSTRAINT aqorders_branch FOREIGN KEY (branch) >- REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE SET NULL >- "); >- $dbh->do(" > INSERT INTO permissions (module_bit, code, description) > VALUES (11, 'order_receive_all', 'Receive all orders') > "); >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 bf60a3d..9bb2b8c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -228,25 +228,6 @@ $(document).ready(function() > <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform" onsubmit="return Check(this);"> > > <fieldset class="rows"> >- <legend>Order details</legend> >- <ol> >- <li> >- <span class="label">Branch:</span> >- <select name="branch"> >- <option value=""> </option> >- [% FOREACH branch IN branchloop %] >- [% IF branch.selected %] >- <option selected="selected" value="[% branch.value %]">[% branch.branchname %]</option> >- [% ELSE %] >- <option value="[% branch.value %]">[% branch.branchname %]</option> >- [% END %] >- [% END %] >- </select> >- </li> >- </ol> >-</fieldset> >- >-<fieldset class="rows"> > <legend> > Catalog details > [% IF ( biblionumber ) %] >diff --git a/t/Acquisition/CanUserReceiveBasket.t b/t/Acquisition/CanUserReceiveBasket.t >index a0c4633..f0a7453 100644 >--- a/t/Acquisition/CanUserReceiveBasket.t >+++ b/t/Acquisition/CanUserReceiveBasket.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > use Test::MockModule; >-use Test::More tests => 30; >+use Test::More tests => 18; > > use C4::Acquisition; > >@@ -29,35 +29,11 @@ my $order1 = { > basketno => 1 > }; > my $order2 = { >- basketno => 1, >- branch => 'B1' >-}; >-my $order3 = { >- basketno => 1, >- branch => 'B2' >-}; >-my $order4 = { > basketno => 2 > }; >-my $order5 = { >- basketno => 2, >- branch => 'B1' >-}; >-my $order6 = { >- basketno => 2, >- branch => 'B2' >-}; >-my $order7 = { >+my $order3 = { > basketno => 3 > }; >-my $order8 = { >- basketno => 3, >- branch => 'B1' >-}; >-my $order9 = { >- basketno => 3, >- branch => 'B2' >-}; > > $userenv->{branch} = 'B1'; > >@@ -72,13 +48,6 @@ ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive > ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 1 }}) ); > ok( CanUserReceiveOrder($borrower, $order2, {acquisition => { order_receive => 1 }}) ); > ok( not CanUserReceiveOrder($borrower, $order3, {acquisition => { order_receive => 1 }}) ); >-ok( CanUserReceiveOrder($borrower, $order4, {acquisition => { order_receive => 1 }}) ); >-ok( CanUserReceiveOrder($borrower, $order5, {acquisition => { order_receive => 1 }}) ); >-ok( not CanUserReceiveOrder($borrower, $order6, {acquisition => { order_receive => 1 }}) ); >-ok( not CanUserReceiveOrder($borrower, $order7, {acquisition => { order_receive => 1 }}) ); >-ok( CanUserReceiveOrder($borrower, $order8, {acquisition => { order_receive => 1 }}) ); >-ok( not CanUserReceiveOrder($borrower, $order9, {acquisition => { order_receive => 1 }}) ); >- > > $userenv->{branch} = 'B2'; > >@@ -93,12 +62,6 @@ ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive > ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 1 }}) ); > ok( not CanUserReceiveOrder($borrower, $order2, {acquisition => { order_receive => 1 }}) ); > ok( CanUserReceiveOrder($borrower, $order3, {acquisition => { order_receive => 1 }}) ); >-ok( not CanUserReceiveOrder($borrower, $order4, {acquisition => { order_receive => 1 }}) ); >-ok( not CanUserReceiveOrder($borrower, $order5, {acquisition => { order_receive => 1 }}) ); >-ok( CanUserReceiveOrder($borrower, $order6, {acquisition => { order_receive => 1 }}) ); >-ok( CanUserReceiveOrder($borrower, $order7, {acquisition => { order_receive => 1 }}) ); >-ok( not CanUserReceiveOrder($borrower, $order8, {acquisition => { order_receive => 1 }}) ); >-ok( CanUserReceiveOrder($borrower, $order9, {acquisition => { order_receive => 1 }}) ); > > sub Mock_GetBasket { > my ($basketno) = @_; >-- >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 7290
:
9314
|
9399
|
9944
|
11444
|
13214
|
14517
|
25068
|
26669
|
26671
|
26676
|
28386
|
28387
|
28388
|
28405
|
28406
|
28407
|
30337
|
30338
|
30339
|
30340
|
30926
|
30927
|
30928
|
32074
|
32075
|
32076
|
32077
|
35700
|
35701
|
35702
|
35935
|
35936
|
35937