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

(-)a/acqui/supplier.pl (-118 lines)
Lines 1-118 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2000-2002 Katipo Communications
4
# Copyright 2008-2009 BibLibre SARL
5
# Copyright 2010 PTFS Europe Ltd
6
#
7
# This file is part of Koha.
8
#
9
# Koha is free software; you can redistribute it and/or modify it
10
# under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 3 of the License, or
12
# (at your option) any later version.
13
#
14
# Koha is distributed in the hope that it will be useful, but
15
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
22
=head1 NAME
23
24
supplier.pl
25
26
=head1 DESCRIPTION
27
28
this script shows the details for a bookseller given on input arg.
29
It allows to edit & save information about this bookseller.
30
31
=head1 CGI PARAMETERS
32
33
=over 4
34
35
=item booksellerid
36
37
To know the bookseller this script has to display details.
38
39
=back
40
41
=cut
42
43
use Modern::Perl;
44
use C4::Auth     qw( get_template_and_user );
45
use C4::Contract qw( GetContracts GetContract );
46
use C4::Output   qw( output_html_with_http_headers );
47
use CGI          qw ( -utf8 );
48
49
use C4::Budgets;
50
51
use Koha::Acquisition::Bookseller::Contacts;
52
use Koha::Acquisition::Booksellers;
53
use Koha::Acquisition::Currencies;
54
55
my $query = CGI->new;
56
my $op    = $query->param('op') || 'display';
57
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
58
    {
59
        template_name => 'acqui/supplier.tt',
60
        query         => $query,
61
        type          => 'intranet',
62
        flagsrequired => { acquisition => '*' },
63
    }
64
);
65
my $booksellerid = $query->param('booksellerid');
66
my $supplier;
67
if ($booksellerid) {
68
    $supplier = Koha::Acquisition::Booksellers->find($booksellerid);
69
    my $supplier_hashref = $supplier->unblessed;
70
    foreach ( keys %{$supplier_hashref} ) {
71
        $template->{'VARS'}->{$_} = $supplier->$_;
72
    }
73
    $template->{VARS}->{contacts}         = $supplier->contacts if $supplier->contacts->count;
74
    $template->{'VARS'}->{'booksellerid'} = $booksellerid;
75
}
76
77
$template->{VARS}->{contacts} ||= Koha::Acquisition::Bookseller::Contact->new;
78
79
if ( $op eq 'display' ) {
80
    my $contracts = GetContracts( { booksellerid => $booksellerid } );
81
82
    $template->param(
83
        active            => $supplier->active,
84
        tax_rate          => $supplier->tax_rate + 0.0,
85
        invoiceprice      => $supplier->invoiceprice,
86
        listprice         => $supplier->listprice,
87
        basketcount       => $supplier->baskets->count,
88
        subscriptioncount => $supplier->subscriptions->count,
89
        vendor            => $supplier,
90
        contracts         => $contracts,
91
    );
92
} elsif ( $op eq 'cud-delete' ) {
93
94
    # no further message needed for the user
95
    # the DELETE button only appears in the template if basketcount == 0 AND subscriptioncount == 0
96
    if ( $supplier->baskets->count == 0 && $supplier->subscriptions->count == 0 ) {
97
        Koha::Acquisition::Booksellers->find($booksellerid)->delete;
98
    }
99
    print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
100
    exit;
101
} else {
102
103
    # get option values from TaxRates syspref
104
    my @gst_values = map { option => $_ + 0.0 }, split( '\|', C4::Context->preference("TaxRates") );
105
106
    $template->param(
107
108
        # set active ON by default for supplier add (id empty for add)
109
        active     => $supplier ? $supplier->active         : 1,
110
        tax_rate   => $supplier ? $supplier->tax_rate + 0.0 : 0,
111
        vendor     => $supplier,
112
        gst_values => \@gst_values,
113
        currencies => Koha::Acquisition::Currencies->search,
114
        enter      => 1,
115
    );
116
}
117
118
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/acqui/updatesupplier.pl (-163 lines)
Lines 1-163 Link Here
1
#!/usr/bin/perl
2
3
#script to show suppliers and orders
4
#written by chris@katipo.co.nz 23/2/2000
5
6
# Copyright 2000-2002 Katipo Communications
7
# Copyright 2008-2009 BibLibre SARL
8
#
9
# This file is part of Koha.
10
#
11
# Koha is free software; you can redistribute it and/or modify it
12
# under the terms of the GNU General Public License as published by
13
# the Free Software Foundation; either version 3 of the License, or
14
# (at your option) any later version.
15
#
16
# Koha is distributed in the hope that it will be useful, but
17
# WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
20
#
21
# You should have received a copy of the GNU General Public License
22
# along with Koha; if not, see <http://www.gnu.org/licenses>.
23
24
=head1 NAME
25
26
updatesupplier.pl
27
28
=head1 DESCRIPTION
29
30
this script allow to update or create (if id == 0)
31
a supplier. This script is called from acqui/supplier.pl.
32
33
=head1 CGI PARAMETERS
34
35
All informations regarding this supplier are listed on input parameter.
36
Here is the list :
37
38
supplier, id, company, company_postal, physical, company_phone,
39
physical, company_phone, company_fax, website, company_email, notes,
40
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
41
discount, tax_rate, contact_name, contact_position, contact_phone,
42
contact_altphone, contact_fax, contact_email, contact_notes,
43
contact_claimacquisition, contact_claimissues, contact_acqprimary,
44
contact_serialsprimary.
45
46
=cut
47
48
use Modern::Perl;
49
use List::MoreUtils qw( any );
50
use C4::Context;
51
use C4::Auth qw( checkauth );
52
53
use C4::Output;
54
55
use Koha::Acquisition::Bookseller::Contacts;
56
use Koha::Acquisition::Booksellers;
57
use CGI qw ( -utf8 );
58
59
my $input = CGI->new;
60
61
checkauth( $input, 0, { acquisition => 'vendors_manage' }, 'intranet' );
62
63
my $op = $input->param('op') // q{};
64
65
my $booksellerid = $input->param('booksellerid');
66
67
my $address   = $input->param('physical');
68
my @addresses = split( '\n', $address );
69
70
my %data;
71
$data{'id'} = $booksellerid;
72
73
$data{'name'}          = $input->param('company');
74
$data{'postal'}        = $input->param('company_postal');
75
$data{'address1'}      = $addresses[0];
76
$data{'address2'}      = $addresses[1];
77
$data{'address3'}      = $addresses[2];
78
$data{'address4'}      = $addresses[3];
79
$data{'phone'}         = $input->param('company_phone');
80
$data{'accountnumber'} = $input->param('accountnumber');
81
$data{'type'}          = $input->param('vendor_type');
82
$data{'fax'}           = $input->param('company_fax');
83
$data{'url'}           = $input->param('website');
84
$data{'notes'}         = $input->param('notes');
85
$data{'active'}        = $input->param('status');
86
$data{'listprice'}     = $input->param('list_currency');
87
$data{'invoiceprice'}  = $input->param('invoice_currency');
88
$data{'gstreg'}        = $input->param('gst');
89
$data{'listincgst'}    = $input->param('list_gst');
90
$data{'invoiceincgst'} = $input->param('invoice_gst');
91
$data{'tax_rate'}      = $input->param('tax_rate');          #have to transform this into fraction so it's easier to use
92
$data{'discount'}      = $input->param('discount');
93
$data{deliverytime}    = $input->param('deliverytime');
94
$data{'active'}        = $input->param('status');
95
96
my @aliases = $input->multi_param('alias');
97
my @contacts;
98
my %contact_info;
99
100
foreach (
101
    qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary)
