View | Details | Raw Unified | Return to bug 15151
Collapse All | Expand All

(-)a/C4/Members.pm (-7 / +4 lines)
Lines 41-50 use Koha::Borrower::Debarments qw(IsDebarred); Link Here
41
use Text::Unaccent qw( unac_string );
41
use Text::Unaccent qw( unac_string );
42
use Koha::AuthUtils qw(hash_password);
42
use Koha::AuthUtils qw(hash_password);
43
use Koha::Database;
43
use Koha::Database;
44
use Module::Load;
44
require Koha::NorwegianPatronDB;
45
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
46
    load Koha::NorwegianPatronDB, qw( NLUpdateHashedPIN NLEncryptPIN NLSync );
47
}
48
45
49
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
46
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
50
47
Lines 651-657 sub ModMember { Link Here
651
        } else {
648
        } else {
652
            if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
649
            if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
653
                # Update the hashed PIN in borrower_sync.hashed_pin, before Koha hashes it
650
                # Update the hashed PIN in borrower_sync.hashed_pin, before Koha hashes it
654
                NLUpdateHashedPIN( $data{'borrowernumber'}, $data{password} );
651
                Koha::NorwegianPatronDB::NLUpdateHashedPIN( $data{'borrowernumber'}, $data{password} );
655
            }
652
            }
656
            $data{password} = hash_password($data{password});
653
            $data{password} = hash_password($data{password});
657
        }
654
        }
Lines 705-711 sub ModMember { Link Here
705
            # Set the value of 'sync'
702
            # Set the value of 'sync'
706
            $borrowersync->update( { 'sync' => $data{'sync'} } );
703
            $borrowersync->update( { 'sync' => $data{'sync'} } );
707
            # Try to do the live sync
704
            # Try to do the live sync
708
            NLSync({ 'borrowernumber' => $data{'borrowernumber'} });
705
            Koha::NorwegianPatronDB::NLSync({ 'borrowernumber' => $data{'borrowernumber'} });
709
        }
706
        }
710
707
711
        logaction("MEMBERS", "MODIFY", $data{'borrowernumber'}, "UPDATE (executed w/ arg: $data{'borrowernumber'})") if C4::Context->preference("BorrowersLog");
708
        logaction("MEMBERS", "MODIFY", $data{'borrowernumber'}, "UPDATE (executed w/ arg: $data{'borrowernumber'})") if C4::Context->preference("BorrowersLog");
Lines 781-787 sub AddMember { Link Here
781
            'synctype'       => 'norwegianpatrondb',
778
            'synctype'       => 'norwegianpatrondb',
782
            'sync'           => 1,
779
            'sync'           => 1,
783
            'syncstatus'     => 'new',
780
            'syncstatus'     => 'new',
784
            'hashed_pin'     => NLEncryptPIN( $plain_text_password ),
781
            'hashed_pin'     => Koha::NorwegianPatronDB::NLEncryptPIN( $plain_text_password ),
785
        });
782
        });
786
    }
783
    }
787
784
(-)a/t/Circulation_barcodedecode.t (-22 / +12 lines)
Lines 16-29 Link Here
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
use Test::More tests => 25;
19
20
use t::lib::Mocks;
20
use Test::More tests => 26;
21
use C4::Circulation;
21
22
use C4::Context;
22
use C4::Context;
23
23
24
BEGIN {
24
use_ok( 'C4::Circulation' );
25
    t::lib::Mocks::mock_dbh;
26
};
27
25
28
C4::Context->_new_userenv(123456);
26
C4::Context->_new_userenv(123456);
29
C4::Context->set_userenv(1,'kmkale' , 1, 'km', 'kale' , 'IMS', 'IMS Branch DEscription', 0, 'kmkale@anantcorp.com');
27
C4::Context->set_userenv(1,'kmkale' , 1, 'km', 'kale' , 'IMS', 'IMS Branch DEscription', 0, 'kmkale@anantcorp.com');
Lines 49-73 our %outputs = ( Link Here
49
my @filters = sort keys %inputs;
47
my @filters = sort keys %inputs;
50
foreach my $filter (@filters) {
48
foreach my $filter (@filters) {
51
    foreach my $datum (@{$inputs{$filter}}) {
49
    foreach my $datum (@{$inputs{$filter}}) {
52
        my $expect = shift @{$outputs{$filter}} or die "Internal Test Error: missing expected output for filter '$filter' on input '$datum'";
50
        my $expect = shift @{$outputs{$filter}}
51
            or die "Internal Test Error: missing expected output for filter '$filter' on input '$datum'";
53
        my $output = C4::Circulation::barcodedecode($datum, $filter);
52
        my $output = C4::Circulation::barcodedecode($datum, $filter);
54
        ok($output eq $expect, sprintf("%12s: %20s => %15s", $filter, "'$datum'", "'$expect'")); 
53
        ok($output eq $expect, sprintf("%12s: %20s => %15s", $filter, "'$datum'", "'$expect'")); 
55
        ($output eq $expect) or diag  "Bad output: '$output'";
54
        ($output eq $expect) or diag  "Bad output: '$output'";
56
    }
55
    }
57
}
56
}
58
57
59
__END__
58
# T-prefix style is derived from zero-padded "Follett Classic Code 3 of 9".  From:
60
59
#     www.fsc.follett.com/_file/File/pdf/Barcode%20Symbology%20Q%20%20A%203_05.pdf
61
=head2 C4::Circulation::barcodedecode()
60
#  ~ 1 to 7 characters
62
61
#  ~ T, P or X followed by numeric characters
63
This tests avoids being dependent on the database by using the optional
62
#  ~ No checkdigit
64
second argument to barcodedecode.
65
66
T-prefix style is derived from zero-padded "Follett Classic Code 3 of 9".  From:
67
    www.fsc.follett.com/_file/File/pdf/Barcode%20Symbology%20Q%20%20A%203_05.pdf
68
 
69
 ~ 1 to 7 characters
70
 ~ T, P or X followed by numeric characters
71
 ~ No checkdigit
72
63
73
=cut
64
1;
74
- 

Return to bug 15151