From f918820091bbf9767d5d48d6ee040813132fd510 Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Mon, 4 Jul 2016 19:22:51 +0200 Subject: [PATCH] Bug 6906: Follow coding guidelines in terminology. * Koha/Patron.pm (wantsCheckPrevCheckout, doCheckPrevCheckout): Rename to... (wants_check_for_previous_checkout, do_check_for_previous_checkout): ...this. * C4/Circulation.pm: Use new names. * t/db_dependent/Patron/CheckPrevCheckout.t: Renamed to... * t/db_dependent/Patron/Borrower_PrevCheckout.t: ...this. --- C4/Circulation.pm | 4 +-- Koha/Patron.pm | 12 ++++---- ...CheckPrevCheckout.t => Borrower_PrevCheckout.t} | 32 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) rename t/db_dependent/Patron/{CheckPrevCheckout.t => Borrower_PrevCheckout.t} (91%) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 68f5d23..4298e01 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -944,9 +944,9 @@ sub CanBookBeIssued { # CHECKPREVCHECKOUT: CHECK IF ITEM HAS EVER BEEN LENT TO PATRON # my $patron = Koha::Patrons->find($borrower->{borrowernumber}); - my $wantsCheckPrevCheckout = $patron->wantsCheckPrevCheckout; + my $wants_check = $patron->wants_check_for_previous_checkout; $needsconfirmation{PREVISSUE} = 1 - if ($wantsCheckPrevCheckout and $patron->doCheckPrevCheckout($item)); + if ($wants_check and $patron->do_check_for_previous_checkout($item)); # # ITEM CHECKING diff --git a/Koha/Patron.pm b/Koha/Patron.pm index aa38363..c9c2714 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -100,15 +100,15 @@ sub siblings { ); } -=head3 wantsCheckPrevCheckout +=head3 wants_check_for_previous_checkout - $wantsCheckPrevCheckout = $patron->wantsCheckPrevCheckout; + $wants_check = $patron->wantsCheckPrevCheckout; Return 1 if Koha needs to perform PrevIssue checking, else 0. =cut -sub wantsCheckPrevCheckout { +sub wants_check_for_previous_checkout { my ( $self ) = @_; my $syspref = C4::Context->preference("checkPrevCheckout"); @@ -134,16 +134,16 @@ sub wantsCheckPrevCheckout { } } -=head3 doCheckPrevCheckout +=head3 do_check_for_previous_checkout - $checkPrevCheckout = $patron->doCheckPrevCheckout($item); + $do_check = $patron->do_check_for_previous_checkout($item); Return 1 if the bib associated with $ITEM has previously been checked out to $PATRON, 0 otherwise. =cut -sub doCheckPrevCheckout { +sub do_check_for_previous_checkout { my ( $self, $item ) = @_; # Find all items for bib and extract item numbers. diff --git a/t/db_dependent/Patron/CheckPrevCheckout.t b/t/db_dependent/Patron/Borrower_PrevCheckout.t similarity index 91% rename from t/db_dependent/Patron/CheckPrevCheckout.t rename to t/db_dependent/Patron/Borrower_PrevCheckout.t index 67964ec..453ccf1 100644 --- a/t/db_dependent/Patron/CheckPrevCheckout.t +++ b/t/db_dependent/Patron/Borrower_PrevCheckout.t @@ -54,7 +54,7 @@ C4::Context->set_userenv(@USERENV); BAIL_OUT("No userenv") unless C4::Context->userenv; -# wantsCheckPrevCheckout +# wants_check_for_previous_checkout # We expect the following result matrix: # @@ -203,7 +203,7 @@ map { }); my $patron = Koha::Patrons->find($kpatron->{borrowernumber}); is( - $patron->wantsCheckPrevCheckout, $_->{result}, + $patron->wants_check_for_previous_checkout, $_->{result}, "Predicate with syspref " . $syspref . ", cat " . $code . ", patron " . $_->{setting} ); @@ -211,7 +211,7 @@ map { } @{$_->{categories}}; } @{$mappings}; -# doCheckPrevCheckout +# do_check_for_previous_checkout # We want to test: # - DESCRIPTION [RETURNVALUE (0/1)] @@ -254,7 +254,7 @@ sub test_it { map { my $patron = Koha::Patrons->find($_->{patron}->{borrowernumber}); is( - $patron->doCheckPrevCheckout($_->{item}), + $patron->do_check_for_previous_checkout($_->{item}), $_->{result}, $stage . ": " . $_->{msg} ); } @{$mapping}; @@ -358,20 +358,20 @@ test_it($cpvPmappings, "PostReturn"); # Finally test C4::Circulation::CanBookBeIssued -# We have already tested ->wantsCheckPrevCheckout and ->doCheckPrevCheckout, -# so all that remains to be tested is whetherthe different combinational -# outcomes of the above return values in CanBookBeIssued result in the -# approriate $needsconfirmation. +# We have already tested ->wants_check_for_previous_checkout and +# ->do_check_for_previous_checkout, so all that remains to be tested is +# whetherthe different combinational outcomes of the above return values in +# CanBookBeIssued result in the approriate $needsconfirmation. # We want to test: # - DESCRIPTION [RETURNVALUE (0/1)] -# - patron, !wantsCheckPrevCheckout, !doCheckPrevCheckout +# - patron, !wants_check_for_previous_checkout, !do_check_for_previous_checkout # [!$issuingimpossible,!$needsconfirmation->{PREVISSUE}] -# - patron, wantsCheckPrevCheckout, !doCheckPrevCheckout +# - patron, wants_check_for_previous_checkout, !do_check_for_previous_checkout # [!$issuingimpossible,!$needsconfirmation->{PREVISSUE}] -# - patron, !wantsCheckPrevCheckout, doCheckPrevCheckout +# - patron, !wants_check_for_previous_checkout, do_check_for_previous_checkout # [!$issuingimpossible,!$needsconfirmation->{PREVISSUE}] -# - patron, wantsCheckPrevCheckout, doCheckPrevCheckout +# - patron, wants_check_for_previous_checkout, do_check_for_previous_checkout # [!$issuingimpossible,$needsconfirmation->{PREVISSUE}] # Needs: @@ -410,26 +410,26 @@ my $CBBI_mappings = [ syspref => 'hardno', item => $new_item, result => undef, - msg => "patron, !wantsCheckPrevCheckout, !doCheckPrevCheckout" + msg => "patron, !wants_check_for_previous_checkout, !do_check_for_previous_checkout" }, { syspref => 'hardyes', item => $new_item, result => undef, - msg => "patron, wantsCheckPrevCheckout, !doCheckPrevCheckout" + msg => "patron, wants_check_for_previous_checkout, !do_check_for_previous_checkout" }, { syspref => 'hardno', item => $prev_item, result => undef, - msg => "patron, !wantsCheckPrevCheckout, doCheckPrevCheckout" + msg => "patron, !wants_check_for_previous_checkout, do_check_for_previous_checkout" }, { syspref => 'hardyes', item => $prev_item, result => 1, - msg => "patron, wantsCheckPrevCheckout, doCheckPrevCheckout" + msg => "patron, wants_check_for_previous_checkout, do_check_for_previous_checkout" }, ]; -- 2.8.4