From 7d6282e513b961921843459df6ff090c856787bd Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 27 Dec 2007 16:47:22 -0600 Subject: [PATCH] Fix for 1704, now if autoitemreturns is off you get a dialogue warning a Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 14 +++++++------ circ/returns.pl | 20 ++++++++++++++++++- .../data/mysql/en/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/circ/returns.tmpl | 20 ++++++++++++++++++- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 6c31ddd5d9..156158ab4f 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1029,7 +1029,7 @@ sub GetLoanLength { $dbh->prepare( "select issuelength from issuingrules where categorycode=? and itemtype=? and branchcode=? and issuelength is not null" ); - +warn "in get loan lenght $borrowertype $itemtype $branchcode "; # try to find issuelength & return the 1st available. # check with borrowertype, itemtype and branchcode, then without one of those parameters $sth->execute( $borrowertype, $itemtype, $branchcode ); @@ -1261,11 +1261,13 @@ sub AddReturn { #we check, if we don't have reserv or transfert for this document, if not, return it to homebranch . if ( ($iteminformation->{'holdingbranch'} ne $iteminformation->{'homebranch'}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){ - if (C4::Context->preference("AutomaticItemReturn") == 1) { - ModItemTransfer($iteminformation->{'itemnumber'}, C4::Context->userenv->{'branch'}, $iteminformation->{'homebranch'}); - $messages->{'WasTransfered'} = 1; - warn "was transfered"; - } + if (C4::Context->preference("AutomaticItemReturn") == 1) { + ModItemTransfer($iteminformation->{'itemnumber'}, C4::Context->userenv->{'branch'}, $iteminformation->{'homebranch'}); + $messages->{'WasTransfered'} = 1; + } + else { + $messages->{'NeedsTransfer'} = 1; + } } } return ( $doreturn, $messages, $iteminformation, $borrower ); diff --git a/circ/returns.pl b/circ/returns.pl index 50afaf10c4..4dea59f42f 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -100,7 +100,7 @@ foreach ( $query->param ) { # Deal with the requests.... if ($query->param('WT-itemNumber')){ -updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From')); + updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From')); } if ( $query->param('resbarcode') ) { @@ -154,6 +154,14 @@ my $messages; my $issueinformation; my $barcode = $query->param('barcode'); +my $dotransfer = $query->param('dotransfer'); +if ($dotransfer){ + # An item has been returned to a branch other than the homebranch, and the librarian has choosen to initiate a transfer + my $transferitem=$query->param('transferitem'); + my $tobranch=$query->param('tobranch'); + ModItemTransfer($transferitem, C4::Context->userenv->{'branch'}, $tobranch); +} + # actually return book and prepare item table..... if ($barcode) { # decode cuecat @@ -227,7 +235,14 @@ if ( $messages->{'WasTransfered'} ) { found => 1, transfer => 1, ); +} +if ( $messages->{'NeedsTransfer'} ){ + $template->param( + found => 1, + needstransfer => 1, + itemnumber => $issueinformation->{'itemnumber'} + ); } # adding a case of wrong transfert, if the document wasn't transfered in the good library (according to branchtransfer (tobranch) BDD) @@ -387,6 +402,9 @@ foreach my $code ( keys %$messages ) { elsif ( $code eq 'WrongTransferItem' ) { ; # FIXME... anything to do here? } + elsif ( $code eq 'NeedsTransfer' ) { + } + else { die "Unknown error code $code"; # XXX } diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index e39507fe39..7d87a801b1 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -13,7 +13,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('authoritysep','--','Used to separate a list of authorities in a display. Usually --','10','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('autoBarcode','OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002','incremental|annual|OFF','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoLocation','0','If ON, IP authentication is enabled, blocking access to the staff client from unauthorized IP addresses',NULL,'YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutomaticItemReturn','1','If ON, items attempt to return to their home branch when checked in',NULL,'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutomaticItemReturn','1','If ON, Koha will automatically set up a transfer of this item to its homebranch',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('autoMemberNum','1','If ON, patron number is auto-calculated','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BiblioDefaultView','normal','Choose the default detail view in the catalog; choose between normal, marc or isbd','normal|marc|isbd','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerMandatoryField','zipcode|surname','Choose the mandatory fields for a patron\'s account',NULL,'free'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl index 31b34d191c..d1088b91c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl @@ -99,8 +99,26 @@ -

Please return "> to

+

Please return "> to

+ + + +

This item needs to be transfered to

+
+ + + "> + "> + + " value="" /> + " value="" /> + " value="" /> + + +
+ +

Item Consigned:

-- 2.39.5