Bugzilla – Attachment 40186 Details for
Bug 13881
Add ability to defined circulation desks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13881: attach a reserve to a desk
Bug-13881-attach-a-reserve-to-a-desk.patch (text/plain), 15.31 KB, created by
Nicolas Legrand
on 2015-06-16 15:27:30 UTC
(
hide
)
Description:
Bug 13881: attach a reserve to a desk
Filename:
MIME Type:
Creator:
Nicolas Legrand
Created:
2015-06-16 15:27:30 UTC
Size:
15.31 KB
patch
obsolete
>From 0b3b7685ac6f4a9446c6196955e540922e23e7d2 Mon Sep 17 00:00:00 2001 >From: Nicolas Legrand <nicolas.legrand@bulac.fr> >Date: Wed, 10 Jun 2015 15:32:47 +0200 >Subject: [PATCH] Bug 13881: attach a reserve to a desk > >In the intranet, if desks are defined, a librarian can set her desk as >she sets her branch. If the desk is set, and she checks in an items on >which a patron made a hold, the desk deskcode is attached to the >reserve and can be viewed in the Holds awaiting pickup circulation >report. > >Test plan: > >Set a desk, put a book on hold, check it in, confirm hold, it should >appear in the "holds awaiting pickup" circulation page, it should >appear as waiting at the desk on the patron's session. >--- > C4/Auth.pm | 32 ++++++++++---------- > C4/Reserves.pm | 20 ++++++++++-- > circ/returns.pl | 3 +- > circ/waitingreserves.pl | 9 ++++++ > .../bug_138881_link_desk_to_reserves.sql | 10 ++++++ > installer/data/mysql/kohastructure.sql | 6 +++- > .../prog/en/modules/circ/waitingreserves.tt | 6 ++++ > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 2 +- > opac/opac-user.pl | 7 +++++ > 9 files changed, 73 insertions(+), 22 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_138881_link_desk_to_reserves.sql > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 75caa08..406962f 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -391,21 +391,6 @@ sub get_template_and_user { > marcflavour => C4::Context->preference("marcflavour"), > persona => C4::Context->preference("persona"), > ); >- if (C4::Context->userenv->{"branch"}) { >- my $desksaref = GetDesks(C4::Context->userenv->{"branch"}); >- if ($#$desksaref > -1) { >- $template->param( >- LoginDeskcode => ( C4::Context->userenv ? C4::Context->userenv->{"deskcode"} : undef ), >- LoginDeskname => ( C4::Context->userenv ? C4::Context->userenv->{"deskname"} : undef ), >- HasDesk => (1), >- ); >- } >- else { >- $template->param( >- HasDesk => (undef), >- ); >- } >- } > if ( $in->{'type'} eq "intranet" ) { > $template->param( > AmazonCoverImages => C4::Context->preference("AmazonCoverImages"), >@@ -440,7 +425,22 @@ sub get_template_and_user { > UseKohaPlugins => C4::Context->preference('UseKohaPlugins'), > UseCourseReserves => C4::Context->preference("UseCourseReserves"), > useDischarge => C4::Context->preference('useDischarge'), >- ); >+ ); >+ if ( C4::Context->userenv ? C4::Context->userenv->{"branch"} : undef) { >+ my $desksaref = GetDesks(C4::Context->userenv->{"branch"}); >+ if ($#$desksaref > -1) { >+ $template->param( >+ LoginDeskcode => ( C4::Context->userenv->{"deskcode"} ), >+ LoginDeskname => ( C4::Context->userenv->{"deskname"} ), >+ HasDesk => (1), >+ ); >+ } >+ else { >+ $template->param( >+ HasDesk => ( undef ), >+ ); >+ } >+ } > } > else { > warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' ); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9c760b6..9a43585 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -843,7 +843,7 @@ sub GetReservesForBranch { > my $dbh = C4::Context->dbh; > > my $query = " >- SELECT reserve_id,borrowernumber,reservedate,itemnumber,waitingdate >+ SELECT reserve_id,borrowernumber,reservedate,itemnumber,waitingdate, deskcode > FROM reserves > WHERE priority='0' > AND found='W' >@@ -1353,7 +1353,7 @@ sub ModReserveStatus { > > =head2 ModReserveAffect > >- &ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend); >+ &ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend, $deskcode); > > This function affect an item and a status for a given reserve > The itemnumber parameter is used to find the biblionumber. >@@ -1367,7 +1367,7 @@ take care of the waiting status > =cut > > sub ModReserveAffect { >- my ( $itemnumber, $borrowernumber,$transferToDo ) = @_; >+ my ( $itemnumber, $borrowernumber,$transferToDo, $deskcode ) = @_; > my $dbh = C4::Context->dbh; > > # we want to attach $itemnumber to $borrowernumber, find the biblionumber >@@ -1398,6 +1398,19 @@ sub ModReserveAffect { > AND biblionumber = ? > "; > } >+ elsif ($deskcode) { >+ # add deskcode with waiting >+ $query = " >+ UPDATE reserves >+ SET priority = 0, >+ found = 'W', >+ waitingdate = NOW(), >+ deskcode = '$deskcode', >+ itemnumber = ? >+ WHERE borrowernumber = ? >+ AND biblionumber = ? >+ "; >+ } > else { > # affect the reserve to Waiting as well. > $query = " >@@ -1405,6 +1418,7 @@ sub ModReserveAffect { > SET priority = 0, > found = 'W', > waitingdate = NOW(), >+ deskcode = NULL, > itemnumber = ? > WHERE borrowernumber = ? > AND biblionumber = ? >diff --git a/circ/returns.pl b/circ/returns.pl >index 8b70e1a..67864e9 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -144,12 +144,13 @@ if ( $query->param('resbarcode') ) { > my $resbarcode = $query->param('resbarcode'); > my $diffBranchReturned = $query->param('diffBranch'); > my $iteminfo = GetBiblioFromItemNumber($item); >+ my $deskcode = C4::Context->userenv->{"deskcode"} || undef; > # fix up item type for display > $iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'}; > my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef; > # diffBranchSend tells ModReserveAffect whether document is expected in this library or not, > # i.e., whether to apply waiting status >- ModReserveAffect( $item, $borrowernumber, $diffBranchSend); >+ ModReserveAffect( $item, $borrowernumber, $diffBranchSend, $deskcode); > # check if we have other reserves for this document, if we have a return send the message of transfer > my ( $messages, $nextreservinfo ) = GetOtherReserves($item); > >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index 5471643..0ce4eb3 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -24,6 +24,7 @@ use CGI qw ( -utf8 ); > use C4::Context; > use C4::Output; > use C4::Branch; # GetBranchName >+use C4::Desks; > use C4::Auth; > use C4::Dates qw/format_date/; > use C4::Circulation; >@@ -93,18 +94,26 @@ foreach my $num (@getreserves) { > my $itemnumber = $num->{'itemnumber'}; > my $gettitle = GetBiblioFromItemNumber( $itemnumber ); > my $borrowernum = $num->{'borrowernumber'}; >+ my $deskcode = $num->{'deskcode'}; >+ my $desk = GetDesk($deskcode); >+ my $deskname; >+ if ($desk) { >+ $deskname = $desk->{'deskname'}; >+ } > my $holdingbranch = $gettitle->{'holdingbranch'}; > my $homebranch = $gettitle->{'homebranch'}; > > my %getreserv = ( > itemnumber => $itemnumber, > borrowernum => $borrowernum, >+ deskname => $deskname, > ); > > # fix up item type for display > $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'}; > my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); > my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype >+ > $getreserv{'waitingdate'} = $num->{'waitingdate'}; > my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'}); > ( $waiting_year, $waiting_month, $waiting_day ) = >diff --git a/installer/data/mysql/atomicupdate/bug_138881_link_desk_to_reserves.sql b/installer/data/mysql/atomicupdate/bug_138881_link_desk_to_reserves.sql >new file mode 100644 >index 0000000..e412527 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_138881_link_desk_to_reserves.sql >@@ -0,0 +1,10 @@ >+ALTER TABLE reserves ADD COLUMN deskcode VARCHAR(10) DEFAULT NULL AFTER branchcode >+ ADD KEY deskcode (deskcode) >+ ADD CONSTRAINT reserves_ibfk_5 >+ FOREIGN KEY (deskcode) REFERENCES desks (deskcode) >+ ON DELETE CASCADE ON UPDATE CASCADE; >+ALTER TABLE old_reserves ADD COLUMN deskcode VARCHAR(10) DEFAULT NULL AFTER branchcode >+ ADD KEY deskcode (deskcode) >+ ADD CONSTRAINT old_reserves_ibfk_4 >+ FOREIGN KEY (deskcode) REFERENCES desks (deskcode) >+ ON DELETE SET NULL ON UPDATE SET NULL; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index b09572e..c9f950a 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1670,6 +1670,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b > `biblionumber` int(11) default NULL, -- foreign key from the biblio table defining which bib record this hold is on > `constrainttype` varchar(1) default NULL, > `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at >+ `deskcode` varchar(10) default NULL, -- foreign key from the desks table defining which desk the patron may pick this hold up from > `notificationdate` date default NULL, -- currently unused > `reminderdate` date default NULL, -- currently unused > `cancellationdate` date default NULL, -- the date this hold was cancelled >@@ -1857,6 +1858,7 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha > `biblionumber` int(11) NOT NULL default 0, -- foreign key from the biblio table defining which bib record this hold is on > `constrainttype` varchar(1) default NULL, > `branchcode` varchar(10) default NULL, -- foreign key from the branches table defining which branch the patron wishes to pick this hold up at >+ `deskcode` varchar(10) default NULL, -- foreign key from the desks table defining which desk the patron may pick this hold up from > `notificationdate` date default NULL, -- currently unused > `reminderdate` date default NULL, -- currently unused > `cancellationdate` date default NULL, -- the date this hold was cancelled >@@ -1876,10 +1878,12 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha > KEY `biblionumber` (`biblionumber`), > KEY `itemnumber` (`itemnumber`), > KEY `branchcode` (`branchcode`), >+ KEY `deskcode` (`deskcode`), > CONSTRAINT `reserves_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `reserves_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `reserves_ibfk_3` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE >+ CONSTRAINT `reserves_ibfk_4` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `reserves_ibfk_5` FOREIGN KEY (`deskcode`) REFERENCES `desks` (`deskcode`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; > > -- >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >index 1d5faf4..31294ec 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >@@ -82,6 +82,9 @@ > <th class="anti-the">Title</th> > <th>Patron</th> > <th>Location</th> >+ [% IF HasDesk %] >+ <th>Desk</th> >+ [% END %] > <th>Copy number</th> > <th>Enumeration</th> > <th>Action</th> >@@ -101,6 +104,9 @@ > [% reserveloo.borrowermail %]</a>[% END %] > </td> > <td>[% Branches.GetName( reserveloo.homebranch ) %]<br />[% reserveloo.itemcallnumber %]</td> >+ [% IF HasDesk %] >+ <td>[% reserveloo.deskname %]</td> >+ [% END %] > <td>[% reserveloo.copynumber %]</td> > <td>[% reserveloo.enumchron %]</td> > <td> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 85c985d..5945492 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -566,7 +566,7 @@ > [% IF ( RESERVE.wait ) %] > [% IF ( RESERVE.atdestination ) %] > [% IF ( RESERVE.found ) %] >- Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %] >+ Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF (RESERVE.wdkname) %], [% RESERVE.wdkname %][% END %][% IF ( RESERVE.waitingdate ) %], since [% RESERVE.waitingdate | $KohaDates %][% END %] > <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" /> > [% ELSE %] > Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b> >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 18dfec6..a8cdd38 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -34,6 +34,7 @@ use C4::Biblio; > use C4::Items; > use C4::Letters; > use C4::Branch; # GetBranches >+use C4::Desks; > use Koha::DateUtils; > use Koha::Borrower::Debarments qw(IsDebarred); > >@@ -325,6 +326,12 @@ foreach my $res (@reserves) { > $res->{'wbrcode'} = $res->{'branchcode'}; > $res->{'itemnumber'} = $res->{'itemnumber'}; > $res->{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'}; >+ if ($res->{'deskcode'}) { >+ my $desk = GetDesk($res->{'deskcode'}); >+ if ($desk) { >+ $res->{'wdkname'} = $desk->{'deskname'}; >+ } >+ } > if($res->{'holdingbranch'} eq $res->{'wbrcode'}){ > $res->{'atdestination'} = 1; > } >-- >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 13881
:
37808
|
39837
|
40186
|
40569
|
40709
|
40895
|
41233
|
42804
|
43664
|
93445
|
93446
|
93447
|
93452
|
93453
|
93454
|
95287
|
95288
|
95289
|
95293
|
95294
|
95295
|
101033
|
101050
|
101064
|
101065
|
101479
|
101543
|
101544
|
101545
|
101546
|
101547
|
105009