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