Bug 25306: Remove framework paramter from ModBiblioMarc
Tested with : For a framework (not the default) : Creation of a biblio record Edition of this biblio record Creation of an item of this record Creation of an item of this record ./misc/batchRepairMissingBiblionumbers.pl OK prove t/db_dependent/Biblio/ModBiblioMarc.t OK Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
489b08ab4c
commit
a96c73eb76
14
C4/Biblio.pm
14
C4/Biblio.pm
|
|
@ -285,7 +285,7 @@ sub AddBiblio {
|
|||
_koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode );
|
||||
|
||||
# now add the record
|
||||
ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save;
|
||||
ModBiblioMarc( $record, $biblionumber ) unless $defer_marc_save;
|
||||
|
||||
# update OAI-PMH sets
|
||||
if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) {
|
||||
|
|
@ -378,7 +378,7 @@ sub ModBiblio {
|
|||
_koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode );
|
||||
|
||||
# update the MARC record (that now contains biblio and items) with the new record data
|
||||
&ModBiblioMarc( $record, $biblionumber, $frameworkcode );
|
||||
&ModBiblioMarc( $record, $biblionumber );
|
||||
|
||||
# modify the other koha tables
|
||||
_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode );
|
||||
|
|
@ -2982,7 +2982,7 @@ sub _koha_delete_biblio_metadata {
|
|||
|
||||
=head2 ModBiblioMarc
|
||||
|
||||
&ModBiblioMarc($newrec,$biblionumber,$frameworkcode);
|
||||
&ModBiblioMarc($newrec,$biblionumber);
|
||||
|
||||
Add MARC XML data for a biblio to koha
|
||||
|
||||
|
|
@ -2993,7 +2993,7 @@ Function exported, but should NOT be used, unless you really know what you're do
|
|||
sub ModBiblioMarc {
|
||||
# pass the MARC::Record to this function, and it will create the records in
|
||||
# the marcxml field
|
||||
my ( $record, $biblionumber, $frameworkcode ) = @_;
|
||||
my ( $record, $biblionumber ) = @_;
|
||||
if ( !$record ) {
|
||||
carp 'ModBiblioMarc passed an undefined record';
|
||||
return;
|
||||
|
|
@ -3003,12 +3003,6 @@ sub ModBiblioMarc {
|
|||
$record = $record->clone();
|
||||
my $dbh = C4::Context->dbh;
|
||||
my @fields = $record->fields();
|
||||
if ( !$frameworkcode ) {
|
||||
$frameworkcode = "";
|
||||
}
|
||||
my $sth = $dbh->prepare("UPDATE biblio SET frameworkcode=? WHERE biblionumber=?");
|
||||
$sth->execute( $frameworkcode, $biblionumber );
|
||||
$sth->finish;
|
||||
my $encoding = C4::Context->preference("marcflavour");
|
||||
|
||||
# deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode
|
||||
|
|
|
|||
|
|
@ -276,9 +276,6 @@ sub AddItemBatchFromMarc {
|
|||
$record->delete_field($item_field);
|
||||
}
|
||||
|
||||
# update the MARC biblio
|
||||
# $biblionumber = ModBiblioMarc( $record, $biblionumber, $frameworkcode );
|
||||
|
||||
return (\@itemnumbers, \@errors);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ $sth->execute();
|
|||
while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){
|
||||
my $record = GetMarcBiblio({ biblionumber => $biblionumber });
|
||||
C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
|
||||
my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber, $frameworkcode )};
|
||||
my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber )};
|
||||
if($@){
|
||||
print "Problem with biblionumber : $biblionumber\n";
|
||||
exit -1;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ sub MARCmodbiblionumber{
|
|||
|
||||
|
||||
if ($update){
|
||||
&ModBiblioMarc($record,$biblionumber,'');
|
||||
&ModBiblioMarc($record,$biblionumber);
|
||||
print "\n modified : $biblionumber \n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ foreach ($record->field('995')) {
|
|||
$record->delete_field($_);
|
||||
}
|
||||
if ($update){
|
||||
&ModBiblioMarc($record,'',$biblionumber);
|
||||
&ModBiblioMarc($record,$biblionumber);
|
||||
print "$biblionumber \n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ sub MARCmodrecord {
|
|||
$record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>"$string"));
|
||||
}
|
||||
if ($update){
|
||||
&ModBiblioMarc($record,$biblionumber,'');
|
||||
&ModBiblioMarc($record,$biblionumber);
|
||||
print "\r$biblionumber" unless ( $biblionumber % 100 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ RECORD: while ( ) {
|
|||
$biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber;
|
||||
};
|
||||
if ($update) {
|
||||
eval { ModBiblio( $record, $biblionumber, GetFrameworkCode($biblionumber) ) };
|
||||
eval { ModBiblio( $record, $biblionumber, $framework ) };
|
||||
if ($@) {
|
||||
warn "ERROR: Edit biblio $biblionumber failed: $@\n";
|
||||
printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile);
|
||||
|
|
@ -458,7 +458,7 @@ RECORD: while ( ) {
|
|||
}
|
||||
} else {
|
||||
if ($insert) {
|
||||
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '', { defer_marc_save => 1 } ) };
|
||||
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, $framework, { defer_marc_save => 1 } ) };
|
||||
if ($@) {
|
||||
warn "ERROR: Adding biblio $biblionumber failed: $@\n";
|
||||
printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ERROR" } ) if ($logfile);
|
||||
|
|
@ -480,7 +480,7 @@ RECORD: while ( ) {
|
|||
C4::Biblio::_strip_item_fields($clone_record, '');
|
||||
# This sets the marc fields if there was an error, and also calls
|
||||
# defer_marc_save.
|
||||
ModBiblioMarc( $clone_record, $biblionumber, $framework );
|
||||
ModBiblioMarc( $clone_record, $biblionumber );
|
||||
if ( $error_adding ) {
|
||||
warn "ERROR: Adding items to bib $biblionumber failed: $error_adding";
|
||||
printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile);
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ while ( my ( $biblionumber ) = $bibs_sth->fetchrow ) {
|
|||
else {
|
||||
print ".";
|
||||
}
|
||||
ModBiblioMarc( $biblio, $biblionumber, $framework );
|
||||
ModBiblioMarc( $biblio, $biblionumber );
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ subtest "Check MARC field length calculation" => sub {
|
|||
);
|
||||
|
||||
is( $record->leader, ' 'x24, 'No leader lengths' );
|
||||
C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber, '' );
|
||||
C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber );
|
||||
my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber });
|
||||
like( substr($savedrec->leader,0,5), qr/^\d{5}$/, 'Record length found' );
|
||||
like( substr($savedrec->leader,12,5), qr/^\d{5}$/, 'Base address found' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue