Bug 13028: Followup adding a -partial flag for partial compares

If you compare the database with a partial pref file, you may not be
interested in lots of lines saying that a pref is not in the file. You
were already aware of that ;)
If you add the -partial flag, these lines will be skipped.

Test plan:
Do as described above.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Marcel de Rooy 2014-10-08 14:27:40 +02:00 committed by Tomas Cohen Arazi
parent 98a3aa4d8f
commit 407c2fe7c0
1 changed files with 7 additions and 1 deletions

View File

@ -33,7 +33,7 @@ use Pod::Usage;
use C4::Context;
my $dbh = C4::Context->dbh;
my ( $help, $cmd, $filename, $override, $compare_add, $compare_del, $compare_upd, $ignore_opt );
my ( $help, $cmd, $filename, $override, $compare_add, $compare_del, $compare_upd, $ignore_opt, $partial );
GetOptions(
'help' => \$help,
'cmd:s' => \$cmd,
@ -42,6 +42,7 @@ GetOptions(
'del' => \$compare_del,
'upd' => \$compare_upd,
'ign-opt' => \$ignore_opt,
'partial' => \$partial,
);
if ( $filename && !-e $filename && $cmd !~ /^b/ ) {
@ -98,6 +99,7 @@ sub PrintCompare {
my ( $ch, $s1, $s2 ) = @_;
foreach ( sort keys %$ch ) {
my $v = $ch->{$_};
next if $v eq '1' && $partial;
print "$_: ";
if ( $v eq '1' ) { print "Not in $s2"; }
elsif ( $v eq '2' ) { print "Not in $s1"; }
@ -308,6 +310,10 @@ Command: backup, compare, restore or test.
Name of the file used in command.
=item B<-partial>
Only for partial compares: skip 'not present in file'-messages.
=item B<-add>
Only for compares: restore preferences not present in database.