Browse Source

Bug 17600: Standardize our EXPORT_OK

On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
master
Jonathan Druart 5 years ago
parent
commit
9d6d641d1f
  1. 7
      C4/Accounts.pm
  2. 108
      C4/Acquisition.pm
  3. 36
      C4/Auth.pm
  4. 7
      C4/Auth_with_cas.pm
  5. 12
      C4/Auth_with_ldap.pm
  6. 12
      C4/Auth_with_shibboleth.pm
  7. 66
      C4/AuthoritiesMarc.pm
  8. 1
      C4/AuthoritiesMarc/MARC21.pm
  9. 2
      C4/BackgroundJob.pm
  10. 9
      C4/Barcodes.pm
  11. 4
      C4/Barcodes/EAN13.pm
  12. 4
      C4/Barcodes/annual.pm
  13. 2
      C4/Barcodes/hbyymmincr.pm
  14. 32
      C4/Biblio.pm
  15. 15
      C4/Breeding.pm
  16. 99
      C4/Budgets.pm
  17. 4
      C4/Calendar.pm
  18. 11
      C4/Charset.pm
  19. 150
      C4/Circulation.pm
  20. 18
      C4/ClassSortRoutine.pm
  21. 2
      C4/ClassSortRoutine/Dewey.pm
  22. 2
      C4/ClassSortRoutine/Generic.pm
  23. 2
      C4/ClassSortRoutine/LCC.pm
  24. 29
      C4/ClassSource.pm
  25. 3
      C4/ClassSplitRoutine.pm
  26. 5
      C4/Context.pm
  27. 16
      C4/Contract.pm
  28. 37
      C4/CourseReserves.pm
  29. 18
      C4/Creators.pm
  30. 2
      C4/Creators/Lib.pm
  31. 35
      C4/Creators/PDF.pm
  32. 2
      C4/Creators/Profile.pm
  33. 4
      C4/Creators/Template.pm
  34. 13
      C4/External/BakerTaylor.pm
  35. 2
      C4/External/OverDrive.pm
  36. 19
      C4/External/Syndetics.pm
  37. 4
      C4/Heading.pm
  38. 1
      C4/Heading/MARC21.pm
  39. 1
      C4/Heading/UNIMARC.pm
  40. 23
      C4/HoldsQueue.pm
  41. 14
      C4/ILSDI/Services.pm
  42. 121
      C4/ImportBatch.pm
  43. 17
      C4/ImportExportFramework.pm
  44. 19
      C4/InstallAuth.pm
  45. 4
      C4/Installer.pm
  46. 3
      C4/Installer/PerlModules.pm
  47. 6
      C4/Installer/UpgradeBackup.pm
  48. 2
      C4/ItemCirculationAlertPreference.pm
  49. 22
      C4/Items.pm
  50. 53
      C4/Koha.pm
  51. 7
      C4/Labels/Label.pm
  52. 16
      C4/Languages.pm
  53. 35
      C4/Letters.pm
  54. 1
      C4/Linker.pm
  55. 1
      C4/Linker/Default.pm
  56. 1
      C4/Linker/FirstMatch.pm
  57. 1
      C4/Linker/LastMatch.pm
  58. 3
      C4/Log.pm
  59. 37
      C4/MarcModificationTemplates.pm
  60. 9
      C4/Matcher.pm
  61. 40
      C4/Members.pm
  62. 11
      C4/Members/Statistics.pm
  63. 6
      C4/Message.pm
  64. 8
      C4/OAI/Sets.pm
  65. 23
      C4/Output.pm
  66. 2
      C4/Output/JSONStream.pm
  67. 43
      C4/Overdues.pm
  68. 11
      C4/Patroncards.pm
  69. 10
      C4/Patroncards/Patroncard.pm
  70. 31
      C4/Record.pm
  71. 4
      C4/Reports.pm
  72. 18
      C4/Reports/Guided.pm
  73. 80
      C4/Reserves.pm
  74. 6
      C4/Ris.pm
  75. 6
      C4/RotatingCollections.pm
  76. 2
      C4/SIP/ILS.pm
  77. 4
      C4/SIP/ILS/Item.pm
  78. 4
      C4/SIP/ILS/Transaction/Checkin.pm
  79. 4
      C4/SIP/ILS/Transaction/Checkout.pm
  80. 6
      C4/SIP/ILS/Transaction/Hold.pm
  81. 2
      C4/SIP/ILS/Transaction/Renew.pm
  82. 2
      C4/SIP/ILS/Transaction/RenewAll.pm
  83. 2
      C4/SIP/SIPServer.pm
  84. 2
      C4/SIP/Sip.pm
  85. 9
      C4/Scheduler.pm
  86. 2
      C4/Scrubber.pm
  87. 43
      C4/Search.pm
  88. 7
      C4/Search/History.pm
  89. 2
      C4/Search/PazPar2.pm
  90. 73
      C4/Serials.pm
  91. 12
      C4/Serials/Frequency.pm
  92. 16
      C4/Serials/Numberpattern.pm
  93. 2
      C4/Service.pm
  94. 15
      C4/ShelfBrowser.pm
  95. 2
      C4/SocialData.pm
  96. 10
      C4/Stats.pm
  97. 3
      C4/Suggestions.pm
  98. 37
      C4/Tags.pm
  99. 7
      C4/Templates.pm
  100. 31
      C4/TmplTokenType.pm

