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 368-385 Link Here
368
                <div id="supplier-interfaces" class="page-section">
368
                <div id="supplier-interfaces" class="page-section">
369
                    <h2>Interfaces</h2>
369
                    <h2>Interfaces</h2>
370
370
371
                    [% FOR interface IN vendor.interfaces %]
371
                    [% FOR i IN vendor.interfaces %]
372
                        <fieldset class="rows">
372
                        <fieldset class="rows">
373
                            <legend>[% interface.name | html %]</legend>
373
                            <legend>[% i.name | html %]</legend>
374
                            <ul>
374
                            <ul>
375
                                <li>
375
                                [% IF i.type %]
376
                                    <li>Type: [% interface.type | html %]</li>
376
                                    <li>Type: [% i.type | html %]</li>
377
                                    <li>URI: [% interface.uri | html %]</li>
377
                                [% END %]
378
                                    <li>Login: [% interface.login | html %]</li>
378
                                [% IF i.uri %]
379
                                    <li>Password: [% interface.password | html %]</li>
379
                                    <li>URI: [% i.uri | html %]</li>
380
                                    <li>Account email: [% interface.account_email | html %]</li>
380
                                [% END %]
381
                                    <li>Notes : [% interface.notes | html %]</li>
381
                                [% IF i.login %]
382
                                </li>
382
                                    <li>Login: [% i.login | html %]</li>
383
                                [% END %]
384
                                [% IF i.password %]
385
                                    <li>Password: <span class="password"><a href="#" class="show_password" data-plain-text-password="[% i.plain_text_password | html %]">Show</a></span></li>
386
                                [% END %]
387
                                [% IF i.account_email %]
388
                                    <li>Account email: [% i.account_email | html %]</li>
389
                                [% END %]
390
                                [% IF i.notes %]
391
                                    <li>Notes : [% i.notes | html %]</li>
392
                                [% END %]
383
                            </ul>
393
                            </ul>
384
                        </fieldset>
394
                        </fieldset>
385
                    [% END %]
395
                    [% END %]
Lines 539-547 Link Here
539
        }
549
        }
540
550
541
        [% IF vendor %]
551
        [% IF vendor %]
542
        let interfaces = [% To.json(vendor.interfaces.unblessed) | $raw %];
552
            let interfaces = [];
553
            [% FOR i_object IN vendor.interfaces %]
554
                [% SET i = i_object.unblessed %]
555
                [% SET i.password = i_object.plain_text_password %]
556
                interfaces.push([% To.json(i) | $raw %]);
557
            [% END %]
543
        [% ELSE %]
558
        [% ELSE %]
544
        let interfaces = [];
559
            let interfaces = [];
545
        [% END %]
560
        [% END %]
546
        function serialize_interface_form(){
561
        function serialize_interface_form(){
547
            interfaces = [];
562
            interfaces = [];
Lines 646-651 Link Here
646
                $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
661
                $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
647
            });
662
            });
648
663
664
            $('body').on('click', '.show_password', null, function(e){
665
                e.preventDefault();
666
                $(this).parent().replaceWith($(this).data('plain-text-password'));
667
            });
649
            refresh_aliases();
668
            refresh_aliases();
650
            refresh_interfaces();
669
            refresh_interfaces();
651
670
652
- 

Return to bug 33104