+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<chapter version="5.0" xml:id="sample_chapter"\r
- xmlns="http://docbook.org/ns/docbook"\r
- xmlns:xlink="http://www.w3.org/1999/xlink/"\r
- xmlns:xi="http://www.w3.org/2001/XInclude"\r
- xmlns:ns6="http://www.w3.org/1999/xlink"\r
- xmlns:ns5="http://www.w3.org/2000/svg"\r
- xmlns:ns4="http://www.w3.org/1998/Math/MathML"\r
- xmlns:ns3="http://www.w3.org/1999/xhtml"\r
- xmlns:ns="http://docbook.org/ns/docbook">\r
- <!-- <chapter xmlns='http://docbook.org/ns/docbook'\r
- xml:id="sample_chapter" version="5.0"> -->\r
-\r
- <!-- The following declarations have been removed from the <chapter> tag:\r
- scratch pad for swapping namespace xmlns declarations in and out to debug warning \r
- ("cannot add @xml.base to node set root element. Relative paths may not work.)\r
-\r
-\r
--->\r
-\r
- <title>Administration</title>\r
-\r
- <para>This chapter describes administrative features on the staff client.\r
- They include:</para>\r
-\r
- <orderedlist>\r
- <listitem>\r
- <para>Operator Change</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Offline Transaction Management</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Download Offline Patron List</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para><link linkend="local_system_admin">Local System\r
- Administration</link></para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Server Settings</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>User Permission</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Receipt Template</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Survey Wizard</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Features for Developers</para>\r
- </listitem>\r
- </orderedlist>\r
-\r
- <!-- Local System Administration -->\r
-\r
- <section>\r
- <title>Local System Administration</title>\r
-\r
- <para>The following administrative functions are available:</para>\r
-\r
- <orderedlist>\r
- <listitem>\r
- <para>Workstation Configuration</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para><link linkend="library_settings">Library\r
- Configuration</link></para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Maintenance Reports</para>\r
- </listitem>\r
- </orderedlist>\r
-\r
- <section xml:id="library_configuration">\r
- <title>Library Configuration</title>\r
-\r
- <para>You can configure the following settings:</para>\r
-\r
- <orderedlist>\r
- <listitem>\r
- <para>Closed Dates</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Copy Locations</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Library Settings or Organization Unit???</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Non-cataloged Types</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Statistical Categories</para>\r
- </listitem>\r
- </orderedlist>\r
-\r
- <section xml:id="closed_dates">\r
- <title>Closed Dates</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="copy_locations">\r
- <title>Copy Locations</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <!-- Library Settings -->\r
-\r
- <section xml:id="library_settings">\r
- <title>Library Settings</title>\r
-\r
- <!-- Alert on Empty Bib Records -->\r
-\r
- <section xml:id="alert_empty_bib_records">\r
- <title>Alert on Empty Bib Records</title>\r
-\r
- <section xml:id="alert_empty_bib_records_concept">\r
- <title>Introduction to Empty Bib Records</title>\r
-\r
- <para>This setting is used to alert staff when the last copy for a\r
- record is being deleted. (Text is coming from the GUI, but should\r
- it be "last copy of a record???") The default value is True??? It\r
- can be changed through the <guimenu>Local System\r
- Administration</guimenu> menu.</para>\r
- </section>\r
-\r
- <section xml:id="alert_empty_bib_records_task">\r
- <title>Changing the Alert Status on Empty Bib Records</title>\r
-\r
- <para>To change the alert status on empty bib records:</para>\r
-\r
- <orderedlist>\r
- <listitem>\r
- <para>On the Local System Administration screen, click the\r
- <guilabel>Library Settings Editor</guilabel> link.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>On the Organization Unit Settings screen, find the\r
- setting <guilabel>Alert on empty bib records</guilabel>, and\r
- click <guibutton>Edit</guibutton>.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>In the Edit Setting pop-up window, select a location\r
- from the <guimenu>Context</guimenu> list.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>From the <guilabel>Value</guilabel> list, select a\r
- value.</para>\r
- </listitem>\r
- </orderedlist>\r
-\r
- <example>\r
- <title>Changing Value of Empty Bib Records</title>\r
-\r
- <para>To change the value to false, select\r
- <userinput>False</userinput> from the <guimenu>Value</guimenu>\r
- list.</para>\r
- </example>\r
- </section>\r
-\r
- <section xml:id="alert_empty_bib_records__ref">\r
- <title>References for the Alert Status on Empty Bib\r
- Records</title>\r
-\r
- <itemizedlist>\r
- <listitem>\r
-\r
-<link linkend='nextsect'>this</link> \r
- <para><link\r
- linkend='http://open-ils.org/dokuwiki/doku.php?id=evergreen-user:permission_list'>Permissions Galore</link></para>\r
- </listitem>\r
- </itemizedlist>\r
- </section>\r
- </section>\r
-\r
- <!-- Credit Card Payments -->\r
-\r
- <section xml:id="credit_card_payments">\r
- <title>Credit Card Payments</title>\r
-\r
- <section xml:id="credit_card_payments_concept">\r
- <title>Introduction to Credit Card Payments</title>\r
-\r
- <para>If enabled, patrons will be able to pay fines accrued at\r
- this location via credit card. The default value is True??? It can\r
- be changed through the <guimenu>Local System\r
- Administration</guimenu> menu.</para>\r
- </section>\r
-\r
- <section xml:id="credit_card_payments_task">\r
- <title>Allowing Credit Card Payments</title>\r
-\r
- <para>To allow credit card payments:</para>\r
-\r
- <orderedlist>\r
- <listitem>\r
- <para>From the Local System Administration screen, click the\r
- <guilabel>Library Settings Editor</guilabel> link.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>On the Organization Unit Settings screen, find the\r
- setting <guilabel>Allow Credit Card Payments</guilabel> (May\r
- want to standarize on style in GUI - caps on first letter of\r
- each word or caps of first letter of first work), and click\r
- <guibutton>Edit</guibutton>.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>In the Edit Setting pop-up window, select a location\r
- from the <guimenu>Context</guimenu> list.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>In the <guilabel>Value</guilabel> box, select a\r
- value.</para>\r
- </listitem>\r
- </orderedlist>\r
-\r
- <example>\r
- <title>Changing Credit Card Payment Status</title>\r
-\r
- <para>To change the credit card payment status to false, select\r
- <userinput>False</userinput> from the <guilabel>Value</guilabel>\r
- list.</para>\r
- </example>\r
- </section>\r
-\r
- <section xml:id="credit_card_payments_ref">\r
- <title>References for Credit Card Payments</title>\r
-\r
- <itemizedlist>\r
- <listitem>\r
- <para>\r
-\r
-<link linkend='nextsect'>this</link> \r
-\r
-<link\r
- linkend='http://open-ils.org/dokuwiki/doku.php?id=evergreen-user:permission_list'>Permissions</link></para>\r
- </listitem>\r
- </itemizedlist>\r
- </section>\r
- </section>\r
-\r
- <!-- Reshelving Status Interval -->\r
-\r
- <section xml:id="reselving">\r
- <title>Reshelving Status Interval</title>\r
-\r
- <section xml:id="reshelving_concept">\r
- <title>Introduction to the Reshelving Status Interval</title>\r
-\r
- <para>What kind of preamble do we need here???</para>\r
- </section>\r
-\r
- <section xml:id="reshelving_task">\r
- <title>Changing the Reshelving Status Interval</title>\r
-\r
- <para>To change the reshelving status interval: <segmentedlist>\r
- <title>Overview of Editing Settings for Pop-Up Windows</title>\r
-\r
- <?dbhtml list-presentation="table"?>\r
-\r
- <segtitle>Context</segtitle>\r
-\r
- <segtitle>Value</segtitle>\r
-\r
- <seglistitem>\r
- <seg>LEDDY</seg>\r
-\r
- <seg>0.00</seg>\r
- </seglistitem>\r
-\r
- <seglistitem>\r
- <seg>Alabama</seg>\r
-\r
- <seg>Montgomery</seg>\r
- </seglistitem>\r
-\r
- <seglistitem>\r
- <seg>Alaska</seg>\r
-\r
- <seg>Anchorage</seg>\r
- </seglistitem>\r
- </segmentedlist></para>\r
-\r
- <orderedlist>\r
- <listitem>\r
- <para>From the Local System Administration screen, click the\r
- <guilabel>Library Settings Editor</guilabel> link.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>On the Organization Unit Settings screen, find the\r
- setting <guilabel>Change reshelving status\r
- interval</guilabel>, and click\r
- <guibutton>Edit</guibutton>.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>In the Edit Setting pop-up window, enter a location from\r
- the <guimenu>Context</guimenu> list.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>In the <guilabel>Value</guilabel> box, enter a value in\r
- seconds, hours, or days. The value cannot be zero; however, a\r
- value of 1 second is valid. What are the default units when\r
- none are entered with the value???</para>\r
-\r
- <para>For example, to change the reshelving status interval to\r
- four hours, enter <userinput>4 hours</userinput> in the\r
- <guilabel>Value</guilabel> box.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>Click on <guibutton>Update Setting</guibutton>.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>You can see the selected organization unit displayed\r
- under the Context column and the reshelving status interval\r
- displayed under the Value column.</para>\r
- </listitem>\r
-\r
- <listitem>\r
- <para>To delete both Context and Value for the reshelving\r
- status interval, click on <guibutton>Delete\r
- Setting</guibutton>.</para>\r
- </listitem>\r
- </orderedlist>\r
- </section>\r
-\r
- <section xml:id="reshelving_ref">\r
- <title>References for the Reshelving Status Interval</title>\r
-\r
- <itemizedlist>\r
- <listitem>\r
- <para><link\r
- linkend="permissions">http://open-ils.org/dokuwiki/doku.php?id=evergreen-user:permission_list</link></para>\r
- </listitem>\r
- </itemizedlist>\r
- </section>\r
-\r
- <!-- BEGINNING OF NOTE OUTPUT -->\r
-\r
- <section>\r
- <title>Reshelving Intervals and Permissions</title>\r
-\r
- <note>\r
- <para>The reshelving status interval is not inherited from the\r
- parent organizational unit at run time. The default value is 24\r
- hours??? and can be changed through the <guimenu>Local System\r
- Administration</guimenu> menu.</para>\r
- </note>\r
-\r
- <note>\r
- <para>Permissions for organization unit settings are not\r
- automatically created at install time, which means the\r
- permission will have to be created before it can be\r
- applied.</para>\r
- </note>\r
- </section>\r
- </section>\r
-\r
- <section xml:id="default_item_price">\r
- <title>Default Item Price</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="default_locale">\r
- <title>Default Locale</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="no_auto_deletion_empty_bib_records">\r
- <title>Deletion of Empty Bib Records</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="holds_expire_alert_interval">\r
- <title>Holds: Expire Alert Interval</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="holds_expire_interval">\r
- <title>Holds: Expire Interval</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="holds_hard">\r
- <title>Holds: Hard Boundary</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="holds_soft">\r
- <title>Holds: Soft Boundary</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="lost_materials_proc_fee">\r
- <title>Lost Materials Processing Fee</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="max_prev_checkouts">\r
- <title>Maximum Previous Checkouts Displayed</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="OPAC_inactivity_timeout">\r
- <title>OPAC Inactivity Timeout</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="patron_barcode">\r
- <title>Patron Barcode Format</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="patron_login">\r
- <title>Selfcheck: Patron Login Timeout</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="pop_up_alert">\r
- <title>Selfcheck: Pop-up Alert for Errors</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="patron_password">\r
- <title>Selfcheck: Require Patron Password</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="email_addr_for_patron_notices">\r
- <title>Sending Email Address for Patron Notices</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="staff_login_inactivity_timeout">\r
- <title>Staff Login Inactivity Timeout</title>\r
-\r
- <para></para>\r
- </section>\r
-\r
- <section xml:id="void_overdue_fines">\r
- <title>Void Overdue Fines</title>\r
-\r
- <para></para>\r
- </section>\r
- </section>\r
- </section>\r
- </section>\r
-</chapter>\r
use XML::Twig;
use YAML::Tiny;
-use JSON;
+use Getopt::Long;
-my $marcxml = shift || help();
-my $htag = shift || help();
-open HOLDINGS, '>', "holdings";
-open X, '>', "holdings.x";
-open Z, '>', "holdings.z";
+my $conf = initialize();
+my $marcxml = shift;
+
+open HOLDINGS, '>', $conf->{output};
+open X, '>', $conf->{pubnotesfile};
+open Z, '>', $conf->{privnotesfile};
my $holdings = {};
-my %all852 = ( x => {}, z => {} ); # hash of all subfields in all 852s
+my %sample = ( x => {}, z => {} ); # hash of all subfields in all 852s
my $copyid = 0;
my $yaml = YAML::Tiny->new;
my $t = XML::Twig->new( twig_handlers => { record => \&record } );
$t->parsefile($marcxml);
-$yaml->[0] = \%all852;
+$yaml->[0] = \%sample;
$yaml->write('holdings.sample');
print "\n\n";
}
# and holdings data
- if ($d->{'att'}->{'tag'} == $htag) {
+ if ($d->{'att'}->{'tag'} == $conf->{tag}) {
push @{$holdings->{copies}}, { x =>[], z => [] };
$holdings->{copies}[-1]{copyid} = $copyid;
my @subs = $d->children('subfield');
my $code = $s->{'att'}->{'code'};
my $value = $s->text;
- if ($code eq 'x' or $code eq 'z') {
+ if ($code eq $conf->{pubnotes} or $code eq $conf->{privnotes}) {
push @{$copy->{$code}}, $value;
my ($k,$v) = split /:/, $value;
- $all852{$code}{$k} = $v;
+ $sample{$code}{$k} = $v;
} else {
$copy->{$code} = $value;
- $all852{$code} = $value;
+ $sample{$code} = $value;
}
}
print Z join("\t", $holdings->{id}, $copy->{copyid}, $note, $_), "\n";
$note++;
}
- for (qw( copyid b p h 9 ))
- { $copy->{$_} = '' unless defined $copy->{$_} }
- print HOLDINGS join("\t", $holdings->{id}, $copy->{copyid},
- $copy->{b}, $copy->{p}, $copy->{h}, $copy->{9}), "\n";
+ my @fields = ();
+ for ( @{$conf->{fields}} )
+ { $copy->{$_} = '' unless defined $copy->{$_}; push @fields, $copy->{$_} }
+ print HOLDINGS join("\t", $holdings->{id}, $copy->{copyid}, @fields), "\n";
+}
+
+
+#------------------------------------------------
+
+
+sub initialize {
+ my $c = {};
+ my @missing = ();
+
+ # set mode on existing filehandles
+ binmode(STDIN, ':utf8');
+
+ my $rc = GetOptions( $c,
+ 'fields|f=s',
+ 'output|o=s',
+ 'prefix|p=s',
+ 'pubnotes|pub=i',
+ 'pubnotesfile=s',
+ 'privnotes|priv=s',
+ 'privnotesfile=s',
+ 'tag|t=i',
+ 'help|h',
+ );
+ show_help() unless $rc;
+ show_help() if ($c->{help});
+
+ # set defaults
+ $c->{prefix} = (defined $c->{prefix}) ? ($c->{prefix} . '.') : '';
+ $c->{tag} = $c->{tag} || '852';
+ $c->{output} =
+ $c->{output} || join('', $c->{prefix}, "holdings.pg");
+ $c->{pubnotes} = $c->{pubnotes} || 'x';
+ $c->{pubnotesfile} =
+ $c->{pubnotesfile} || join('', $c->{prefix}, "holdings.pubnote.pg");
+ $c->{privnotes} = $c->{privnotes} || 'z';
+ $c->{privnotesfile} =
+ $c->{privnotesfile} || join('', $c->{prefix}, "holdings.privnote.pg");
+
+ my @keys = keys %{$c};
+ show_help() unless (@ARGV and @keys);
+ for my $key ('fields', 'tag')
+ { push @missing, $key unless $c->{$key} }
+ if (@missing) {
+ print "Required option: ", join(', ', @missing), " missing!\n";
+ show_help();
+ }
+
+ # explode and validate fields string
+ process_fields($c);
+ return $c;
}
+sub process_fields {
+ my ($c) = @_;
+ my @holdings_fields = split /,/, $c->{fields};
+ for (@holdings_fields) {
+ die "Field names must be alphanumeric!\n" if /\W/;
+ die "Field names must be single characters!\n"
+ if /\w{2,}/;
+ }
+ $c->{fields} = \@holdings_fields;
+}
-sub help {
+sub show_help {
print <<HELP;
Usage is: extract_holdings MARCXML_FILE HOLDINGS_TAG
HELP