7
C4/Accounts.pm

@ -22,14 +22,11 @@ use Modern::Perl;
use C4::Context;
use C4::Stats;
use C4::Members;
use C4::Log qw(logaction);
use Koha::Account;
use Koha::Account::Lines;
use Koha::Account::Offsets;
use Koha::Items;
use Mojo::Util qw(deprecated);
use Data::Dumper qw(Dumper);
use vars qw(@ISA @EXPORT);
@ -37,8 +34,8 @@ BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&chargelostitem
&purge_zero_balance_fees
chargelostitem
purge_zero_balance_fees
);
}

108
C4/Acquisition.pm

@ -19,13 +19,13 @@ package C4::Acquisition;
use Modern::Perl;
use Carp;
use Carp qw( carp croak );
use Text::CSV_XS;
use C4::Context;
use C4::Suggestions;
use C4::Biblio;
use C4::Contract;
use C4::Log qw(logaction);
use C4::Suggestions qw( GetSuggestion GetSuggestionFromBiblionumber ModSuggestion );
use C4::Biblio qw( GetMarcFromKohaField GetMarcStructure IsMarcStructureInternal );
use C4::Contract qw( GetContract );
use C4::Log qw( logaction );
use C4::Templates qw(gettemplate);
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Acquisition::Baskets;
@ -42,60 +42,58 @@ use Koha::Patrons;
use C4::Koha;
use MARC::Field;
use MARC::Record;
use JSON qw(to_json);
use JSON qw( to_json );
use Time::localtime;
use vars qw(@ISA @EXPORT);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&GetBasket &NewBasket &ReopenBasket &ModBasket
&GetBasketAsCSV &GetBasketGroupAsCSV
&GetBasketsByBookseller &GetBasketsByBasketgroup
&GetBasketsInfosByBookseller
&GetBasketUsers &ModBasketUsers
&CanUserManageBasket
&ModBasketHeader
&ModBasketgroup &NewBasketgroup &DelBasketgroup &GetBasketgroup &CloseBasketgroup
&GetBasketgroups &ReOpenBasketgroup
&ModOrder &GetOrder &GetOrders &GetOrdersByBiblionumber
&GetOrderFromItemnumber
&SearchOrders &GetHistory &GetRecentAcqui
&ModReceiveOrder &CancelReceipt
&TransferOrder
&ModItemOrder
&GetParcels
&GetInvoices
&GetInvoice
&GetInvoiceDetails
&AddInvoice
&ModInvoice
&CloseInvoice
&ReopenInvoice
&DelInvoice
&MergeInvoices
&AddClaim
&GetBiblioCountByBasketno
&GetOrderUsers
&ModOrderUsers
&NotifyOrderUsers
&FillWithDefaultValues
&get_rounded_price
&get_rounding_sql
@ISA = qw(Exporter);
@EXPORT_OK = qw(
GetBasket NewBasket ReopenBasket ModBasket
GetBasketAsCSV GetBasketGroupAsCSV
GetBasketsByBookseller GetBasketsByBasketgroup
GetBasketsInfosByBookseller
GetBasketUsers ModBasketUsers
CanUserManageBasket
ModBasketHeader
ModBasketgroup NewBasketgroup DelBasketgroup GetBasketgroup CloseBasketgroup
GetBasketgroups ReOpenBasketgroup
ModOrder GetOrder GetOrders GetOrdersByBiblionumber
GetOrderFromItemnumber
SearchOrders GetHistory GetRecentAcqui
ModReceiveOrder CancelReceipt
populate_order_with_prices
TransferOrder
ModItemOrder
GetParcels
GetInvoices
GetInvoice
GetInvoiceDetails
AddInvoice
ModInvoice
CloseInvoice
ReopenInvoice
DelInvoice
MergeInvoices
AddClaim
GetBiblioCountByBasketno
GetOrderUsers
ModOrderUsers
NotifyOrderUsers
FillWithDefaultValues
get_rounded_price
get_rounding_sql
);
}

36
C4/Auth.pm

