[Koha-bugs] [Bug 13881] Add desk management
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Jul 9 17:34:36 CEST 2015
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13881
Nicolas Legrand <nicolas.legrand at bulac.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #40569|0 |1
is obsolete| |
--- Comment #11 from Nicolas Legrand <nicolas.legrand at bulac.fr> ---
Comment on attachment 40569
--> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40569
Bug 13881: attach a reserve to a desk
>From 61e00bd675d86d6f3f3f6590c0ad403e19e2a1e0 Mon Sep 17 00:00:00 2001
>From: Nicolas Legrand <nicolas.legrand at bulac.fr>
>Date: Wed, 24 Jun 2015 12:20:27 +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 5cd5823..2dd92d5 100644
>--- a/C4/Auth.pm
>+++ b/C4/Auth.pm
>@@ -392,21 +392,6 @@ sub get_template_and_user {
> persona => C4::Context->preference("persona"),
> OPACBaseURL => C4::Context->preference('OPACBaseURL'),
> );
>- 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"),
>@@ -441,7 +426,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 d3fca1d..554ca7e 100644
>--- a/installer/data/mysql/kohastructure.sql
>+++ b/installer/data/mysql/kohastructure.sql
>@@ -1676,6 +1676,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
>@@ -1863,6 +1864,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
>@@ -1882,10 +1884,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 are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list