Bug 6681: (qa followup) document the existence of the sample files
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqcontract.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Acquisitions &rsaquo; Contracts &rsaquo;
3 [% IF ( add_form ) %]
4     [% IF ( contractnumber ) %]Modify contract '[% contractname %]'
5 [% ELSE %]New contract[% END %]
6 [% END %]
7 [% IF ( else ) %]Contracts of [% booksellername %][% END %]
8 [% IF ( add_validate ) %]Data recorded[% END %]
9 [% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber %]'[% END %]
10 [% IF ( delete_confirmed ) %]Contract deleted[% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% INCLUDE 'calendar.inc' %]
13 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
14 <script type="text/javascript">
15 //<![CDATA[
16 // to check if the data are correctly entered.
17 function Check(ff) {
18     var ok=0;
19     var _alertString=_("Form not submitted because of the following problem(s)");
20     _alertString +="\n-------------------------------------------------------------------\n\n";
21     if (!(isNotNull(ff.contractname,0))){
22         ok=1;
23         _alertString += _("- Name missing") + "\n";
24     }
25     var startDate = Date_from_syspref($("#from").val());
26     var endDate   = Date_from_syspref($("#to").val());
27     if (!parseInt(startDate.getTime())) {
28         ok=1;
29         _alertString += _("- Start date missing or invalid.") + "\n";
30     }
31     if (!parseInt(endDate.getTime())) {
32         ok=1;
33         _alertString += _("- End date missing or invalid.") + "\n";
34     }
35     
36     if (startDate > endDate) {
37         ok=1;
38         _alertString += _("Wrong date! start date cannot be after end date.") + "\n";
39     }
40     if (endDate < (new Date)) {
41         ok=1;
42         _alertString += _("End date before today, Invalid end date!") + "\n";
43     }
44     if (ok) { // if there is a problem
45         alert(_alertString);
46     return false;
47 }
48 // if all is good
49     ff.submit();
50 }
51 //]]>
52 </script>
53 </head>
54 <body id="acq_aqcontract" class="acq">
55 [% INCLUDE 'header.inc' %]
56 [% INCLUDE 'contracts-admin-search.inc' %]
57
58 <div id="breadcrumbs">
59     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
60     &rsaquo;
61     <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
62     &rsaquo;
63     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername %]</a>
64     &rsaquo;
65     [% IF ( add_form ) %]
66         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
67         &rsaquo;
68         [% IF ( contractnumber ) %]Modify contract '[% contractname %]'
69         [% ELSE %]New contract
70         [% END %]
71     [% END %]
72     [% IF ( add_validate ) %]
73         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
74         &rsaquo; Data recorded
75     [% END %]
76     [% IF ( delete_confirm ) %]
77         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
78         &rsaquo; Confirm deletion of contract [% contractnumber %]
79     [% END %]
80     [% IF ( delete_confirmed ) %]
81         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a> &rsaquo; Contract deleted
82     [% END %]
83     [% IF ( else ) %]Contracts[% END %]
84 </div>
85
86 <div id="doc3" class="yui-t2">
87
88     <div id="bd">
89     <div id="yui-main">
90     <div class="yui-b">
91
92 [% INCLUDE 'acquisitions-toolbar.inc' %]
93
94 [% IF error == 'not_deleted' %]
95     <div class="dialog alert">Contract has not been deleted. Maybe a basket linked to this contract exists.</div>
96 [% END %]
97
98                 [% IF ( add_form ) %]
99                     <form name="Aform" action="[% script_name %]" method="post">
100                         <input type="hidden" name="op" value="add_validate" />
101                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
102                         <input type="hidden" name="checked" value="0" />
103                         [% IF ( contractnumber ) %]
104                             <h1>Modify contract [% contractname %] for [% booksellername %]</h1>
105                         [% ELSE %]
106                             <h1>New contract for [% booksellername %]</h1>
107                         [% END %]
108                         <fieldset class="rows">
109                             <ol>
110                                 [% IF ( contractnumber ) %]
111                                         <li><span class="label">Contract id </span>[% contractnumber %]
112                                             <input type="hidden" name="contractnumber" value="[% contractnumber %]" />
113                                             <input type="hidden" name="is_a_modif" value="1" />
114                                         </li>
115                                 [% END %]
116                                 <li><label for="contractname" class="required">Name: *</label> &nbsp;
117                                         <input type="text" name="contractname" id="contractname" size="40" maxlength="80" value="[% contractname %]" />
118                                 </li>
119                                 <li><label for="contractdescription">Description: </label> &nbsp;
120                                         <input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="[% contractdescription %]" />
121                                 </li>
122                                 <li><label for="from" class="required">Start date: *</label> &nbsp;
123                                         <input type="text" name="contractstartdate" id="from" value="[% contractstartdate %]" maxlength="10" size="10" class="datepickerfrom" />
124                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
125                                 </li>
126                                 <li><label for="to" class="required">End date: *</label> &nbsp;
127                                         <input type="text" name="contractenddate" id="to" value="[% contractenddate %]" maxlength="10"  size="10" class="datepickerto" />
128                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
129                                 </li>
130                             </ol>
131                         </fieldset>
132                         <fieldset class="action">
133                             <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>
134                         </fieldset>
135                     </form>
136             [% END %]
137             [% IF ( add_validate ) %]
138                 <h3>Data recorded</h3>
139                 <form action="[% script_name %]" method="post">
140                     <input type="submit" value="OK" />
141                 </form>
142             [% END %]
143             [% IF ( delete_confirm ) %]
144                 <form action="[% script_name %]" method="post">
145                     <fieldset>
146                         <legend>Confirm deletion of contract [% contractnumber %]</legend>
147                         <table>
148                             <tr><th scope="row">Contract number:</th><td>[% contractnumber %]</td></tr>
149                             <tr><th scope="row">Contract name:</th><td>[% contractname %]</td></tr>
150                             <tr><th scope="row">Contract description:</th><td>[% contractdescription %]</td></tr>
151                             <tr><th scope="row">Contract start date:</th><td>[% contractstartdate %]</td></tr>
152                             <tr><th scope="row">Contract end date:</th><td>[% contractenddate %]</td></tr>
153                             <tr><th scope="row">Vendor:</th><td>[% booksellername %]</td></tr>
154                         </table>
155                         <fieldset class="action">
156                             <input type="hidden" name="op" value="delete_confirmed" />
157                             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
158                             <input type="hidden" name="contractnumber" value="[% contractnumber %]" />
159                             <input type="submit" value="Delete this contract" />
160                             <a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]&amp;contractnumber=[% contractnumber %]">Cancel</a>
161                         </fieldset>
162                     </fieldset>
163                 </form>
164             [% END %]
165             [% IF ( delete_confirmed ) %]
166                 <h3>Contract deleted</h3>
167                 <form action="[% script_name %]" method="post">
168                     <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
169                     <input type="submit" value="OK" />
170                 </form>
171             [% END %]
172             [% IF ( else ) %]
173                 <h2>Contract(s) of [% booksellername %]</h2>
174                 [% IF ( loop ) %]
175                     <table>
176                         <tr>
177                             <th scope="col">Name</th>
178                             <th scope="col">Description</th>
179                             <th scope="col">Start date</th>
180                             <th scope="col">End date</th>
181                             <th scope="col" colspan="2">&nbsp; </th>
182                         </tr>
183                     [% FOREACH loo IN loop %]
184                         <tr>
185                         <td>
186                             <a href="[% loo.script_name %]?op=add_form&amp;booksellerid=[% loo.booksellerid %]&amp;contractnumber=[% loo.contractnumber %]">[% loo.contractname %]</a>
187                         </td>
188                         <td>[% loo.contractdescription %]</td>
189                         <td>[% loo.contractstartdate %]</td>
190                         <td>[% loo.contractenddate %]</td>
191                         <td><a href="[% loo.script_name %]?op=add_form&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Edit</a></td>
192                         <td><a href="[% loo.script_name %]?op=delete_confirm&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Delete</a></td>
193                         </tr>
194                     [% END %]
195                 </table>
196                 [% ELSE %]
197                 <div class="dialog message">There are no contracts with this vendor. <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">Add a contract</a>.</div>
198                 [% END %]
199             [% END %]
200 </div>
201 </div>
202 <div class="yui-b">
203 [% INCLUDE 'vendor-menu.inc' %]
204 </div>
205 </div>
206 [% INCLUDE 'intranet-bottom.inc' %]