@ -19,14 +19,11 @@ package C4::Auth;
use strict;
use warnings;
use Carp qw/croak/;
use Carp qw( croak );
use Digest::MD5 qw(md5_base64);
use JSON qw/encode_json/;
use URI::Escape;
use Digest::MD5 qw( md5_base64 );
use CGI::Session;
require Exporter;
use C4::Context;
use C4::Templates; # to get the template
use C4::Languages;
@ -34,25 +31,25 @@ use C4::Search::History;
use Koha;
use Koha::Logger;
use Koha::Caches;
use Koha::AuthUtils qw(get_script_name hash_password);
use Koha::AuthUtils qw( get_script_name hash_password );
use Koha::Checkouts;
use Koha::DateUtils qw(dt_from_string);
use Koha::DateUtils qw( dt_from_string );
use Koha::Library::Groups;
use Koha::Libraries;
use Koha::Cash::Registers;
use Koha::Desks;
use Koha::Patrons;
use Koha::Patron::Consents;
use POSIX qw/strftime/;
use List::MoreUtils qw/ any /;
use Encode qw( encode is_utf8);
use C4::Auth_with_shibboleth;
use List::MoreUtils qw( any );
use Encode;
use C4::Auth_with_shibboleth qw( shib_ok get_login_shib login_shib_url logout_shib checkpw_shib );
use Net::CIDR;
use C4::Log qw/logaction/;
use C4::Log qw( logaction );
# use utf8;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $ldap $cas $caslogout);
use vars qw($ldap $cas $caslogout);
our (@ISA, @EXPORT_OK);
BEGIN {
sub psgi_env { any { /^psgi\./ } keys %ENV }
@ -63,12 +60,15 @@ BEGIN {
C4::Context->set_remote_address;
@ISA = qw(Exporter);
@EXPORT = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions);
@EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &checkpw_internal &checkpw_hash
&get_all_subpermissions &get_user_subpermissions track_login_daily &in_iprange
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
checkauth check_api_auth get_session check_cookie_auth checkpw checkpw_internal checkpw_hash
get_all_subpermissions get_user_subpermissions track_login_daily in_iprange
get_template_and_user haspermission
);
%EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] );
$ldap = C4::Context->config('useldapserver') || 0;
$cas = C4::Context->preference('casAuthentication');
$caslogout = C4::Context->preference('casLogout');

7
C4/Auth_with_cas.pm

@ -21,20 +21,19 @@ use strict;
use warnings;
use C4::Context;
use Koha::AuthUtils qw(get_script_name);
use Koha::AuthUtils qw( get_script_name );
use Authen::CAS::Client;
use CGI qw ( -utf8 );
use FindBin;
use YAML::XS;
use Koha::Logger;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required);
@EXPORT_OK = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required);
}
my $defaultcasserver;
my $casservers;

12
C4/Auth_with_ldap.pm

@ -18,23 +18,21 @@ package C4::Auth_with_ldap;
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Carp;
use Carp qw( croak );
use C4::Context;
use C4::Members::Messaging;
use C4::Auth qw(checkpw_internal);
use C4::Auth qw( checkpw_internal );
use Koha::Patrons;
use Koha::AuthUtils qw(hash_password);
use List::MoreUtils qw( any );
use Koha::AuthUtils qw( hash_password );
use Net::LDAP;
use Net::LDAP::Filter;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw( checkpw_ldap );
@EXPORT_OK = qw( checkpw_ldap );
}
# Redefine checkpw_ldap:

12
C4/Auth_with_shibboleth.pm

@ -20,22 +20,20 @@ package C4::Auth_with_shibboleth;
use Modern::Perl;
use C4::Context;
use Koha::AuthUtils qw(get_script_name);
use Koha::AuthUtils qw( get_script_name );
use Koha::Database;
use Koha::Patrons;
use C4::Members::Messaging;
use Carp;
use CGI;
use List::MoreUtils qw(any);
use Carp qw( carp );
use List::MoreUtils qw( any );
use Koha::Logger;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT =
@EXPORT_OK =
qw(shib_ok logout_shib login_shib_url checkpw_shib get_login_shib);
}

66
C4/AuthoritiesMarc.pm

@ -21,13 +21,12 @@ package C4::AuthoritiesMarc;
use strict;
use warnings;
use C4::Context;
use MARC::Record;
use C4::Biblio;
use C4::Search;
use C4::Biblio qw( GetFrameworkCode GetMarcBiblio ModBiblio );
use C4::Search qw( FindDuplicate new_record_from_zebra );
use C4::AuthoritiesMarc::MARC21;
use C4::AuthoritiesMarc::UNIMARC;
use C4::Charset;
use C4::Log;
use C4::Charset qw( SetUTF8Flag );
use C4::Log qw( logaction );
use Koha::MetadataRecord::Authority;
use Koha::Authorities;
use Koha::Authority::MergeRequests;
@ -38,35 +37,38 @@ use Koha::SearchEngine;
use Koha::SearchEngine::Indexer;
use Koha::SearchEngine::Search;
use vars qw(@ISA @EXPORT);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&GetTagsLabels
&GetAuthMARCFromKohaField
&AddAuthority
&ModAuthority
&DelAuthority
&GetAuthority
&GetAuthorityXML
&SearchAuthorities
&BuildSummary
&BuildAuthHierarchies
&BuildAuthHierarchy
&GenerateHierarchy
&merge
&FindDuplicateAuthority
&GuessAuthTypeCode
&GuessAuthId
);
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
GetTagsLabels
GetAuthMARCFromKohaField
AddAuthority
ModAuthority
DelAuthority
GetAuthority
GetAuthorityXML
SearchAuthorities
BuildSummary
BuildAuthHierarchies
BuildAuthHierarchy
GenerateHierarchy
GetHeaderAuthority
AddAuthorityTrees
CompareFieldWithAuthority
merge
FindDuplicateAuthority
GuessAuthTypeCode
GuessAuthId
compare_fields
);
}

