From 407c2fe7c0e1597aee39905d59f370b2b89ebfc7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 8 Oct 2014 14:27:40 +0200 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Works as described, passes tests and QA script. Signed-off-by: Tomas Cohen Arazi --- misc/maintenance/cmp_sysprefs.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/misc/maintenance/cmp_sysprefs.pl b/misc/maintenance/cmp_sysprefs.pl index bed32a2517..57f2b427b8 100755 --- a/misc/maintenance/cmp_sysprefs.pl +++ b/misc/maintenance/cmp_sysprefs.pl @@ -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. -- 2.20.1