Bugzilla – Attachment 32889 Details for
Bug 11401
Add support for Norwegian national library card
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11401 - QA followup
Bug-11401---QA-followup.patch (text/plain), 8.60 KB, created by
Magnus Enger
on 2014-10-29 11:11:02 UTC
(
hide
)
Description:
Bug 11401 - QA followup
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2014-10-29 11:11:02 UTC
Size:
8.60 KB
patch
obsolete
>From 852763e77d644739c776d289b9bd69fce19c2bdf Mon Sep 17 00:00:00 2001 >From: Magnus Enger <digitalutvikling@gmail.com> >Date: Wed, 29 Oct 2014 10:26:11 +0100 >Subject: [PATCH] Bug 11401 - QA followup > >1) Be more careful when checking the NorwegianPatronDBEnable syspref. > >Before: >if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > >After: >if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > >This should avoid complaints if the syspref is not initialized. > >2) Fix some empty =head2 POD sections >--- > C4/Members.pm | 8 ++++---- > Koha/NorwegianPatronDB.pm | 2 +- > members/deletemem.pl | 4 ++-- > members/memberentry.pl | 6 +++--- > members/moremember.pl | 4 ++-- > misc/cronjobs/nl-sync-from-koha.pl | 18 ++++++++++++++++++ > 6 files changed, 30 insertions(+), 12 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index b754aeb..577c738 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -44,7 +44,7 @@ use Text::Unaccent qw( unac_string ); > use Koha::AuthUtils qw(hash_password); > use Koha::Database; > use Module::Load; >-if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > load Koha::NorwegianPatronDB, qw( NLUpdateHashedPIN NLEncryptPIN NLSync ); > } > >@@ -789,7 +789,7 @@ sub ModMember { > if ($data{password} eq '****' or $data{password} eq '') { > delete $data{password}; > } else { >- if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > # Update the hashed PIN in borrower_sync.hashed_pin, before Koha hashes it > NLUpdateHashedPIN( $data{'borrowernumber'}, $data{password} ); > } >@@ -815,7 +815,7 @@ sub ModMember { > > # If NorwegianPatronDBEnable is enabled, we set syncstatus to something that a > # cronjob will use for syncing with NL >- if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > my $borrowersync = Koha::Database->new->schema->resultset('BorrowerSync')->find({ > 'synctype' => 'norwegianpatrondb', > 'borrowernumber' => $data{'borrowernumber'} >@@ -883,7 +883,7 @@ sub AddMember { > > # If NorwegianPatronDBEnable is enabled, we set syncstatus to something that a > # cronjob will use for syncing with NL >- if ( exists $data{'borrowernumber'} && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+ if ( exists $data{'borrowernumber'} && C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > Koha::Database->new->schema->resultset('BorrowerSync')->create({ > 'borrowernumber' => $data{'borrowernumber'}, > 'synctype' => 'norwegianpatrondb', >diff --git a/Koha/NorwegianPatronDB.pm b/Koha/NorwegianPatronDB.pm >index 51955eb..c38d687 100644 >--- a/Koha/NorwegianPatronDB.pm >+++ b/Koha/NorwegianPatronDB.pm >@@ -39,7 +39,7 @@ But in scripts that are also used by others (like e.g. moremember.pl), it will > be polite to only load the module at runtime, if it is needed: > > use Module::Load; >- if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber ); > } > >diff --git a/members/deletemem.pl b/members/deletemem.pl >index 36aaf5d..85c0166 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -32,7 +32,7 @@ use C4::Members; > use C4::Branch; # GetBranches > use C4::VirtualShelves (); #no import > use Module::Load; >-if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > load Koha::NorwegianPatronDB, qw( NLMarkForDeletion NLSync ); > } > >@@ -56,7 +56,7 @@ my $member = $input->param('member'); > # out. If "deletelocal" is set to "true", or not set to anything normal > # deletion will be done. > my $deletelocal = $input->param('deletelocal') eq 'false' ? 0 : 1; # Deleting locally is the default >-if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > if ( $input->param('deleteremote') eq 'true' ) { > # Mark for deletion, then try a live sync > NLMarkForDeletion( $member ); >diff --git a/members/memberentry.pl b/members/memberentry.pl >index a9773d6..7a0329f 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -44,7 +44,7 @@ use C4::Form::MessagingPreferences; > use Koha::Borrower::Debarments; > use Koha::DateUtils; > use Module::Load; >-if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber ); > } > >@@ -421,7 +421,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ > C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template, 1, $newdata{'categorycode'}); > } > # Try to do the live sync with the Norwegian national patron database, if it is enabled >- if ( exists $data{'borrowernumber'} && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+ if ( exists $data{'borrowernumber'} && C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > NLSync({ 'borrowernumber' => $borrowernumber }); > } > } elsif ($op eq 'save'){ >@@ -479,7 +479,7 @@ if ($op eq "modify") { > $template->param( categorycode => $borrower_data->{'categorycode'} ); > } > # Add sync data to the user data >- if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > my $sync = NLGetSyncDataFromBorrowernumber( $borrowernumber ); > if ( $sync ) { > $template->param( >diff --git a/members/moremember.pl b/members/moremember.pl >index d056580..3fc92ca 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -54,7 +54,7 @@ use List::MoreUtils qw/uniq/; > use C4::Members::Attributes qw(GetBorrowerAttributes); > use Koha::Borrower::Debarments qw(GetDebarments IsDebarred); > use Module::Load; >-if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber ); > } > #use Smart::Comments; >@@ -295,7 +295,7 @@ else { > } > > # Add sync data to the user data >-if ( C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { >+if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { > my $sync = NLGetSyncDataFromBorrowernumber( $borrowernumber ); > if ( $sync ) { > $data->{'sync'} = $sync->sync; >diff --git a/misc/cronjobs/nl-sync-from-koha.pl b/misc/cronjobs/nl-sync-from-koha.pl >index f62fd7a..81e3218 100644 >--- a/misc/cronjobs/nl-sync-from-koha.pl >+++ b/misc/cronjobs/nl-sync-from-koha.pl >@@ -46,6 +46,8 @@ This script performs the following steps: > > =head2 Check sysprefs > >+Check that the necessary sysprefs are set before proceeding. >+ > =cut > > my $check_result = NLCheckSysprefs(); >@@ -62,6 +64,18 @@ unless ( $run ) { > > =head2 Find patrons that need to be synced > >+Patrons with either of these statuses: >+ >+=over 4 >+ >+=item * edited >+ >+=item * new >+ >+=item * deleted >+ >+=back >+ > =cut > > my @needs_sync = Koha::Database->new->schema->resultset('BorrowerSync')->search({ >@@ -78,6 +92,8 @@ my @needs_sync = Koha::Database->new->schema->resultset('BorrowerSync')->search( > > =head2 Do the actual sync > >+Data is synced to NL with NLSync. >+ > =cut > > my $sync_success = 0; >@@ -106,6 +122,8 @@ foreach my $borrower ( @needs_sync ) { > > =head2 Summarize if verbose mode is enabled > >+Specify -v on the command line to get a summary of the syncing operations. >+ > =cut > > if ( $verbose ) { >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11401
:
30752
|
31710
|
31711
|
31815
|
31816
|
32546
|
32607
|
32888
|
32889
|
32890
|
32949
|
32950
|
32951
|
32952
|
33528
|
33570
|
33582