From 193e22714f5da304001d65fb1817ca40e832ea64 Mon Sep 17 00:00:00 2001 From: alaurin Date: Thu, 8 Jun 2006 15:36:31 +0000 Subject: [PATCH] Add a new system preference 'AutomaticItemReturn' : if this prefence is switched on: the document returned in another library than homebranch, the system automaticly transfer the document to his homebranch (with notification for librarian in returns.tmpl) . switch off : the document stay in the holdingbranch ... correcting bugs : - comment C4::acquisition (not using in request.pl). - correcting date in request.pl -add the new call of function getbranches in request.pl --- C4/Circulation/Circ2.pm | 15 +++++++-------- circ/returns.pl | 2 +- koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl | 17 +++++++++++++++-- reserve/request.pl | 10 ++++++---- updater/updatedatabase | 21 +++++++++++++++++++++ 5 files changed, 50 insertions(+), 15 deletions(-) diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index 72eb115c82..b9e131d5ce 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -511,8 +511,8 @@ sub transferbook { # $messages->{'ResFound'} = $resrec; $dotransfer = 1; } - - if ($dotransfer and not $resfound) { + + if ($dotransfer) { dotransfer($iteminformation->{'itemnumber'}, $fbr, $tbr); $messages->{'WasTransfered'} = 1; } @@ -534,7 +534,7 @@ sub dotransfer { #update holdingbranch in items ..... $dbh->do("UPDATE items set holdingbranch = $tbr WHERE items.itemnumber = $itm"); &itemseen($itm); - &domarctransfer($dbh,$itm); + &domarctransfer($dbh,$itm); return; } @@ -1197,13 +1197,12 @@ sub returnbook { # now we check if there is a reservation with the validate of transfer if we have one, we can set it with the status 'W' my $updateWaiting = SetWaitingStatus($iteminformation->{'itemnumber'}); } -# if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly . +# if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly if system preference Automaticreturn is turn on . else { - # new op dev my $checkreserves = CheckReserves($iteminformation->{'itemnumber'}); - if (($iteminformation->{'homebranch'} ne $iteminformation->{'holdingbranch'}) and (not $checkreserves)){ - my $automatictransfer = dotransfer($iteminformation->{'itemnumber'},$iteminformation->{'holdingbranch'},$iteminformation->{'homebranch'}); - $messages->{'WasTransfered'} = 1; + if (($iteminformation->{'homebranch'} ne $iteminformation->{'holdingbranch'}) and (not $checkreserves) and (C4::Context->preference("AutomaticItemReturn") == 1)){ + my $automatictransfer = dotransfer($iteminformation->{'itemnumber'},$iteminformation->{'holdingbranch'},$iteminformation->{'homebranch'}); + $messages->{'WasTransfered'} = 1; } } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/circ/returns.pl b/circ/returns.pl index acea45fc31..d338619ddd 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -57,7 +57,7 @@ my $headerbackgroundcolor = '#99cc33'; my $linecolor1 = '#ffffcc'; my $linecolor2 = 'white'; -my $branches = getbranches(); +my $branches = getbranches('IS'); my $printers = getprinters( \%env ); my $branch = C4::Context->userenv->{'branch'}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl b/koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl index e488d6b0e6..9edcd9721b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl @@ -26,10 +26,23 @@ " value="" /> - + + - + +

This item must return to his homebranch :

+

The document () Must be returned to his homebranch() +

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

Item Consigned:

diff --git a/reserve/request.pl b/reserve/request.pl index 95b012f643..9b16450663 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -29,6 +29,7 @@ use CGI; use Date::Manip; use List::MoreUtils qw/uniq/; use Data::Dumper; +use Date::Calc qw/Today/; use C4::Search; use C4::Output; @@ -38,7 +39,8 @@ use C4::Reserves2; use C4::Biblio; use C4::Koha; use C4::Circulation::Circ2; -use C4::Acquisition; +# FIXME Is there utility to use Acquisition.pm ???? +# use C4::Acquisition; use C4::Date; use C4::Members; @@ -66,7 +68,8 @@ my %env; my $borrowerslist; my $messageborrower; -my $date = today(); +# my $date = today(); +my $date= sprintf('%04d-%02d-%02d', Today()); if ($findborrower) { my ($count,$borrowers) = BornameSearch(\%env, $findborrower, 'cardnumber', 'web'); @@ -318,7 +321,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { # existingreserves building my @reserveloop; -my $branches = getbranches(); +my $branches = getbranches('RE'); foreach my $res (sort {$a->{found} cmp $b->{found}} @$reserves){ my %reserve; my @optionloop; @@ -381,7 +384,6 @@ foreach my $branchcode (keys %{$branches}) { push @values, $branchcode; $label_of{$branchcode} = $branches->{$branchcode}->{branchname}; } - my $CGIbranch = CGI::scrolling_list( -name => 'pickup', -values => \@values, diff --git a/updater/updatedatabase b/updater/updatedatabase index deb003c7fa..133bc545c0 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -445,6 +445,15 @@ my %tabledata = ( explanation => 'Allow no debt alert if the patron is issuing item that accumulate debt', type => 'YesNo', }, + { + uniquefieldrequired => 'variable', + variable => 'AutomaticItemReturn', + value => '1', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'This Variable allow or not to return automaticly to his homebranch', + type => 'YesNo', + }, ], ); @@ -1604,6 +1613,18 @@ sub MARCgetitem { exit; # $Log$ +# Revision 1.144 2006/06/08 15:36:31 alaurin +# Add a new system preference 'AutomaticItemReturn' : +# +# if this prefence is switched on: the document returned in another library than homebranch, the system automaticly transfer the document to his homebranch (with notification for librarian in returns.tmpl) . +# +# switch off : the document stay in the holdingbranch ... +# +# correcting bugs : +# - comment C4::acquisition (not using in request.pl). +# - correcting date in request.pl +# -add the new call of function getbranches in request.pl +# # Revision 1.143 2006/06/07 02:02:47 bob_lyon # merging katipo changes... # -- 2.11.0