@@ -, +, @@ - Returns the list of modified biblio records - Retrieve MARC records from DB if not given in parameters - Delete source authority if source and destination records are different --- C4/AuthoritiesMarc.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/C4/AuthoritiesMarc.pm +++ a/C4/AuthoritiesMarc.pm @@ -1399,22 +1399,27 @@ sub AddAuthorityTrees{ =head2 merge - $ref= &merge(mergefrom,$MARCfrom,$mergeto,$MARCto) + my @edited_biblionumbers = merge(mergefrom, $MARCfrom, $mergeto, $MARCto); Could add some feature : Migrating from a typecode to an other for instance. Then we should add some new parameter : bibliotargettag, authtargettag +Returns a list of biblionumbers of records that were modified. + =cut sub merge { my ($mergefrom, $MARCfrom, $mergeto, $MARCto) = @_; - my ($counteditedbiblio,$countunmodifiedbiblio,$counterrors)=(0,0,0); + my @editedbiblios; my $dbh = C4::Context->dbh; my $authfrom = Koha::Authorities->find($mergefrom); my $authto = Koha::Authorities->find($mergeto); my $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode); my $authtypeto = Koha::Authority::Types->find($authto->authtypecode); + $MARCfrom ||= GetAuthority($mergefrom); + $MARCto ||= GetAuthority($mergeto); + return "error MARCFROM not a marcrecord ".Data::Dumper::Dumper($MARCfrom) if scalar($MARCfrom->fields()) == 0; return "error MARCTO not a marcrecord".Data::Dumper::Dumper($MARCto) if scalar($MARCto->fields()) == 0; # search the tag to report @@ -1514,12 +1519,13 @@ sub merge { } if ($update==1){ &ModBiblio($marcrecord,$biblionumber,GetFrameworkCode($biblionumber)) ; - $counteditedbiblio++; - warn $counteditedbiblio if (($counteditedbiblio % 10) and $ENV{DEBUG}); + push @editedbiblios, $biblionumber; } }#foreach $marc - return $counteditedbiblio; + DelAuthority($mergefrom) if ($mergefrom != $mergeto); + + return @editedbiblios; } =head2 get_auth_type_location --