Bug 38010: Delete old code
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
5dc611d037
commit
4a6008150d
|
|
@ -1,118 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2000-2002 Katipo Communications
|
||||
# Copyright 2008-2009 BibLibre SARL
|
||||
# Copyright 2010 PTFS Europe Ltd
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
supplier.pl
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
this script shows the details for a bookseller given on input arg.
|
||||
It allows to edit & save information about this bookseller.
|
||||
|
||||
=head1 CGI PARAMETERS
|
||||
|
||||
=over 4
|
||||
|
||||
=item booksellerid
|
||||
|
||||
To know the bookseller this script has to display details.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
use Modern::Perl;
|
||||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Contract qw( GetContracts GetContract );
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use CGI qw ( -utf8 );
|
||||
|
||||
use C4::Budgets;
|
||||
|
||||
use Koha::Acquisition::Bookseller::Contacts;
|
||||
use Koha::Acquisition::Booksellers;
|
||||
use Koha::Acquisition::Currencies;
|
||||
|
||||
my $query = CGI->new;
|
||||
my $op = $query->param('op') || 'display';
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
{
|
||||
template_name => 'acqui/supplier.tt',
|
||||
query => $query,
|
||||
type => 'intranet',
|
||||
flagsrequired => { acquisition => '*' },
|
||||
}
|
||||
);
|
||||
my $booksellerid = $query->param('booksellerid');
|
||||
my $supplier;
|
||||
if ($booksellerid) {
|
||||
$supplier = Koha::Acquisition::Booksellers->find($booksellerid);
|
||||
my $supplier_hashref = $supplier->unblessed;
|
||||
foreach ( keys %{$supplier_hashref} ) {
|
||||
$template->{'VARS'}->{$_} = $supplier->$_;
|
||||
}
|
||||
$template->{VARS}->{contacts} = $supplier->contacts if $supplier->contacts->count;
|
||||
$template->{'VARS'}->{'booksellerid'} = $booksellerid;
|
||||
}
|
||||
|
||||
$template->{VARS}->{contacts} ||= Koha::Acquisition::Bookseller::Contact->new;
|
||||
|
||||
if ( $op eq 'display' ) {
|
||||
my $contracts = GetContracts( { booksellerid => $booksellerid } );
|
||||
|
||||
$template->param(
|
||||
active => $supplier->active,
|
||||
tax_rate => $supplier->tax_rate + 0.0,
|
||||
invoiceprice => $supplier->invoiceprice,
|
||||
listprice => $supplier->listprice,
|
||||
basketcount => $supplier->baskets->count,
|
||||
subscriptioncount => $supplier->subscriptions->count,
|
||||
vendor => $supplier,
|
||||
contracts => $contracts,
|
||||
);
|
||||
} elsif ( $op eq 'cud-delete' ) {
|
||||
|
||||
# no further message needed for the user
|
||||
# the DELETE button only appears in the template if basketcount == 0 AND subscriptioncount == 0
|
||||
if ( $supplier->baskets->count == 0 && $supplier->subscriptions->count == 0 ) {
|
||||
Koha::Acquisition::Booksellers->find($booksellerid)->delete;
|
||||
}
|
||||
print $query->redirect('/cgi-bin/koha/acqui/acqui-home.pl');
|
||||
exit;
|
||||
} else {
|
||||
|
||||
# get option values from TaxRates syspref
|
||||
my @gst_values = map { option => $_ + 0.0 }, split( '\|', C4::Context->preference("TaxRates") );
|
||||
|
||||
$template->param(
|
||||
|
||||
# set active ON by default for supplier add (id empty for add)
|
||||
active => $supplier ? $supplier->active : 1,
|
||||
tax_rate => $supplier ? $supplier->tax_rate + 0.0 : 0,
|
||||
vendor => $supplier,
|
||||
gst_values => \@gst_values,
|
||||
currencies => Koha::Acquisition::Currencies->search,
|
||||
enter => 1,
|
||||
);
|
||||
}
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#script to show suppliers and orders
|
||||
#written by chris@katipo.co.nz 23/2/2000
|
||||
|
||||
# Copyright 2000-2002 Katipo Communications
|
||||
# Copyright 2008-2009 BibLibre SARL
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
updatesupplier.pl
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
this script allow to update or create (if id == 0)
|
||||
a supplier. This script is called from acqui/supplier.pl.
|
||||
|
||||
=head1 CGI PARAMETERS
|
||||
|
||||
All information regarding this supplier are listed on input parameter.
|
||||
Here is the list :
|
||||
|
||||
supplier, id, company, company_postal, physical, company_phone,
|
||||
physical, company_phone, company_fax, website, company_email, notes,
|
||||
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
|
||||
discount, tax_rate, contact_name, contact_position, contact_phone,
|
||||
contact_altphone, contact_fax, contact_email, contact_notes,
|
||||
contact_claimacquisition, contact_claimissues, contact_acqprimary,
|
||||
contact_serialsprimary.
|
||||
|
||||
=cut
|
||||
|
||||
use Modern::Perl;
|
||||
use List::MoreUtils qw( any );
|
||||
use C4::Context;
|
||||
use C4::Auth qw( checkauth );
|
||||
|
||||
use C4::Output;
|
||||
|
||||
use Koha::Acquisition::Bookseller::Contacts;
|
||||
use Koha::Acquisition::Booksellers;
|
||||
use CGI qw ( -utf8 );
|
||||
|
||||
my $input = CGI->new;
|
||||
|
||||
checkauth( $input, 0, { acquisition => 'vendors_manage' }, 'intranet' );
|
||||
|
||||
my $op = $input->param('op') // q{};
|
||||
|
||||
my $booksellerid = $input->param('booksellerid');
|
||||
|
||||
my $address = $input->param('physical');
|
||||
my @addresses = split( '\n', $address );
|
||||
|
||||
my %data;
|
||||
$data{'id'} = $booksellerid;
|
||||
|
||||
$data{'name'} = $input->param('company');
|
||||
$data{'postal'} = $input->param('company_postal');
|
||||
$data{'address1'} = $addresses[0];
|
||||
$data{'address2'} = $addresses[1];
|
||||
$data{'address3'} = $addresses[2];
|
||||
$data{'address4'} = $addresses[3];
|
||||
$data{'phone'} = $input->param('company_phone');
|
||||
$data{'accountnumber'} = $input->param('accountnumber');
|
||||
$data{'type'} = $input->param('vendor_type');
|
||||
$data{'fax'} = $input->param('company_fax');
|
||||
$data{'url'} = $input->param('website');
|
||||
$data{'notes'} = $input->param('notes');
|
||||
$data{'active'} = $input->param('status');
|
||||
$data{'listprice'} = $input->param('list_currency');
|
||||
$data{'invoiceprice'} = $input->param('invoice_currency');
|
||||
$data{'gstreg'} = $input->param('gst');
|
||||
$data{'listincgst'} = $input->param('list_gst');
|
||||
$data{'invoiceincgst'} = $input->param('invoice_gst');
|
||||
$data{'tax_rate'} = $input->param('tax_rate'); #have to transform this into fraction so it's easier to use
|
||||
$data{'discount'} = $input->param('discount');
|
||||
$data{deliverytime} = $input->param('deliverytime');
|
||||
$data{'active'} = $input->param('status');
|
||||
|
||||
my @aliases = $input->multi_param('alias');
|
||||
my @contacts;
|
||||
my %contact_info;
|
||||
|
||||
foreach (
|
||||
qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary)
|
||||
)
|
||||
{
|
||||
$contact_info{$_} = [ $input->multi_param( 'contact_' . $_ ) ];
|
||||
}
|
||||
|
||||
for my $cnt ( 0 .. scalar( @{ $contact_info{'id'} } ) ) {
|
||||
my %contact;
|
||||
my $real_contact;
|
||||
foreach (
|
||||
qw(id name position phone altphone fax email notes orderacquisition claimacquisition claimissues acqprimary serialsprimary)
|
||||
)
|
||||
{
|
||||
$contact{$_} = $contact_info{$_}->[$cnt];
|
||||
$real_contact = 1 if $contact{$_};
|
||||
}
|
||||
push @contacts, \%contact if $real_contact;
|
||||
}
|
||||
|
||||
if ( $op eq 'cud-add' ) {
|
||||
my $bookseller;
|
||||
if ( $data{id} ) {
|
||||
|
||||
# Update
|
||||
$bookseller = Koha::Acquisition::Booksellers->find( $data{id} )->set( \%data )->store;
|
||||
|
||||
# Delete existing contacts
|
||||
$bookseller->contacts->delete;
|
||||
} else {
|
||||
|
||||
# Insert
|
||||
delete $data{id}; # Remove the key if exists
|
||||
$bookseller = Koha::Acquisition::Bookseller->new( \%data )->store;
|
||||
$data{id} = $bookseller->id;
|
||||
}
|
||||
|
||||
# Insert contacts
|
||||
for my $contact (@contacts) {
|
||||
$contact->{booksellerid} = $data{id};
|
||||
Koha::Acquisition::Bookseller::Contact->new($contact)->store;
|
||||
}
|
||||
|
||||
# Insert aliases
|
||||
$bookseller->aliases( [ map { { alias => $_ } } @aliases ] );
|
||||
|
||||
# Insert interfaces
|
||||
my @interface_counters = $input->multi_param('interface_counter');
|
||||
my @interfaces;
|
||||
for my $counter (@interface_counters) {
|
||||
my $interface = {};
|
||||
for my $attr (qw(name type uri login password account_email notes)) {
|
||||
my $v = $input->param("interface_${attr}_${counter}");
|
||||
$interface->{$attr} = $v;
|
||||
}
|
||||
push @interfaces, $interface if any { defined && length } values %$interface;
|
||||
}
|
||||
$bookseller->interfaces( \@interfaces );
|
||||
|
||||
#redirect to booksellers.pl
|
||||
print $input->redirect( "booksellers.pl?booksellerid=" . $data{id} );
|
||||
} else {
|
||||
print $input->redirect("supplier.pl?op=enter"); # fail silently.
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@
|
|||
[% END %]
|
||||
</ul>
|
||||
</div>
|
||||
<a href="booksellers.pl">Go back to vendor page</a>
|
||||
<a href="/cgi-bin/koha/vendors">Go back to vendor page</a>
|
||||
[% ELSE %]
|
||||
<a href="/cgi-bin/koha/vendors/[% booksellerid | uri %]" class="btn btn-default btn-sm">Show baskets for vendor [% booksellername | html %]</a>
|
||||
<a href="/cgi-bin/koha/vendors" class="btn btn-default btn-sm">Show all active baskets</a>
|
||||
|
|
@ -304,7 +304,7 @@
|
|||
</div>
|
||||
[% END # /FOR m %]
|
||||
|
||||
<h1>[% UNLESS ( basketno ) %]New[% END %]Basket [% basketname | html %] ([% basketno | html %]) for <a href="supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
|
||||
<h1>[% UNLESS ( basketno ) %]New[% END %]Basket [% basketname | html %] ([% basketno | html %]) for <a href="cgi-bin/koha/vendors/[% booksellerid | uri %]">[% booksellername | html %]</a></h1>
|
||||
|
||||
[% IF ( basketno ) %]
|
||||
<div id="acqui_basket_summary" class="row">
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
[% SET h2_class="inactive" %]
|
||||
[% END %]
|
||||
<h2 class="suppliername [% h2_class | html %]">
|
||||
<a id="vendor[% supplier.booksellerid | html %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid | uri %]">
|
||||
<a id="vendor[% supplier.booksellerid | html %]" href="/cgi-bin/koha/vendors/[% supplier.booksellerid | uri %]">
|
||||
[% IF (supplier.name) %]
|
||||
[% supplier.name | html %]
|
||||
[% ELSE %]
|
||||
|
|
|
|||
|
|
@ -1,735 +0,0 @@
|
|||
[% USE raw %]
|
||||
[% USE Koha %]
|
||||
[% USE To %]
|
||||
[% USE Asset %]
|
||||
[% USE KohaDates %]
|
||||
[% USE AuthorisedValues %]
|
||||
[% PROCESS 'i18n.inc' %]
|
||||
[% BLOCK edit_contact %]
|
||||
<ol id="contact-form">
|
||||
<input type="hidden" name="contact_id" value="[% contact.id | html %]" />
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</ol>
|
||||
<div style="display:flex">
|
||||
<div>
|
||||
<fieldset class="rows">
|
||||
<legend>Acquisitions options</legend>
|
||||
<ol class="radio">
|
||||
<li>
|
||||
<label>
|
||||
[% IF contact.acqprimary %]
|
||||
<input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" checked="checked" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" id="contact_acqprimary[% contact.id | html %]" class="contact_acqprimary" />
|
||||
[% END %]
|
||||
<input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary | html %]" />
|
||||
Primary acquisitions contact
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
[% IF contact.orderacquisition %]
|
||||
<input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" checked="checked" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" id="contact_orderacquisition[% contact.id | html %]" class="contact_orderacquisition" />
|
||||
[% END %]
|
||||
<input type="hidden" class="contact_orderacquisition_hidden" name="contact_orderacquisition" value="[% contact.orderacquisition | html %]" />
|
||||
Contact when ordering
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
[% IF contact.claimacquisition %]
|
||||
<input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" checked="checked" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" id="contact_claimacquisition[% contact.id | html %]" class="contact_claimacquisition" />
|
||||
[% END %]
|
||||
<input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition | html %]" />
|
||||
Contact about late orders
|
||||
</label>
|
||||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div>
|
||||
<fieldset class="rows">
|
||||
<legend>Serials options</legend>
|
||||
<ol class="radio">
|
||||
<li>
|
||||
<label>
|
||||
[% IF contact.serialsprimary %]
|
||||
<input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" checked="checked" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" id="contact_serialsprimary[% contact.id | html %]" class="contact_serialsprimary" />
|
||||
[% END %]
|
||||
<input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary | html %]" />
|
||||
Primary serials contact
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
[% IF contact.claimissues %]
|
||||
<input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" checked="checked" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" id="contact_claimissues[% contact.id | html %]" class="contact_claimissues" />
|
||||
[% END %]
|
||||
<input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues | html %]" />
|
||||
Contact about late issues
|
||||
</label>
|
||||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
[% IF contact.id %]
|
||||
<ol
|
||||
><li
|
||||
><button class="btn btn-default delete-contact"><i class="fa fa-trash-can"></i> Delete contact</button></li
|
||||
></ol
|
||||
>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
[% BLOCK show_contact %]
|
||||
<h3>[% contact.name | html %]</h3>
|
||||
<ol>
|
||||
<li><span class="label">Position: </span>[% contact.position | html %]</li>
|
||||
<li><span class="label">Phone: </span>[% contact.phone | html %]</li>
|
||||
<li><span class="label">Alternative phone: </span>[% contact.altphone | html %]</li>
|
||||
<li><span class="label">Fax: </span>[% contact.fax | html %]</li>
|
||||
[% IF ( contact.email ) %]
|
||||
<li><span class="label">Email: </span><a href="mailto:[% contact.email | uri %]">[% contact.email | html %]</a></li>
|
||||
[% END %]
|
||||
[% IF ( contact.notes ) %]
|
||||
<li><span class="label">Notes: </span>[% contact.notes | html %]</li>
|
||||
[% END %]
|
||||
[% IF ( contact.acqprimary || contact.orderacquisition || contact.claimacquisition ) %]
|
||||
<li>
|
||||
<span class="label">Acquisitions options:</span>
|
||||
<ol>
|
||||
[% IF ( contact.acqprimary ) %]
|
||||
<li><span class="label"></span> <i class="fa fa-check"></i> Primary acquisitions contact</li>
|
||||
[% END %]
|
||||
[% IF ( contact.orderacquisition ) %]
|
||||
<li><span class="label"></span> <i class="fa fa-check"></i> Receives orders</li>
|
||||
[% END %]
|
||||
[% IF ( contact.claimacquisition ) %]
|
||||
<li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late orders</li>
|
||||
[% END %]
|
||||
</ol>
|
||||
</li>
|
||||
[% END %]
|
||||
[% IF ( contact.serialsprimary || contact.claimissues ) %]
|
||||
<li>
|
||||
<span class="label">Serials options:</span>
|
||||
<ol>
|
||||
[% IF ( contact.serialsprimary ) %]
|
||||
<li><span class="label"></span> <i class="fa fa-check"></i> Primary serials contact</li>
|
||||
[% END %]
|
||||
[% IF ( contact.claimissues ) %]
|
||||
<li><span class="label"></span> <i class="fa fa-check"></i> Receives claims for late issues</li>
|
||||
[% END %]
|
||||
</ol>
|
||||
</li>
|
||||
[% END %]
|
||||
</ol>
|
||||
[% END %]
|
||||
|
||||
[% SET footerjs = 1 %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title
|
||||
>[% FILTER collapse %]
|
||||
[% IF ( enter ) %]
|
||||
[% IF ( booksellerid ) %]
|
||||
[% tx("Modify vendor '{vendor}'", { vendor = name }) | html %]
|
||||
[% ELSE %]
|
||||
[% t("Add vendor") | html %]
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% tx("Vendor '{vendor}'", { vendor = name }) | html %]
|
||||
[% END %]
|
||||
› [% t("Acquisitions") | html %] › [% t("Koha") | html %]
|
||||
[% END %]</title
|
||||
>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
</head>
|
||||
|
||||
<body id="acq_supplier" class="acq">
|
||||
[% WRAPPER 'header.inc' %]
|
||||
[% INCLUDE 'acquisitions-search.inc' %]
|
||||
[% END %]
|
||||
|
||||
[% WRAPPER 'sub-header.inc' %]
|
||||
[% WRAPPER breadcrumbs %]
|
||||
[% WRAPPER breadcrumb_item %]
|
||||
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
|
||||
[% END %]
|
||||
[% IF ( enter ) %]
|
||||
[% IF ( booksellerid ) %]
|
||||
[% WRAPPER breadcrumb_item %]
|
||||
<a href="/cgi-bin/koha/vendors/[% booksellerid | uri %]">[% name | html %]</a>
|
||||
[% END %]
|
||||
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
||||
[% tx("Modify vendor '{vendor}'", { vendor = name }) | html %]
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
||||
<span>Add vendor</span>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
||||
[% name | html %]
|
||||
[% END %]
|
||||
[% END # /IF (enter) %]
|
||||
[% END #/ WRAPPER breadcrumbs %]
|
||||
[% END #/ WRAPPER sub-header.inc %]
|
||||
|
||||
[% WRAPPER 'main-container.inc' aside='vendor-menu' %]
|
||||
|
||||
[% IF ( enter ) %]
|
||||
[% INCLUDE 'messages.inc' %]
|
||||
[% IF ( booksellerid ) %]
|
||||
<h1>Modify vendor '[% name | html %]'</h1>
|
||||
[% ELSE %]
|
||||
<h1>Add vendor</h1>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %]
|
||||
[% IF ( enter ) %]
|
||||
<form action="updatesupplier.pl" name="updatesupplier" class="validated" method="post">
|
||||
<input type="hidden" name="op" value="cud-add" />
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<div id="toolbar" class="btn-toolbar sticky">
|
||||
<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
|
||||
[% IF ( booksellerid ) %]
|
||||
<a class="btn btn-default cancel" href="/cgi-bin/koha/vendors/[% booksellerid | html %]"> </a>
|
||||
[% ELSE %]
|
||||
[% SET a_href = '/cgi-bin/koha/acqui/acqui-home.pl' %]
|
||||
[% END %]
|
||||
<a class="btn btn-default cancel" href="[% a_href | url %]"><i class="fa fa-times"></i> Cancel</a>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
|
||||
<fieldset class="rows">
|
||||
<legend>Company details</legend>
|
||||
<ol
|
||||
><li
|
||||
><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"
|
||||
>Required</span
|
||||
></li
|
||||
>
|
||||
<li><label for="company_postal">Postal address: </label> <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal | html %]</textarea></li>
|
||||
<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>
|
||||
<li><label for="company_phone">Phone: </label> <input type="tel" size="20" id="company_phone" name="company_phone" value="[% phone | html %]" /></li>
|
||||
<li><label for="company_fax">Fax: </label> <input type="tel" size="20" id="company_fax" name="company_fax" value="[% fax | html %]" /></li>
|
||||
<li><label for="website">Website: </label> <input type="url" size="40" id="website" name="website" value="[% url | html %]" class="url" /></li>
|
||||
<li><label for="accountnumber">Account number: </label> <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber | html %]" /></li>
|
||||
<li>
|
||||
<label for="vendor_type">Vendor type: </label>
|
||||
[% PROCESS 'av-build-dropbox.inc' name="vendor_type", category="VENDOR_TYPE", default=type, empty=1, size = 20 %]
|
||||
</li>
|
||||
<li>
|
||||
<label for="aliases">Aliases: </label>
|
||||
<div id="aliases" style="padding-left: 11rem;"></div>
|
||||
</li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
<fieldset class="rows">
|
||||
<legend>Contacts</legend>
|
||||
<fieldset id="contact-template" class="supplier-contact">
|
||||
<legend>Contact details</legend>
|
||||
[% INCLUDE edit_contact %]
|
||||
</fieldset>
|
||||
[% FOREACH contact IN contacts %]
|
||||
<fieldset class="supplier-contact">
|
||||
<legend>Contact details</legend>
|
||||
[% INCLUDE edit_contact %]
|
||||
</fieldset>
|
||||
[% END %]
|
||||
<button id="add-contact" class="btn btn-default"><i class="fa fa-plus"></i> Add another contact</button>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="rows">
|
||||
<legend>Interfaces</legend>
|
||||
<div id="interfaces"></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="rows">
|
||||
<legend>Ordering information</legend>
|
||||
<ol
|
||||
><li
|
||||
><label for="activestatus">Vendor is:</label> [% IF ( active ) %]
|
||||
<input type="radio" id="activestatus" name="status" value="1" checked="checked" />
|
||||
<label class="radio" for="activestatus">Active</label>
|
||||
<input type="radio" id="inactivestatus" name="status" value="0" />
|
||||
<label class="radio" for="inactivestatus">Inactive</label>
|
||||
[% ELSE %]
|
||||
<input type="radio" id="activestatus" name="status" value="1" />
|
||||
<label class="radio" for="activestatus">Active</label>
|
||||
<input type="radio" id="inactivestatus" name="status" value="0" checked="checked" />
|
||||
<label class="radio" for="inactivestatus">Inactive</label>
|
||||
[% END %]</li
|
||||
>
|
||||
<li
|
||||
><label for="list_currency">List prices are: </label>
|
||||
<select name="list_currency" id="list_currency">
|
||||
[% FOREACH c IN currencies %]
|
||||
[% IF booksellerid and c.currency == listprice or not booksellerid and c.active %]
|
||||
<option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
|
||||
[% ELSIF not c.archived %]
|
||||
<option value="[% c.currency | html %]">[% c.currency | html %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
<li
|
||||
><label for="invoice_currency">Invoice prices are: </label>
|
||||
<select name="invoice_currency" id="invoice_currency">
|
||||
[% FOREACH c IN currencies %]
|
||||
[% IF booksellerid and c.currency == invoiceprice or not booksellerid and c.active %]
|
||||
<option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
|
||||
[% ELSIF not c.archived %]
|
||||
<option value="[% c.currency | html %]">[% c.currency | html %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
<li
|
||||
><label for="gstyes">Tax number registered:</label> [% IF ( gstreg ) %]
|
||||
<label class="radio" for="gstyes">Yes</label>
|
||||
<input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
|
||||
<label class="radio" for="gstno">No</label>
|
||||
<input type="radio" name="gst" id="gstno" value="0" />
|
||||
[% ELSE %]
|
||||
<label class="radio" for="gstyes">Yes</label>
|
||||
<input type="radio" name="gst" id="gstyes" value="1" />
|
||||
<label class="radio" for="gstno">No</label>
|
||||
<input type="radio" name="gst" id="gstno" value="0" checked="checked" />
|
||||
[% END %]</li
|
||||
>
|
||||
|
||||
<li
|
||||
><label for="list_gstyes">List prices:</label> [% IF ( listincgst ) %]
|
||||
<label class="radio" for="list_gstyes">Include tax</label>
|
||||
<input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
|
||||
<label class="radio" for="list_gstno">Don't include tax</label>
|
||||
<input type="radio" id="list_gstno" name="list_gst" value="0" />
|
||||
[% ELSE %]
|
||||
<label class="radio" for="list_gstyes">Include tax</label>
|
||||
<input type="radio" id="list_gstyes" name="list_gst" value="1" />
|
||||
<label class="radio" for="list_gstno">Don't include tax</label>
|
||||
<input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
|
||||
[% END %]</li
|
||||
>
|
||||
|
||||
<li
|
||||
><label for="invoice_gstyes">Invoice prices:</label> [% IF ( invoiceincgst ) %]
|
||||
<label class="radio" for="invoice_gstyes">Include tax</label>
|
||||
<input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
|
||||
<label class="radio" for="invoice_gstno">Don't include tax</label>
|
||||
<input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
|
||||
[% ELSE %]
|
||||
<label class="radio" for="invoice_gstyes">Include tax</label>
|
||||
<input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
|
||||
<label class="radio" for="invoice_gstno">Don't include tax</label>
|
||||
<input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
|
||||
[% END %]</li
|
||||
>
|
||||
|
||||
[% IF gst_values %]
|
||||
<li>
|
||||
<label for="tax_rate">Tax rate: </label>
|
||||
<select name="tax_rate" id="tax_rate">
|
||||
[% FOREACH gst IN gst_values %]
|
||||
[% IF ( tax_rate == gst.option ) %]
|
||||
<option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %] %</option>
|
||||
[% ELSE %]
|
||||
<option value="[% gst.option | html %]">[% gst.option * 100 | html %] %</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% ELSE %]
|
||||
<input type="hidden" name="tax_rate" value="0" />
|
||||
[% END %]
|
||||
<li><label for="discount">Discount: </label> <input class="rate" type="text" size="6" id="discount" name="discount" value="[% discount | html %]" />%</li>
|
||||
<li>
|
||||
<label for="deliverytime">Delivery time: </label>
|
||||
<input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime | html %]" /> days
|
||||
</li>
|
||||
<li><label for="notes">Notes: </label> <textarea cols="40" rows="4" id="notes" name="notes">[% notes | html %]</textarea></li>
|
||||
</ol>
|
||||
</fieldset>
|
||||
</form>
|
||||
[% ELSE %]
|
||||
<h1>[% name | html %]</h1>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div id="supplier-company-details" class="page-section rows">
|
||||
<h2>Vendor details</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<span class="label">Type: </span>
|
||||
[% IF (type) %][% AuthorisedValues.GetByCode( 'VENDOR_TYPE', type ) | html %][% END %]
|
||||
</li>
|
||||
<li><span class="label">Company name: </span>[% name | html %]</li>
|
||||
<li><span class="label">Postal address: </span>[% postal | html %]</li>
|
||||
<li><span class="label">Physical address: </span>[% address1 | html %][% address2 | html %][% address3 | html %][% address4 | html %]</li>
|
||||
<li><span class="label">Phone: </span>[% phone | html %]</li>
|
||||
<li><span class="label">Fax: </span>[% fax | html %]</li>
|
||||
[% IF ( url ) %]
|
||||
<li><span class="label">Website: </span><a href="[% url | url %]" target="_blank">[% url | html %]</a></li>
|
||||
[% END %]
|
||||
[% IF ( accountnumber ) %]
|
||||
<li><span class="label">Account number: </span>[% accountnumber | html %]</li>
|
||||
[% END %]
|
||||
[% IF vendor.aliases.count %]
|
||||
<li>
|
||||
<span class="label">Aliases: </span>
|
||||
<ul>
|
||||
[% FOR alias IN vendor.aliases %]
|
||||
<li>[% alias.alias | html %]</li>
|
||||
[% END %]
|
||||
</ul>
|
||||
</li>
|
||||
[% END %]
|
||||
</ol>
|
||||
</div>
|
||||
<!-- /#supplier-company-details -->
|
||||
|
||||
<div id="supplier-ordering-information" class="page-section rows">
|
||||
<h2>Ordering information</h2>
|
||||
<li><span class="label">Vendor is: </span>[% IF ( active ) %]Active[% ELSE %]Inactive[% END %]</li>
|
||||
<li><span class="label">List prices are: </span>[% listprice | html %]</li>
|
||||
<li><span class="label">Invoice prices are: </span>[% invoiceprice | html %]</li>
|
||||
[% IF ( tax_rate ) %]
|
||||
<li><span class="label">Tax number registered: </span>[% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</li>
|
||||
<li><span class="label">List item price includes tax: </span>[% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</li>
|
||||
<li><span class="label">Invoice item price includes tax: </span>[% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</li>
|
||||
[% END %]
|
||||
<li><span class="label">Discount: </span>[% ( discount || 0 ) | format("%.1f" ) %] %</li>
|
||||
<li><span class="label">Tax rate: </span>[% ( tax_rate || 0 ) * 100 | html %] %</li>
|
||||
[% IF deliverytime.defined %]
|
||||
<li><span class="label">Delivery time: </span>[% deliverytime | html %] days</li>
|
||||
[% END %]
|
||||
[% IF ( notes ) %]
|
||||
<li><span class="label">Notes: </span>[% notes | html %]</li>
|
||||
[% END %]
|
||||
</div>
|
||||
<!-- #supplier-ordering-information -->
|
||||
|
||||
[% IF vendor.interfaces.count %]
|
||||
<div id="supplier-interfaces" class="page-section rows">
|
||||
<h2>Interfaces</h2>
|
||||
|
||||
[% FOR i IN vendor.interfaces %]
|
||||
<h3>[% i.name | html %]</h3>
|
||||
[% IF i.type %]
|
||||
<li><span class="label">Type: </span>[% AuthorisedValues.GetByCode( 'VENDOR_INTERFACE_TYPE', i.type) | html %]</li>
|
||||
[% END %]
|
||||
[% IF i.uri %]
|
||||
<li> <span class="label">URI: </span><a href="[% i.uri | url %]" target="_blank">[% i.uri | html %]</a> </li>
|
||||
[% END %]
|
||||
[% IF i.login %]
|
||||
<li><span class="label">Login: </span>[% i.login | html %]</li>
|
||||
[% END %]
|
||||
[% IF i.password %]
|
||||
<li
|
||||
><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
|
||||
>
|
||||
[% END %]
|
||||
[% IF i.account_email %]
|
||||
<li><span class="label">Account email: </span>[% i.account_email | html %]</li>
|
||||
[% END %]
|
||||
[% IF i.notes %]
|
||||
<li><span class="label">Notes: </span>[% i.notes | html %]</li>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</div>
|
||||
[% END %]
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
|
||||
<div class="col">
|
||||
<div id="supplier-contact-details" class="page-section rows">
|
||||
<h2>Contact</h2>
|
||||
[% FOREACH contact IN contacts %]
|
||||
[% INCLUDE show_contact %]
|
||||
[% END %]
|
||||
</div>
|
||||
<!-- /#supplier-contact-details -->
|
||||
|
||||
<div id="subscription-details" class="page-section">
|
||||
<h2>Subscription details</h2>
|
||||
<p
|
||||
><strong>Number of subscriptions: </strong>
|
||||
[% IF ( CAN_user_serials ) %]
|
||||
<a href="/cgi-bin/koha/serials/serials-search.pl?bookseller_filter=[% name | uri %]&searched=1">[% subscriptioncount | html %]</a>
|
||||
[% ELSE %]
|
||||
[% subscriptioncount | html %]
|
||||
[% END %]
|
||||
</p>
|
||||
</div>
|
||||
<!-- /#subscription-details -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
[% IF ( contracts ) %]
|
||||
<div id="supplier-contracts" class="page-section rows">
|
||||
<h2>Contract(s)</h2>
|
||||
<table id="contractst">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Start date</th>
|
||||
<th scope="col">End date</th>
|
||||
[% IF CAN_user_acquisition_contracts_manage %]
|
||||
<th scope="col" class="no-sort no-export">Actions</th>
|
||||
[% END %]
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH contract IN contracts %]
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber | uri %]&booksellerid=[% contract.booksellerid | uri %]">[% contract.contractname | html %]</a>
|
||||
</td>
|
||||
<td>[% contract.contractdescription | html %]</td>
|
||||
<td data-order="[% contract.contractstartdate | html %]">[% contract.contractstartdate | $KohaDates %]</td>
|
||||
<td data-order="[% contract.contractenddate | html %]">[% contract.contractenddate | $KohaDates %]</td>
|
||||
[% IF CAN_user_acquisition_contracts_manage %]
|
||||
<td class="actions">
|
||||
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=[% contract.contractnumber | html %]&booksellerid=[% contract.booksellerid | html %]"
|
||||
><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a
|
||||
>
|
||||
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=[% contract.contractnumber | html %]&booksellerid=[% contract.booksellerid | html %]"
|
||||
><i class="fa fa-trash-can"></i> Delete</a
|
||||
>
|
||||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /#supplier-contracts -->
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% Asset.js("js/acquisitions-menu.js") | $raw %]
|
||||
[% Asset.js("js/acq.js") | $raw %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
[% Asset.js("js/vue/dist/islands.js", "init" => "1") | $raw %]
|
||||
<script>
|
||||
function add_contact() {
|
||||
var new_contact = $('#contact-template').clone();
|
||||
var timestamp = new Date().getTime();
|
||||
$(new_contact).removeAttr('id');
|
||||
$('input, textarea', new_contact).each(function () {
|
||||
$(this).attr('id', $(this).attr('id') + '_' + timestamp);
|
||||
});
|
||||
$(new_contact).insertBefore(this);
|
||||
if ($('.supplier-contact').length === 2) { // First contact
|
||||
$.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_orderacquisition', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
|
||||
$(checkbox, new_contact).click();
|
||||
});
|
||||
}
|
||||
$('input[name="contact_name"]', new_contact).focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
function delete_contact(ev) {
|
||||
$(this).parents('.supplier-contact').remove();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
[% IF vendor %]
|
||||
let aliases = [% To.json(vendor.aliases.unblessed) | $raw %];
|
||||
[% ELSE %]
|
||||
let aliases = [];
|
||||
[% END %]
|
||||
function remove_alias(i){
|
||||
aliases.splice(i, 1);
|
||||
refresh_aliases();
|
||||
}
|
||||
|
||||
function encodeHTMLEntities(str){
|
||||
return str.replace(/[&<>'"]/g,
|
||||
tag => ({
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
"'": ''',
|
||||
'"': '"'
|
||||
}[tag]));
|
||||
}
|
||||
|
||||
function add_alias(){
|
||||
let alias = $("#new_alias").val();
|
||||
if ( !alias.length > 0 ) { return }
|
||||
aliases.push({alias});
|
||||
refresh_aliases();
|
||||
}
|
||||
function refresh_aliases(){
|
||||
let nodes = $("<div></div>");
|
||||
aliases.forEach((a, i) => {
|
||||
let alias_str = encodeHTMLEntities(a.alias);
|
||||
let n = $("<div></div>").append(alias_str);
|
||||
let input = $('<input type="hidden" name="alias" />');
|
||||
input.val(a.alias);
|
||||
n.append(input);
|
||||
n.append(` <a style="cursor: pointer;" onclick="remove_alias(${i});"><i class="fa fa-trash" aria-hidden="true"></i> ` + _("Remove") + '</a>');
|
||||
nodes.append(n);
|
||||
});
|
||||
nodes.append("<input id='new_alias' type='text' class='noEnterSubmit' />");
|
||||
nodes.append(' <a style="cursor: pointer;" onclick="add_alias();"><i class="fa fa-plus" aria-hidden="true"></i> ' + _("Add") + '</a>');
|
||||
$("#aliases").html(nodes.html());
|
||||
}
|
||||
|
||||
[% IF vendor %]
|
||||
let interfaces = [];
|
||||
[% FOR i_object IN vendor.interfaces %]
|
||||
[% SET i = i_object.unblessed %]
|
||||
[% SET i.password = i_object.plain_text_password %]
|
||||
interfaces.push([% To.json(i) | $raw %]);
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
let interfaces = [];
|
||||
[% END %]
|
||||
function serialize_interface_form(){
|
||||
interfaces = [];
|
||||
$("#interfaces > fieldset.supplier-interface > ol.interface-form").each( (index, interface_form )=> {
|
||||
let interface = {};
|
||||
$(interface_form).find('input,textarea,select').serializeArray().map(attr => {
|
||||
let name = attr.name.replace(/interface_([\w_]+)_\d+/, "$1");
|
||||
interface[name] = attr.value
|
||||
})
|
||||
interfaces.push(interface);
|
||||
});
|
||||
return interfaces;
|
||||
}
|
||||
function remove_interface(i){
|
||||
interfaces = serialize_interface_form();
|
||||
interfaces.splice(i, 1);
|
||||
refresh_interfaces();
|
||||
}
|
||||
function add_interface(){
|
||||
interfaces = serialize_interface_form();
|
||||
interfaces.push({
|
||||
type: "",
|
||||
name: "",
|
||||
uri: "",
|
||||
login: "",
|
||||
password: "",
|
||||
account_email: "",
|
||||
notes: "",
|
||||
});
|
||||
refresh_interfaces();
|
||||
}
|
||||
let av_select = {
|
||||
VENDOR_INTERFACE_TYPE: $("[% PROCESS 'av-build-dropbox.inc', category="VENDOR_INTERFACE_TYPE" empty=1 | replace('\n', '') | replace('"', '\"') %]"),
|
||||
};
|
||||
function refresh_interfaces(){
|
||||
let nodes = $("<div id='interfaces'></div>");
|
||||
interfaces.forEach((interface, i) => {
|
||||
let n = $("<fieldset class='supplier-interface'></fieldset>");
|
||||
n.append("<legend>" + _("Interface details") + "</legend>");
|
||||
n.append(`<input type="hidden" name="interface_counter" value="${i}" />`);
|
||||
let ol = $('<ol class="interface-form"></ol>');
|
||||
let attributes = [
|
||||
{ label: _("Name:"), name: 'name', type: 'text', node: 'input' },
|
||||
{ label: _("Type:"), name: 'type', type: 'select', node: 'av_select', av_cat: 'VENDOR_INTERFACE_TYPE' },
|
||||
{ label: _("URI:"), name: 'uri', type: 'url', node: 'input' },
|
||||
{ label: _("Login:"), name: 'login', type: 'text', node: 'input' },
|
||||
{ label: _("Password:"), name: 'password', type: 'text', node: 'input' },
|
||||
{ label: _("Account email:"), name: 'account_email', type: 'email', node: 'input' },
|
||||
{ label: _("Notes:"), name: 'notes', type: 'textarea', node: 'textarea' }
|
||||
];
|
||||
attributes.forEach((attribute, ii) => {
|
||||
let li = $('<li></li>');
|
||||
li.append(`<label for="interface_${attribute.name}_${i}">${attribute.label}</label>`);
|
||||
if( attribute.node == 'input' ) {
|
||||
li.append(`<input type="${attribute.type}" size="40" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}" value="${interface[attribute.name]}" />`);
|
||||
} else if ( attribute.node == 'textarea' ) {
|
||||
li.append(`<textarea cols="40" rows="3" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}">${interface[attribute.name]}</textarea>`);
|
||||
} else if ( attribute.node == 'av_select' ) {
|
||||
let select = av_select[attribute.av_cat].clone();
|
||||
select.attr('name', `interface_${attribute.name}_${i}`);
|
||||
select.find(`option[value='${interface[attribute.name]}']`).prop("selected", true);
|
||||
li.append(select);
|
||||
}
|
||||
ol.append(li);
|
||||
});
|
||||
ol.append(`<li><button class="btn btn-default" onclick="remove_interface(${i});"><i class="fa fa-trash"></i> ` + _("Delete interface") + '</li>');
|
||||
n.append(ol);
|
||||
nodes.append(n);
|
||||
});
|
||||
nodes.append(`<button onclick="add_interface();" class="btn btn-default"><i class="fa fa-plus"></i> ` + _("Add another interface") + '</button>')
|
||||
$("#interfaces").replaceWith(nodes);
|
||||
|
||||
interfaces.forEach((interface, i) => {
|
||||
$("#interface_account_email_" + i).rules("add", {
|
||||
email: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
var contractst = $("#contractst").kohaTable({
|
||||
dom: 't'
|
||||
} );
|
||||
$('body').on('click', '.delete-contact', null, delete_contact);
|
||||
$('#add-contact').click(add_contact);
|
||||
$('body').on('click', '.contact_acqprimary', null, function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
|
||||
$('.contact_acqprimary_hidden').each(function () {
|
||||
$(this).val('0');
|
||||
});
|
||||
}
|
||||
$(this).next('.contact_acqprimary_hidden').val('1');
|
||||
});
|
||||
$('body').on('click', '.contact_serialsprimary', null, function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
|
||||
$('.contact_serialsprimary_hidden').each(function () {
|
||||
$(this).val('0');
|
||||
});
|
||||
}
|
||||
$(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
|
||||
});
|
||||
$('body').on('click', '.contact_orderacquisition', null, function () {
|
||||
$(this).next('.contact_orderacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
|
||||
});
|
||||
$('body').on('click', '.contact_claimacquisition', null, function () {
|
||||
$(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
|
||||
});
|
||||
$('body').on('click', '.contact_claimissues', null, function () {
|
||||
$(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
|
||||
});
|
||||
|
||||
$('body').on('click', '.show_password', null, function(e){
|
||||
e.preventDefault();
|
||||
$(this).parent().replaceWith($(this).data('plain-text-password'));
|
||||
});
|
||||
refresh_aliases();
|
||||
refresh_interfaces();
|
||||
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
|
||||
[% INCLUDE 'intranet-bottom.inc' %]
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
[% FOREACH account IN accounts %]
|
||||
<tr>
|
||||
<td>[% account.id | html %]</td>
|
||||
<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% account.vendor_id | uri %]">[% account.vendor.name | html %]</a></td>
|
||||
<td><a href="/cgi-bin/koha/vendors/[% account.vendor_id | uri %]">[% account.vendor.name | html %]</a></td>
|
||||
<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>
|
||||
<td>[% account.description | html %]</td>
|
||||
<td>[% account.download_directory | html %]</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue