From 28159f04de850501db37ebde0ababd14fa805b5e Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 4 Dec 2007 17:40:56 -0600 Subject: [PATCH] misc subdir - Dates.pm integration and warnings fixes. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- misc/cronjobs/notifyMailsOp.pl | 2 +- misc/cronjobs/overduenotices-30.pl | 2 +- misc/cronjobs/overduenotices.pl | 2 +- misc/cronjobs/smsoverdues.pl | 2 +- misc/marcimport_to_biblioitems.pl | 70 +++++++++++++++--------------- misc/merge_authority.pl | 4 +- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/misc/cronjobs/notifyMailsOp.pl b/misc/cronjobs/notifyMailsOp.pl index e2a086f249..92ad0277d1 100755 --- a/misc/cronjobs/notifyMailsOp.pl +++ b/misc/cronjobs/notifyMailsOp.pl @@ -1,6 +1,6 @@ use strict; use C4::Context; -use C4::Date; +use C4::Dates; use Mail::Sendmail; # comment out if not doing e-mail notices use Getopt::Long; use C4::Circulation; diff --git a/misc/cronjobs/overduenotices-30.pl b/misc/cronjobs/overduenotices-30.pl index 40e9922429..4d6b3fa808 100755 --- a/misc/cronjobs/overduenotices-30.pl +++ b/misc/cronjobs/overduenotices-30.pl @@ -31,7 +31,7 @@ use strict; use C4::Context; -use C4::Date; +use C4::Dates; use Mail::Sendmail; # comment out if not doing e-mail notices use Getopt::Long; diff --git a/misc/cronjobs/overduenotices.pl b/misc/cronjobs/overduenotices.pl index 349f4d3ad9..0366cfa26f 100644 --- a/misc/cronjobs/overduenotices.pl +++ b/misc/cronjobs/overduenotices.pl @@ -36,7 +36,7 @@ use strict; use C4::Context; -use C4::Date; +use C4::Dates; use Mail::Sendmail; # comment out if not doing e-mail notices use Getopt::Long; diff --git a/misc/cronjobs/smsoverdues.pl b/misc/cronjobs/smsoverdues.pl index 5f930625bd..e43bc75780 100755 --- a/misc/cronjobs/smsoverdues.pl +++ b/misc/cronjobs/smsoverdues.pl @@ -32,7 +32,7 @@ use C4::Search; use C4::Circulation; use C4::Circulation::Fines; use C4::Members; -use C4::Date; +use C4::Dates; use HTML::Template::Pro; use Mail::Sendmail; use Mail::RFC822::Address; diff --git a/misc/marcimport_to_biblioitems.pl b/misc/marcimport_to_biblioitems.pl index cc80d5e902..f56f72dc3a 100644 --- a/misc/marcimport_to_biblioitems.pl +++ b/misc/marcimport_to_biblioitems.pl @@ -31,56 +31,56 @@ SAMPLE : \t\$ perl misc/marcimport_to_biblioitems.pl -file /home/jmf/koha.mrc EOF ;#' -die; + die; } my $starttime = gettimeofday; my $timeneeded; my $dbh = C4::Context->dbh; my $sth2=$dbh->prepare("update biblioitems set marc=? where biblionumber=?"); -my $i=0; - my $batch = MARC::Batch->new( 'USMARC', $input_marc_file ); $batch->warnings_off(); $batch->strict_off(); -my $i=0; my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber",""); +my $i=0; while ( my $record = $batch->next() ) { -my $biblionumber=$record->field($tagfield)->subfield($biblionumtagsubfield); -$i++; -$sth2->execute($record->as_usmarc,$biblionumber) if $biblionumber; -print "$biblionumber \n"; + my $biblionumber=$record->field($tagfield)->subfield($biblionumtagsubfield); + $i++; + $sth2->execute($record->as_usmarc,$biblionumber) if $biblionumber; + print "$biblionumber \n"; } $timeneeded = gettimeofday - $starttime ; - print "$i records in $timeneeded s\n" ; +print "$i records in $timeneeded s\n" ; END; -sub search{ -my ($query)=@_; -my $nquery="\ \@attr 1=1007 ".$query; -my $oAuth=C4::Context->Zconn("biblioserver"); -if ($oAuth eq "error"){ -warn "Error/CONNECTING \n"; - return("error",undef); -} -my $oAResult; -my $Anewq= new ZOOM::Query::PQF($nquery); -eval { -$oAResult= $oAuth->search_pqf($nquery) ; -}; -if($@){ -warn " /Cannot search:", $@->code()," /MSG:",$@->message(),"\n"; - return("error",undef); -} -my $authrecord; -my $nbresults="0"; - $nbresults=$oAResult->size(); -if ($nbresults eq "1" ){ -my $rec=$oAResult->record(0); -my $marcdata=$rec->raw(); - $authrecord = MARC::File::USMARC::decode($marcdata); +# IS THIS SUPPOSED TO BE __END__ ?? If not, then what is it? --JBA + +sub search { + my ($query)=@_; + my $nquery="\ \@attr 1=1007 ".$query; + my $oAuth=C4::Context->Zconn("biblioserver"); + if ($oAuth eq "error"){ + warn "Error/CONNECTING \n"; + return("error",undef); + } + my $oAResult; + my $Anewq= new ZOOM::Query::PQF($nquery); + eval { + $oAResult= $oAuth->search_pqf($nquery) ; + }; + if($@){ + warn " /Cannot search:", $@->code()," /MSG:",$@->message(),"\n"; + return("error",undef); + } + my $authrecord; + my $nbresults="0"; + $nbresults=$oAResult->size(); + if ($nbresults eq "1" ){ + my $rec=$oAResult->record(0); + my $marcdata=$rec->raw(); + $authrecord = MARC::File::USMARC::decode($marcdata); + } + return ($authrecord,$nbresults); } -return ($authrecord,$nbresults); -} \ No newline at end of file diff --git a/misc/merge_authority.pl b/misc/merge_authority.pl index 0e9d7dbaeb..5f6a7ae739 100755 --- a/misc/merge_authority.pl +++ b/misc/merge_authority.pl @@ -106,11 +106,11 @@ while (my ($bibid,$tag,$tag_indicator,$tagorder,$subfieldcode,$subfieldorder) = &MARCaddsubfield($bibid,$tag,$tag_indicator,$tagorder,$subfield->[0],$subfieldorder,$subfield->[1]); } &MARCaddsubfield($bibid,$tag,$tag_indicator,$tagorder,'9',$subfieldorder,$mergeto); - my $biblio = GetMarcBiblio($bibid); + $biblio = GetMarcBiblio($bibid); print "AFTER : ".$biblio->as_formatted."\n" if $verbose; $nbdone++; # &MARCdelsubfield($dbh,$bibid,$tag,$tagorder,$subfieldcode,$subfieldorder); } my $timeneeded = gettimeofday - $starttime; -print "$nbdone authorities done in $timeneeded seconds" unless $noconfirm; \ No newline at end of file +print "$nbdone authorities done in $timeneeded seconds" unless $noconfirm; -- 2.39.5