1
C4/AuthoritiesMarc/MARC21.pm

@ -18,7 +18,6 @@ package C4::AuthoritiesMarc::MARC21;
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use MARC::Record;
=head1 NAME

2
C4/BackgroundJob.pm

@ -20,7 +20,7 @@ package C4::BackgroundJob;
use Modern::Perl;
use C4::Context;
use C4::Auth qw/get_session/;
use C4::Auth qw( get_session );
use Digest::MD5;

9
C4/Barcodes.pm

@ -20,7 +20,7 @@ package C4::Barcodes;
use strict;
use warnings;
use Carp;
use Carp qw( carp );
use C4::Context;
use C4::Barcodes::hbyymmincr;
@ -28,15 +28,8 @@ use C4::Barcodes::annual;
use C4::Barcodes::incremental;
use C4::Barcodes::EAN13;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use vars qw($max $prefformat);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw();
}
sub _prefformat {
unless (defined $prefformat) {
unless ($prefformat = C4::Context->preference('autoBarcode')) {

4
C4/Barcodes/EAN13.pm

@ -22,8 +22,8 @@ use warnings;
use C4::Context;
use Algorithm::CheckDigits;
use Carp;
use Algorithm::CheckDigits qw( CheckDigits );
use Carp qw( carp );
use vars qw(@ISA);

4
C4/Barcodes/annual.pm

@ -20,11 +20,11 @@ package C4::Barcodes::annual;
use strict;
use warnings;
use Carp;
use Carp qw( carp );
use C4::Context;
use Koha::DateUtils qw( output_pref dt_from_string );
use Koha::DateUtils qw( dt_from_string output_pref );
use vars qw(@ISA);
use vars qw($width);

2
C4/Barcodes/hbyymmincr.pm

@ -19,7 +19,7 @@ package C4::Barcodes::hbyymmincr;
use Modern::Perl;
use Carp;
use Carp qw( carp );
use C4::Context;

32
C4/Biblio.pm

@ -21,12 +21,12 @@ package C4::Biblio;
use Modern::Perl;
use vars qw(@ISA @EXPORT);
use vars qw(@ISA @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
@EXPORT_OK = qw(
AddBiblio
GetBiblioData
GetMarcBiblio
@ -45,6 +45,7 @@ BEGIN {
GetMarcQuantity
GetAuthorisedValueDesc
GetMarcStructure
GetMarcSubfieldStructure
IsMarcStructureInternal
GetMarcFromKohaField
GetMarcSubfieldStructureFromKohaField
@ -54,6 +55,7 @@ BEGIN {
CountItemsIssued
ModBiblio
ModZebra
EmbedItemsInMarcBiblio
UpdateTotalIssues
RemoveAllNsb
DelBiblio
@ -63,35 +65,42 @@ BEGIN {
TransformHtmlToMarc
TransformHtmlToXml
prepare_host_field
TransformMarcToKohaOneField
);
# Internal functions
# those functions are exported but should not be used
# they are useful in a few circumstances, so they are exported,
# but don't use them unless you are a core developer ;-)
push @EXPORT, qw(
push @EXPORT_OK, qw(
ModBiblioMarc
);
}
use Carp;
use Try::Tiny;
use Carp qw( carp );
use Try::Tiny qw( catch try );
use Encode qw( decode is_utf8 );
use Encode;
use List::MoreUtils qw( uniq );
use MARC::Record;
use MARC::File::USMARC;
use MARC::File::XML;
use POSIX qw(strftime);
use Module::Load::Conditional qw(can_load);
use POSIX qw( strftime );
use Module::Load::Conditional qw( can_load );
use C4::Koha;
use C4::Log; # logaction
use C4::Log qw( logaction ); # logaction
use C4::Budgets;
use C4::ClassSource;
use C4::Charset;
use C4::ClassSource qw( GetClassSort );
use C4::Charset qw(
nsb_clean
SetMarcUnicodeFlag
SetUTF8Flag
StripNonXmlChars
);
use C4::Linker;
use C4::OAI::Sets;
use C4::Items qw( GetHiddenItemnumbers GetMarcItem );
use Koha::Logger;
use Koha::Caches;
@ -2572,7 +2581,6 @@ sub EmbedItemsInMarcBiblio {
my $opachiddenitems = $opac
&& ( C4::Context->preference('OpacHiddenItems') !~ /^\s*$/ );
require C4::Items;
while ( my ($itemnumber) = $sth->fetchrow_array ) {
next if @$itemnumbers and not grep { $_ == $itemnumber } @$itemnumbers;
my $item;

15
C4/Breeding.pm

@ -22,22 +22,21 @@ use strict;
use warnings;
use C4::Biblio;
use C4::Koha;
use C4::Charset;
use C4::Koha qw( GetNormalizedISBN );
use C4::Charset qw( MarcToUTF8Record SetUTF8Flag );
use MARC::File::USMARC;
use MARC::Field;
use C4::ImportBatch;
use C4::ImportBatch qw( GetZ3950BatchId AddBiblioToBatch AddAuthToBatch );
use C4::AuthoritiesMarc; #GuessAuthTypeCode, FindDuplicateAuthority
use C4::Languages;
use Koha::Database;
use Koha::XSLT::Base;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(&BreedingSearch &Z3950Search &Z3950SearchAuth);
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(BreedingSearch Z3950Search Z3950SearchAuth);
}
=head1 NAME

99
C4/Budgets.pm

@ -23,54 +23,61 @@ use Koha::Database;
use Koha::Patrons;
use Koha::Acquisition::Invoice::Adjustments;
use C4::Acquisition;
use vars qw(@ISA @EXPORT);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&GetBudget
&GetBudgetByOrderNumber
&GetBudgetByCode
&GetBudgets
&BudgetsByActivity
&GetBudgetsReport
&GetBudgetReport
&GetBudgetHierarchy
&AddBudget
&ModBudget
&DelBudget
&GetBudgetSpent
&GetBudgetOrdered
&GetBudgetName
&GetPeriodsCount
GetBudgetHierarchySpent
GetBudgetHierarchyOrdered
&GetBudgetUsers
&ModBudgetUsers
&CanUserUseBudget
&CanUserModifyBudget
&GetBudgetPeriod
&GetBudgetPeriods
&ModBudgetPeriod
&AddBudgetPeriod
&DelBudgetPeriod
&ModBudgetPlan
&GetBudgetsPlanCell
&AddBudgetPlanValue
&GetBudgetAuthCats
&BudgetHasChildren
&CheckBudgetParent
&CheckBudgetParentPerm
&HideCols
&GetCols
);
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
GetBudget
GetBudgetByOrderNumber
GetBudgetByCode
GetBudgets
BudgetsByActivity
GetBudgetsReport
GetBudgetReport
GetBudgetsByActivity
GetBudgetHierarchy
AddBudget
ModBudget
DelBudget
GetBudgetSpent
GetBudgetOrdered
GetBudgetName
GetPeriodsCount
GetBudgetHierarchySpent
GetBudgetHierarchyOrdered
GetBudgetUsers
ModBudgetUsers
CanUserUseBudget
CanUserModifyBudget
GetBudgetPeriod
GetBudgetPeriods
ModBudgetPeriod
AddBudgetPeriod
DelBudgetPeriod
ModBudgetPlan
GetBudgetsPlanCell
AddBudgetPlanValue
GetBudgetAuthCats
BudgetHasChildren
GetBudgetChildren
SetOwnerToFundHierarchy
CheckBudgetParent
CheckBudgetParentPerm
HideCols
GetCols
CloneBudgetPeriod
CloneBudgetHierarchy
MoveOrders
);
}
# ----------------------------BUDGETS.PM-----------------------------";

4
C4/Calendar.pm

@ -19,8 +19,8 @@ use strict;
use warnings;
use vars qw(@EXPORT);
use Carp;
use Date::Calc qw( Date_to_Days Today);
use Carp qw( croak );
use Date::Calc qw( Today );
use C4::Context;
use Koha::Caches;

11
C4/Charset.pm

@ -19,19 +19,18 @@ package C4::Charset;
use Modern::Perl;
use MARC::Charset qw/marc8_to_utf8/;
use MARC::Charset;
use Text::Iconv;
use Unicode::Normalize;
use Encode qw( decode encode is_utf8 );
use Unicode::Normalize qw( NFC NFD );
use Encode;
use Koha::Logger;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
@EXPORT_OK = qw(
NormalizeString
IsStringUTF8ish
MarcToUTF8Record

150
C4/Circulation.pm

@ -24,32 +24,31 @@ use POSIX qw( floor );
use YAML::XS;
use Encode;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string output_pref );
use C4::Context;
use C4::Stats;
use C4::Reserves;
use C4::Biblio;
use C4::Items;
use C4::Members;
use C4::Stats qw( UpdateStats );
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest );
use C4::Biblio qw( UpdateTotalIssues );
use C4::Items qw( ModItemTransfer ModDateLastSeen CartToShelf );
use C4::Accounts;
use C4::ItemCirculationAlertPreference;
use C4::Message;
use C4::Log; # logaction
use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units);
use C4::Log qw( logaction ); # logaction
use C4::Overdues;
use C4::RotatingCollections qw(GetCollectionItemBranches);
use Algorithm::CheckDigits;
use Algorithm::CheckDigits qw( CheckDigits );
use Data::Dumper;
use Data::Dumper qw( Dumper );
use Koha::Account;
use Koha::AuthorisedValues;
use Koha::Biblioitems;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Calendar;
use Koha::Checkouts;
use Koha::Illrequests;
use Koha::Items;
use Koha::Patrons;
use Koha::Patron::Debarments;
use Koha::Patron::Debarments qw( DelUniqueDebarment GetDebarments );
use Koha::Database;
use Koha::Libraries;
use Koha::Account::Lines;
@ -62,77 +61,68 @@ use Koha::Config::SysPref;
use Koha::Checkouts::ReturnClaims;
use Koha::SearchEngine::Indexer;
use Koha::Exceptions::Checkout;
use Carp;
use List::MoreUtils qw( uniq any );
use Carp qw( carp );
use List::MoreUtils qw( any );
use Scalar::Util qw( looks_like_number );
use Try::Tiny;
use Date::Calc qw(
Today
Today_and_Now
Add_Delta_YM
Add_Delta_DHMS
Date_to_Days
Day_of_Week
Add_Delta_Days
);
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use Date::Calc qw( Date_to_Days );
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
# FIXME subs that should probably be elsewhere
push @EXPORT, qw(
&barcodedecode
&LostItem
&ReturnLostItem
&GetPendingOnSiteCheckouts
);
# subs to deal with issuing a book
push @EXPORT, qw(
&CanBookBeIssued
&CanBookBeRenewed
&AddIssue
&AddRenewal
&GetRenewCount
&GetSoonestRenewDate
&GetLatestAutoRenewDate
&GetIssuingCharges
&GetBranchBorrowerCircRule
&GetBranchItemRule
&GetOpenIssue
&CheckIfIssuedToPatron
&IsItemIssued
GetTopIssues
);
# subs to deal with returns
push @EXPORT, qw(
&AddReturn
&MarkIssueReturned
);
# subs to deal with transfers
push @EXPORT, qw(
&transferbook
&GetTransfers
&GetTransfersFromTo
&updateWrongTransfer
&IsBranchTransferAllowed
&CreateBranchTransferLimit
&DeleteBranchTransferLimits
&TransferSlip
);
# subs to deal with offline circulation
push @EXPORT, qw(
&GetOfflineOperations
&GetOfflineOperation
&AddOfflineOperation
&DeleteOfflineOperation
&ProcessOfflineOperation
require Exporter;
@ISA = qw(Exporter);
# FIXME subs that should probably be elsewhere
push @EXPORT_OK, qw(
barcodedecode
LostItem
ReturnLostItem
GetPendingOnSiteCheckouts
CanBookBeIssued
checkHighHolds
CanBookBeRenewed
AddIssue
GetLoanLength
GetHardDueDate
AddRenewal
GetRenewCount
GetSoonestRenewDate
GetLatestAutoRenewDate
GetIssuingCharges
AddIssuingCharge
GetBranchBorrowerCircRule
GetBranchItemRule
GetBiblioIssues
GetOpenIssue
GetUpcomingDueIssues
CheckIfIssuedToPatron
IsItemIssued
GetAgeRestriction
GetTopIssues
AddReturn
MarkIssueReturned
transferbook
TooMany
GetTransfers
GetTransfersFromTo
updateWrongTransfer
CalcDateDue
CheckValidBarcode
IsBranchTransferAllowed
CreateBranchTransferLimit
DeleteBranchTransferLimits
TransferSlip
GetOfflineOperations
GetOfflineOperation
AddOfflineOperation
DeleteOfflineOperation
ProcessOfflineOperation
ProcessOfflinePayment
);
push @EXPORT_OK, '_GetCircControlBranch'; # This is wrong!
}
=head1 NAME

18
C4/ClassSortRoutine.pm

@ -20,12 +20,18 @@ package C4::ClassSortRoutine;
use strict;
use warnings;
require Exporter;
use Class::Factory::Util;
use C4::Context;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
GetSortRoutineNames
GetClassSortKey
);
}
=head1 NAME
@ -40,12 +46,6 @@ use C4::ClassSortRoutine;
=cut
@ISA = qw(Exporter);
@EXPORT = qw(
&GetSortRoutineNames
&GetClassSortKey
);
# initialization code
my %loaded_routines = ();
my @sort_routines = GetSortRoutineNames();

2
C4/ClassSortRoutine/Dewey.pm

@ -28,7 +28,7 @@ C4::ClassSortRoutine::Dewey - generic call number sorting key routine
=head1 SYNOPSIS
use C4::ClassSortRoutine;
use C4::ClassSortRoutine qw( GetClassSortKey );
my $cn_sort = GetClassSortKey('Dewey', $cn_class, $cn_item);

2
C4/ClassSortRoutine/Generic.pm

@ -28,7 +28,7 @@ C4::ClassSortRoutine::Generic - generic call number sorting key routine
=head1 SYNOPSIS
use C4::ClassSortRoutine;
use C4::ClassSortRoutine qw( GetClassSortKey );
my $cn_sort = GetClassSortKey('Generic', $cn_class, $cn_item);

2
C4/ClassSortRoutine/LCC.pm

@ -30,7 +30,7 @@ C4::ClassSortRoutine::LCC - generic call number sorting key routine
=head1 SYNOPSIS
use C4::ClassSortRoutine;
use C4::ClassSortRoutine qw( GetClassSortKey );
my $cn_sort = GetClassSortKey('LCC', $cn_class, $cn_item);

29
C4/ClassSource.pm

@ -20,12 +20,20 @@ package C4::ClassSource;
use strict;
use warnings;
require Exporter;
use C4::Context;
use C4::ClassSortRoutine;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use C4::ClassSortRoutine qw( GetClassSortKey );
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
GetClassSources
GetClassSource
GetClassSortRule
GetClassSort
);
}
=head1 NAME
@ -44,17 +52,6 @@ sources and sorting rules.
=cut
@ISA = qw(Exporter);
@EXPORT = qw(
&GetClassSources
&GetClassSource
&GetClassSortRule
&GetClassSort
);
=head2 GetClassSources
my $sources = GetClassSources();

