[Koha-bugs] [Bug 15336] Script for merging booksellers

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Dec 10 11:14:10 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15336

--- Comment #3 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Comment on attachment 45530
  --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=45530
Bug 15336 - New command-line script: merge_bookseller.pl

Review of attachment 45530:
 --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=15336&attachment=45530)
-----------------------------------------------------------------

::: misc/migration_tools/merge_booksellers.pl
@@ +1,1 @@
> +#!/usr/bin/perl

The copyright is missing.

@@ +1,4 @@
> +#!/usr/bin/perl
> +# Script that merge source bookseller (-f) into target bookseller (-t).
> +
> +use strict;

use Modern::Perl;

@@ +18,5 @@
> +    't:s' => \$mergeto,
> +    'c' => \$confirm,
> +);
> +
> +if ($help || !$mergefrom || !$mergeto) {

you could also test mergefrom == mergeto

@@ +30,5 @@
> +my $to_bookseller = Koha::Acquisition::Bookseller->fetch({id => $mergeto});
> +die "Unknown bookseller id ($mergeto)" unless $to_bookseller;
> +
> +my $report;
> +foreach (qw(Aqbasketgroup Aqbasket Aqcontract Aqcontact Aqinvoice)) {

What about the tables items, deleteditems, subscription?

@@ +31,5 @@
> +die "Unknown bookseller id ($mergeto)" unless $to_bookseller;
> +
> +my $report;
> +foreach (qw(Aqbasketgroup Aqbasket Aqcontract Aqcontact Aqinvoice)) {
> +    my $rs = Koha::Database->new()->schema->resultset($_);

Please don't use $_

@@ +47,5 @@
> +print "\n" if $verbose;
> +print_report($report);
> +print "Nothing done (test only). Use confirm option to commit changes in database\n" unless $confirm;
> +
> +sub print_usage {

use Pod::Usage;
see misc/export_records.pl for an example.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list