use C4::Biblio;
use C4::Items;
use C4::Members;
-use C4::Branch; # GetBranches GetBranchName
+use C4::Members::Messaging;
use C4::Koha; # FIXME : is it still useful ?
use C4::RotatingCollections;
+use Koha::AuthorisedValues;
use Koha::DateUtils;
use Koha::Calendar;
#####################
#Global vars
-my $branches = GetBranches();
my $printers = GetPrinters();
my $userenv = C4::Context->userenv;
my $userenv_branch = $userenv->{'branch'} // '';
updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From'));
}
-if ( $query->param('resbarcode') ) {
+if ( $query->param('reserve_id') ) {
my $item = $query->param('itemnumber');
my $borrowernumber = $query->param('borrowernumber');
- my $resbarcode = $query->param('resbarcode');
+ my $reserve_id = $query->param('reserve_id');
my $diffBranchReturned = $query->param('diffBranch');
my $iteminfo = GetBiblioFromItemNumber($item);
my $cancel_reserve = $query->param('cancel_reserve');
$iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'};
if ( $cancel_reserve ) {
- CancelReserve({ borrowernumber => $borrowernumber, itemnumber => $item, charge_cancel_fee => !$forgivemanualholdsexpire });
+ CancelReserve({ reserve_id => $reserve_id, charge_cancel_fee => !$forgivemanualholdsexpire });
} else {
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, $reserve_id );
}
# check if we have other reserves for this document, if we have a return send the message of transfer
my ( $messages, $nextreservinfo ) = GetOtherReserves($item);
itemnumber => $iteminfo->{'itemnumber'},
itembiblionumber => $iteminfo->{'biblionumber'},
iteminfo => $iteminfo->{'author'},
- tobranchname => GetBranchName($messages->{'transfert'}),
name => $name,
borrowernumber => $borrowernumber,
borcnum => $borr->{'cardnumber'},
borfirstname => $borr->{'firstname'},
borsurname => $borr->{'surname'},
+ borcategory => $borr->{'description'},
diffbranch => 1,
);
}
}
# actually return book and prepare item table.....
+my $returnbranch;
if ($barcode) {
$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
$barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
# make sure return branch respects home branch circulation rules, default to homebranch
my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
- my $returnbranch = $biblio->{$hbr} ;
+ $returnbranch = $biblio->{$hbr};
my $materials = $biblio->{'materials'};
- my $avcode = GetAuthValCode('items.materials');
- if ($avcode) {
- $materials = GetKohaAuthorisedValueLib($avcode, $materials);
- }
+ my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
+ $materials = $descriptions->{lib} // '';
$template->param(
title => $biblio->{'title'},
);
my $reserve = $messages->{'ResFound'};
- my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
my $borr = C4::Members::GetMember( borrowernumber => $reserve->{'borrowernumber'} );
my $name = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
$template->param(
wname => $name,
wborfirstname => $borr->{'firstname'},
wborsurname => $borr->{'surname'},
+ wborcategory => $borr->{'description'},
wbortitle => $borr->{'title'},
wborphone => $borr->{'phone'},
wboremail => $borr->{'email'},
#
if ( $messages->{'ResFound'}) {
my $reserve = $messages->{'ResFound'};
- my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
my $borr = C4::Members::GetMember( borrowernumber => $reserve->{'borrowernumber'} );
-
+ my $holdmsgpreferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $reserve->{'borrowernumber'}, message_name => 'Hold_Filled' } );
if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) {
if ( $reserve->{'ResFound'} eq "Waiting" ) {
$template->param(
$template->param(
intransit => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ),
transfertodo => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ),
- resbarcode => $barcode,
+ reserve_id => $reserve->{reserve_id},
reserved => 1,
);
}
# same params for Waiting or Reserved
$template->param(
found => 1,
- currentbranch => $branches->{$userenv_branch}->{'branchname'},
- destbranchname => $branches->{ $reserve->{'branchcode'} }->{'branchname'},
name => $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'},
borfirstname => $borr->{'firstname'},
borsurname => $borr->{'surname'},
+ borcategory => $borr->{'description'},
bortitle => $borr->{'title'},
borphone => $borr->{'phone'},
boremail => $borr->{'email'},
borrowernumber => $reserve->{'borrowernumber'},
itemnumber => $reserve->{'itemnumber'},
reservenotes => $reserve->{'reservenotes'},
+ bormessagepref => $holdmsgpreferences->{'transports'},
);
} # else { ; } # error?
}
elsif ( $code eq 'NotIssued' ) {
$err{notissued} = 1;
$err{msg} = '';
- $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'} if $messages->{'IsPermanent'};
+ $err{msg} = $messages->{'IsPermanent'} if $messages->{'IsPermanent'};
}
elsif ( $code eq 'LocalUse' ) {
$err{localuse} = 1;
elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
$err{ispermanent} = 1;
- $err{msg} =
- $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
+ $err{msg} = $messages->{'IsPermanent'};
}
}
elsif ( $code eq 'WrongTransfer' ) {
my $returned_counter = ( C4::Context->preference('numReturnedItemsToShow') ) ? C4::Context->preference('numReturnedItemsToShow') : 8;
my $count = 0;
my @riloop;
-my $shelflocations = GetKohaAuthorisedValues('items.location','');
+my $shelflocations =
+ { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' } ) };
foreach ( sort { $a <=> $b } keys %returneditems ) {
my %ri;
if ( $count++ < $returned_counter ) {
$ri{itemnote} = $biblio->{'itemnotes'};
$ri{itemnotes_nonpublic} = $item->{'itemnotes_nonpublic'};
$ri{ccode} = $biblio->{'ccode'};
+ $ri{enumchron} = $biblio->{'enumchron'};
$ri{itemnumber} = $biblio->{'itemnumber'};
$ri{barcode} = $bar_code;
$ri{homebranch} = $item->{'homebranch'};
}
push @riloop, \%ri;
}
-my ($genbrname, $genprname);
-if (my $b = $branches->{$userenv_branch}) {
- $genbrname = $b->{'branchname'};
-}
-if (my $p = $printers->{$printer}) {
- $genprname = $p->{'printername'};
-}
+
$template->param(
riloop => \@riloop,
- genbrname => $genbrname,
- genprname => $genprname,
- branchname => $genbrname,
printer => $printer,
errmsgloop => \@errmsgloop,
exemptfine => $exemptfine,
$itemnumber = GetItemnumberFromBarcode( $barcode );
if ( $itemnumber ) {
- my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
- $holdingBranch //= '';
- $collectionBranch //= '';
- if ( ! ( $holdingBranch eq $collectionBranch ) ) {
- $template->param(
- collectionItemNeedsTransferred => 1,
- collectionBranch => GetBranchName($collectionBranch),
- );
+ my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
+ if ( $holdingBranch and $collectionBranch ) {
+ $holdingBranch //= '';
+ $collectionBranch //= $returnbranch;
+ if ( ! ( $holdingBranch eq $collectionBranch ) ) {
+ $template->param(
+ collectionItemNeedsTransferred => 1,
+ collectionBranch => $collectionBranch,
+ itemnumber => $itemnumber,
+ );
+ }
}
}