3
C4/ClassSplitRoutine.pm

@ -20,7 +20,6 @@ package C4::ClassSplitRoutine;
use Modern::Perl;
require Exporter;
use Class::Factory::Util;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ -39,7 +38,7 @@ use C4::ClassSplitRoutine;
@ISA = qw(Exporter);
@EXPORT = qw(
&GetSplitRoutineNames
GetSplitRoutineNames
);
=head2 GetSplitRoutineNames

5
C4/Context.pm

@ -35,12 +35,11 @@ BEGIN {
}
};
use Carp;
use Carp qw( carp );
use DateTime::TimeZone;
use Encode;
use File::Spec;
use Module::Load::Conditional qw(can_load);
use POSIX ();
use POSIX;
use YAML::XS;
use ZOOM;

16
C4/Contract.pm

@ -25,14 +25,14 @@ use vars qw(@ISA @EXPORT);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&GetContracts
&GetContract
&AddContract
&ModContract
&DelContract
);
@ISA = qw(Exporter);
@EXPORT = qw(
GetContracts
GetContract
AddContract
ModContract
DelContract
);
}
=head1 NAME

37
C4/CourseReserves.pm

@ -17,43 +17,42 @@ package C4::CourseReserves;
use Modern::Perl;
use List::MoreUtils qw(any);
use List::MoreUtils qw( any );
use C4::Context;
use C4::Circulation qw(GetOpenIssue);
use C4::Circulation qw( GetOpenIssue );
use Koha::Courses;
use Koha::Course::Instructors;
use Koha::Course::Items;
use Koha::Course::Reserves;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS @FIELDS);
use vars qw(@FIELDS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
&GetCourse
&ModCourse
&GetCourses
&DelCourse
GetCourse
ModCourse
GetCourses
DelCourse
&GetCourseInstructors
&ModCourseInstructors
GetCourseInstructors
ModCourseInstructors
&GetCourseItem
&ModCourseItem
GetCourseItem
ModCourseItem
&GetCourseReserve
&ModCourseReserve
&GetCourseReserves
&DelCourseReserve
GetCourseReserve
ModCourseReserve
GetCourseReserves
DelCourseReserve
&SearchCourses
SearchCourses
&GetItemCourseReservesInfo
GetItemCourseReservesInfo
);
%EXPORT_TAGS = ( 'all' => \@EXPORT_OK );
@FIELDS = ( 'itype', 'ccode', 'homebranch', 'holdingbranch', 'location' );
}

