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

(-)a/Koha/Acquisition/Bookseller.pm (-1 / +6 lines)
Lines 122-128 sub interfaces { Link Here
122
            sub {
122
            sub {
123
                $self->interfaces->delete;
123
                $self->interfaces->delete;
124
                for my $interface (@$interfaces) {
124
                for my $interface (@$interfaces) {
125
                    $self->_result->add_to_aqbookseller_interfaces($interface);
125
                    Koha::Acquisition::Bookseller::Interface->new(
126
                        {
127
                            %$interface,
128
                            vendor_id => $self->id,
129
                        }
130
                    )->store;
126
                }
131
                }
127
            }
132
            }
128
        );
133
        );
(-)a/Koha/Acquisition/Bookseller/Interface.pm (+33 lines)
Lines 16-21 package Koha::Acquisition::Bookseller::Interface; 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 Koha::Encryption;
19
20
20
use base qw( Koha::Object );
21
use base qw( Koha::Object );
21
22
Lines 29-34 Koha::Acquisition::Bookseller::Interface - Koha Bookseller interface Object clas Link Here
29
30
30
=cut
31
=cut
31
32
33
=head3 store
34
35
    $self->store;
36
37
Specific store method to encrypt the password.
38
39
=cut
40
41
sub store {
42
    my ($self) = @_;
43
44
    if ( $self->password ) {
45
        $self->password(Koha::Encryption->new->encrypt_hex($self->password));
46
    }
47
48
    return $self->SUPER::store;
49
}
50
51
=head3 plain_text_password
52
53
    my $plain_text_password = $self->plain_text_password;
54
55
Decrypt the password and return its plain text form.
56
57
=cut
58
59
sub plain_text_password {
60
    my ($self) = @_;
61
    return Koha::Encryption->new->decrypt_hex($self->password)
62
        if $self->password;
63
}
64
32
=head3 _type
65
=head3 _type
33
66
34
=cut
67
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-13 / +31 lines)
Lines 364-381 Link Here
364
                <div id="supplier-interfaces" class="page-section">
364
                <div id="supplier-interfaces" class="page-section">
365
                    <h2>Interfaces</h2>
365
                    <h2>Interfaces</h2>
366
366
367
                    [% FOR interface IN vendor.interfaces %]
367
                    [% FOR i IN vendor.interfaces %]
368
                        <fieldset class="rows">
368
                        <fieldset class="rows">
369
                            <legend>[% interface.name | html %]</legend>
369
                            <legend>[% i.name | html %]</legend>
370
                            <ul>
370
                            <ul>
371
                                <li>
371
                                [% IF i.type %]
372
                                    <li>Type: [% interface.type | html %]</li>
372
                                    <li>Type: [% i.type | html %]</li>
373
                                    <li>URI: [% interface.uri | html %]</li>
373
                                [% END %]
374
                                    <li>Login: [% interface.login | html %]</li>
374
                                [% IF i.uri %]
375
                                    <li>Password: [% interface.password | html %]</li>
375
                                    <li>URI: [% i.uri | html %]</li>
376
                                    <li>Account email: [% interface.account_email | html %]</li>
376
                                [% END %]
377
                                    <li>Notes : [% interface.notes | html %]</li>
377
                                [% IF i.login %]
378
                                </li>
378
                                    <li>Login: [% i.login | html %]</li>
379
                                [% END %]
380
                                [% IF i.password %]
381
                                    <li>Password: <span class="password"><a href="#" class="show_password" data-plain-text-password="[% i.plain_text_password | html %]">Show</a></span></li>
382
                                [% END %]
383
                                [% IF i.account_email %]
384
                                    <li>Account email: [% i.account_email | html %]</li>
385
                                [% END %]
386
                                [% IF i.notes %]
387
                                    <li>Notes : [% i.notes | html %]</li>
388
                                [% END %]
379
                            </ul>
389
                            </ul>
380
                        </fieldset>
390
                        </fieldset>
381
                    [% END %]
391
                    [% END %]
Lines 520-528 Link Here
520
        }
530
        }
521
531
522
        [% IF vendor %]
532
        [% IF vendor %]
523
        let interfaces = [% To.json(vendor.interfaces.unblessed) | $raw %];
533
            let interfaces = [];
534
            [% FOR i_object IN vendor.interfaces %]
535
                [% SET i = i_object.unblessed %]
536
                [% SET i.password = i_object.plain_text_password %]
537
                interfaces.push([% To.json(i) | $raw %]);
538
            [% END %]
524
        [% ELSE %]
539
        [% ELSE %]
525
        let interfaces = [];
540
            let interfaces = [];
526
        [% END %]
541
        [% END %]
527
        function serialize_interface_form(){
542
        function serialize_interface_form(){
528
            interfaces = [];
543
            interfaces = [];
Lines 627-632 Link Here
627
                $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
642
                $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
628
            });
643
            });
629
644
645
            $('body').on('click', '.show_password', null, function(e){
646
                e.preventDefault();
647
                $(this).parent().replaceWith($(this).data('plain-text-password'));
648
            });
630
            refresh_aliases();
649
            refresh_aliases();
631
            refresh_interfaces();
650
            refresh_interfaces();
632
651
633
- 

Return to bug 33104