102
    )
103
{
104
    $contact_info{$_} = [ $input->multi_param( 'contact_' . $_ ) ];
105
}
106
107
for my $cnt ( 0 .. scalar( @{ $contact_info{'id'} } ) ) {
108
    my %contact;
109
    my $real_contact;
110
    foreach (
111
        qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary)
112
        )
113
    {
114
        $contact{$_} = $contact_info{$_}->[$cnt];
115
        $real_contact = 1 if $contact{$_};
116
    }
117
    push @contacts, \%contact if $real_contact;
118
}
119
120
if ( $op eq 'cud-add' ) {
121
    my $bookseller;
122
    if ( $data{id} ) {
123
124
        # Update
125
        $bookseller = Koha::Acquisition::Booksellers->find( $data{id} )->set( \%data )->store;
126
127
        # Delete existing contacts
128
        $bookseller->contacts->delete;
129
    } else {
130
131
        # Insert
132
        delete $data{id};    # Remove the key if exists
133
        $bookseller = Koha::Acquisition::Bookseller->new( \%data )->store;
134
        $data{id} = $bookseller->id;
135
    }
136
137
    # Insert contacts
138
    for my $contact (@contacts) {
139
        $contact->{booksellerid} = $data{id};
140
        Koha::Acquisition::Bookseller::Contact->new($contact)->store;
141
    }
142
143
    # Insert aliases
144
    $bookseller->aliases( [ map { { alias => $_ } } @aliases ] );
145
146
    # Insert interfaces
147
    my @interface_counters = $input->multi_param('interface_counter');
148
    my @interfaces;
149
    for my $counter (@interface_counters) {
150
        my $interface = {};
151
        for my $attr (qw(name type uri login password account_email notes)) {
152
            my $v = $input->param("interface_${attr}_${counter}");
153
            $interface->{$attr} = $v;
154
        }
155
        push @interfaces, $interface if any { defined && length } values %$interface;
156
    }
157
    $bookseller->interfaces( \@interfaces );
158
159
    #redirect to booksellers.pl
160
    print $input->redirect( "booksellers.pl?booksellerid=" . $data{id} );
161
} else {
162
    print $input->redirect("supplier.pl?op=enter");    # fail silently.
163
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-2 / +2 lines)
Lines 280-286 Link Here
280
                                [% END %]
280
                                [% END %]
281
                            </ul>
281
                            </ul>
282
                        </div>
282
                        </div>
283
                        <a href="booksellers.pl">Go back to vendor page</a>
283
                        <a href="/cgi-bin/koha/vendors">Go back to vendor page</a>
284
                    [% ELSE %]
284
                    [% ELSE %]
285
                        <a href="/cgi-bin/koha/vendors/[% booksellerid | uri %]" class="btn btn-default btn-sm">Show baskets for vendor [% booksellername | html %]</a>
285
                        <a href="/cgi-bin/koha/vendors/[% booksellerid | uri %]" class="btn btn-default btn-sm">Show baskets for vendor [% booksellername | html %]</a>
286
                        <a href="/cgi-bin/koha/vendors" class="btn btn-default btn-sm">Show all active baskets</a>
286
                        <a href="/cgi-bin/koha/vendors" class="btn btn-default btn-sm">Show all active baskets</a>
Lines 304-310 Link Here
304
                        </div>
304
                        </div>