18
C4/Creators.pm

@ -38,7 +38,23 @@ BEGIN {
get_unit_values
html_table
);
use C4::Creators::Lib;
use C4::Creators::Lib qw(
get_all_image_names
get_all_layouts
get_all_profiles
get_all_templates
get_barcode_types
get_batch_summary
get_card_summary
get_font_types
get_label_summary
get_label_types
get_output_formats
get_table_names
get_text_justification_types
get_unit_values
html_table
);
use C4::Creators::PDF;
}

2
C4/Creators/Lib.pm

@ -18,7 +18,7 @@ package C4::Creators::Lib;
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Storable qw(dclone);
use Storable qw( dclone );
use autouse 'Data::Dumper' => qw(Dumper);

35
C4/Creators/PDF.pm

@ -19,10 +19,41 @@ package C4::Creators::PDF;
use strict;
use warnings;
use PDF::Reuse;
use PDF::Reuse qw(
prAdd
prAltJpeg
prBookmark
prCompress
prDoc
prDocDir
prDocForm
prEnd
prExtract
prField
prFile
prFont
prFontSize
prForm
prGetLogBuffer
prGraphState
prImage
prInit
prInitVars
prJpeg
prJs
prLink
prLog
prLogDir
prMbox
prPage
prSinglePage
prStrWidth
prText
prTTFont
);
use PDF::Reuse::Barcode;
use File::Temp;
use List::Util qw/first/;
use List::Util qw( first );
sub _InitVars {

2
C4/Creators/Profile.pm

@ -6,7 +6,7 @@ use warnings;
use autouse 'Data::Dumper' => qw(Dumper);
use C4::Context;
use C4::Creators::Lib qw(get_unit_values);
use C4::Creators::Lib qw( get_unit_values );
sub _check_params {

4
C4/Creators/Template.pm

@ -2,12 +2,12 @@ package C4::Creators::Template;
use strict;
use warnings;
use POSIX qw(ceil);
use POSIX qw( ceil );
use autouse 'Data::Dumper' => qw(Dumper);
use C4::Context;
use C4::Creators::Profile;
use C4::Creators::Lib qw(get_unit_values);
use C4::Creators::Lib qw( get_unit_values );
sub _check_params {

13
C4/External/BakerTaylor.pm

@ -19,21 +19,20 @@ package C4::External::BakerTaylor;
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use XML::Simple;
use LWP::Simple;
use HTTP::Request::Common;
use LWP::Simple qw( get );
use C4::Context;
use Modern::Perl;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
use vars qw(%EXPORT_TAGS $VERSION);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
require Exporter;
@ISA = qw(Exporter);
$VERSION = 3.07.00.049;
@EXPORT_OK = qw(&availability &content_cafe &image_url &link_url &http_jacket_link);
%EXPORT_TAGS = (all=>\@EXPORT_OK);
@EXPORT_OK = qw(availability content_cafe_url image_url link_url http_jacket_link);
}
# These variables are plack safe: they are initialized each time

2
C4/External/OverDrive.pm

@ -21,7 +21,7 @@ use strict;
use warnings;
use Koha;
use JSON;
use JSON qw( from_json );
use Koha::Caches;
use HTTP::Request;
use HTTP::Request::Common;

19
C4/External/Syndetics.pm

@ -17,11 +17,10 @@ package C4::External::Syndetics;
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use XML::Simple;
use XML::Simple qw( XMLout );
use XML::LibXML;
use LWP::Simple;
use LWP::Simple qw( $ua );
use LWP::UserAgent;
use HTTP::Request::Common;
use strict;
use warnings;
@ -32,13 +31,13 @@ BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
&get_syndetics_index
&get_syndetics_summary
&get_syndetics_toc
&get_syndetics_editions
&get_syndetics_excerpt
&get_syndetics_reviews
&get_syndetics_anotes
get_syndetics_index
get_syndetics_summary
get_syndetics_toc
get_syndetics_editions
get_syndetics_excerpt
get_syndetics_reviews
get_syndetics_anotes
);
}

