Browse Source

Final batch of POD cleanups.

Should fix any remaining warnings with 'podchecker'

Signed-off-by: Andrew Elwell <Andrew.Elwell@gmail.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
3.2.x
Andrew Elwell 14 years ago
committed by Galen Charlton
parent
commit
4370a19d75
  1. 372
      C4/Items.pm
  2. 167
      C4/Matcher.pm
  3. 98
      C4/Members.pm
  4. 107
      C4/Record.pm
  5. 87
      C4/UploadedFile.pm

372
C4/Items.pm

@ -118,11 +118,7 @@ of C<C4::Items>
=head2 GetItem =head2 GetItem
=over 4 $item = GetItem($itemnumber,$barcode,$serial);
$item = GetItem($itemnumber,$barcode,$serial);
=back
Return item information, for a given itemnumber or barcode. Return item information, for a given itemnumber or barcode.
The return value is a hashref mapping item column The return value is a hashref mapping item column
@ -165,11 +161,7 @@ sub GetItem {
=head2 CartToShelf =head2 CartToShelf
=over 4 CartToShelf($itemnumber);
CartToShelf($itemnumber);
=back
Set the current shelving location of the item record Set the current shelving location of the item record
to its stored permanent shelving location. This is to its stored permanent shelving location. This is
@ -193,12 +185,8 @@ sub CartToShelf {
=head2 AddItemFromMarc =head2 AddItemFromMarc
=over 4 my ($biblionumber, $biblioitemnumber, $itemnumber)
= AddItemFromMarc($source_item_marc, $biblionumber);
my ($biblionumber, $biblioitemnumber, $itemnumber)
= AddItemFromMarc($source_item_marc, $biblionumber);
=back
Given a MARC::Record object containing an embedded item Given a MARC::Record object containing an embedded item
record and a biblionumber, create a new item record. record and a biblionumber, create a new item record.
@ -222,12 +210,8 @@ sub AddItemFromMarc {
=head2 AddItem =head2 AddItem
=over 4 my ($biblionumber, $biblioitemnumber, $itemnumber)
= AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]);
my ($biblionumber, $biblioitemnumber, $itemnumber)
= AddItem($item, $biblionumber[, $dbh, $frameworkcode, $unlinked_item_subfields]);
=back
Given a hash containing item column names as keys, Given a hash containing item column names as keys,
create a new Koha item record. create a new Koha item record.
@ -286,11 +270,8 @@ sub AddItem {
=head2 AddItemBatchFromMarc =head2 AddItemBatchFromMarc
=over 4 ($itemnumber_ref, $error_ref) = AddItemBatchFromMarc($record,
$biblionumber, $biblioitemnumber, $frameworkcode);
($itemnumber_ref, $error_ref) = AddItemBatchFromMarc($record, $biblionumber, $biblioitemnumber, $frameworkcode);
=back
Efficiently create item records from a MARC biblio record with Efficiently create item records from a MARC biblio record with
embedded item fields. This routine is suitable for batch jobs. 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 errors encountered during the processing. Each entry in the errors
list is a hashref containing the following keys: list is a hashref containing the following keys:
=over 2 =over
=item item_sequence =item item_sequence
@ -393,11 +374,7 @@ sub AddItemBatchFromMarc {
=head2 ModItemFromMarc =head2 ModItemFromMarc
=over 4 ModItemFromMarc($item_marc, $biblionumber, $itemnumber);
ModItemFromMarc($item_marc, $biblionumber, $itemnumber);
=back
This function updates an item record based on a supplied This function updates an item record based on a supplied
C<MARC::Record> object containing an embedded item field. C<MARC::Record> object containing an embedded item field.
@ -470,11 +447,8 @@ sub ModItemFromMarc {
=head2 ModItem =head2 ModItem
=over 4 ModItem({ column => $newvalue }, $biblionumber,
$itemnumber[, $original_item_marc]);
ModItem({ column => $newvalue }, $biblionumber, $itemnumber[, $original_item_marc]);
=back
Change one or more columns in an item record and update Change one or more columns in an item record and update
the MARC representation of the item. the MARC representation of the item.
@ -545,11 +519,7 @@ sub ModItem {
=head2 ModItemTransfer =head2 ModItemTransfer
=over 4 ModItemTransfer($itenumber, $frombranch, $tobranch);
ModItemTransfer($itenumber, $frombranch, $tobranch);
=back
Marks an item as being transferred from one branch Marks an item as being transferred from one branch
to another. to another.
@ -574,11 +544,7 @@ sub ModItemTransfer {
=head2 ModDateLastSeen =head2 ModDateLastSeen
=over 4 ModDateLastSeen($itemnum);
ModDateLastSeen($itemnum);
=back
Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking. Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking.
C<$itemnum> is the item number C<$itemnum> is the item number
@ -594,11 +560,7 @@ sub ModDateLastSeen {
=head2 DelItem =head2 DelItem
=over 4 DelItem($dbh, $biblionumber, $itemnumber);
DelItem($dbh, $biblionumber, $itemnumber);
=back
Exported function (core API) for deleting an item record in Koha. Exported function (core API) for deleting an item record in Koha.
@ -635,8 +597,6 @@ sub DelItem {
=head2 CheckItemPreSave =head2 CheckItemPreSave
=over 4
my $item_ref = TransformMarcToKoha($marc, 'items'); my $item_ref = TransformMarcToKoha($marc, 'items');
# do stuff # do stuff
my %errors = CheckItemPreSave($item_ref); my %errors = CheckItemPreSave($item_ref);
@ -650,8 +610,6 @@ sub DelItem {
print "item is OK"; print "item is OK";
} }
=back
Given a hashref containing item fields, determine if it can be Given a hashref containing item fields, determine if it can be
inserted or updated in the database. Specifically, checks for inserted or updated in the database. Specifically, checks for
database integrity issues, and returns a hash containing any database integrity issues, and returns a hash containing any
@ -734,11 +692,7 @@ has copy-and-paste work.
=head2 GetItemStatus =head2 GetItemStatus
=over 4 $itemstatushash = GetItemStatus($fwkcode);
$itemstatushash = GetItemStatus($fwkcode);
=back
Returns a list of valid values for the Returns a list of valid values for the
C<items.notforloan> field. C<items.notforloan> field.
@ -753,32 +707,24 @@ Create a status selector with the following code
=head3 in PERL SCRIPT =head3 in PERL SCRIPT
=over 4 my $itemstatushash = getitemstatus;
my @itemstatusloop;
my $itemstatushash = getitemstatus; foreach my $thisstatus (keys %$itemstatushash) {
my @itemstatusloop; my %row =(value => $thisstatus,
foreach my $thisstatus (keys %$itemstatushash) { statusname => $itemstatushash->{$thisstatus}->{'statusname'},
my %row =(value => $thisstatus, );
statusname => $itemstatushash->{$thisstatus}->{'statusname'}, push @itemstatusloop, \%row;
); }
push @itemstatusloop, \%row; $template->param(statusloop=>\@itemstatusloop);
}
$template->param(statusloop=>\@itemstatusloop);
=back
=head3 in TEMPLATE =head3 in TEMPLATE
=over 4 <select name="statusloop">
<option value="">Default</option>
<select name="statusloop"> <!-- TMPL_LOOP name="statusloop" -->
<option value="">Default</option> <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="statusname" --></option>
<!-- TMPL_LOOP name="statusloop" --> <!-- /TMPL_LOOP -->
<option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="statusname" --></option> </select>
<!-- /TMPL_LOOP -->
</select>
=back
=cut =cut
@ -834,11 +780,7 @@ sub GetItemStatus {
=head2 GetItemLocation =head2 GetItemLocation
=over 4 $itemlochash = GetItemLocation($fwk);
$itemlochash = GetItemLocation($fwk);
=back
Returns a list of valid values for the Returns a list of valid values for the
C<items.location> field. C<items.location> field.
@ -851,34 +793,26 @@ Create a location selector with the following code
=head3 in PERL SCRIPT =head3 in PERL SCRIPT
=over 4 my $itemlochash = getitemlocation;
my @itemlocloop;
my $itemlochash = getitemlocation; foreach my $thisloc (keys %$itemlochash) {
my @itemlocloop; my $selected = 1 if $thisbranch eq $branch;
foreach my $thisloc (keys %$itemlochash) { my %row =(locval => $thisloc,
my $selected = 1 if $thisbranch eq $branch; selected => $selected,
my %row =(locval => $thisloc, locname => $itemlochash->{$thisloc},
selected => $selected, );
locname => $itemlochash->{$thisloc}, push @itemlocloop, \%row;
); }
push @itemlocloop, \%row; $template->param(itemlocationloop => \@itemlocloop);
}
$template->param(itemlocationloop => \@itemlocloop);
=back
=head3 in TEMPLATE =head3 in TEMPLATE
=over 4 <select name="location">
<option value="">Default</option>
<select name="location"> <!-- TMPL_LOOP name="itemlocationloop" -->
<option value="">Default</option> <option value="<!-- TMPL_VAR name="locval" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="locname" --></option>
<!-- TMPL_LOOP name="itemlocationloop" --> <!-- /TMPL_LOOP -->
<option value="<!-- TMPL_VAR name="locval" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="locname" --></option> </select>
<!-- /TMPL_LOOP -->
</select>
=back
=cut =cut
@ -932,11 +866,7 @@ sub GetItemLocation {
=head2 GetLostItems =head2 GetLostItems
=over 4 $items = GetLostItems( $where, $orderby );
$items = GetLostItems( $where, $orderby );
=back
This function gets a list of lost items. This function gets a list of lost items.
@ -960,9 +890,9 @@ from the "items" table as keys.
=item usage in the perl script: =item usage in the perl script:
my $where = { barcode => '0001548' }; my $where = { barcode => '0001548' };
my $items = GetLostItems( $where, "homebranch" ); my $items = GetLostItems( $where, "homebranch" );
$template->param( itemsloop => $items ); $template->param( itemsloop => $items );
=back =back
@ -1007,11 +937,9 @@ sub GetLostItems {
=head2 GetItemsForInventory =head2 GetItemsForInventory
=over 4 $itemlist = GetItemsForInventory($minlocation, $maxlocation,
$location, $itemtype $datelastseen, $branch,
$itemlist = GetItemsForInventory($minlocation, $maxlocation, $location, $itemtype $datelastseen, $branch, $offset, $size, $statushash); $offset, $size, $statushash);
=back
Retrieve a list of title/authors/barcode/callnumber, for biblio inventory. Retrieve a list of title/authors/barcode/callnumber, for biblio inventory.
@ -1105,10 +1033,7 @@ END_SQL
=head2 GetItemsCount =head2 GetItemsCount
=over 4 $count = &GetItemsCount( $biblionumber);
$count = &GetItemsCount( $biblionumber);
=back
This function return count of item with $biblionumber This function return count of item with $biblionumber
@ -1128,11 +1053,7 @@ sub GetItemsCount {
=head2 GetItemInfosOf =head2 GetItemInfosOf
=over 4 GetItemInfosOf(@itemnumbers);
GetItemInfosOf(@itemnumbers);
=back
=cut =cut
@ -1149,11 +1070,7 @@ sub GetItemInfosOf {
=head2 GetItemsByBiblioitemnumber =head2 GetItemsByBiblioitemnumber
=over 4 GetItemsByBiblioitemnumber($biblioitemnumber);
GetItemsByBiblioitemnumber($biblioitemnumber);
=back
Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP
Called by C<C4::XISBN> Called by C<C4::XISBN>
@ -1205,11 +1122,7 @@ sub GetItemsByBiblioitemnumber {
=head2 GetItemsInfo =head2 GetItemsInfo
=over 4 @results = GetItemsInfo($biblionumber, $type);
@results = GetItemsInfo($biblionumber, $type);
=back
Returns information about books with the given biblionumber. Returns information about books with the given biblionumber.
@ -1407,11 +1320,8 @@ sub GetItemsInfo {
=head2 GetLastAcquisitions =head2 GetLastAcquisitions
=over 4 my $lastacq = GetLastAcquisitions({'branches' => ('branch1','branch2'),
'itemtypes' => ('BK','BD')}, 10);
my $lastacq = GetLastAcquisitions({'branches' => ('branch1','branch2'), 'itemtypes' => ('BK','BD')}, 10);
=back
=cut =cut
@ -1461,11 +1371,7 @@ sub GetLastAcquisitions {
=head2 get_itemnumbers_of =head2 get_itemnumbers_of
=over 4 my @itemnumbers_of = get_itemnumbers_of(@biblionumbers);
my @itemnumbers_of = get_itemnumbers_of(@biblionumbers);
=back
Given a list of biblionumbers, return the list of corresponding itemnumbers Given a list of biblionumbers, return the list of corresponding itemnumbers
for each biblionumber. for each biblionumber.
@ -1500,11 +1406,7 @@ sub get_itemnumbers_of {
=head2 GetItemnumberFromBarcode =head2 GetItemnumberFromBarcode
=over 4 $result = GetItemnumberFromBarcode($barcode);
$result = GetItemnumberFromBarcode($barcode);
=back
=cut =cut
@ -1521,11 +1423,7 @@ sub GetItemnumberFromBarcode {
=head2 GetBarcodeFromItemnumber =head2 GetBarcodeFromItemnumber
=over 4 $result = GetBarcodeFromItemnumber($itemnumber);
$result = GetBarcodeFromItemnumber($itemnumber);
=back
=cut =cut
@ -1542,12 +1440,11 @@ sub GetBarcodeFromItemnumber {
=head3 get_item_authorised_values =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: parameters: itemnumber
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 = { $authorised_values = {
'CCODE' => undef, 'CCODE' => undef,
@ -1563,7 +1460,7 @@ sub GetBarcodeFromItemnumber {
'itemtypes' => 'SER', '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 =cut
@ -1593,25 +1490,24 @@ sub get_item_authorised_values {
=head3 get_authorised_value_images =head3 get_authorised_value_images
find a list of icons that are appropriate for display based on the find a list of icons that are appropriate for display based on the
authorised values for a biblio. authorised values for a biblio.
parameters: listref of authorised values, such as comes from parameters: listref of authorised values, such as comes from
get_item_authorised_values or get_item_authorised_values or
from C4::Biblio::get_biblio_authorised_values from C4::Biblio::get_biblio_authorised_values
returns: listref of hashrefs for each image. Each hashref looks like returns: listref of hashrefs for each image. Each hashref looks like this:
this:
{ imageurl => '/intranet-tmpl/prog/img/itemtypeimg/npl/WEB.gif', { imageurl => '/intranet-tmpl/prog/img/itemtypeimg/npl/WEB.gif',
label => '', label => '',
category => '', category => '',
value => '', } value => '', }
Notes: Currently, I put on the full path to the images on the staff 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 side. This should either be configurable or not done at all. Since I
have to deal with 'intranet' or 'opac' in have to deal with 'intranet' or 'opac' in
get_biblio_authorised_values, perhaps I should be passing it in. get_biblio_authorised_values, perhaps I should be passing it in.
=cut =cut
@ -1652,11 +1548,7 @@ without careful thought.
=head2 GetMarcItem =head2 GetMarcItem
=over 4 my $item_marc = GetMarcItem($biblionumber, $itemnumber);
my $item_marc = GetMarcItem($biblionumber, $itemnumber);
=back
Returns MARC::Record of the item passed in parameter. Returns MARC::Record of the item passed in parameter.
This function is meant for use only in C<cataloguing/additem.pl>, This function is meant for use only in C<cataloguing/additem.pl>,
@ -1743,11 +1635,7 @@ my %derived_columns = (
=head2 _set_derived_columns_for_add =head2 _set_derived_columns_for_add
=over 4 _set_derived_column_for_add($item);
_set_derived_column_for_add($item);
=back
Given an item hash representing a new item to be added, Given an item hash representing a new item to be added,
calculate any derived columns. Currently the only calculate any derived columns. Currently the only
@ -1771,11 +1659,7 @@ sub _set_derived_columns_for_add {
=head2 _set_derived_columns_for_mod =head2 _set_derived_columns_for_mod
=over 4 _set_derived_column_for_mod($item);
_set_derived_column_for_mod($item);
=back
Given an item hash representing a new item to be modified. Given an item hash representing a new item to be modified.
calculate any derived columns. Currently the only calculate any derived columns. Currently the only
@ -1822,11 +1706,7 @@ sub _set_derived_columns_for_mod {
=head2 _do_column_fixes_for_mod =head2 _do_column_fixes_for_mod
=over 4 _do_column_fixes_for_mod($item);
_do_column_fixes_for_mod($item);
=back
Given an item hashref containing one or more Given an item hashref containing one or more
columns to modify, fix up certain values. columns to modify, fix up certain values.
@ -1863,11 +1743,7 @@ sub _do_column_fixes_for_mod {
=head2 _get_single_item_column =head2 _get_single_item_column
=over 4 _get_single_item_column($column, $itemnumber);
_get_single_item_column($column, $itemnumber);
=back
Retrieves the value of a single column from an C<items> Retrieves the value of a single column from an C<items>
row specified by C<$itemnumber>. row specified by C<$itemnumber>.
@ -1887,11 +1763,7 @@ sub _get_single_item_column {
=head2 _calc_items_cn_sort =head2 _calc_items_cn_sort
=over 4 _calc_items_cn_sort($item, $source_values);
_calc_items_cn_sort($item, $source_values);
=back
Helper routine to calculate C<items.cn_sort>. Helper routine to calculate C<items.cn_sort>.
@ -1906,11 +1778,7 @@ sub _calc_items_cn_sort {
=head2 _set_defaults_for_add =head2 _set_defaults_for_add
=over 4 _set_defaults_for_add($item_hash);
_set_defaults_for_add($item_hash);
=back
Given an item hash representing an item to be added, set Given an item hash representing an item to be added, set
correct default values for columns whose default value correct default values for columns whose default value
@ -1951,11 +1819,7 @@ sub _set_defaults_for_add {
=head2 _koha_new_item =head2 _koha_new_item
=over 4 my ($itemnumber,$error) = _koha_new_item( $item, $barcode );
my ($itemnumber,$error) = _koha_new_item( $item, $barcode );
=back
Perform the actual insert into the C<items> table. Perform the actual insert into the C<items> table.
@ -2048,16 +1912,14 @@ sub _koha_new_item {
=head2 MoveItemFromBiblio =head2 MoveItemFromBiblio
=over 4 MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio);
MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio);
=back
Moves an item from a biblio to another Moves an item from a biblio to another
Returns undef if the move failed or the biblionumber of the destination record otherwise Returns undef if the move failed or the biblionumber of the destination record otherwise
=cut =cut
sub MoveItemFromBiblio { sub MoveItemFromBiblio {
my ($itemnumber, $frombiblio, $tobiblio) = @_; my ($itemnumber, $frombiblio, $tobiblio) = @_;
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
@ -2124,11 +1986,7 @@ sub MoveItemFromBiblio {
=head2 DelItemCheck =head2 DelItemCheck
=over 4 DelItemCheck($dbh, $biblionumber, $itemnumber);
DelItemCheck($dbh, $biblionumber, $itemnumber);
=back
Exported function (core API) for deleting an item record in Koha if there no current issue. 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 =head2 _koha_modify_item
=over 4 my ($itemnumber,$error) =_koha_modify_item( $item );
my ($itemnumber,$error) =_koha_modify_item( $item );
=back
Perform the actual update of the C<items> row. Note that this Perform the actual update of the C<items> row. Note that this
routine accepts a hashref specifying the columns to update. routine accepts a hashref specifying the columns to update.
@ -2199,11 +2053,7 @@ sub _koha_modify_item {
=head2 _koha_delete_item =head2 _koha_delete_item
=over 4 _koha_delete_item( $dbh, $itemnum );
_koha_delete_item( $dbh, $itemnum );
=back
Internal function to delete an item record from the koha tables Internal function to delete an item record from the koha tables
@ -2234,11 +2084,7 @@ sub _koha_delete_item {
=head2 _marc_from_item_hash =head2 _marc_from_item_hash
=over 4 my $item_marc = _marc_from_item_hash($item, $frameworkcode[, $unlinked_item_subfields]);
my $item_marc = _marc_from_item_hash($item, $frameworkcode[, $unlinked_item_subfields]);
=back
Given an item hash representing a complete item record, Given an item hash representing a complete item record,
create a C<MARC::Record> object containing an embedded create a C<MARC::Record> object containing an embedded
@ -2285,11 +2131,7 @@ sub _marc_from_item_hash {
=head2 _add_item_field_to_biblio =head2 _add_item_field_to_biblio
=over 4 _add_item_field_to_biblio($item_marc, $biblionumber, $frameworkcode);
_add_item_field_to_biblio($item_marc, $biblionumber, $frameworkcode);
=back
Adds the fields from a MARC record containing the Adds the fields from a MARC record containing the
representation of a Koha item record to the MARC 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 =head2 _replace_item_field_in_biblio
=over &_replace_item_field_in_biblio($item_marc, $biblionumber, $itemnumber, $frameworkcode)
&_replace_item_field_in_biblio($item_marc, $biblionumber, $itemnumber, $frameworkcode)
=back
Given a MARC::Record C<$item_marc> containing one tag with the MARC Given a MARC::Record C<$item_marc> containing one tag with the MARC
representation of the item, examine the biblio MARC representation of the item, examine the biblio MARC
@ -2381,11 +2219,7 @@ sub _repack_item_errors {
=head2 _get_unlinked_item_subfields =head2 _get_unlinked_item_subfields
=over 4 my $unlinked_item_subfields = _get_unlinked_item_subfields($original_item_marc, $frameworkcode);
my $unlinked_item_subfields = _get_unlinked_item_subfields($original_item_marc, $frameworkcode);
=back
=cut =cut
@ -2415,11 +2249,7 @@ sub _get_unlinked_item_subfields {
=head2 _get_unlinked_subfields_xml =head2 _get_unlinked_subfields_xml
=over 4 my $unlinked_subfields_xml = _get_unlinked_subfields_xml($unlinked_item_subfields);
my $unlinked_subfields_xml = _get_unlinked_subfields_xml($unlinked_item_subfields);
=back
=cut =cut
@ -2441,11 +2271,7 @@ sub _get_unlinked_subfields_xml {
=head2 _parse_unlinked_item_subfields_from_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'}):
my $unlinked_item_subfields = _parse_unlinked_item_subfields_from_xml($whole_item->{'more_subfields_xml'}):
=back
=cut =cut

167
C4/Matcher.pm

@ -38,37 +38,33 @@ C4::Matcher - find MARC records matching another one
=head1 SYNOPSIS =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->add_simple_matchpoint('isbn', 1000, '020', 'a', -1, 0, '');
$matcher->threshold($threshold); $matcher->add_simple_matchpoint('Date', 1000, '008', '', 7, 4, '');
$matcher->code($code); $matcher->add_matchpoint('isbn', 1000, [ { tag => '020', subfields => 'a', norms => [] } ]);
$matcher->description($description);
$matcher->add_simple_matchpoint('isbn', 1000, '020', 'a', -1, 0, ''); $matcher->add_simple_required_check('245', 'a', -1, 0, '', '245', 'a', -1, 0, '');
$matcher->add_simple_matchpoint('Date', 1000, '008', '', 7, 4, ''); $matcher->add_required_check([ { tag => '245', subfields => 'a', norms => [] } ],
$matcher->add_matchpoint('isbn', 1000, [ { tag => '020', subfields => 'a', norms => [] } ]); [ { tag => '245', subfields => 'a', norms => [] } ]);
$matcher->add_simple_required_check('245', 'a', -1, 0, '', '245', 'a', -1, 0, ''); my @matches = $matcher->get_matches($marc_record, $max_matches);
$matcher->add_required_check([ { tag => '245', subfields => 'a', norms => [] } ],
[ { tag => '245', subfields => 'a', norms => [] } ]);
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();
my $matcher_description = $matcher->dump();
=back
=head1 FUNCTIONS =head1 FUNCTIONS
@ -76,18 +72,14 @@ my $matcher_description = $matcher->dump();
=head2 GetMatcherList =head2 GetMatcherList
=over 4 my @matchers = C4::Matcher::GetMatcherList();
my @matchers = C4::Matcher::GetMatcherList();
=back
Returns an array of hashrefs list all matchers Returns an array of hashrefs list all matchers
present in the database. Each hashref includes: present in the database. Each hashref includes:
matcher_id * matcher_id
code * code
description * description
=cut =cut
@ -105,15 +97,9 @@ sub GetMatcherList {
=head1 METHODS =head1 METHODS
=cut
=head2 new =head2 new
=over 4 my $matcher = C4::Matcher->new($record_type, $threshold);
my $matcher = C4::Matcher->new($record_type, $threshold);
=back
Creates a new Matcher. C<$record_type> indicates which search Creates a new Matcher. C<$record_type> indicates which search
database to use, e.g., 'biblio' or 'authority' and defaults to database to use, e.g., 'biblio' or 'authority' and defaults to
@ -152,11 +138,7 @@ sub new {
=head2 fetch =head2 fetch
=over 4 my $matcher = C4::Matcher->fetch($id);
my $matcher = C4::Matcher->fetch($id);
=back
Creates a matcher object from the version stored Creates a matcher object from the version stored
in the database. If a matcher with the given in the database. If a matcher with the given
@ -245,11 +227,7 @@ sub _fetch_matchpoint {
=head2 store =head2 store
=over 4 my $id = $matcher->store();
my $id = $matcher->store();
=back
Stores matcher in database. The return value is the ID Stores matcher in database. The return value is the ID
of the marc_matchers row. If the matcher was of the marc_matchers row. If the matcher was
@ -374,11 +352,7 @@ sub _store_matchpoint {
=head2 delete =head2 delete
=over 4 C4::Matcher->delete($id);
C4::Matcher->delete($id);
=back
Deletes the matcher of the specified ID Deletes the matcher of the specified ID
from the database. from the database.
@ -396,12 +370,8 @@ sub delete {
=head2 threshold =head2 threshold
=over 4 $matcher->threshold(1000);
my $threshold = $matcher->threshold();
$matcher->threshold(1000);
my $threshold = $matcher->threshold();
=back
Accessor method. Accessor method.
@ -414,12 +384,8 @@ sub threshold {
=head2 _id =head2 _id
=over 4 $matcher->_id(123);
my $id = $matcher->_id();
$matcher->_id(123);
my $id = $matcher->_id();
=back
Accessor method. Note that using this method Accessor method. Note that using this method
to set the DB ID of the matcher should not be to set the DB ID of the matcher should not be
@ -434,12 +400,8 @@ sub _id {
=head2 code =head2 code
=over 4 $matcher->code('ISBN');
my $code = $matcher->code();
$matcher->code('ISBN');
my $code = $matcher->code();
=back
Accessor method. Accessor method.
@ -452,12 +414,8 @@ sub code {
=head2 description =head2 description
=over 4 $matcher->description('match on ISBN');
my $description = $matcher->description();
$matcher->description('match on ISBN');
my $description = $matcher->description();
=back
Accessor method. Accessor method.
@ -470,11 +428,7 @@ sub description {
=head2 add_matchpoint =head2 add_matchpoint
=over 4 $matcher->add_matchpoint($index, $score, $matchcomponents);
$matcher->add_matchpoint($index, $score, $matchcomponents);
=back
Adds a matchpoint that may include multiple components. The $index Adds a matchpoint that may include multiple components. The $index
parameter identifies the index that will be searched, while $score parameter identifies the index that will be searched, while $score
@ -512,13 +466,10 @@ sub add_matchpoint {
=head2 add_simple_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, 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 normalized per the normalization fuction, search the index. All records retrieved
@ -540,11 +491,7 @@ sub add_simple_matchpoint {
=head2 add_required_check =head2 add_required_check
=over 4 $match->add_required_check($source_matchpoint, $target_matchpoint);
$match->add_required_check($source_matchpoint, $target_matchpoint);
=back
Adds a required check definition. A required check means that in Adds a required check definition. A required check means that in
order for a match to be considered valid, the key derived from the 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 =head2 add_simple_required_check
$matcher->add_simple_required_check($source_tag, $source_subfields, $source_offset, $source_length, $source_normalizer, $matcher->add_simple_required_check($source_tag, $source_subfields,
$target_tag, $target_subfields, $target_offset, $target_length, $target_normalizer); $source_offset, $source_length, $source_normalizer,
$target_tag, $target_subfields, $target_offset,
=over 4 $target_length, $target_normalizer);
Adds a required check, which requires that the normalized keys made from the source and targets 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. must match for a match to be considered valid.
=back
=cut =cut
sub add_simple_required_check { sub add_simple_required_check {
@ -623,17 +568,13 @@ sub add_simple_required_check {
=head2 find_matches =head2 find_matches
=over 4 my @matches = $matcher->get_matches($marc_record, $max_matches);
foreach $match (@matches) {
my @matches = $matcher->get_matches($marc_record, $max_matches); # matches already sorted in order of
foreach $match (@matches) { # decreasing score
# matches already sorted in order of print "record ID: $match->{'record_id'};
# decreasing score print "score: $match->{'score'};
print "record ID: $match->{'record_id'}; }
print "score: $match->{'score'};
}
=back
Identifies all of the records matching the given MARC record. For a record already 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: in the database to be considered a match, it must meet the following criteria:
@ -697,11 +638,7 @@ sub get_matches {
=head2 dump =head2 dump
=over 4 $description = $matcher->dump();
$description = $matcher->dump();
=back
Returns a reference to a structure containing all of the information Returns a reference to a structure containing all of the information
in the matcher object. This is mainly a convenience method to in the matcher object. This is mainly a convenience method to

98
C4/Members.pm

@ -133,13 +133,10 @@ This module contains routines for adding, modifying and deleting members/patrons
=head1 FUNCTIONS =head1 FUNCTIONS
=over 2 =head2 SearchMember
=item SearchMember ($count, $borrowers) = &SearchMember($searchstring, $type,
$category_type, $filter, $showallbranches);
($count, $borrowers) = &SearchMember($searchstring, $type,$category_type,$filter,$showallbranches);
=back
Looks up patrons (borrowers) by name. Looks up patrons (borrowers) by name.
@ -245,13 +242,10 @@ sub SearchMember {
return ( scalar(@$data), $data ); return ( scalar(@$data), $data );
} }
=over 2 =head2 Search
=item Search $borrowers_result_array_ref = &Search($filter,$orderby, $limit,
$columns_out, $search_on_fields,$searchtype);
$borrowers_result_array_ref = &Search($filter,$orderby, $limit, $columns_out, $search_on_fields,$searchtype);
=back
Looks up patrons (borrowers) on filter. Looks up patrons (borrowers) on filter.
@ -378,9 +372,9 @@ sub GetMemberDetails {
$flags = &patronflags($patron); $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}->{amount} Amount of debt
$flags->{CHARGES}->{noissues} Set if debt amount >$5.00 (or syspref noissuescharge) $flags->{CHARGES}->{noissues} Set if debt amount >$5.00 (or syspref noissuescharge)
$flags->{CHARGES}->{message} Message -- deprecated $flags->{CHARGES}->{message} Message -- deprecated
@ -412,17 +406,17 @@ sub GetMemberDetails {
$flags->{WAITING}->{message} Message -- deprecated $flags->{WAITING}->{message} Message -- deprecated
$flags->{WAITING}->{itemlist} ref-to-array: list of available items $flags->{WAITING}->{itemlist} ref-to-array: list of available items
=over 4 =over
C<$flags-E<gt>{ODUES}-E<gt>{itemlist}> is a reference-to-array listing the =item C<$flags-E<gt>{ODUES}-E<gt>{itemlist}> is a reference-to-array listing the
overdue items. Its elements are references-to-hash, each describing an overdue items. Its elements are references-to-hash, each describing an
overdue item. The keys are selected fields from the issues, biblio, overdue item. The keys are selected fields from the issues, biblio,
biblioitems, and items tables of the Koha database. biblioitems, and items tables of the Koha database.
C<$flags-E<gt>{ODUES}-E<gt>{itemlisttext}> is a string giving a text listing of =item C<$flags-E<gt>{ODUES}-E<gt>{itemlisttext}> is a string giving a text listing of
the overdue items, one per line. Deprecated. the overdue items, one per line. Deprecated.
C<$flags-E<gt>{WAITING}-E<gt>{itemlist}> is a reference-to-array listing the =item C<$flags-E<gt>{WAITING}-E<gt>{itemlist}> is a reference-to-array listing the
available items. Each element is a reference-to-hash whose keys are available items. Each element is a reference-to-hash whose keys are
fields from the reserves table of the Koha database. fields from the reserves table of the Koha database.
@ -577,11 +571,7 @@ sub GetMember {
=head2 IsMemberBlocked =head2 IsMemberBlocked
=over 4 my ($block_status, $count) = IsMemberBlocked( $borrowernumber );
my ($block_status, $count) = IsMemberBlocked( $borrowernumber );
=back
Returns whether a patron has overdue items that may result Returns whether a patron has overdue items that may result
in a block or whether the patron has active fine days 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")}; return @{C4::Context->dbh->selectcol_arrayref("SHOW columns from borrowers")};
} }
=head2
=head2 ModMember =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. Modify borrower's data. All date fields should ALREADY be in ISO format.
return : return :
true on success, or false on failure true on success, or false on failure
=back
=cut =cut
sub ModMember { sub ModMember {
my (%data) = @_; my (%data) = @_;
# test to know if you must update or not the borrower password # test to know if you must update or not the borrower password
@ -740,8 +726,6 @@ sub ModMember {
} }
=head2
=head2 AddMember =head2 AddMember
$borrowernumber = &AddMember(%borrower); $borrowernumber = &AddMember(%borrower);
@ -1357,8 +1341,9 @@ sub GetborCatFromCatType {
Given the borrower's category code, the function returns the corresponding Given the borrower's category code, the function returns the corresponding
data hashref for a comprehensive information display. data hashref for a comprehensive information display.
$arrayref_hashref = &GetBorrowercategory; $arrayref_hashref = &GetBorrowercategory;
If no category code provided, the function returns all the categories. If no category code provided, the function returns all the categories.
=cut =cut
@ -1382,7 +1367,7 @@ sub GetBorrowercategory {
} # sub getborrowercategory } # sub getborrowercategory
=head2 GetBorrowercategoryList =head2 GetBorrowercategoryList
$arrayref_hashref = &GetBorrowercategoryList; $arrayref_hashref = &GetBorrowercategoryList;
If no category code provided, the function returns all the categories. If no category code provided, the function returns all the categories.
@ -1478,6 +1463,7 @@ sub GetAge{
} # sub get_age } # sub get_age
=head2 get_institutions =head2 get_institutions
$insitutions = get_institutions(); $insitutions = get_institutions();
Just returns a list of all the borrowers of type I, borrownumber and name Just returns a list of all the borrowers of type I, borrownumber and name
@ -1603,7 +1589,7 @@ sub MoveMemberToDeleted {
=head2 DelMember =head2 DelMember
DelMember($borrowernumber); DelMember($borrowernumber);
This function remove directly a borrower whitout writing it on deleteborrower. This function remove directly a borrower whitout writing it on deleteborrower.
+ Deletes reserves for the borrower + Deletes reserves for the borrower
@ -1813,10 +1799,10 @@ WHERE roadtypeid=?|;
=head2 GetBorrowersWhoHaveNotBorrowedSince =head2 GetBorrowersWhoHaveNotBorrowedSince
&GetBorrowersWhoHaveNotBorrowedSince($date) &GetBorrowersWhoHaveNotBorrowedSince($date)
this function get all borrowers who haven't borrowed since the date given on input arg. this function get all borrowers who haven't borrowed since the date given on input arg.
=cut =cut
sub GetBorrowersWhoHaveNotBorrowedSince { sub GetBorrowersWhoHaveNotBorrowedSince {
@ -1874,9 +1860,9 @@ sub GetBorrowersWhoHaveNotBorrowedSince {
=head2 GetBorrowersWhoHaveNeverBorrowed =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. I<$result> is a ref to an array which all elements are a hasref.
@ -1921,7 +1907,7 @@ sub GetBorrowersWhoHaveNeverBorrowed {
=head2 GetBorrowersWithIssuesHistoryOlderThan =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. 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 =head2 GetBorrowersNamesAndLatestIssue
$results = &GetBorrowersNamesAndLatestIssueList(@borrowernumbers) $results = &GetBorrowersNamesAndLatestIssueList(@borrowernumbers)
this function get borrowers Names and surnames and Issue information. this function get borrowers Names and surnames and Issue information.
@ -1992,9 +1978,7 @@ sub GetBorrowersNamesAndLatestIssue {
=head2 DebarMember =head2 DebarMember
=over 4 my $success = DebarMember( $borrowernumber );
my $success = DebarMember( $borrowernumber );
marks a Member as debarred, and therefore unable to checkout any more marks a Member as debarred, and therefore unable to checkout any more
items. items.
@ -2002,8 +1986,6 @@ items.
return : return :
true on success, false on failure true on success, false on failure
=back
=cut =cut
sub DebarMember { sub DebarMember {
@ -2019,9 +2001,7 @@ sub DebarMember {
=head2 AddMessage =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. Adds a message to the messages table for the given borrower.
@ -2029,8 +2009,6 @@ Returns:
True on success True on success
False on failure False on failure
=back
=cut =cut
sub AddMessage { sub AddMessage {
@ -2051,17 +2029,13 @@ sub AddMessage {
=head2 GetMessages =head2 GetMessages
=over 4 GetMessages( $borrowernumber, $type );
GetMessages( $borrowernumber, $type );
$type is message type, B for borrower, or L for Librarian. $type is message type, B for borrower, or L for Librarian.
Empty type returns all messages of any type. Empty type returns all messages of any type.
Returns all messages for the given borrowernumber Returns all messages for the given borrowernumber
=back
=cut =cut
sub GetMessages { sub GetMessages {
@ -2096,17 +2070,13 @@ sub GetMessages {
=head2 GetMessages =head2 GetMessages
=over 4 GetMessagesCount( $borrowernumber, $type );
GetMessagesCount( $borrowernumber, $type );
$type is message type, B for borrower, or L for Librarian. $type is message type, B for borrower, or L for Librarian.
Empty type returns all messages of any type. Empty type returns all messages of any type.
Returns the number of messages for the given borrowernumber Returns the number of messages for the given borrowernumber
=back
=cut =cut
sub GetMessagesCount { sub GetMessagesCount {
@ -2133,11 +2103,7 @@ sub GetMessagesCount {
=head2 DeleteMessage =head2 DeleteMessage
=over 4 DeleteMessage( $message_id );
DeleteMessage( $message_id );
=back
=cut =cut

107
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 =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 Returns an ISO-2709 scalar
=back
=cut =cut
sub marc2marc { sub marc2marc {
@ -89,14 +85,10 @@ sub marc2marc {
=head2 marc2marcxml - Convert from ISO-2709 to MARCXML =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 Returns a MARCXML scalar
=over 2
C<$marc> - an ISO-2709 scalar or MARC::Record object C<$marc> - an ISO-2709 scalar or MARC::Record object
C<$encoding> - UTF-8 or MARC-8 [UTF-8] 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) C<$dont_entity_encode> - a flag that instructs marc2marcxml not to entity encode the xml before returning (optional)
=back
=back
=cut =cut
sub marc2marcxml { sub marc2marcxml {
@ -175,24 +163,16 @@ sub marc2marcxml {
=head2 marcxml2marc - Convert from MARCXML to ISO-2709 =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 Returns an ISO-2709 scalar
=over 2
C<$marcxml> - a MARCXML record C<$marcxml> - a MARCXML record
C<$encoding> - UTF-8 or MARC-8 [UTF-8] C<$encoding> - UTF-8 or MARC-8 [UTF-8]
C<$flavour> - MARC21 or UNIMARC C<$flavour> - MARC21 or UNIMARC
=back
=back
=cut =cut
sub marcxml2marc { sub marcxml2marc {
@ -215,24 +195,16 @@ sub marcxml2marc {
=head2 marc2dcxml - Convert from ISO-2709 to Dublin Core =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 Returns a DublinCore::Record object, will eventually return a Dublin Core scalar
FIXME: should return actual XML, not just an object FIXME: should return actual XML, not just an object
=over 2
C<$marc> - an ISO-2709 scalar or MARC::Record object 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] C<$qualified> - specify whether qualified Dublin Core should be used in the input or output [0]
=back
=back
=cut =cut
sub marc2dcxml { sub marc2dcxml {
@ -269,16 +241,13 @@ sub marc2dcxml {
$dcxmlfinal .= "\n</metadata>"; $dcxmlfinal .= "\n</metadata>";
return ($error,$dcxmlfinal); 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 Returns a MODS scalar
=back
=cut =cut
sub marc2modsxml { sub marc2modsxml {
@ -330,25 +299,19 @@ sub marc2endnote {
} }
=head2 marc2csv - Convert several records from UNIMARC to CSV =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 Returns a CSV scalar
=over 2
C<$biblio> - a list of biblionumbers 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) 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 =cut
sub marc2csv { sub marc2csv {
my ($biblios, $id) = @_; my ($biblios, $id) = @_;
my $output; my $output;
@ -379,14 +342,10 @@ sub marc2csv {
=head2 marcrecord2csv - Convert a single record from UNIMARC to CSV =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 Returns a CSV scalar
=over 2
C<$biblio> - a biblionumber 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) 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 C<$csv> - an already initialised Text::CSV object
=back
=back
=cut =cut
@ -539,9 +494,7 @@ sub marcrecord2csv {
=head2 html2marcxml =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 Returns a MARCXML scalar
@ -550,8 +503,6 @@ the form submission.
FIXME: this could use some better code documentation FIXME: this could use some better code documentation
=back
=cut =cut
sub html2marcxml { sub html2marcxml {
@ -628,12 +579,8 @@ sub html2marcxml {
=head2 html2marc =head2 html2marc
=over 4
Probably best to avoid using this ... it has some rather striking problems: Probably best to avoid using this ... it has some rather striking problems:
=over 2
* saves blank subfields * saves blank subfields
* subfield order is hardcoded to always start with 'a' for repeatable tags (because it is hardcoded in the addfield routine). * 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. * 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 I've left it in here because it could be useful if someone took the time to fix it. -- kados
=back
=cut =cut
sub html2marc { sub html2marc {
@ -717,14 +660,10 @@ sub html2marc {
=head2 changeEncoding - Change the encoding of a record =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 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<$record> - the record itself can be in ISO-2709, a MARC::Record object, or MARCXML for now (required)
C<$format> - MARC or MARCXML (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) 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: the from_encoding doesn't work yet
FIXME: better handling for UNIMARC, it should allow management of 100 field 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 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 =cut
sub changeEncoding { sub changeEncoding {
@ -780,22 +715,14 @@ sub changeEncoding {
=head2 marc2bibtex - Convert from MARC21 and UNIMARC to BibTex =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 Returns a BibTex scalar
=over 2
C<$record> - a MARC::Record object C<$record> - a MARC::Record object
C<$id> - an id for the BibTex record (might be the biblionumber) C<$id> - an id for the BibTex record (might be the biblionumber)
=back
=back
=cut =cut
@ -870,18 +797,14 @@ sub marc2bibtex {
=head2 _entity_encode - Entity-encode an array of strings =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 or
my (@entity_encoded_strings) = _entity_encode(@strings); my (@entity_encoded_strings) = _entity_encode(@strings);
Entity-encode an array of strings Entity-encode an array of strings
=back
=cut =cut
sub _entity_encode { sub _entity_encode {

87
C4/UploadedFile.pm

@ -38,26 +38,23 @@ for later processing.
=head1 SYNOPSIS =head1 SYNOPSIS
=over 4 # create and store data
my $uploaded_file = C4::UploadedFile->new($sessionID);
# create and store data my $fileID = $uploaded_file->id();
my $uploaded_file = C4::UploadedFile->new($sessionID); $uploaded_file->name('c:\temp\file.mrc');
my $fileID = $uploaded_file->id(); $uploaded_file->max_size(1024);
$uploaded_file->name('c:\temp\file.mrc'); while ($have_more_data) {
$uploaded_file->max_size(1024);
while ($have_more_data) {
$uploaded_file->stash($data, $bytes_read); $uploaded_file->stash($data, $bytes_read);
} }
$uploaded_file->done(); $uploaded_file->done();
# check status of current file upload # check status of current file upload
my $progress = C4::UploadedFile->upload_progress($sessionID); my $progress = C4::UploadedFile->upload_progress($sessionID);
# get file handle for reading uploaded file # get file handle for reading uploaded file
my $uploaded_file = C4::UploadedFile->fetch($fileID); my $uploaded_file = C4::UploadedFile->fetch($fileID);
my $fh = $uploaded_file->fh(); my $fh = $uploaded_file->fh();
=back
Stores files uploaded by the user from their web browser. The Stores files uploaded by the user from their web browser. The
uploaded files are temporary and at present are not guaranteed uploaded files are temporary and at present are not guaranteed
@ -76,11 +73,7 @@ TODO: implement secure persistant storage of uploaded files.
=head2 new =head2 new
=over 4 my $uploaded_file = C4::UploadedFile->new($sessionID);
my $uploaded_file = C4::UploadedFile->new($sessionID);
=back
Creates a new object to represent the uploaded file. Requires Creates a new object to represent the uploaded file. Requires
the current session ID. the current session ID.
@ -138,11 +131,7 @@ sub _serialize {
=head2 id =head2 id
=over 4 my $fileID = $uploaded_file->id();
my $fileID = $uploaded_file->id();
=back
=cut =cut
@ -153,12 +142,8 @@ sub id {
=head2 name =head2 name
=over 4 my $name = $uploaded_file->name();
$uploaded_file->name($name);
my $name = $uploaded_file->name();
$uploaded_file->name($name);
=back
Accessor method for the name by which the file is to be known. Accessor method for the name by which the file is to be known.
@ -176,12 +161,8 @@ sub name {
=head2 max_size =head2 max_size
=over 4 my $max_size = $uploaded_file->max_size();
$uploaded_file->max_size($max_size);
my $max_size = $uploaded_file->max_size();
$uploaded_file->max_size($max_size);
=back
Accessor method for the maximum size of the uploaded file. Accessor method for the maximum size of the uploaded file.
@ -194,11 +175,7 @@ sub max_size {
=head2 stash =head2 stash
=over 4 $uploaded_file->stash($dataref, $bytes_read);
$uploaded_file->stash($dataref, $bytes_read);
=back
Write C<$dataref> to the temporary file. C<$bytes_read> represents Write C<$dataref> to the temporary file. C<$bytes_read> represents
the number of bytes (out of C<$max_size>) transmitted so far. the number of bytes (out of C<$max_size>) transmitted so far.
@ -222,11 +199,7 @@ sub stash {
=head2 done =head2 done
=over 4 $uploaded_file->done();
$uploaded_file->done();
=back
Indicates that all of the bytes have been uploaded. Indicates that all of the bytes have been uploaded.
@ -241,11 +214,7 @@ sub done {
=head2 upload_progress =head2 upload_progress
=over 4 my $upload_progress = C4::UploadFile->upload_progress($sessionID);
my $upload_progress = C4::UploadFile->upload_progress($sessionID);
=back
Returns (as an integer from 0 to 100) the percentage Returns (as an integer from 0 to 100) the percentage
progress of the current file upload. progress of the current file upload.
@ -276,11 +245,7 @@ sub upload_progress {
=head2 fetch =head2 fetch
=over 4 my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID);
my $uploaded_file = C4::UploadedFile->fetch($sessionID, $fileID);
=back
Retrieves an uploaded file object from the current session. Retrieves an uploaded file object from the current session.
@ -303,11 +268,7 @@ sub fetch {
=head2 fh =head2 fh
=over my $fh = $uploaded_file->fh();
my $fh = $uploaded_file->fh();
=back
Returns an IO::File handle to read the uploaded file. Returns an IO::File handle to read the uploaded file.

Loading…
Cancel
Save