305
                    [% END # /FOR m %]
305
                    [% END # /FOR m %]
306
306
307
                    <h1>[% UNLESS ( basketno ) %]New[% END %]Basket [% basketname | html %] ([% basketno | html %]) for <a href="supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
307
                    <h1>[% UNLESS ( basketno ) %]New[% END %]Basket [% basketname | html %] ([% basketno | html %]) for <a href="cgi-bin/koha/vendors/[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
308
308
309
                    [% IF ( basketno ) %]
309
                    [% IF ( basketno ) %]
310
                        <div id="acqui_basket_summary" class="row">
310
                        <div id="acqui_basket_summary" class="row">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt (-1 / +1 lines)
Lines 80-86 Link Here
80
                        [% SET h2_class="inactive" %]
80
                        [% SET h2_class="inactive" %]
81
                    [% END %]
81
                    [% END %]
82
                    <h2 class="suppliername [% h2_class | html %]">
82
                    <h2 class="suppliername [% h2_class | html %]">
83
                        <a id="vendor[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">
83
                        <a id="vendor[% supplier.booksellerid | html %]" href="/cgi-bin/koha/vendors/[% supplier.booksellerid | uri %]">
84
                            [% IF (supplier.name) %]
84
                            [% IF (supplier.name) %]
85
                                [% supplier.name | html %]
85
                                [% supplier.name | html %]
86
                            [% ELSE %]
86
                            [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt (-738 lines)
Lines 1-738 Link Here
1
[% USE raw %]
2
[% USE Koha %]
3
[% USE To %]
4
[% USE Asset %]
5
[% USE KohaDates %]
6
[% USE AuthorisedValues %]
7
[% PROCESS 'i18n.inc' %]
8
[% BLOCK edit_contact %]
9
    <ol id="contact-form">
10
        <input type="hidden" name="contact_id" value="[% contact.id | html %]" />
11
        <li><label for="contact_name[% contact.id | html %]">Contact name: </label> <input type="text" size="40" id="contact_name[% contact.id | html %]" name="contact_name" value="[% contact.name | html %]" /></li>
12
        <li><label for="contact_position[% contact.id | html %]">Position: </label> <input type="text" size="40" id="contact_position[% contact.id | html %]" name="contact_position" value="[% contact.position | html %]" /></li>
13
        <li><label for="contact_phone[% contact.id | html %]">Phone: </label> <input type="tel" size="20" id="contact_phone[% contact.id | html %]" name="contact_phone" value="[% contact.phone | html %]" /> </li>
14
        <li><label for="contact_altphone[% contact.id | html %]">Alternative phone: </label> <input type="tel" size="20" id="contact_altphone[% contact.id | html %]" name="contact_altphone" value="[% contact.altphone | html %]" /></li>
15
        <li><label for="contact_fax[% contact.id | html %]">Fax: </label> <input type="tel" size="20" id="contact_fax[% contact.id | html %]" name="contact_fax" value="[% contact.fax | html %]" /></li>
16
        <li><label for="contact_email[% contact.id | html %]">Email: </label> <input type="email" size="40" id="contact_email[% contact.id | html %]" name="contact_email" value="[% contact.email | html %]" class="email" /></li>
17
        <li><label for="contact_notes[% contact.id | html %]">Notes: </label> <textarea id="contact_notes[% contact.id | html %]" name="contact_notes" cols="40" rows="4">[% contact.notes | html %]</textarea></li>
18
    </ol>
19
    <div style="display:flex">
20
        <div>
21
            <fieldset class="rows">
22
                <legend>Acquisitions options</legend>
23
                <ol class="radio">
24
                    <li>
25
                        <label>
26
                            [% IF contact.acqprimary %]
27
                                <input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" checked="checked" />
28
                            [% ELSE %]
29
                                <input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" />
30
                            [% END %]
31
                            <input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary | html %]" />
32
                            Primary acquisitions contact
33
                        </label>
34
                    </li>
35
                    <li>
36
                        <label>
37
                            [% IF contact.orderacquisition %]
38
                                <input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" checked="checked" />
39
                            [% ELSE %]
40
                                <input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" />
41
                            [% END %]
42
                            <input type="hidden" class="contact_orderacquisition_hidden" name="contact_orderacquisition" value="[% contact.orderacquisition | html %]" />
43
                            Contact when ordering
44
                        </label>
45
                    </li>
46
                    <li>
47
                        <label>
48
                            [% IF contact.claimacquisition %]
49
                                <input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" checked="checked" />
50
                            [% ELSE %]
51
                                <input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" />
52
                            [% END %]
53
                            <input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition | html %]" />
54
                            Contact about late orders
55
                        </label>
56
                    </li>
57
                </ol>
58
            </fieldset>
59
        </div>
60
        <div>
61
            <fieldset class="rows">
62
                <legend>Serials options</legend>
63
                <ol class="radio">
64
                    <li>
65
                        <label>
66
                            [% IF contact.serialsprimary %]
67
                                <input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" checked="checked" />
68
                            [% ELSE %]
69
                                <input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" />
70
                            [% END %]
71
                            <input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary | html %]" />
72
                            Primary serials contact
73
                        </label>
74
                    </li>
75
                    <li>
76
                        <label>
77
                            [% IF contact.claimissues %]
78
                                <input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" checked="checked" />
79
                            [% ELSE %]
80
                                <input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" />
81
                            [% END %]
82
                            <input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues | html %]" />
83
                            Contact about late issues
84
                        </label>
85
                    </li>
86
                </ol>
87
            </fieldset>
88
        </div>
89
    </div>
90
91
    [% IF contact.id %]
92
        <ol
93
            ><li
94
                ><button class="btn btn-default delete-contact"><i class="fa fa-trash-can"></i> Delete contact</button></li
95
            ></ol
96
        >
97
    [% END %]
98
[% END %]
99
100
[% BLOCK show_contact %]
101
    <h3>[% contact.name | html %]</h3>
102
    <ol>
103
        <li><span class="label">Position: </span>[% contact.position | html %]</li>
104
        <li><span class="label">Phone: </span>[% contact.phone | html %]</li>
105
        <li><span class="label">Alternative phone: </span>[% contact.altphone | html %]</li>
106
        <li><span class="label">Fax: </span>[% contact.fax | html %]</li>
107
        [% IF ( contact.email ) %]
108
            <li><span class="label">Email: </span><a href="mailto:[% contact.email | uri %]">[% contact.email | html %]</a></li>
109
        [% END %]
110
        [% IF ( contact.notes ) %]
111
            <li><span class="label">Notes: </span>[% contact.notes | html %]</li>
112
        [% END %]