4
C4/Heading.pm

@ -19,11 +19,9 @@ package C4::Heading;
use Modern::Perl;
use MARC::Record;
use MARC::Field;
use C4::Context;
use Module::Load;
use Carp;
use Module::Load qw( load );
=head1 NAME

1
C4/Heading/MARC21.pm

@ -19,7 +19,6 @@ package C4::Heading::MARC21;
use strict;
use warnings;
use MARC::Record;
use MARC::Field;

1
C4/Heading/UNIMARC.pm

@ -20,7 +20,6 @@ package C4::Heading::UNIMARC;
use 5.010;
use strict;
use warnings;
use MARC::Record;
use MARC::Field;
use C4::Context;

23
C4/HoldsQueue.pm

@ -24,29 +24,26 @@ use warnings;
use C4::Context;
use C4::Search;
use C4::Items;
use C4::Circulation;
use C4::Members;
use C4::Biblio;
use Koha::DateUtils;
use C4::Circulation qw( GetTransfers GetBranchItemRule );
use Koha::DateUtils qw( dt_from_string );
use Koha::Items;
use Koha::Patrons;
use Koha::Libraries;
use List::Util qw(shuffle);
use List::MoreUtils qw(any);
use Data::Dumper;
use List::Util qw( shuffle );
use List::MoreUtils qw( any );
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
&CreateQueue
&GetHoldsQueueItems
CreateQueue
GetHoldsQueueItems
&TransportCostMatrix
&UpdateTransportCostMatrix