Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt
Jonathan Druart 58c652a0fc Bug 12054: Inactive vendors should be inactive
This patch make inactive vendors really inactive.
That means an inactive vendor would not be able to add a basket / add an order.

Revised test plan
=================

1/ In the acquisition module create 2 vendors: 1 active and 1 inactive.

2/ On the acqui/booksellers.pl, acqui/uncertainprice.pl,
   admin/aqcontract.pl and acqui/supplier.pl (pages which include the
   acq toolbar), you should be able to, for both the 'active' as well
   as the inactive vendor :
     (a) add new basket
     (b) add order items to the basket

   Remark: This is *wrong*. You should be able to do so only for active
           vendor.

3/ Apply the patch

4/ Go to the links in step #2 above and select the inactive vendor
   you should no longer be able to:
   (a) add new basket
   (b) add order items to the basket

   Remark: This is the *correct* behaviour

5/ No change should be noted for vendor marked "active", and should
   be able to undertake operations 4 (a), 4 (b) and 4 (c).

   Remark: This is the *correct* behaviour.

6/ run koha qa tests tool

Bug 12054: (follow-up) Inactive vendors should be inactive

Don't display "add order""block and buttons if the vendor is inactive.

Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-07-20 10:34:55 -03:00

211 lines
10 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; Contracts &rsaquo;
[% IF ( add_form ) %]
[% IF ( contractnumber ) %]Modify contract '[% contractname %]'
[% ELSE %]New contract[% END %]
[% END %]
[% IF ( else ) %]Contracts of [% booksellername %][% END %]
[% IF ( add_validate ) %]Data recorded[% END %]
[% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber %]'[% END %]
[% IF ( delete_confirmed ) %]Contract deleted[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
<script type="text/javascript">
//<![CDATA[
// to check if the data are correctly entered.
function Check(ff) {
var ok=0;
var _alertString=_("Form not submitted because of the following problem(s)");
_alertString +="\n-------------------------------------------------------------------\n\n";
if (!(isNotNull(ff.contractname,0))){
ok=1;
_alertString += _("- Name missing") + "\n";
}
var startDate = Date_from_syspref($("#from").val());
var endDate = Date_from_syspref($("#to").val());
if (!parseInt(startDate.getTime())) {
ok=1;
_alertString += _("- Start date missing or invalid.") + "\n";
}
if (!parseInt(endDate.getTime())) {
ok=1;
_alertString += _("- End date missing or invalid.") + "\n";
}
if (startDate > endDate) {
ok=1;
_alertString += _("Wrong date! start date cannot be after end date.") + "\n";
}
if (endDate < (new Date)) {
ok=1;
_alertString += _("End date before today, Invalid end date!") + "\n";
}
if (ok) { // if there is a problem
alert(_alertString);
return false;
}
// if all is good
ff.submit();
}
//]]>
</script>
</head>
<body id="acq_aqcontract" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'contracts-admin-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
&rsaquo;
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
&rsaquo;
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername %]</a>
&rsaquo;
[% IF ( add_form ) %]
<a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
&rsaquo;
[% IF ( contractnumber ) %]Modify contract '[% contractname %]'
[% ELSE %]New contract
[% END %]
[% END %]
[% IF ( add_validate ) %]
<a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
&rsaquo; Data recorded
[% END %]
[% IF ( delete_confirm ) %]
<a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
&rsaquo; Confirm deletion of contract [% contractnumber %]
[% END %]
[% IF ( delete_confirmed ) %]
<a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a> &rsaquo; Contract deleted
[% END %]
[% IF ( else ) %]Contracts[% END %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'acquisitions-toolbar.inc' %]
[% IF error == 'not_deleted' %]
<div class="dialog alert">Contract has not been deleted. Maybe a basket linked to this contract exists.</div>
[% END %]
[% IF ( add_form ) %]
<form name="Aform" action="[% script_name %]" method="post">
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
<input type="hidden" name="checked" value="0" />
[% IF ( contractnumber ) %]
<h1>Modify contract [% contractname %] for [% booksellername %]</h1>
[% ELSE %]
<h1>New contract for [% booksellername %]</h1>
[% END %]
<fieldset class="rows">
<ol>
[% IF ( contractnumber ) %]
<li><span class="label">Contract id </span>[% contractnumber %]
<input type="hidden" name="contractnumber" value="[% contractnumber %]" />
<input type="hidden" name="is_a_modif" value="1" />
</li>
[% END %]
<li><label for="contractname" class="required">Name: *</label> &nbsp;
<input type="text" name="contractname" id="contractname" size="40" maxlength="80" value="[% contractname %]" />
</li>
<li><label for="contractdescription">Description: </label> &nbsp;
<input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="[% contractdescription %]" />
</li>
<li><label for="from" class="required">Start date: *</label> &nbsp;
<input type="text" name="contractstartdate" id="from" value="[% contractstartdate %]" maxlength="10" size="10" class="datepickerfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="to" class="required">End date: *</label> &nbsp;
<input type="text" name="contractenddate" id="to" value="[% contractenddate %]" maxlength="10" size="10" class="datepickerto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="button" value="Save" onclick="Check(this.form);" /> <a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]&amp;contractnumber=[% contractnumber %]">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF ( add_validate ) %]
<h3>Data recorded</h3>
<form action="[% script_name %]" method="post">
<input type="submit" value="OK" />
</form>
[% END %]
[% IF ( delete_confirm ) %]
<form action="[% script_name %]" method="post">
<fieldset>
<legend>Confirm deletion of contract [% contractnumber %]</legend>
<table>
<tr><th scope="row">Contract number:</th><td>[% contractnumber %]</td></tr>
<tr><th scope="row">Contract name:</th><td>[% contractname %]</td></tr>
<tr><th scope="row">Contract description:</th><td>[% contractdescription %]</td></tr>
<tr><th scope="row">Contract start date:</th><td>[% contractstartdate %]</td></tr>
<tr><th scope="row">Contract end date:</th><td>[% contractenddate %]</td></tr>
<tr><th scope="row">Vendor:</th><td>[% booksellername %]</td></tr>
</table>
<fieldset class="action">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
<input type="hidden" name="contractnumber" value="[% contractnumber %]" />
<input type="submit" value="Delete this contract" />
<a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]&amp;contractnumber=[% contractnumber %]">Cancel</a>
</fieldset>
</fieldset>
</form>
[% END %]
[% IF ( delete_confirmed ) %]
<h3>Contract deleted</h3>
<form action="[% script_name %]" method="post">
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
<input type="submit" value="OK" />
</form>
[% END %]
[% IF ( else ) %]
<h2>Contract(s) of [% booksellername %]</h2>
[% IF ( loop ) %]
<table>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
<th scope="col">Start date</th>
<th scope="col">End date</th>
<th scope="col" colspan="2">&nbsp; </th>
</tr>
[% FOREACH loo IN loop %]
<tr>
<td>
<a href="[% loo.script_name %]?op=add_form&amp;booksellerid=[% loo.booksellerid %]&amp;contractnumber=[% loo.contractnumber %]">[% loo.contractname %]</a>
</td>
<td>[% loo.contractdescription %]</td>
<td>[% loo.contractstartdate %]</td>
<td>[% loo.contractenddate %]</td>
<td><a href="[% loo.script_name %]?op=add_form&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Edit</a></td>
<td><a href="[% loo.script_name %]?op=delete_confirm&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Delete</a></td>
</tr>
[% END %]
</table>
[% ELSE %]
<div class="dialog message">
There are no contracts with this vendor.
[% IF active %]
<a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">Add a contract</a>.
[% END %]
</div>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'vendor-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]