113
        [% IF ( contact.acqprimary || contact.orderacquisition || contact.claimacquisition ) %]
114
            <li>
115
                <span class="label">Acquisitions options:</span>
116
                <ol>
117
                    [% IF ( contact.acqprimary ) %]
118
                        <li><span class="label"></span> <i class="fa fa-check"></i> Primary acquisitions contact</li>
119
                    [% END %]
120
                    [% IF ( contact.orderacquisition ) %]
121
                        <li><span class="label"></span> <i class="fa fa-check"></i> Receives orders</li>
122
                    [% END %]
123
                    [% IF ( contact.claimacquisition ) %]
124
                        <li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late orders</li>
125
                    [% END %]
126
                </ol>
127
            </li>
128
        [% END %]
129
        [% IF ( contact.serialsprimary || contact.claimissues ) %]
130
            <li>
131
                <span class="label">Serials options:</span>
132
                <ol>
133
                    [% IF ( contact.serialsprimary ) %]
134
                        <li><span class="label"></span> <i class="fa fa-check"></i> Primary serials contact</li>
135
                    [% END %]
136
                    [% IF ( contact.claimissues ) %]
137
                        <li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late issues</li>
138
                    [% END %]
139
                </ol>
140
            </li>
141
        [% END %]
142
    </ol>
143
[% END %]
144
145
[% SET footerjs = 1 %]
146
[% INCLUDE 'doc-head-open.inc' %]
147
<title
148
    >[% FILTER collapse %]
149
        [% IF ( enter ) %]
150
            [% IF ( booksellerid ) %]
151
                [% tx("Modify vendor '{vendor}'", { vendor = name }) | html %]
152
            [% ELSE %]
153
                [% t("Add vendor") | html %]
154
            [% END %]
155
        [% ELSE %]
156
            [% tx("Vendor '{vendor}'", { vendor = name }) | html %]
157
        [% END %]
158
        &rsaquo; [% t("Acquisitions") | html %] &rsaquo; [% t("Koha") | html %]
159
    [% END %]</title
160
>
161
[% INCLUDE 'doc-head-close.inc' %]
162
</head>
163
164
<body id="acq_supplier" class="acq">
165
[% WRAPPER 'header.inc' %]
166
    [% INCLUDE 'acquisitions-search.inc' %]
167
[% END %]
168
169
[% WRAPPER 'sub-header.inc' %]
170
    [% WRAPPER breadcrumbs %]
171
        [% WRAPPER breadcrumb_item %]
172
            <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
173
        [% END %]
174
        [% IF ( enter ) %]
175
            [% IF ( booksellerid ) %]
176
                [% WRAPPER breadcrumb_item %]
177
                    <a href="/cgi-bin/koha/vendors/[% booksellerid | uri %]">[% name | html %]</a>
178
                [% END %]
179
                [% WRAPPER breadcrumb_item bc_active= 1 %]
180
                    [% tx("Modify vendor '{vendor}'", { vendor = name }) | html %]
181
                [% END %]
182
            [% ELSE %]
183
                [% WRAPPER breadcrumb_item bc_active= 1 %]
184
                    <span>Add vendor</span>
185
                [% END %]
186
            [% END %]
187
        [% ELSE %]
188
            [% WRAPPER breadcrumb_item bc_active= 1 %]
189
                [% name | html %]
190
            [% END %]
191
        [% END # /IF (enter) %]
192
    [% END #/ WRAPPER breadcrumbs %]
193
[% END #/ WRAPPER sub-header.inc %]
194
195
[% WRAPPER 'main-container.inc' aside='vendor-menu' %]
196
197
    [% IF ( enter ) %]
198
        [% INCLUDE 'messages.inc' %]
199
        [% IF ( booksellerid ) %]
200
            <h1>Modify vendor '[% name | html %]'</h1>
201
        [% ELSE %]
202
            <h1>Add vendor</h1>
203
        [% END %]
204
    [% END %]
205
    [% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %]
206
    [% IF ( enter ) %]
207
        <form action="updatesupplier.pl" name="updatesupplier" class="validated" method="post">
208
            <input type="hidden" name="op" value="cud-add" />
209
            [% INCLUDE 'csrf-token.inc' %]
210
            <div id="toolbar" class="btn-toolbar sticky">
211
                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
212
                [% IF ( booksellerid ) %]
213
                    <a class="btn btn-default cancel" href="/cgi-bin/koha/vendors/[% booksellerid | html %]"> </a>
214
                [% ELSE %]
215
                    [% SET a_href = '/cgi-bin/koha/acqui/acqui-home.pl' %]
216
                [% END %]
217
                <a class="btn btn-default cancel" href="[% a_href | url %]"><i class="fa fa-times"></i> Cancel</a>
218
            </div>
219
220
            <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
221
            <fieldset class="rows">
222
                <legend>Company details</legend>
223
                <ol
224
                    ><li
225
                        ><label for="company" class="required">Name:</label> <input type="text" size="40" id="company" name="company" value="[% name | html %]" required="required" class="required focus" /><span class="required"
226
                            >Required</span
227
                        ></li
228
                    >
229
                    <li><label for="company_postal">Postal address: </label> <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal | html %]</textarea></li>
230
                    <li><label for="physical">Physical address: </label> <textarea id="physical" name="physical" cols="40" rows="3">[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</textarea></li>
231
                    <li><label for="company_phone">Phone: </label> <input type="tel" size="20" id="company_phone" name="company_phone" value="[% phone | html %]" /></li>
232
                    <li><label for="company_fax">Fax: </label> <input type="tel" size="20" id="company_fax" name="company_fax" value="[% fax | html %]" /></li>
233
                    <li><label for="website">Website: </label> <input type="url" size="40" id="website" name="website" value="[% url | html %]" class="url" /></li>
234
                    <li><label for="accountnumber">Account number: </label> <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber | html %]" /></li>
235
                    <li>
236
                        <label for="vendor_type">Vendor type: </label>
237
                        [% PROCESS 'av-build-dropbox.inc' name="vendor_type", category="VENDOR_TYPE", default=type, empty=1, size = 20 %]
238
                    </li>
239
                    <li>
240
                        <label for="aliases">Aliases: </label>
241
                        <div id="aliases" style="padding-left: 11rem;"></div>
242
                    </li>
243
                </ol>
244
            </fieldset>
245
            <fieldset class="rows">
246
                <legend>Contacts</legend>
247
                <fieldset id="contact-template" class="supplier-contact">
248
                    <legend>Contact details</legend>
249
                    [% INCLUDE edit_contact %]
250
                </fieldset>
251
                [% FOREACH contact IN contacts %]
252
                    <fieldset class="supplier-contact">
253
                        <legend>Contact details</legend>
254
                        [% INCLUDE edit_contact %]
255
                    </fieldset>
256
                [% END %]
257
                <button id="add-contact" class="btn btn-default"><i class="fa fa-plus"></i> Add another contact</button>
258
            </fieldset>
259
260
            <fieldset class="rows">
261
                <legend>Interfaces</legend>
262
                <div id="interfaces"></div>
263
            </fieldset>
264
265
            <fieldset class="rows">
266
                <legend>Ordering information</legend>
267
                <ol
268
                    ><li
269
                        ><label for="activestatus">Vendor is:</label> [% IF ( active ) %]
270
                            <input type="radio" id="activestatus" name="status" value="1" checked="checked" />
271
                            <label class="radio" for="activestatus">Active</label>
272
                            <input type="radio" id="inactivestatus" name="status" value="0" />
273
                            <label class="radio" for="inactivestatus">Inactive</label>
274
                        [% ELSE %]
275
                            <input type="radio" id="activestatus" name="status" value="1" />
276
                            <label class="radio" for="activestatus">Active</label>
277
                            <input type="radio" id="inactivestatus" name="status" value="0" checked="checked" />
278
                            <label class="radio" for="inactivestatus">Inactive</label>
279
                        [% END %]</li
280
                    >
281
                    <li
282
                        ><label for="list_currency">List prices are: </label>
283
                        <select name="list_currency" id="list_currency">
284
                            [% FOREACH c IN currencies %]
285
                                [% IF booksellerid and c.currency == listprice or not booksellerid and c.active %]
286
                                    <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
287
                                [% ELSIF not c.archived %]
288
                                    <option value="[% c.currency | html %]">[% c.currency | html %]</option>
289
                                [% END %]
290
                            [% END %]
291
                        </select>
292
                    </li>
293
                    <li
294
                        ><label for="invoice_currency">Invoice prices are: </label>
295
                        <select name="invoice_currency" id="invoice_currency">
296
                            [% FOREACH c IN currencies %]
297
                                [% IF booksellerid and c.currency == invoiceprice or not booksellerid and c.active %]
298
                                    <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
299
                                [% ELSIF not c.archived %]
300
                                    <option value="[% c.currency | html %]">[% c.currency | html %]</option>
301
                                [% END %]
302
                            [% END %]
303
                        </select>
304
                    </li>
305
                    <li
306
                        ><label for="gstyes">Tax number registered:</label> [% IF ( gstreg ) %]
307
                            <label class="radio" for="gstyes">Yes</label>
308
                            <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
309
                            <label class="radio" for="gstno">No</label>
310
                            <input type="radio" name="gst" id="gstno" value="0" />
311
                        [% ELSE %]
312
                            <label class="radio" for="gstyes">Yes</label>
313
                            <input type="radio" name="gst" id="gstyes" value="1" />
314
                            <label class="radio" for="gstno">No</label>
315
                            <input type="radio" name="gst" id="gstno" value="0" checked="checked" />
316
                        [% END %]</li
317
                    >
318
319
                    <li
320
                        ><label for="list_gstyes">List prices:</label> [% IF ( listincgst ) %]
321
                            <label class="radio" for="list_gstyes">Include tax</label>
322
                            <input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
323
                            <label class="radio" for="list_gstno">Don't include tax</label>
324
                            <input type="radio" id="list_gstno" name="list_gst" value="0" />
325
                        [% ELSE %]
326
                            <label class="radio" for="list_gstyes">Include tax</label>
327
                            <input type="radio" id="list_gstyes" name="list_gst" value="1" />
328
                            <label class="radio" for="list_gstno">Don't include tax</label>
329
                            <input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
330
                        [% END %]</li
331
                    >
332
333
                    <li
334
                        ><label for="invoice_gstyes">Invoice prices:</label> [% IF ( invoiceincgst ) %]
335
                            <label class="radio" for="invoice_gstyes">Include tax</label>
336
                            <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
337
                            <label class="radio" for="invoice_gstno">Don't include tax</label>
338
                            <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
339
                        [% ELSE %]
340
                            <label class="radio" for="invoice_gstyes">Include tax</label>
341
                            <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
342
                            <label class="radio" for="invoice_gstno">Don't include tax</label>
343
                            <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
344
                        [% END %]</li
345
                    >
346
347
                    [% IF gst_values %]
348
                        <li>
349
                            <label for="tax_rate">Tax rate: </label>
350
                            <select name="tax_rate" id="tax_rate">
351
                                [% FOREACH gst IN gst_values %]
352
                                    [% IF ( tax_rate == gst.option ) %]
353
                                        <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %] %</option>
354
                                    [% ELSE %]
355
                                        <option value="[% gst.option | html %]">[% gst.option * 100 | html %] %</option>
356
                                    [% END %]
357
                                [% END %]
358
                            </select>
359
                        </li>
360
                    [% ELSE %]
361
                        <input type="hidden" name="tax_rate" value="0" />
362
                    [% END %]
363
                    <li><label for="discount">Discount: </label> <input class="rate" type="text" size="6" id="discount" name="discount" value="[% discount | html %]" />%</li>
364
                    <li>
365
                        <label for="deliverytime">Delivery time: </label>
366
                        <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime | html %]" /> days
367
                    </li>
368
                    <li><label for="notes">Notes: </label> <textarea cols="40" rows="4" id="notes" name="notes">[% notes | html %]</textarea></li>
369
                </ol>
370
            </fieldset>
371
        </form>
372
    [% ELSE %]
373
        <h1>[% name | html %]</h1>
374
        <div class="row">
375
            <div class="col">
376
                <div id="supplier-company-details" class="page-section rows">
377
                    <h2>Vendor details</h2>
378
                    <ol>
379
                        <li>
380
                            <span class="label">Type: </span>
381
                            [% IF (type) %][% AuthorisedValues.GetByCode( 'VENDOR_TYPE', type ) | html %][% END %]
382
                        </li>
383
                        <li><span class="label">Company name: </span>[% name | html %]</li>
384
                        <li><span class="label">Postal address: </span>[% postal | html %]</li>
385
                        <li><span class="label">Physical address: </span>[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</li>
386
                        <li><span class="label">Phone: </span>[% phone | html %]</li>
387
                        <li><span class="label">Fax: </span>[% fax | html %]</li>
388
                        [% IF ( url ) %]
389
                            <li><span class="label">Website: </span><a href="[% url | url %]" target="_blank">[% url | html %]</a></li>
390
                        [% END %]
391
                        [% IF ( accountnumber ) %]
392
                            <li><span class="label">Account number: </span>[% accountnumber | html %]</li>
393
                        [% END %]
394
                        [% IF vendor.aliases.count %]
395
                            <li>
396
                                <span class="label">Aliases: </span>
397
                                <ul>
398
                                    [% FOR alias IN vendor.aliases %]
399
                                        <li>[% alias.alias | html %]</li>
400
                                    [% END %]
401
                                </ul>
402
                            </li>
403
                        [% END %]
404
                    </ol>
405
                </div>
406
                <!-- /#supplier-company-details -->
407
408
                <div id="supplier-ordering-information" class="page-section rows">
409
                    <h2>Ordering information</h2>
410
                    <li><span class="label">Vendor is: </span>[% IF ( active ) %]Active[% ELSE %]Inactive[% END %]</li>
411
                    <li><span class="label">List prices are: </span>[% listprice | html %]</li>
412
                    <li><span class="label">Invoice prices are: </span>[% invoiceprice | html %]</li>
413
                    [% IF ( tax_rate ) %]
414
                        <li><span class="label">Tax number registered: </span>[% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</li>
415
                        <li><span class="label">List item price includes tax: </span>[% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</li>
416
                        <li><span class="label">Invoice item price includes tax: </span>[% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</li>
417
                    [% END %]
418
                    <li><span class="label">Discount: </span>[% ( discount || 0 ) | format("%.1f" ) %] %</li>
419
                    <li><span class="label">Tax rate: </span>[% ( tax_rate || 0 ) * 100 | html %] %</li>
420
                    [% IF deliverytime.defined %]
421
                        <li><span class="label">Delivery time: </span>[% deliverytime | html %] days</li>
422
                    [% END %]
423
                    [% IF ( notes ) %]
424
                        <li><span class="label">Notes: </span>[% notes | html %]</li>
425
                    [% END %]
426
                </div>
427
                <!-- #supplier-ordering-information -->
428
429
                [% IF vendor.interfaces.count %]
430
                    <div id="supplier-interfaces" class="page-section rows">
431
                        <h2>Interfaces</h2>
432
433
                        [% FOR i IN vendor.interfaces %]
434
                            <h3>[% i.name | html %]</h3>
435
                            [% IF i.type %]
436
                                <li><span class="label">Type: </span>[% AuthorisedValues.GetByCode( 'VENDOR_INTERFACE_TYPE', i.type) | html %]</li>
437
                            [% END %]
438
                            [% IF i.uri %]
439
                                <li> <span class="label">URI: </span><a href="[% i.uri | url %]" target="_blank">[% i.uri | html %]</a> </li>
440
                            [% END %]
441
                            [% IF i.login %]
442
                                <li><span class="label">Login: </span>[% i.login | html %]</li>
443
                            [% END %]
444
                            [% IF i.password %]
445
                                <li
446
                                    ><span class="label">Password: </span><span class="password"><a href="#" class="show_password" data-plain-text-password="[% i.plain_text_password | html %]">Show</a></span></li
447
                                >
448
                            [% END %]
449
                            [% IF i.account_email %]
450
                                <li><span class="label">Account email: </span>[% i.account_email | html %]</li>
451
                            [% END %]
452
                            [% IF i.notes %]
453
                                <li><span class="label">Notes: </span>[% i.notes | html %]</li>
454
                            [% END %]
455
                        [% END %]
456
                    </div>
457
                [% END %]
458
            </div>
459
            <!-- /.col -->
460
461
            <div class="col">
462
                <div id="supplier-contact-details" class="page-section rows">
463
                    <h2>Contact</h2>
464
                    [% FOREACH contact IN contacts %]
465
                        [% INCLUDE show_contact %]
466
                    [% END %]
467
                </div>
468
                <!-- /#supplier-contact-details -->
469
470
                <div id="subscription-details" class="page-section">
471
                    <h2>Subscription details</h2>
472
                    <p
473
                        ><strong>Number of subscriptions: </strong>
474
                        [% IF (  CAN_user_serials ) %]
475
                            <a href="/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=[% name | uri %]&searched=1">[% subscriptioncount | html %]</a>
476
                        [% ELSE %]
477
                            [% subscriptioncount | html %]
478
                        [% END %]
479
                    </p>
480
                </div>
481
                <!-- /#subscription-details -->
482
            </div>
483
            <!-- /.col -->
484
        </div>
485
        <!-- /.row -->
486
487
        [% IF ( contracts ) %]
488
            <div id="supplier-contracts" class="page-section rows">
489
                <h2>Contract(s)</h2>
490
                <table id="contractst">
491
                    <thead>
492
                        <tr>
493
                            <th scope="col">Name</th>
494
                            <th scope="col">Description</th>
495
                            <th scope="col">Start date</th>
496
                            <th scope="col">End date</th>
497
                            [% IF CAN_user_acquisition_contracts_manage %]
498
                                <th scope="col" class="NoSort noExport">Actions</th>
499
                            [% END %]
500
                        </tr>
501
                    </thead>
502
                    <tbody>
503
                        [% FOREACH contract IN contracts %]
504
                            <tr>
505
                                <td>
506
                                    <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber | uri %]&amp;booksellerid=[% contract.booksellerid | uri %]">[% contract.contractname | html %]</a>
507
                                </td>
508
                                <td>[% contract.contractdescription | html %]</td>
509
                                <td data-order="[% contract.contractstartdate | html %]">[% contract.contractstartdate | $KohaDates %]</td>
510
                                <td data-order="[% contract.contractenddate | html %]">[% contract.contractenddate | $KohaDates %]</td>
511
                                [% IF CAN_user_acquisition_contracts_manage %]
512
                                    <td class="actions">
513
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber | html %]&amp;booksellerid=[% contract.booksellerid | html %]"
514
                                            ><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a
515
                                        >
516
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&amp;contractnumber=[% contract.contractnumber | html %]&amp;booksellerid=[% contract.booksellerid | html %]"
517
                                            ><i class="fa fa-trash-can"></i> Delete</a
518
                                        >
519
                                    </td>
520
                                [% END %]
521
                            </tr>
522
                        [% END %]
523
                    </tbody>
524
                </table>
525
            </div>
526
            <!-- /#supplier-contracts -->
527
        [% END %]
528
    [% END %]
529
[% END %]
530
531
[% MACRO jsinclude BLOCK %]
532
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
533
    [% Asset.js("js/acq.js") | $raw %]
534
    [% INCLUDE 'datatables.inc' %]
535
    [% Asset.js("js/vue/dist/islands.js", "init" => "1") | $raw %]
536
    <script>
537
        function add_contact() {
538
            var new_contact = $('#contact-template').clone();
539
            var timestamp = new Date().getTime();
540
            $(new_contact).removeAttr('id');
541
            $('input, textarea', new_contact).each(function () {
542
                $(this).attr('id', $(this).attr('id') + '_' + timestamp);
543
            });
544
            $(new_contact).insertBefore(this);
545
            if ($('.supplier-contact').length === 2) { // First contact
546
                $.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
547
                    $(checkbox, new_contact).click();
548
                });
549
            }
550
            $('input[name="contact_name"]', new_contact).focus();
551
            return false;
552
        }
553
554
        function delete_contact(ev) {
555
            $(this).parents('.supplier-contact').remove();
556
            ev.preventDefault();
557
        }
558
559
        [% IF vendor %]
560
        let aliases = [% To.json(vendor.aliases.unblessed) | $raw %];
561
        [% ELSE %]
562
        let aliases = [];
563
        [% END %]
564
        function remove_alias(i){
565
            aliases.splice(i, 1);
566
            refresh_aliases();
567
        }
568
569
        function encodeHTMLEntities(str){
570
            return str.replace(/[&<>'"]/g,
571
              tag => ({
572
                  '&': '&amp;',
573
                  '<': '&lt;',
574
                  '>': '&gt;',
575
                  "'": '&#39;',
576
                  '"': '&quot;'
577
                }[tag]));
578
        }
579
580
        function add_alias(){
581
            let alias = $("#new_alias").val();
582
            if ( !alias.length > 0 ) { return }
583
            aliases.push({alias});
584
            refresh_aliases();
585
        }
586
        function refresh_aliases(){
587
            let nodes = $("<div></div>");
588
            aliases.forEach((a, i) => {
589
                let alias_str = encodeHTMLEntities(a.alias);
590
                let n = $("<div></div>").append(alias_str);
591
                let input = $('<input type="hidden" name="alias" />');
592
                input.val(a.alias);
593
                n.append(input);
594
                n.append(` <a style="cursor: pointer;" onclick="remove_alias(${i});"><i class="fa fa-trash" aria-hidden="true"></i> ` + _("Remove") + '</a>');
595
                nodes.append(n);
596
            });
597
            nodes.append("<input id='new_alias' type='text' class='noEnterSubmit' />");
598
            nodes.append(' <a style="cursor: pointer;" onclick="add_alias();"><i class="fa fa-plus" aria-hidden="true"></i> ' + _("Add") + '</a>');
599
            $("#aliases").html(nodes.html());
600
        }
601
602
        [% IF vendor %]
603
            let interfaces = [];
604
            [% FOR i_object IN vendor.interfaces %]
605
                [% SET i = i_object.unblessed %]
606
                [% SET i.password = i_object.plain_text_password %]
607
                interfaces.push([% To.json(i) | $raw %]);
608
            [% END %]
609
        [% ELSE %]
610
            let interfaces = [];
611
        [% END %]
612
        function serialize_interface_form(){
613
            interfaces = [];
614
            $("#interfaces > fieldset.supplier-interface > ol.interface-form").each( (index, interface_form )=> {
615
                let interface = {};
616
                $(interface_form).find('input,textarea,select').serializeArray().map(attr => {
617
                    let name = attr.name.replace(/interface_([\w_]+)_\d+/, "$1");
618
                    interface[name] = attr.value
619
                })
620
                interfaces.push(interface);
621
            });
622
            return interfaces;
623
        }
624
        function remove_interface(i){
625
            interfaces = serialize_interface_form();
626
            interfaces.splice(i, 1);
627
            refresh_interfaces();
628
        }
629
        function add_interface(){
630
            interfaces = serialize_interface_form();
631
            interfaces.push({
632
                type: "",
633
                name: "",
634
                uri: "",
635
                login: "",
636
                password: "",
637
                account_email: "",
638
                notes: "",
639
            });
640
            refresh_interfaces();
641
        }
642
        let av_select = {
643
            VENDOR_INTERFACE_TYPE: $("[% PROCESS 'av-build-dropbox.inc', category="VENDOR_INTERFACE_TYPE" empty=1 | replace('\n', '') | replace('"', '\"') %]"),
644
        };
645
        function refresh_interfaces(){
646
            let nodes = $("<div id='interfaces'></div>");
647
            interfaces.forEach((interface, i) => {
648
                let n = $("<fieldset class='supplier-interface'></fieldset>");
649
                n.append("<legend>" + _("Interface details") + "</legend>");
650
                n.append(`<input type="hidden" name="interface_counter" value="${i}" />`);
651
                let ol = $('<ol class="interface-form"></ol>');
652
                let attributes = [
653
                    { label: _("Name:"),          name: 'name',          type: 'text',     node: 'input' },
654
                    { label: _("Type:"),          name: 'type',          type: 'select',   node: 'av_select', av_cat: 'VENDOR_INTERFACE_TYPE' },
655
                    { label: _("URI:"),           name: 'uri',           type: 'url',      node: 'input' },
656
                    { label: _("Login:"),         name: 'login',         type: 'text',     node: 'input' },
657
                    { label: _("Password:"),      name: 'password',      type: 'text',     node: 'input' },
658
                    { label: _("Account email:"), name: 'account_email', type: 'email',    node: 'input' },
659
                    { label: _("Notes:"),         name: 'notes',         type: 'textarea', node: 'textarea' }
660
                ];
661
                attributes.forEach((attribute, ii) => {
662
                    let li = $('<li></li>');
663
                    li.append(`<label for="interface_${attribute.name}_${i}">${attribute.label}</label>`);
664
                    if( attribute.node == 'input' ) {
665
                        li.append(`<input type="${attribute.type}" size="40" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}" value="${interface[attribute.name]}" />`);
666
                    } else if ( attribute.node == 'textarea' ) {
667
                        li.append(`<textarea cols="40" rows="3" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}">${interface[attribute.name]}</textarea>`);
668
                    } else if ( attribute.node == 'av_select' ) {
669
                        let select = av_select[attribute.av_cat].clone();
670
                        select.attr('name', `interface_${attribute.name}_${i}`);
671
                        select.find(`option[value='${interface[attribute.name]}']`).prop("selected", true);
672
                        li.append(select);
673
                    }
674
                    ol.append(li);
675
                });
676
                ol.append(`<li><button class="btn btn-default" onclick="remove_interface(${i});"><i class="fa fa-trash"></i> ` + _("Delete interface") + '</li>');
677
                n.append(ol);
678
                nodes.append(n);
679
            });
680
            nodes.append(`<button onclick="add_interface();" class="btn btn-default"><i class="fa fa-plus"></i> ` + _("Add another interface") + '</button>')
681
            $("#interfaces").replaceWith(nodes);
682
683
            interfaces.forEach((interface, i) => {
684
                $("#interface_account_email_" + i).rules("add", {
685
                    email: true,
686
                });
687
            });
688
        }
689
690
         $(document).ready(function() {
691
            var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
692
                "columnDefs": [
693
                    { "orderable": false, "searchable":  false, "targets": [ 'NoSort' ] }
694
                ],
695
                "dom": 't'
696
            } ) );
