[Koha-patches] [PATCH] bug in rebuild_zebra verbose logging - found another print I didn't want to see all the time

2008-11-21 Thread Michael Hafen
Add the phrase 'if ( $verbose_logging )' to the two print statements
concerning the skipping of biblio or authority records.

I recently had to split biblio and authority index updating in my cron
script ( had some really big records so had to add the -x switch which
should only be used on biblios accourding to the help ).  So I noticed
that rebuild_zebra.pl printed messages that it was skipping biblios or
authorities.

This patch is to conditionalize those prints based on the verbose
logging switch.
---
 misc/migration_tools/rebuild_zebra.pl |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/migration_tools/rebuild_zebra.pl 
b/misc/migration_tools/rebuild_zebra.pl
index 731aee4..5e6d985 100755
--- a/misc/migration_tools/rebuild_zebra.pl
+++ b/misc/migration_tools/rebuild_zebra.pl
@@ -121,13 +121,13 @@ if ($do_munge) {
 if ($authorities) {
 index_records('authority', $directory, $skip_export, $process_zebraqueue, 
$as_xml, $noxml, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt);
 } else {
-print skipping authorities\n;
+print skipping authorities\n if ( $verbose_logging );
 }
 
 if ($biblios) {
 index_records('biblio', $directory, $skip_export, $process_zebraqueue, 
$as_xml, $noxml, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt);
 } else {
-print skipping biblios\n;
+print skipping biblios\n if ( $verbose_logging );
 }
 
 
-- 
1.5.6.3

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches


[Koha-patches] [PATCH] Update MARC to add 099$c and 099$d fields, with :

2008-11-21 Thread Henri-Damien LAURENT
This allow the acquisition date sorting in UNIMARC.
---
 .../UNIMARC_sync_date_created_with_marc_biblio.pl  |   73 
 1 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 
misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl

diff --git a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl 
b/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl
new file mode 100644
index 000..c94a5a4
--- /dev/null
+++ b/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+#
+# This script should be used only with UNIMARC flavour
+# It is designed to report some missing information from biblio
+# table into  marc data
+#
+use strict;
+use warnings;
+
+BEGIN {
+use FindBin;
+eval { require $FindBin::Bin/../kohalib.pl };
+}
+
+use C4::Biblio;
+
+sub updateMarc {
+my $id = shift;
+my $dbh = C4::Context-dbh;
+my $field;
+my $biblio = GetMarcBiblio($id);
+
+if(!$biblio-field('099'))
+{
+$field = new MARC::Field('099','','',
+'c' = '',
+'d'='');
+$biblio-add_fields($field);
+}
+
+$field = $biblio-field('099');
+
+my $sth = $dbh-prepare(SELECT DATE_FORMAT(datecreated,'%Y-%m-%d') as 
datecreated,
+DATE_FORMAT(timestamp,'%Y-%m-%d') as 
timestamp,
+frameworkcode
+FROM biblio
+WHERE biblionumber = ?);
+$sth-execute($id);
+(my $bibliorow = $sth-fetchrow_hashref);
+my $frameworkcode = $bibliorow-{'frameworkcode'};
+
+$field-update( 'c' = $bibliorow-{'datecreated'},
+'d' = $bibliorow-{'timestamp'}
+);
+
+ if(ModBiblio($biblio, $id, $frameworkcode))
+ {
+print \r$id;
+ }
+
+}
+
+sub process {
+
+my $dbh = C4::Context-dbh;
+
+my $sth = $dbh-prepare(SELECT biblionumber FROM biblio);
+$sth-execute();
+
+while(my $biblios = $sth-fetchrow_hashref)
+{
+updateMarc($biblios-{'biblionumber'});
+print .;
+}
+
+}
+
+if (lc(C4::Context-preference('marcflavour')) eq unimarc){
+process();
+} 
+else {
+   print this script is UNIMARC only and should be used only on unimarc 
databases;
+}
-- 
1.6.0.2

___
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches