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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt (-1 / +1 lines)
Lines 21-26 Link Here
21
        $(new_line).find("select").each( function() {
21
        $(new_line).find("select").each( function() {
22
            var attr = $(this).attr('name');
22
            var attr = $(this).attr('name');
23
            var val = $(line).find('[data-id="' + attr + '"]').val();
23
            var val = $(line).find('[data-id="' + attr + '"]').val();
24
            $(this).find('option').removeAttr('selected');
24
            $(this).find('option[value="' + val + '"]').attr("selected", "selected");
25
            $(this).find('option[value="' + val + '"]').attr("selected", "selected");
25
        } );
26
        } );
26
        return new_line;
27
        return new_line;
Lines 58-64 Link Here
58
            if ( marc_field.length > 0 ) {
59
            if ( marc_field.length > 0 ) {
59
                var new_line = clone_line( line );
60
                var new_line = clone_line( line );
60
                var search_field_name = $(line).find('select[data-id="mapping_search_field_name"] option:selected').text();
61
                var search_field_name = $(line).find('select[data-id="mapping_search_field_name"] option:selected').text();
61
                $(new_line).children('td:first').append('<input type="hidden" name="mapping_search_field_name" value="' + search_field_name + '">');
62
                new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody'));
62
                new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody'));
63
63
64
                var search_field_line = $('input[name="search_field_name"][value="' + search_field_name + '"]').closest("tr");
64
                var search_field_line = $('input[name="search_field_name"][value="' + search_field_name + '"]').closest("tr");
(-)a/t/db_dependent/Auth/Auth.t (-1 / +58 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
#
3
# This Koha test module is a stub!  
4
5
use Modern::Perl;
6
7
use CGI qw ( -utf8 );
8
9
use t::lib::Mocks;
10
use t::lib::TestBuilder;
11
use Test::MockObject;
12
use Test::MockModule;
13
14
use C4::Auth qw(checkpw);
15
16
use Test::More tests => 1;
17
18
my $schema  = Koha::Database->schema;
19
my $builder = t::lib::TestBuilder->new;
20
my $dbh     = C4::Context->dbh;
21
22
t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' );
23
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 0 );
24
25
$schema->storage->txn_begin;
26
27
subtest 'no_set_userenv parameter tests' => sub {
28
29
    plan tests => 12;
30
31
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
32
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
33
    my $password = 'password';
34
35
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
36
    $patron->set_password({ password => $password });
37
38
    ok( checkpw( $dbh, $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' );
39
    is( C4::Context->userenv, undef, 'Userenv should be undef as required' );
40
    C4::Context->_new_userenv('DUMMY SESSION');
41
42
    C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Library 1', 0, '', '');
43
    is( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv gives correct branch' );
44
    ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 1 ), 'checkpw returns true' );
45
    is( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv branch is preserved if no_set_userenv is true' );
46
    ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 0 ), 'checkpw still returns true' );
47
    #isnt( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv branch is overwritten if no_set_userenv is false' );
48
49
    t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
50
    my @result = checkpw( $dbh, $patron->{userid}, 'wrong_password', undef, undef, 1 );
51
    is( $result[0], 0, 'With TestAuth plugin, checkpw returns 0' );
52
    is( $result[1], undef, 'With TestAuth plugin, checkpw returns empty cardnumber' );
53
    is( $result[2], undef, 'With TestAuth plugin, checkpw returns empty userid' );
54
    @result = checkpw( $dbh, 'test', 'test', undef, undef, 1 );
55
    is( $result[0], 1, 'With TestAuth plugin, checkpw returns 1' );
56
    is( $result[1], 'test', 'With TestAuth plugin, checkpw returns test cardnumber' );
57
    is( $result[2], 'test', 'With TestAuth plugin, checkpw returns test userid' );
58
}

Return to bug 20388