697
            $('body').on('click', '.delete-contact', null, delete_contact);
698
            $('#add-contact').click(add_contact);
699
            $('body').on('click', '.contact_acqprimary', null, function () {
700
                if ($(this).is(':checked')) {
701
                    $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
702
                    $('.contact_acqprimary_hidden').each(function () {
703
                        $(this).val('0');
704
                    });
705
                }
706
                $(this).next('.contact_acqprimary_hidden').val('1');
707
            });
708
            $('body').on('click', '.contact_serialsprimary', null, function () {
709
                if ($(this).is(':checked')) {
710
                    $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
711
                    $('.contact_serialsprimary_hidden').each(function () {
712
                        $(this).val('0');
713
                    });
714
                }
715
                $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
716
            });
717
            $('body').on('click', '.contact_orderacquisition', null, function () {
718
                $(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
719
            });
720
            $('body').on('click', '.contact_claimacquisition', null, function () {
721
                $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
722
            });
723
            $('body').on('click', '.contact_claimissues', null, function () {
724
                $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
725
            });
726
727
            $('body').on('click', '.show_password', null, function(e){
728
                e.preventDefault();
729
                $(this).parent().replaceWith($(this).data('plain-text-password'));
730
            });
731
            refresh_aliases();
732
            refresh_interfaces();
733
734
        });
735
    </script>
736
[% END %]
737
738
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt (-2 / +1 lines)
Lines 58-64 Link Here
58
                    [% FOREACH account IN accounts %]
58
                    [% FOREACH account IN accounts %]
59
                        <tr>
59
                        <tr>
60
                            <td>[% account.id | html %]</td>
60
                            <td>[% account.id | html %]</td>
61
                            <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% account.vendor_id | uri %]">[% account.vendor.name | html %]</a></td>
61
                            <td><a href="/cgi-bin/koha/vendors/[% account.vendor_id | uri %]">[% account.vendor.name | html %]</a></td>
62
                            <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% account.budget.budget_period_id | uri %]">[% account.budget.budget_name | html %]</a></td>
62
                            <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% account.budget.budget_period_id | uri %]">[% account.budget.budget_name | html %]</a></td>
63
                            <td>[% account.description | html %]</td>
63
                            <td>[% account.description | html %]</td>
64
                            <td>[% account.download_directory | html %]</td>
64
                            <td>[% account.download_directory | html %]</td>
65
- 

Return to bug 38010