Bug 6875 de-nesting C4/Serials

* use C4::Branch is loaded only to call GetBranchNAme in PrepareSerialsData
  and set branchname in the hashresult. This sub PrepareSerialsData is used
  in the following scripts :
opac/opac-serial-issues.pl:    my $subscriptioninformation=PrepareSerialsData($subscriptions); => no use of branchname after
serials/serials-collection.pl:   $subscriptions=PrepareSerialsData(\@subscriptioninformation); => no use of branchname after
=> we can remove the ->{branchname} from the result, and remove the C4::Branch dependancy
* moves use C4::Items to require C4::Items, to call AddItemFromMarc, when
  receiving a serial, with Recieving create an item set in the subscription.
* removed use C4::Letters and C4::Search, that are useless

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Paul Poulain 2011-09-16 18:48:15 +02:00
parent 6fbe49ce31
commit c52f0b7fdf

View file

@ -23,13 +23,7 @@ use warnings;
use C4::Dates qw(format_date format_date_in_iso);
use Date::Calc qw(:all);
use POSIX qw(strftime);
use C4::Suggestions;
use C4::Koha;
use C4::Biblio;
use C4::Branch;
use C4::Items;
use C4::Search;
use C4::Letters;
use C4::Log; # logaction
use C4::Debug;
@ -417,7 +411,6 @@ sub PrepareSerialsData {
$subs->{$datefield} = format_date( $subs->{$datefield} );
}
}
$subs->{'branchname'} = GetBranchName( $subs->{'branchcode'} );
$subs->{ "status" . $subs->{'status'} } = 1;
$subs->{"checked"} = $subs->{'status'} =~ /1|3|4|7/;
@ -1328,8 +1321,8 @@ sub ReNewSubscription {
my $biblio = $sth->fetchrow_hashref;
if ( C4::Context->preference("RenewSerialAddsSuggestion") ) {
NewSuggestion(
require C4::Suggestions;
C4::Suggestions::NewSuggestion(
{ 'suggestedby' => $user,
'title' => $subscription->{bibliotitle},
'author' => $biblio->{author},
@ -1546,7 +1539,8 @@ sub ItemizeSerials {
$marcrecord->insert_fields_ordered($newField);
}
}
AddItemFromMarc( $marcrecord, $data->{'biblionumber'} );
require C4::Items;
C4::Items::AddItemFromMarc( $marcrecord, $data->{'biblionumber'} );
return 1;
}
return ( 0, @errors );