From 4370a19d75e2824d71946898d0876fb899199e52 Mon Sep 17 00:00:00 2001 From: Andrew Elwell Date: Mon, 7 Jun 2010 16:12:18 +0200 Subject: [PATCH] Final batch of POD cleanups. Should fix any remaining warnings with 'podchecker' Signed-off-by: Andrew Elwell Signed-off-by: Galen Charlton --- C4/Items.pm | 372 ++++++++++++--------------------------------- C4/Matcher.pm | 167 +++++++------------- C4/Members.pm | 98 ++++-------- C4/Record.pm | 107 ++----------- C4/UploadedFile.pm | 87 +++-------- 5 files changed, 222 insertions(+), 609 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 3678bf905c..96f60f0187 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -118,11 +118,7 @@ of C =head2 GetItem -=over 4 - -$item = GetItem($itemnumber,$barcode,$serial); - -=back + $item = GetItem($itemnumber,$barcode,$serial); Return item information, for a given itemnumber or barcode. The return value is a hashref mapping item column @@ -165,11 +161,7 @@ sub GetItem { =head2 CartToShelf -=over 4 - -CartToShelf($itemnumber); - -=back + CartToShelf($itemnumber); Set the current shelving location of the item record to its stored permanent shelving location. This is @@ -193,12 +185,8 @@ sub CartToShelf { =head2 AddItemFromMarc -=over 4 - -my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItemFromMarc($source_item_marc, $biblionumber); - -=back + my ($biblionumber, $biblioitemnumber, $itemnumber) + = AddItemFromMarc($source_item_marc, $biblionumber); Given a MARC::Record object containing an embedded item record and a biblionumber, create a new item record. @@ -222,12 +210,8 @@ sub AddItemFromMarc { =head2 AddItem -=over 4 - -my ($biblionumber, $biblioitemnumber, $itemnumber) - = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); - -=back + my ($biblionumber, $biblioitemnumber, $itemnumber) + = AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]); Given a hash containing item column names as keys, create a new Koha item record. @@ -286,11 +270,8 @@ sub AddItem { =head2 AddItemBatchFromMarc -=over 4 - -($itemnumber_ref, $error_ref) = AddItemBatchFromMarc($record, $biblionumber, $biblioitemnumber, $frameworkcode); - -=back + ($itemnumber_ref, $error_ref) = AddItemBatchFromMarc($record, + $biblionumber, $biblioitemnumber, $frameworkcode); Efficiently create item records from a MARC biblio record with embedded item fields. This routine is suitable for batch jobs. @@ -308,7 +289,7 @@ This function returns an arrayref of new itemsnumbers and an arrayref of item errors encountered during the processing. Each entry in the errors list is a hashref containing the following keys: -=over 2 +=over =item item_sequence @@ -393,11 +374,7 @@ sub AddItemBatchFromMarc { =head2 ModItemFromMarc -=over 4 - -ModItemFromMarc($item_marc, $biblionumber, $itemnumber); - -=back + ModItemFromMarc($item_marc, $biblionumber, $itemnumber); This function updates an item record based on a supplied C object containing an embedded item field. @@ -470,11 +447,8 @@ sub ModItemFromMarc { =head2 ModItem -=over 4 - -ModItem({ column => $newvalue }, $biblionumber, $itemnumber[, $original_item_marc]); - -=back + ModItem({ column => $newvalue }, $biblionumber, + $itemnumber[, $original_item_marc]); Change one or more columns in an item record and update the MARC representation of the item. @@ -545,11 +519,7 @@ sub ModItem { =head2 ModItemTransfer -=over 4 - -ModItemTransfer($itenumber, $frombranch, $tobranch); - -=back + ModItemTransfer($itenumber, $frombranch, $tobranch); Marks an item as being transferred from one branch to another. @@ -574,11 +544,7 @@ sub ModItemTransfer { =head2 ModDateLastSeen -=over 4 - -ModDateLastSeen($itemnum); - -=back + ModDateLastSeen($itemnum); Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking. C<$itemnum> is the item number @@ -594,11 +560,7 @@ sub ModDateLastSeen { =head2 DelItem -=over 4 - -DelItem($dbh, $biblionumber, $itemnumber); - -=back + DelItem($dbh, $biblionumber, $itemnumber); Exported function (core API) for deleting an item record in Koha. @@ -635,8 +597,6 @@ sub DelItem { =head2 CheckItemPreSave -=over 4 - my $item_ref = TransformMarcToKoha($marc, 'items'); # do stuff my %errors = CheckItemPreSave($item_ref); @@ -650,8 +610,6 @@ sub DelItem { print "item is OK"; } -=back - Given a hashref containing item fields, determine if it can be inserted or updated in the database. Specifically, checks for database integrity issues, and returns a hash containing any @@ -734,11 +692,7 @@ has copy-and-paste work. =head2 GetItemStatus -=over 4 - -$itemstatushash = GetItemStatus($fwkcode); - -=back + $itemstatushash = GetItemStatus($fwkcode); Returns a list of valid values for the C field. @@ -753,32 +707,24 @@ Create a status selector with the following code =head3 in PERL SCRIPT -=over 4 - -my $itemstatushash = getitemstatus; -my @itemstatusloop; -foreach my $thisstatus (keys %$itemstatushash) { - my %row =(value => $thisstatus, - statusname => $itemstatushash->{$thisstatus}->{'statusname'}, - ); - push @itemstatusloop, \%row; -} -$template->param(statusloop=>\@itemstatusloop); - -=back + my $itemstatushash = getitemstatus; + my @itemstatusloop; + foreach my $thisstatus (keys %$itemstatushash) { + my %row =(value => $thisstatus, + statusname => $itemstatushash->{$thisstatus}->{'statusname'}, + ); + push @itemstatusloop, \%row; + } + $template->param(statusloop=>\@itemstatusloop); =head3 in TEMPLATE -=over 4 - - - -=back + =cut @@ -834,11 +780,7 @@ sub GetItemStatus { =head2 GetItemLocation -=over 4 - -$itemlochash = GetItemLocation($fwk); - -=back + $itemlochash = GetItemLocation($fwk); Returns a list of valid values for the C field. @@ -851,34 +793,26 @@ Create a location selector with the following code =head3 in PERL SCRIPT -=over 4 - -my $itemlochash = getitemlocation; -my @itemlocloop; -foreach my $thisloc (keys %$itemlochash) { - my $selected = 1 if $thisbranch eq $branch; - my %row =(locval => $thisloc, - selected => $selected, - locname => $itemlochash->{$thisloc}, - ); - push @itemlocloop, \%row; -} -$template->param(itemlocationloop => \@itemlocloop); - -=back + my $itemlochash = getitemlocation; + my @itemlocloop; + foreach my $thisloc (keys %$itemlochash) { + my $selected = 1 if $thisbranch eq $branch; + my %row =(locval => $thisloc, + selected => $selected, + locname => $itemlochash->{$thisloc}, + ); + push @itemlocloop, \%row; + } + $template->param(itemlocationloop => \@itemlocloop); =head3 in TEMPLATE -=over 4 - - - -=back + =cut @@ -932,11 +866,7 @@ sub GetItemLocation { =head2 GetLostItems -=over 4 - -$items = GetLostItems( $where, $orderby ); - -=back + $items = GetLostItems( $where, $orderby ); This function gets a list of lost items. @@ -960,9 +890,9 @@ from the "items" table as keys. =item usage in the perl script: -my $where = { barcode => '0001548' }; -my $items = GetLostItems( $where, "homebranch" ); -$template->param( itemsloop => $items ); + my $where = { barcode => '0001548' }; + my $items = GetLostItems( $where, "homebranch" ); + $template->param( itemsloop => $items ); =back @@ -1007,11 +937,9 @@ sub GetLostItems { =head2 GetItemsForInventory -=over 4 - -$itemlist = GetItemsForInventory($minlocation, $maxlocation, $location, $itemtype $datelastseen, $branch, $offset, $size, $statushash); - -=back + $itemlist = GetItemsForInventory($minlocation, $maxlocation, + $location, $itemtype $datelastseen, $branch, + $offset, $size, $statushash); Retrieve a list of title/authors/barcode/callnumber, for biblio inventory. @@ -1105,10 +1033,7 @@ END_SQL =head2 GetItemsCount -=over 4 -$count = &GetItemsCount( $biblionumber); - -=back + $count = &GetItemsCount( $biblionumber); This function return count of item with $biblionumber @@ -1128,11 +1053,7 @@ sub GetItemsCount { =head2 GetItemInfosOf -=over 4 - -GetItemInfosOf(@itemnumbers); - -=back + GetItemInfosOf(@itemnumbers); =cut @@ -1149,11 +1070,7 @@ sub GetItemInfosOf { =head2 GetItemsByBiblioitemnumber -=over 4 - -GetItemsByBiblioitemnumber($biblioitemnumber); - -=back + GetItemsByBiblioitemnumber($biblioitemnumber); Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP Called by C @@ -1205,11 +1122,7 @@ sub GetItemsByBiblioitemnumber { =head2 GetItemsInfo -=over 4 - -@results = GetItemsInfo($biblionumber, $type); - -=back + @results = GetItemsInfo($biblionumber, $type); Returns information about books with the given biblionumber. @@ -1407,11 +1320,8 @@ sub GetItemsInfo { =head2 GetLastAcquisitions -=over 4 - -my $lastacq = GetLastAcquisitions({'branches' => ('branch1','branch2'), 'itemtypes' => ('BK','BD')}, 10); - -=back + my $lastacq = GetLastAcquisitions({'branches' => ('branch1','branch2'), + 'itemtypes' => ('BK','BD')}, 10); =cut @@ -1461,11 +1371,7 @@ sub GetLastAcquisitions { =head2 get_itemnumbers_of -=over 4 - -my @itemnumbers_of = get_itemnumbers_of(@biblionumbers); - -=back + my @itemnumbers_of = get_itemnumbers_of(@biblionumbers); Given a list of biblionumbers, return the list of corresponding itemnumbers for each biblionumber. @@ -1500,11 +1406,7 @@ sub get_itemnumbers_of { =head2 GetItemnumberFromBarcode -=over 4 - -$result = GetItemnumberFromBarcode($barcode); - -=back + $result = GetItemnumberFromBarcode($barcode); =cut @@ -1521,11 +1423,7 @@ sub GetItemnumberFromBarcode { =head2 GetBarcodeFromItemnumber -=over 4 - -$result = GetBarcodeFromItemnumber($itemnumber); - -=back + $result = GetBarcodeFromItemnumber($itemnumber); =cut @@ -1542,12 +1440,11 @@ sub GetBarcodeFromItemnumber { =head3 get_item_authorised_values - find the types and values for all authorised values assigned to this item. +find the types and values for all authorised values assigned to this item. - parameters: - itemnumber +parameters: itemnumber - returns: a hashref malling the authorised value to the value set for this itemnumber +returns: a hashref malling the authorised value to the value set for this itemnumber $authorised_values = { 'CCODE' => undef, @@ -1563,7 +1460,7 @@ sub GetBarcodeFromItemnumber { 'itemtypes' => 'SER', }; - Notes: see C4::Biblio::get_biblio_authorised_values for a similar method at the biblio level. +Notes: see C4::Biblio::get_biblio_authorised_values for a similar method at the biblio level. =cut @@ -1593,25 +1490,24 @@ sub get_item_authorised_values { =head3 get_authorised_value_images - find a list of icons that are appropriate for display based on the - authorised values for a biblio. +find a list of icons that are appropriate for display based on the +authorised values for a biblio. - parameters: listref of authorised values, such as comes from - get_item_authorised_values or - from C4::Biblio::get_biblio_authorised_values +parameters: listref of authorised values, such as comes from +get_item_authorised_values or +from C4::Biblio::get_biblio_authorised_values - returns: listref of hashrefs for each image. Each hashref looks like - this: +returns: listref of hashrefs for each image. Each hashref looks like this: { imageurl => '/intranet-tmpl/prog/img/itemtypeimg/npl/WEB.gif', label => '', category => '', value => '', } - Notes: Currently, I put on the full path to the images on the staff - side. This should either be configurable or not done at all. Since I - have to deal with 'intranet' or 'opac' in - get_biblio_authorised_values, perhaps I should be passing it in. +Notes: Currently, I put on the full path to the images on the staff +side. This should either be configurable or not done at all. Since I +have to deal with 'intranet' or 'opac' in +get_biblio_authorised_values, perhaps I should be passing it in. =cut @@ -1652,11 +1548,7 @@ without careful thought. =head2 GetMarcItem -=over 4 - -my $item_marc = GetMarcItem($biblionumber, $itemnumber); - -=back + my $item_marc = GetMarcItem($biblionumber, $itemnumber); Returns MARC::Record of the item passed in parameter. This function is meant for use only in C, @@ -1743,11 +1635,7 @@ my %derived_columns = ( =head2 _set_derived_columns_for_add -=over 4 - -_set_derived_column_for_add($item); - -=back + _set_derived_column_for_add($item); Given an item hash representing a new item to be added, calculate any derived columns. Currently the only @@ -1771,11 +1659,7 @@ sub _set_derived_columns_for_add { =head2 _set_derived_columns_for_mod -=over 4 - -_set_derived_column_for_mod($item); - -=back + _set_derived_column_for_mod($item); Given an item hash representing a new item to be modified. calculate any derived columns. Currently the only @@ -1822,11 +1706,7 @@ sub _set_derived_columns_for_mod { =head2 _do_column_fixes_for_mod -=over 4 - -_do_column_fixes_for_mod($item); - -=back + _do_column_fixes_for_mod($item); Given an item hashref containing one or more columns to modify, fix up certain values. @@ -1863,11 +1743,7 @@ sub _do_column_fixes_for_mod { =head2 _get_single_item_column -=over 4 - -_get_single_item_column($column, $itemnumber); - -=back + _get_single_item_column($column, $itemnumber); Retrieves the value of a single column from an C row specified by C<$itemnumber>. @@ -1887,11 +1763,7 @@ sub _get_single_item_column { =head2 _calc_items_cn_sort -=over 4 - -_calc_items_cn_sort($item, $source_values); - -=back + _calc_items_cn_sort($item, $source_values); Helper routine to calculate C. @@ -1906,11 +1778,7 @@ sub _calc_items_cn_sort { =head2 _set_defaults_for_add -=over 4 - -_set_defaults_for_add($item_hash); - -=back + _set_defaults_for_add($item_hash); Given an item hash representing an item to be added, set correct default values for columns whose default value @@ -1951,11 +1819,7 @@ sub _set_defaults_for_add { =head2 _koha_new_item -=over 4 - -my ($itemnumber,$error) = _koha_new_item( $item, $barcode ); - -=back + my ($itemnumber,$error) = _koha_new_item( $item, $barcode ); Perform the actual insert into the C table. @@ -2048,16 +1912,14 @@ sub _koha_new_item { =head2 MoveItemFromBiblio -=over 4 - -MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio); - -=back + MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio); Moves an item from a biblio to another Returns undef if the move failed or the biblionumber of the destination record otherwise + =cut + sub MoveItemFromBiblio { my ($itemnumber, $frombiblio, $tobiblio) = @_; my $dbh = C4::Context->dbh; @@ -2124,11 +1986,7 @@ sub MoveItemFromBiblio { =head2 DelItemCheck -=over 4 - -DelItemCheck($dbh, $biblionumber, $itemnumber); - -=back + DelItemCheck($dbh, $biblionumber, $itemnumber); Exported function (core API) for deleting an item record in Koha if there no current issue. @@ -2163,11 +2021,7 @@ sub DelItemCheck { =head2 _koha_modify_item -=over 4 - -my ($itemnumber,$error) =_koha_modify_item( $item ); - -=back + my ($itemnumber,$error) =_koha_modify_item( $item ); Perform the actual update of the C row. Note that this routine accepts a hashref specifying the columns to update. @@ -2199,11 +2053,7 @@ sub _koha_modify_item { =head2 _koha_delete_item -=over 4 - -_koha_delete_item( $dbh, $itemnum ); - -=back + _koha_delete_item( $dbh, $itemnum ); Internal function to delete an item record from the koha tables @@ -2234,11 +2084,7 @@ sub _koha_delete_item { =head2 _marc_from_item_hash -=over 4 - -my $item_marc = _marc_from_item_hash($item, $frameworkcode[, $unlinked_item_subfields]); - -=back + my $item_marc = _marc_from_item_hash($item, $frameworkcode[, $unlinked_item_subfields]); Given an item hash representing a complete item record, create a C object containing an embedded @@ -2285,11 +2131,7 @@ sub _marc_from_item_hash { =head2 _add_item_field_to_biblio -=over 4 - -_add_item_field_to_biblio($item_marc, $biblionumber, $frameworkcode); - -=back + _add_item_field_to_biblio($item_marc, $biblionumber, $frameworkcode); Adds the fields from a MARC record containing the representation of a Koha item record to the MARC @@ -2312,11 +2154,7 @@ sub _add_item_field_to_biblio { =head2 _replace_item_field_in_biblio -=over - -&_replace_item_field_in_biblio($item_marc, $biblionumber, $itemnumber, $frameworkcode) - -=back + &_replace_item_field_in_biblio($item_marc, $biblionumber, $itemnumber, $frameworkcode) Given a MARC::Record C<$item_marc> containing one tag with the MARC representation of the item, examine the biblio MARC @@ -2381,11 +2219,7 @@ sub _repack_item_errors { =head2 _get_unlinked_item_subfields -=over 4 - -my $unlinked_item_subfields = _get_unlinked_item_subfields($original_item_marc, $frameworkcode); - -=back + my $unlinked_item_subfields = _get_unlinked_item_subfields($original_item_marc, $frameworkcode); =cut @@ -2415,11 +2249,7 @@ sub _get_unlinked_item_subfields { =head2 _get_unlinked_subfields_xml -=over 4 - -my $unlinked_subfields_xml = _get_unlinked_subfields_xml($unlinked_item_subfields); - -=back + my $unlinked_subfields_xml = _get_unlinked_subfields_xml($unlinked_item_subfields); =cut @@ -2441,11 +2271,7 @@ sub _get_unlinked_subfields_xml { =head2 _parse_unlinked_item_subfields_from_xml -=over 4 - -my $unlinked_item_subfields = _parse_unlinked_item_subfields_from_xml($whole_item->{'more_subfields_xml'}): - -=back + my $unlinked_item_subfields = _parse_unlinked_item_subfields_from_xml($whole_item->{'more_subfields_xml'}): =cut diff --git a/C4/Matcher.pm b/C4/Matcher.pm index 5da0801288..3f44783ca1 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -38,37 +38,33 @@ C4::Matcher - find MARC records matching another one =head1 SYNOPSIS -=over 4 + my @matchers = C4::Matcher::GetMatcherList(); -my @matchers = C4::Matcher::GetMatcherList(); + my $matcher = C4::Matcher->new($record_type); + $matcher->threshold($threshold); + $matcher->code($code); + $matcher->description($description); -my $matcher = C4::Matcher->new($record_type); -$matcher->threshold($threshold); -$matcher->code($code); -$matcher->description($description); + $matcher->add_simple_matchpoint('isbn', 1000, '020', 'a', -1, 0, ''); + $matcher->add_simple_matchpoint('Date', 1000, '008', '', 7, 4, ''); + $matcher->add_matchpoint('isbn', 1000, [ { tag => '020', subfields => 'a', norms => [] } ]); -$matcher->add_simple_matchpoint('isbn', 1000, '020', 'a', -1, 0, ''); -$matcher->add_simple_matchpoint('Date', 1000, '008', '', 7, 4, ''); -$matcher->add_matchpoint('isbn', 1000, [ { tag => '020', subfields => 'a', norms => [] } ]); + $matcher->add_simple_required_check('245', 'a', -1, 0, '', '245', 'a', -1, 0, ''); + $matcher->add_required_check([ { tag => '245', subfields => 'a', norms => [] } ], + [ { tag => '245', subfields => 'a', norms => [] } ]); -$matcher->add_simple_required_check('245', 'a', -1, 0, '', '245', 'a', -1, 0, ''); -$matcher->add_required_check([ { tag => '245', subfields => 'a', norms => [] } ], - [ { tag => '245', subfields => 'a', norms => [] } ]); + my @matches = $matcher->get_matches($marc_record, $max_matches); -my @matches = $matcher->get_matches($marc_record, $max_matches); + foreach $match (@matches) { -foreach $match (@matches) { + # matches already sorted in order of + # decreasing score + print "record ID: $match->{'record_id'}; + print "score: $match->{'score'}; - # matches already sorted in order of - # decreasing score - print "record ID: $match->{'record_id'}; - print "score: $match->{'score'}; + } -} - -my $matcher_description = $matcher->dump(); - -=back + my $matcher_description = $matcher->dump(); =head1 FUNCTIONS @@ -76,18 +72,14 @@ my $matcher_description = $matcher->dump(); =head2 GetMatcherList -=over 4 - -my @matchers = C4::Matcher::GetMatcherList(); - -=back + my @matchers = C4::Matcher::GetMatcherList(); Returns an array of hashrefs list all matchers present in the database. Each hashref includes: -matcher_id -code -description + * matcher_id + * code + * description =cut @@ -105,15 +97,9 @@ sub GetMatcherList { =head1 METHODS -=cut - =head2 new -=over 4 - -my $matcher = C4::Matcher->new($record_type, $threshold); - -=back + my $matcher = C4::Matcher->new($record_type, $threshold); Creates a new Matcher. C<$record_type> indicates which search database to use, e.g., 'biblio' or 'authority' and defaults to @@ -152,11 +138,7 @@ sub new { =head2 fetch -=over 4 - -my $matcher = C4::Matcher->fetch($id); - -=back + my $matcher = C4::Matcher->fetch($id); Creates a matcher object from the version stored in the database. If a matcher with the given @@ -245,11 +227,7 @@ sub _fetch_matchpoint { =head2 store -=over 4 - -my $id = $matcher->store(); - -=back + my $id = $matcher->store(); Stores matcher in database. The return value is the ID of the marc_matchers row. If the matcher was @@ -374,11 +352,7 @@ sub _store_matchpoint { =head2 delete -=over 4 - -C4::Matcher->delete($id); - -=back + C4::Matcher->delete($id); Deletes the matcher of the specified ID from the database. @@ -396,12 +370,8 @@ sub delete { =head2 threshold -=over 4 - -$matcher->threshold(1000); -my $threshold = $matcher->threshold(); - -=back + $matcher->threshold(1000); + my $threshold = $matcher->threshold(); Accessor method. @@ -414,12 +384,8 @@ sub threshold { =head2 _id -=over 4 - -$matcher->_id(123); -my $id = $matcher->_id(); - -=back + $matcher->_id(123); + my $id = $matcher->_id(); Accessor method. Note that using this method to set the DB ID of the matcher should not be @@ -434,12 +400,8 @@ sub _id { =head2 code -=over 4 - -$matcher->code('ISBN'); -my $code = $matcher->code(); - -=back + $matcher->code('ISBN'); + my $code = $matcher->code(); Accessor method. @@ -452,12 +414,8 @@ sub code { =head2 description -=over 4 - -$matcher->description('match on ISBN'); -my $description = $matcher->description(); - -=back + $matcher->description('match on ISBN'); + my $description = $matcher->description(); Accessor method. @@ -470,11 +428,7 @@ sub description { =head2 add_matchpoint -=over 4 - -$matcher->add_matchpoint($index, $score, $matchcomponents); - -=back + $matcher->add_matchpoint($index, $score, $matchcomponents); Adds a matchpoint that may include multiple components. The $index parameter identifies the index that will be searched, while $score @@ -512,13 +466,10 @@ sub add_matchpoint { =head2 add_simple_matchpoint -=over 4 + $matcher->add_simple_matchpoint($index, $score, $source_tag, + $source_subfields, $source_offset, + $source_length, $source_normalizer); -$matcher->add_simple_matchpoint($index, $score, $source_tag, $source_subfields, - $source_offset, $source_length, - $source_normalizer); - -=back Adds a simple matchpoint rule -- after composing a key based on the source tag and subfields, normalized per the normalization fuction, search the index. All records retrieved @@ -540,11 +491,7 @@ sub add_simple_matchpoint { =head2 add_required_check -=over 4 - -$match->add_required_check($source_matchpoint, $target_matchpoint); - -=back + $match->add_required_check($source_matchpoint, $target_matchpoint); Adds a required check definition. A required check means that in order for a match to be considered valid, the key derived from the @@ -596,16 +543,14 @@ sub add_required_check { =head2 add_simple_required_check -$matcher->add_simple_required_check($source_tag, $source_subfields, $source_offset, $source_length, $source_normalizer, - $target_tag, $target_subfields, $target_offset, $target_length, $target_normalizer); - -=over 4 + $matcher->add_simple_required_check($source_tag, $source_subfields, + $source_offset, $source_length, $source_normalizer, + $target_tag, $target_subfields, $target_offset, + $target_length, $target_normalizer); Adds a required check, which requires that the normalized keys made from the source and targets must match for a match to be considered valid. -=back - =cut sub add_simple_required_check { @@ -623,17 +568,13 @@ sub add_simple_required_check { =head2 find_matches -=over 4 - -my @matches = $matcher->get_matches($marc_record, $max_matches); -foreach $match (@matches) { - # matches already sorted in order of - # decreasing score - print "record ID: $match->{'record_id'}; - print "score: $match->{'score'}; -} - -=back + my @matches = $matcher->get_matches($marc_record, $max_matches); + foreach $match (@matches) { + # matches already sorted in order of + # decreasing score + print "record ID: $match->{'record_id'}; + print "score: $match->{'score'}; + } Identifies all of the records matching the given MARC record. For a record already in the database to be considered a match, it must meet the following criteria: @@ -697,11 +638,7 @@ sub get_matches { =head2 dump -=over 4 - -$description = $matcher->dump(); - -=back + $description = $matcher->dump(); Returns a reference to a structure containing all of the information in the matcher object. This is mainly a convenience method to diff --git a/C4/Members.pm b/C4/Members.pm index 30e9f2d78b..eba71f5361 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -133,13 +133,10 @@ This module contains routines for adding, modifying and deleting members/patrons =head1 FUNCTIONS -=over 2 +=head2 SearchMember -=item SearchMember - - ($count, $borrowers) = &SearchMember($searchstring, $type,$category_type,$filter,$showallbranches); - -=back + ($count, $borrowers) = &SearchMember($searchstring, $type, + $category_type, $filter, $showallbranches); Looks up patrons (borrowers) by name. @@ -245,13 +242,10 @@ sub SearchMember { return ( scalar(@$data), $data ); } -=over 2 +=head2 Search -=item Search - - $borrowers_result_array_ref = &Search($filter,$orderby, $limit, $columns_out, $search_on_fields,$searchtype); - -=back + $borrowers_result_array_ref = &Search($filter,$orderby, $limit, + $columns_out, $search_on_fields,$searchtype); Looks up patrons (borrowers) on filter. @@ -378,9 +372,9 @@ sub GetMemberDetails { $flags = &patronflags($patron); - This function is not exported. +This function is not exported. - The following will be set where applicable: +The following will be set where applicable: $flags->{CHARGES}->{amount} Amount of debt $flags->{CHARGES}->{noissues} Set if debt amount >$5.00 (or syspref noissuescharge) $flags->{CHARGES}->{message} Message -- deprecated @@ -412,17 +406,17 @@ sub GetMemberDetails { $flags->{WAITING}->{message} Message -- deprecated $flags->{WAITING}->{itemlist} ref-to-array: list of available items -=over 4 +=over -C<$flags-E{ODUES}-E{itemlist}> is a reference-to-array listing the +=item C<$flags-E{ODUES}-E{itemlist}> is a reference-to-array listing the overdue items. Its elements are references-to-hash, each describing an overdue item. The keys are selected fields from the issues, biblio, biblioitems, and items tables of the Koha database. -C<$flags-E{ODUES}-E{itemlisttext}> is a string giving a text listing of +=item C<$flags-E{ODUES}-E{itemlisttext}> is a string giving a text listing of the overdue items, one per line. Deprecated. -C<$flags-E{WAITING}-E{itemlist}> is a reference-to-array listing the +=item C<$flags-E{WAITING}-E{itemlist}> is a reference-to-array listing the available items. Each element is a reference-to-hash whose keys are fields from the reserves table of the Koha database. @@ -577,11 +571,7 @@ sub GetMember { =head2 IsMemberBlocked -=over 4 - -my ($block_status, $count) = IsMemberBlocked( $borrowernumber ); - -=back + my ($block_status, $count) = IsMemberBlocked( $borrowernumber ); Returns whether a patron has overdue items that may result in a block or whether the patron has active fine days @@ -698,22 +688,18 @@ sub columns(;$) { return @{C4::Context->dbh->selectcol_arrayref("SHOW columns from borrowers")}; } -=head2 - =head2 ModMember -=over 4 - -my $success = ModMember(borrowernumber => $borrowernumber, [ field => value ]... ); + my $success = ModMember(borrowernumber => $borrowernumber, + [ field => value ]... ); Modify borrower's data. All date fields should ALREADY be in ISO format. return : true on success, or false on failure -=back - =cut + sub ModMember { my (%data) = @_; # test to know if you must update or not the borrower password @@ -740,8 +726,6 @@ sub ModMember { } -=head2 - =head2 AddMember $borrowernumber = &AddMember(%borrower); @@ -1357,8 +1341,9 @@ sub GetborCatFromCatType { Given the borrower's category code, the function returns the corresponding data hashref for a comprehensive information display. - + $arrayref_hashref = &GetBorrowercategory; + If no category code provided, the function returns all the categories. =cut @@ -1382,7 +1367,7 @@ sub GetBorrowercategory { } # sub getborrowercategory =head2 GetBorrowercategoryList - + $arrayref_hashref = &GetBorrowercategoryList; If no category code provided, the function returns all the categories. @@ -1478,6 +1463,7 @@ sub GetAge{ } # sub get_age =head2 get_institutions + $insitutions = get_institutions(); Just returns a list of all the borrowers of type I, borrownumber and name @@ -1603,7 +1589,7 @@ sub MoveMemberToDeleted { =head2 DelMember -DelMember($borrowernumber); + DelMember($borrowernumber); This function remove directly a borrower whitout writing it on deleteborrower. + Deletes reserves for the borrower @@ -1813,10 +1799,10 @@ WHERE roadtypeid=?|; =head2 GetBorrowersWhoHaveNotBorrowedSince -&GetBorrowersWhoHaveNotBorrowedSince($date) + &GetBorrowersWhoHaveNotBorrowedSince($date) this function get all borrowers who haven't borrowed since the date given on input arg. - + =cut sub GetBorrowersWhoHaveNotBorrowedSince { @@ -1874,9 +1860,9 @@ sub GetBorrowersWhoHaveNotBorrowedSince { =head2 GetBorrowersWhoHaveNeverBorrowed -$results = &GetBorrowersWhoHaveNeverBorrowed + $results = &GetBorrowersWhoHaveNeverBorrowed -this function get all borrowers who have never borrowed. +This function get all borrowers who have never borrowed. I<$result> is a ref to an array which all elements are a hasref. @@ -1921,7 +1907,7 @@ sub GetBorrowersWhoHaveNeverBorrowed { =head2 GetBorrowersWithIssuesHistoryOlderThan -$results = &GetBorrowersWithIssuesHistoryOlderThan($date) + $results = &GetBorrowersWithIssuesHistoryOlderThan($date) this function get all borrowers who has an issue history older than I<$date> given on input arg. @@ -1966,7 +1952,7 @@ sub GetBorrowersWithIssuesHistoryOlderThan { =head2 GetBorrowersNamesAndLatestIssue -$results = &GetBorrowersNamesAndLatestIssueList(@borrowernumbers) + $results = &GetBorrowersNamesAndLatestIssueList(@borrowernumbers) this function get borrowers Names and surnames and Issue information. @@ -1992,9 +1978,7 @@ sub GetBorrowersNamesAndLatestIssue { =head2 DebarMember -=over 4 - -my $success = DebarMember( $borrowernumber ); + my $success = DebarMember( $borrowernumber ); marks a Member as debarred, and therefore unable to checkout any more items. @@ -2002,8 +1986,6 @@ items. return : true on success, false on failure -=back - =cut sub DebarMember { @@ -2019,9 +2001,7 @@ sub DebarMember { =head2 AddMessage -=over 4 - -AddMessage( $borrowernumber, $message_type, $message, $branchcode ); + AddMessage( $borrowernumber, $message_type, $message, $branchcode ); Adds a message to the messages table for the given borrower. @@ -2029,8 +2009,6 @@ Returns: True on success False on failure -=back - =cut sub AddMessage { @@ -2051,17 +2029,13 @@ sub AddMessage { =head2 GetMessages -=over 4 - -GetMessages( $borrowernumber, $type ); + GetMessages( $borrowernumber, $type ); $type is message type, B for borrower, or L for Librarian. Empty type returns all messages of any type. Returns all messages for the given borrowernumber -=back - =cut sub GetMessages { @@ -2096,17 +2070,13 @@ sub GetMessages { =head2 GetMessages -=over 4 - -GetMessagesCount( $borrowernumber, $type ); + GetMessagesCount( $borrowernumber, $type ); $type is message type, B for borrower, or L for Librarian. Empty type returns all messages of any type. Returns the number of messages for the given borrowernumber -=back - =cut sub GetMessagesCount { @@ -2133,11 +2103,7 @@ sub GetMessagesCount { =head2 DeleteMessage -=over 4 - -DeleteMessage( $message_id ); - -=back + DeleteMessage( $message_id ); =cut diff --git a/C4/Record.pm b/C4/Record.pm index 233fa6e2ca..37fc3e11a8 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -71,14 +71,10 @@ New in Koha 3.x. This module handles all record-related management functions. =head2 marc2marc - Convert from one flavour of ISO-2709 to another -=over 4 - -my ($error,$newmarc) = marc2marc($marc,$to_flavour,$from_flavour,$encoding); + my ($error,$newmarc) = marc2marc($marc,$to_flavour,$from_flavour,$encoding); Returns an ISO-2709 scalar -=back - =cut sub marc2marc { @@ -89,14 +85,10 @@ sub marc2marc { =head2 marc2marcxml - Convert from ISO-2709 to MARCXML -=over 4 - -my ($error,$marcxml) = marc2marcxml($marc,$encoding,$flavour); + my ($error,$marcxml) = marc2marcxml($marc,$encoding,$flavour); Returns a MARCXML scalar -=over 2 - C<$marc> - an ISO-2709 scalar or MARC::Record object C<$encoding> - UTF-8 or MARC-8 [UTF-8] @@ -105,10 +97,6 @@ C<$flavour> - MARC21 or UNIMARC C<$dont_entity_encode> - a flag that instructs marc2marcxml not to entity encode the xml before returning (optional) -=back - -=back - =cut sub marc2marcxml { @@ -175,24 +163,16 @@ sub marc2marcxml { =head2 marcxml2marc - Convert from MARCXML to ISO-2709 -=over 4 - -my ($error,$marc) = marcxml2marc($marcxml,$encoding,$flavour); + my ($error,$marc) = marcxml2marc($marcxml,$encoding,$flavour); Returns an ISO-2709 scalar -=over 2 - C<$marcxml> - a MARCXML record C<$encoding> - UTF-8 or MARC-8 [UTF-8] C<$flavour> - MARC21 or UNIMARC -=back - -=back - =cut sub marcxml2marc { @@ -215,24 +195,16 @@ sub marcxml2marc { =head2 marc2dcxml - Convert from ISO-2709 to Dublin Core -=over 4 - -my ($error,$dcxml) = marc2dcxml($marc,$qualified); + my ($error,$dcxml) = marc2dcxml($marc,$qualified); Returns a DublinCore::Record object, will eventually return a Dublin Core scalar FIXME: should return actual XML, not just an object -=over 2 - C<$marc> - an ISO-2709 scalar or MARC::Record object C<$qualified> - specify whether qualified Dublin Core should be used in the input or output [0] -=back - -=back - =cut sub marc2dcxml { @@ -269,16 +241,13 @@ sub marc2dcxml { $dcxmlfinal .= "\n"; return ($error,$dcxmlfinal); } -=head2 marc2modsxml - Convert from ISO-2709 to MODS -=over 4 +=head2 marc2modsxml - Convert from ISO-2709 to MODS -my ($error,$modsxml) = marc2modsxml($marc); + my ($error,$modsxml) = marc2modsxml($marc); Returns a MODS scalar -=back - =cut sub marc2modsxml { @@ -330,25 +299,19 @@ sub marc2endnote { } =head2 marc2csv - Convert several records from UNIMARC to CSV -Pre and postprocessing can be done through a YAML file -=over 4 + my ($csv) = marc2csv($biblios, $csvprofileid); -my ($csv) = marc2csv($biblios, $csvprofileid); +Pre and postprocessing can be done through a YAML file Returns a CSV scalar -=over 2 - C<$biblio> - a list of biblionumbers C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv) -=back - -=back - =cut + sub marc2csv { my ($biblios, $id) = @_; my $output; @@ -379,14 +342,10 @@ sub marc2csv { =head2 marcrecord2csv - Convert a single record from UNIMARC to CSV -=over 4 - -my ($csv) = marcrecord2csv($biblio, $csvprofileid, $header); + my ($csv) = marcrecord2csv($biblio, $csvprofileid, $header); Returns a CSV scalar -=over 2 - C<$biblio> - a biblionumber C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv) @@ -395,10 +354,6 @@ C<$header> - true if the headers are to be printed (typically at first pass) C<$csv> - an already initialised Text::CSV object -=back - -=back - =cut @@ -539,9 +494,7 @@ sub marcrecord2csv { =head2 html2marcxml -=over 4 - -my ($error,$marcxml) = html2marcxml($tags,$subfields,$values,$indicator,$ind_tag); + my ($error,$marcxml) = html2marcxml($tags,$subfields,$values,$indicator,$ind_tag); Returns a MARCXML scalar @@ -550,8 +503,6 @@ the form submission. FIXME: this could use some better code documentation -=back - =cut sub html2marcxml { @@ -628,12 +579,8 @@ sub html2marcxml { =head2 html2marc -=over 4 - Probably best to avoid using this ... it has some rather striking problems: -=over 2 - * saves blank subfields * subfield order is hardcoded to always start with 'a' for repeatable tags (because it is hardcoded in the addfield routine). @@ -642,12 +589,8 @@ Probably best to avoid using this ... it has some rather striking problems: * the underlying routines didn't support subfield reordering or subfield repeatability. -=back - I've left it in here because it could be useful if someone took the time to fix it. -- kados -=back - =cut sub html2marc { @@ -717,14 +660,10 @@ sub html2marc { =head2 changeEncoding - Change the encoding of a record -=over 4 - -my ($error, $newrecord) = changeEncoding($record,$format,$flavour,$to_encoding,$from_encoding); + my ($error, $newrecord) = changeEncoding($record,$format,$flavour,$to_encoding,$from_encoding); Changes the encoding of a record -=over 2 - C<$record> - the record itself can be in ISO-2709, a MARC::Record object, or MARCXML for now (required) C<$format> - MARC or MARCXML (required) @@ -735,16 +674,12 @@ C<$to_encoding> - the encoding you want the record to end up in (optional) [UTF- C<$from_encoding> - the encoding the record is currently in (optional, it will probably be able to tell unless there's a problem with the record) -=back - FIXME: the from_encoding doesn't work yet FIXME: better handling for UNIMARC, it should allow management of 100 field FIXME: shouldn't have to convert to and from xml/marc just to change encoding someone needs to re-write MARC::Record's 'encoding' method to actually alter the encoding rather than just changing the leader -=back - =cut sub changeEncoding { @@ -780,22 +715,14 @@ sub changeEncoding { =head2 marc2bibtex - Convert from MARC21 and UNIMARC to BibTex -=over 4 - -my ($bibtex) = marc2bibtex($record, $id); + my ($bibtex) = marc2bibtex($record, $id); Returns a BibTex scalar -=over 2 - C<$record> - a MARC::Record object C<$id> - an id for the BibTex record (might be the biblionumber) -=back - -=back - =cut @@ -870,18 +797,14 @@ sub marc2bibtex { =head2 _entity_encode - Entity-encode an array of strings -=over 4 - -my ($entity_encoded_string) = _entity_encode($string); + my ($entity_encoded_string) = _entity_encode($string); or -my (@entity_encoded_strings) = _entity_encode(@strings); + my (@entity_encoded_strings) = _entity_encode(@strings); Entity-encode an array of strings -=back - =cut sub _entity_encode { diff --git a/C4/UploadedFile.pm b/C4/UploadedFile.pm index 3329936209..f75518fb54 100644 --- a/C4/UploadedFile.pm +++ b/C4/UploadedFile.pm @@ -38,26 +38,23 @@ for later processing. =head1 SYNOPSIS -=over 4 - -# create and store data -my $uploaded_file = C4::UploadedFile->new($sessionID); -my $fileID = $uploaded_file->id(); -$uploaded_file->name('c:\temp\file.mrc'); -$uploaded_file->max_size(1024); -while ($have_more_data) { + # create and store data + my $uploaded_file = C4::UploadedFile->new($sessionID); + my $fileID = $uploaded_file->id(); + $uploaded_file->name('c:\temp\file.mrc'); + $uploaded_file->max_size(1024); + while ($have_more_data) { $uploaded_file->stash($data, $bytes_read); -} -$uploaded_file->done(); + } + $uploaded_file->done(); -# check status of current file upload -my $progress = C4::UploadedFile->upload_progress($sessionID); + # check status of current file upload + my $progress = C4::UploadedFile->upload_progress($sessionID); -# get file handle for reading uploaded file -my $uploaded_file = C4::UploadedFile->fetch($fileID); -my $fh = $uploaded_file->fh(); + # get file handle for reading uploaded file + my $uploaded_file = C4::UploadedFile->fetch($fileID); + my $fh = $uploaded_file->fh(); -=back Stores files uploaded by the user from their web browser. The uploaded files are temporary and at present are not guaranteed @@ -76,11 +73,7 @@ TODO: implement secure persistant storage of uploaded files. =head2 new -=over 4 - -my $uploaded_file = C4::UploadedFile->new($sessionID); - -=back + my $uploaded_file = C4::UploadedFile->new($sessionID); Creates a new object to represent the uploaded file. Requires the current session ID. @@ -138,11 +131,7 @@ sub _serialize { =head2 id -=over 4 - -my $fileID = $uploaded_file->id(); - -=back + my $fileID = $uploaded_file->id(); =cut @@ -153,12 +142,8 @@ sub id { =head2 name -=over 4 - -my $name = $uploaded_file->name(); -$uploaded_file->name($name); - -=back + my $name = $uploaded_file->name(); + $uploaded_file->name($name); Accessor method for the name by which the file is to be known. @@ -176,12 +161,8 @@ sub name { =head2 max_size -=over 4 - -my $max_size = $uploaded_file->max_size(); -$uploaded_file->max_size($max_size); - -=back + my $max_size = $uploaded_file->max_size(); + $uploaded_file->max_size($max_size); Accessor method for the maximum size of the uploaded file. @@ -194,11 +175,7 @@ sub max_size { =head2 stash -=over 4 - -$uploaded_file->stash($dataref, $bytes_read); - -=back + $uploaded_file->stash($dataref, $bytes_read); Write C<$dataref> to the temporary file. C<$bytes_read> represents the number of bytes (out of C<$max_size>) transmitted so far. @@ -222,11 +199,7 @@ sub stash { =head2 done -=over 4 - -$uploaded_file->done(); - -=back + $uploaded_file->done(); Indicates that all of the bytes have been uploaded. @@ -241,11 +214,7 @@ sub done { =head2 upload_progress -=over 4 - -my $upload_progress = C4::UploadFile->upload_progress($sessionID); - -=back + my $upload_progress = C4::UploadFile->upload_progress($sessionID); Returns (as an integer from 0 to 100) the percentage progress of the current file upload. @@ -276,11 +245,7 @@ sub upload_progress { =head2 fetch -=over 4 - - my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID); - -=back + my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID); Retrieves an uploaded file object from the current session. @@ -303,11 +268,7 @@ sub fetch { =head2 fh -=over - -my $fh = $uploaded_file->fh(); - -=back + my $fh = $uploaded_file->fh(); Returns an IO::File handle to read the uploaded file. -- 2.39.5