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

(-)a/Koha/Template/Plugin/ExtendedAttributeTypes.pm (-2 / +2 lines)
Lines 55-68 Koha::Template::Plugin::ExtendedAttributeTypes - TT Plugin for retrieving patron Link Here
55
In a template, you can get the searchable attribute types with
55
In a template, you can get the searchable attribute types with
56
the following TT code: [% ExtendedAttributes.all( staff_searchable => 1 ) %]
56
the following TT code: [% ExtendedAttributes.all( staff_searchable => 1 ) %]
57
57
58
The function returns the Koha::Patron::Atribute::Type objects
58
The function returns the Koha::Patron::Attribute::Type objects
59
59
60
=head2 codes
60
=head2 codes
61
61
62
In a template, you can get the searchable attribute type codes with
62
In a template, you can get the searchable attribute type codes with
63
the following TT code: [% ExtendedAttributes.codes( staff_searchable => 1 ) %]
63
the following TT code: [% ExtendedAttributes.codes( staff_searchable => 1 ) %]
64
64
65
The function returns the Koha::Patron::Atribute::Type codes as an array
65
The function returns the Koha::Patron::Attribute::Type codes as an array
66
66
67
=head1 AUTHOR
67
=head1 AUTHOR
68
68
(-)a/t/db_dependent/Koha/Template/Plugin/ExtendedAttributeTypes.t (-10 / +9 lines)
Lines 42-75 my $typeA = $builder->build_object( Link Here
42
        class => 'Koha::Patron::Attribute::Types',
42
        class => 'Koha::Patron::Attribute::Types',
43
        value => {
43
        value => {
44
            staff_searchable => 0,
44
            staff_searchable => 0,
45
            description => "Desc type A",
45
            description      => "Desc type A",
46
        }
46
        }
47
    }
47
    }
48
);
48
);
49
my $typeB = $builder->build_object(
49
my $typeB = $builder->build_object(
50
    {
50
    {
51
        class  => 'Koha::Patron::Attribute::Types',
51
        class => 'Koha::Patron::Attribute::Types',
52
        value => {
52
        value => {
53
            staff_searchable => 1,
53
            staff_searchable => 1,
54
            description => "Desc type B",
54
            description      => "Desc type B",
55
        }
55
        }
56
    }
56
    }
57
);
57
);
58
58
59
my $all_plugin = $plugin->all();
59
my $all_plugin  = $plugin->all();
60
my $all_objects = Koha::Patron::Attribute::Types->search();
60
my $all_objects = Koha::Patron::Attribute::Types->search();
61
61
62
is_deeply( $all_plugin->unblessed, $all_objects->unblessed, "all method returns all the types correctly");
62
is_deeply( $all_plugin->unblessed, $all_objects->unblessed, "all method returns all the types correctly" );
63
63
64
my $all_plugin_codes = $plugin->codes();
64
my $all_plugin_codes = $plugin->codes();
65
my $all_object_codes = Koha::Patron::Attribute::Types->search()->get_column('code');
65
my $all_object_codes = Koha::Patron::Attribute::Types->search()->get_column('code');
66
66
67
is_deeply( $all_plugin_codes, $all_object_codes, "codes method returns the codes as expected");
67
is_deeply( $all_plugin_codes, $all_object_codes, "codes method returns the codes as expected" );
68
68
69
my $searchable_plugin_codes = $plugin->codes({ staff_searchable => 1 });
69
my $searchable_plugin_codes = $plugin->codes( { staff_searchable => 1 } );
70
my $searchable_object_codes = Koha::Patron::Attribute::Types->search({ staff_searchable => 1 })->get_column('code');
70
my $searchable_object_codes = Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code');
71
71
72
is_deeply( $searchable_plugin_codes, $searchable_object_codes, "searching plugin method works as expected");
72
is_deeply( $searchable_plugin_codes, $searchable_object_codes, "searching plugin method works as expected" );
73
73
74
$schema->storage->txn_rollback;
74
$schema->storage->txn_rollback;
75
75
76
- 

Return to bug 34519