]> git.koha-community.org Git - koha.git/blob - koha-tt/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
Merge remote branch 'kc/master' into new/enh/bug_5917
[koha.git] / koha-tt / intranet-tmpl / prog / en / modules / reports / guided_reports_start.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Reports &rsaquo; Guided Reports Wizard 
3 [% IF ( saved1 ) %]&rsaquo; Saved Reports
4 [% ELSIF ( create ) %]&rsaquo; Create from SQL
5 [% ELSIF ( showsql ) %]&rsaquo; Saved Reports &rsaquo; SQL View
6 [% ELSIF ( execute ) %]&rsaquo; Saved Reports &rsaquo; [% name %] Report
7 [% ELSIF ( buildx ) %]&rsaquo; Build A Report, Step [% buildx %] of 6:
8 [% IF ( build1 ) %]Choose a Module
9 [% ELSIF ( build2 ) %]Pick a Report Type
10 [% ELSIF ( build3 ) %]Select Columns for Display
11 [% ELSIF ( build4 ) %]Select Criteria to Limit on
12 [% ELSIF ( build5 ) %]Pick which columns to total
13 [% ELSIF ( build6 ) %]Select how you want the report ordered
14 [% END %]
15 [% END %]
16 </title>
17 [% INCLUDE 'doc-head-close.inc' %]
18 [% INCLUDE 'calendar.inc' %]
19 <style type="text/css">
20     #sql { width: 90%; height: 9em;}
21 </style>
22 <script type="text/javascript">
23 //<![CDATA[
24 $(document).ready(function(){
25 [% IF ( showsql ) %]
26     $("#sql").focus(function() {
27         $(this).select();
28     });
29 [% END %]
30 [% IF ( saved1 ) %]
31     $(".confirmdelete").click(function(){
32         $(this).parents('tr').attr("class","warn");
33         if(confirm("Are you sure you want to "+$(this).attr("title")+"?")){
34             return true;
35         } else {
36             $(this).parents('tr').attr("class","");
37             return false;
38         }
39     });
40 [% END %]
41 });
42 //]]>
43 </script>
44 </head>
45 <body>
46 [% INCLUDE 'header.inc' %]
47 [% INCLUDE 'circ-search.inc' %]
48
49 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
50 &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
51 &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a>
52 &rsaquo; 
53 [% IF ( saved1 ) %]Saved Reports
54 [% ELSIF ( create ) %]Create from SQL
55 [% ELSIF ( showsql ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> &rsaquo; SQL View
56 [% ELSIF ( execute ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports</a> &rsaquo; <em>[% name %]</em> Report
57 [% ELSIF ( buildx ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build A Report</a> &rsaquo; Step [% buildx %] of 6:
58     [% IF ( build1 ) %]Choose a Module
59     [% ELSIF ( build2 ) %]Pick a Report Type
60     [% ELSIF ( build3 ) %]Select Columns for Display
61     [% ELSIF ( build4 ) %]Select Criteria to Limit on
62     [% ELSIF ( build5 ) %]Pick which columns to total
63     [% ELSIF ( build6 ) %]Select how you want the report ordered
64     [% END %]
65 [% END %]
66 </div>
67
68 <div id="doc3" class="yui-t1">
69 <div id="bd">
70 <div id="yui-main">
71     <div class="yui-b">
72
73 [% IF ( start ) %]
74     <h2>Guided Reports</h2>
75     <p>Use the guided reports engine to create non standard reports.
76 This feature aims to provide some middle ground between the built in
77 canned reports and writing custom SQL reports.</p>
78
79     <h3>Build And Run Reports</h3>
80         [% IF ( CAN_user_reports_create_reports ) %]
81         <form action="/cgi-bin/koha/reports/guided_reports.pl">
82             <input type="hidden" name="phase" value="Build new" />
83             <input type="submit" name="submit" value="Build new"/>
84         </form>
85         [% END %]
86         [% IF ( CAN_user_reports_execute_reports ) %]
87         <form action="/cgi-bin/koha/reports/guided_reports.pl">
88             <input type="hidden" name="phase" value="Use saved"/>
89             <input type="submit" name="submit" value="Use saved"/>
90         </form>
91         [% END %]
92         [% IF ( CAN_user_reports_create_reports ) %]
93         <form action="/cgi-bin/koha/reports/guided_reports.pl">
94             <input type="hidden" name="phase" value="Create report from SQL"/>
95             <input type="submit" name="submit" value="Create report from SQL"/>
96         </form>
97         [% END %]
98 <h3>Reports Dictionary</h3>
99 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
100 <form action="/cgi-bin/koha/reports/dictionary.pl">
101 <input type="hidden" name="phase" value="View Dictionary"/>
102 <input type="submit" name="submit" value="View Dictionary"/>
103 </form>
104 [% END %]
105
106 [% IF ( saved1 ) %]
107 [% IF ( savedreports ) %]<h1>Saved Reports</h1>
108 <p>Choose the report to run from the list</p>
109 <form action="/cgi-bin/koha/reports/guided_reports.pl">
110 <table>
111 <tr><th>ID</th><th>Report Name</th><th>Type</th><th>Notes</th><th>Author</th><th>Creation Date</th><th>Saved Results</th><th>Saved SQL</th><th colspan="3">&nbsp;</th></tr>
112 [% FOREACH savedreport IN savedreports %]
113 [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
114 <td>[% savedreport.id %]</td>
115 <td>[% savedreport.report_name %]</td>
116 <td>[% savedreport.type %]</td>
117 <td>[% savedreport.notes %]</td>
118 <td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td>
119 <td>[% savedreport.date_created %]</td>
120 <td>[% IF ( savedreport.date_run ) %]<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% savedreport.id %]">[% savedreport.date_run %]</a>[% END %]
121 </td>
122     <td>
123         <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Show%20SQL">Show SQL</a> 
124         [% IF ( savedreport.CAN_user_reports_create_reports ) %]
125             &nbsp; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Edit%20SQL">Edit SQL</a>
126         [% END %]
127     </td>
128 <td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Run%20this%20report">Run</a></td>
129 <td><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id %]">Schedule</a></td>
130     [% IF ( savedreport.CAN_user_reports_create_reports ) %]
131         <td><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&amp;phase=Delete%20Saved">Delete</a></td>
132     [% END %]
133 </tr>
134 [% END %]
135 </table>
136 </form>
137 [% ELSE %]<h4>There are no saved reports. 
138     [% IF ( CAN_user_reports_create_reports ) %]
139         <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new?</a>
140     [% END %]
141 </h4>
142 [% END %]
143 [% END %]
144
145
146 [% IF ( build1 ) %]
147 <h1>Build A Report</h1>
148 <form action="/cgi-bin/koha/reports/guided_reports.pl">
149 <fieldset class="rows">
150 <legend>Step 1 of 6: Choose a Module to Report on</legend>
151 <ol><li><label for="areas">Choose: </label><select name="areas" id="areas">
152 [% FOREACH area IN areas %]
153 <option value="[% area.id %]">[% area.name %]</option>
154 [% END %]
155 </select></li></ol>
156 </fieldset>
157 <fieldset class="action">
158 <input type="hidden" name="phase" value="Report on this Area" />
159 <input type="submit" name="submit" value="Next &gt;&gt;" />
160
161 </fieldset>
162 </form>
163 [% END %]
164
165
166 [% IF ( build2 ) %]
167 <h1>Build A Report</h1>
168 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
169 <input type="hidden" name="area" value="[% area %]" />
170 <fieldset class="rows"><legend>Step 2 of 6: Pick a Report Type</legend>
171 <ol><li><label for="types">Choose: </label>
172     <select id="types" name="types">
173         <option value="1">Tabular</option>
174         <option value="2" disabled="disabled">Summary</option>
175         <option value="3" disabled="disabled">Matrix</option>
176     </select>
177 </li></ol></fieldset>
178
179 <fieldset class="action">
180     <input type="hidden" name="phase" value="Choose this type" />
181     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
182     <input type="submit" name="submit" value="Next &gt;&gt;" />
183 </fieldset>
184 </form>
185 </div>
186 <div class="yui-gb"><div class="yui-u first"></div>
187
188 <!--- Summary and Matrix reports have not yet been implemented-->
189 <!--<div class="yui-u">Summary:
190 <img src="/intranet-tmpl/prog/img/reports-summary-graphic.gif" /></div>
191 <div class="yui-u">Matrix:
192 <img src="/intranet-tmpl/prog/img/reports-matrix-graphic.gif" /></div>-->
193
194 [% END %]
195
196 [% IF ( build3 ) %]
197 <h3>Step 3 of 6: Select Columns for Display</h3>
198 <p>Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.</p>
199
200 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
201     <input type="hidden" name="area" value="[% area %]" />
202     <input type="hidden" name="type" value="[% type %]" />
203     <fieldset>
204 <div class="yui-g">
205 <div class="yui-u first">       <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
206 [% FOREACH column IN columns %]
207 [% IF ( column.table ) %]
208
209 [% IF ( loop.first ) %]
210 [% ELSE %]
211 </optgroup>
212 [% END %]
213
214 <optgroup label="[% column.table %]">
215 [% ELSE %]
216 <option value="[% column.name %]">
217 [% IF ( column.description ) %][% column.description %]
218 [% ELSE %]
219 [% column.name %]
220 [% END %]
221 </option>
222 [% END %]
223 [% END %]
224 </optgroup>
225 </select></div>
226 <div style="width: 6.3em; float: right; margin-top: 100px"><input type="button" name="Add" value="Add" class="button" style="width:6em;" onclick="addColumn()" /><br />
227 <input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width: 6em; margin: 1em 0;" onclick="delColumn()" /></div>
228 </div>
229
230 <div class="yui-u">
231 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
232 </div>
233 </div>
234 </fieldset>
235 <div class="yui-g">
236 <fieldset class="action">
237     <input type="hidden" name="phase" value="Choose these columns" />
238     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
239     <input type="submit" name="submit" value="Next &gt;&gt;" />
240 </fieldset>
241 </div>
242 </form>
243
244 [% END %]
245
246 [% IF ( build4 ) %]
247 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
248     <input type="hidden" name="area" value="[% area %]" />
249     <input type="hidden" name="type" value="[% type %]" />
250     <input type="hidden" name="column" value="[% column %]" />
251     <fieldset><legend>Step 4 of 6: Select Criteria to Limit on</legend>
252     <table>
253         [% FOREACH criteri IN criteria %]
254         <tr>
255         <td>
256             <input type="checkbox" name="criteria_column" id="[% criteri.name %]" value="[% criteri.name %]" /> 
257             <label for="[% criteri.name %]">[% criteri.description %] </label>
258         </td>
259         [% IF ( criteri.date ) %]
260         <td>
261             <input type="text" size="10" id="[% criteri.name %]_value" name="[% criteri.name %]_value" value="" />
262             <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfrom[% criteri.name %]" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
263             <script type="text/javascript">   
264             Calendar.setup({  
265             inputField     : "[% criteri.name %]_value",
266             ifFormat       : "[% criteri.DHTMLcalendar_dateformat %]",
267             button         : "buttonfrom[% criteri.name %]",
268             align          : "Tl" 
269             });     
270             </script>          
271                 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
272         </td>
273         </tr>
274         [% ELSE %]
275         [% IF ( criteri.textrange ) %]
276             <td>from
277             <input type="text" size="10" id="[% criteri.from %]_value" name="[% criteri.from %]_value" value="" /> to 
278             <input type="text" size="10" id="[% criteri.to %]_value" name="[% criteri.to %]_value" value="" />
279             </td>
280             </tr>
281         [% ELSE %]
282             [% IF ( criteri.daterange ) %]
283             <td>from 
284             <input type="text" size="10" id="from_[% criteri.name %]_value" name="from_[% criteri.name %]_value" value="" />
285             <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfromfrom_[% criteri.name %]" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
286             <script type="text/javascript">   
287                 Calendar.setup({  
288                 inputField     : "from_[% criteri.name %]_value",
289                 ifFormat       : "[% criteri.DHTMLcalendar_dateformat %]",
290                 button         : "buttonfromfrom_[% criteri.name %]",
291                 align          : "Tl" 
292                 });     
293             </script>         
294             to
295             <input type="text" size="10" id="to_[% criteri.name %]_value" name="to_[% criteri.name %]_value" value="" />
296             <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfromto_[% criteri.name %]" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />                 
297             <script type="text/javascript">   
298                 Calendar.setup({  
299                 inputField     : "to_[% criteri.name %]_value",
300                 ifFormat       : "[% criteri.DHTMLcalendar_dateformat %]",
301                 button         : "buttonfromto_[% criteri.name %]",
302                 align          : "Tl" 
303                 });     
304             </script>        
305                         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
306             </td>
307         </tr>
308             [% ELSE %]
309             <td>
310                 <select name="[% criteri.name %]_value">
311                 [% FOREACH value IN criteri.values %]
312                 <option value="[% value.availablevalues %]">[% IF ( value.default ) %]Default[% ELSE %][% value.availablevalues |html %][% END %]</option>
313                 [% END %]
314                 </select>
315             </td>
316             </tr>
317             [% END %]
318         [% END %]
319         [% END %]
320     [% END %]
321     </table>
322     </fieldset>
323
324 [% IF ( definitions ) %]
325 <fieldset><legend>Dictionary Definitions</legend><table>
326 [% FOREACH definition IN definitions %]
327     <tr><td><input type="checkbox" name="definition" value="<!--
328 TMPL_VAR NAME="id" -->" /> [% definition.name %]</td></tr>
329 [% END %]
330 </table>
331 [% END %]
332
333 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
334     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
335     <input type="submit" name="submit" value="Next &gt;&gt;" /> </fieldset>
336 </form>
337 [% END %]
338
339
340 [% IF ( build5 ) %]
341 <h3>Step 5 of 6: Pick which columns to total</h3>
342 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
343 <input type="hidden" name="area" value="[% area %]" />
344 <input type="hidden" name="type" value="[% type %]" />
345 <input type="hidden" name="column" value="[% column %]" />
346 <input type="hidden" name="definition" value="[% definition %]" />
347 <input type="hidden" name="criteria" value="[% criteriastring %]" />
348 <fieldset><table>
349 [% FOREACH total_b IN total_by %]
350 <tr><td><input type="checkbox" name="total_by" id="<!-- TMPL_VAR
351 NAME="name" -->" value="<!-- TMPL_VAR
352 NAME="name" -->" /> <label for="<!-- TMPL_VAR
353 NAME="name" -->">[% total_b.name %]</label></td>
354 <td><select name="[% total_b.name %]_tvalue">
355
356 [% FOREACH selec IN total_b.select %]
357 <option value="[% selec.value %]">[% selec.value %]</option>
358 [% END %]
359 </select>
360
361 </td></tr>
362 [% END %]
363 </table></fieldset>
364
365 <fieldset class="action"><input type="hidden" name="phase" value="Choose These Operations" />
366     <input type="button" name="back" value="&lt;&lt; Back" onclick="javascript:history.back()" />
367     <input type="submit" name="submit" value="Next &gt;&gt;" /></fieldset>
368 </form>
369 [% END %]
370
371
372 [% IF ( build6 ) %]
373 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
374 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
375 <input type="hidden" name="area" value="[% area %]" />
376 <input type="hidden" name="type" value="[% type %]" />
377 <input type="hidden" name="column" value="[% column %]" />
378 <input type="hidden" name="criteria" value="[% criteriastring %]" />
379 <input type="hidden" name="definition" value="[% definition %]" />
380 <input type="hidden" name="totals" value="[% totals %]" />
381 <fieldset><table>[% FOREACH order_b IN order_by %]
382 <tr><td><input type="checkbox" id="<!-- TMPL_VAR
383 NAME="name" -->" name="order_by" value="<!-- TMPL_VAR
384 NAME="name" -->" /> <label for="<!-- TMPL_VAR
385 NAME="name" -->">[% order_b.name %]</label></td><td>
386 <select name="[% order_b.name %]_ovalue">
387
388 [% FOREACH selec IN order_b.select %]
389 <option value="[% selec.value %]">[% selec.value %]</option>
390 [% END %]
391 </select>
392 </td></tr>
393
394 [% END %]
395 </table></fieldset>
396
397 <fieldset class="action">
398 <input type="hidden" name="phase" value="Build Report" />
399 <input type="submit" name="submit" value="Finish" /></fieldset>
400 </form>
401 [% END %]
402
403
404 [% IF ( showreport ) %]
405 <h1>Confirm Custom Report</h1>
406 <p>Your report will be generated with the following SQL statement.</p>
407 <p> 
408 [% sql |html %]
409 </p>
410
411 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
412 <input type="hidden" name="sql" value="[% sql %]" />
413 <input type="hidden" name="type" value="[% type %]" />
414 <p>You will need to save the report before you can execute it</p>
415 <fieldset class="action"><input type="hidden" name="phase" value="Save" />  
416 <input type="submit" name="submit" value="Save" />  </fieldset>
417 </form>
418 [% END %]
419
420 [% IF ( save ) %]
421 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
422 <input type="hidden" name="sql" value="[% sql |html %]" />
423 <input type="hidden" name="type" value="[% type %]" />
424 <fieldset class="rows">
425 <legend>Save Your Custom Report</legend>
426 <ol>
427     <li><label for="reportname">Report Name: </label><input type="text" id="reportname" name="reportname" /></li>
428     <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
429 </ol></fieldset>
430 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
431 <input type="submit" name="submit" value="Save Report" /></fieldset>
432 </form>
433 [% END %]
434
435 [% IF ( enter_params ) %]
436     <form action='/cgi-bin/koha/reports/guided_reports.pl'>
437         <input type='hidden' name='phase' value='Run this report' />
438         <input type='hidden' name='reports' value="[% reports %]" />
439         <h1>Enter parameters for report [% name %]:</h1>
440         [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
441         [% FOREACH sql_param IN sql_params %]
442             <p>[% sql_param.entry %]: [% sql_param.input %]</p>
443         [% END %]
444         <input type='submit' value='Run the report'/>
445     </form>
446 [% END %]
447
448 [% IF ( execute ) %]
449 <h1>[% name %]</h1>
450 [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
451 [% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
452 [% sql %]
453 [% DEFAULT pagination_bar="" %]
454 [% UNLESS ( errors ) %]
455 <table>
456 <tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
457 [% FOREACH result IN results %]
458 <tr>
459     [% FOREACH cell IN result.cells %]<td>[% cell.cell %]</td>[% END %]
460 </tr>
461 [% END %]
462 </table>
463 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
464 <fieldset class="action">
465 <label for="format">Download the report: </label>
466 <select name="format" id="format">
467 <option value="csv">Comma Separated Text</option>
468 <option value="tab">Tab Separated Text</option>
469 </select>
470 <input type="hidden" name="sql" value="[% sql |html %]" />
471 <input type="hidden" name="phase" value="Export" />
472 <input type="submit" name="submit" value="Download" /></fieldset>
473 </form>
474 [% END %]
475 [% END %]
476
477 [% IF ( create ) %]
478 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
479 <fieldset class="rows">
480 <legend>Create Report From SQL</legend>
481 <ol>
482     <li><label for="reportname">Report Name:</label> <input type="text" id="reportname" name="reportname" [% IF ( reportname ) %] value="[% reportname %]"[% END %] /> </li>
483     <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% DEFAULT notes="" %]</textarea></li>
484     <li><label for="types">Type:</label>
485         <select id="types" name="types">
486             <option value="1">Tabular</option>
487             <option value="2" disabled="disabled">Summary</option>
488             <option value="3" disabled="disabled">Matrix</option>
489         </select>
490     </li>
491 </ol>
492 </fieldset>
493 <fieldset class="rows">
494 <legend>SQL:</legend>
495 <div style="margin:1em;">
496 <textarea  id="sql" name="sql" cols="50" rows="10">[% DEFAULT sql="" %]</textarea>
497 </div>
498 </fieldset>
499
500 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
501 <input type="submit" name="submit" value="Save Report" /></fieldset>
502 </form>
503 [% END %]
504
505 [% IF ( compound ) %]
506 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
507 Master: <select name="master">
508 [% FOREACH savedreport IN savedreports %]
509 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
510 [% END %]
511 </select>
512 &nbsp;
513 Sub report:<select name="subreport">
514 [% FOREACH savedreport IN savedreports %]
515 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
516 [% END %]
517 </select>
518 <br />
519 <input type="hidden" name="phase" value="Save Compound" />
520 <input type="submit" name="submit" value="Save Compound" />
521 </form>
522 [% END %]
523
524 [% IF ( save_compound ) %]
525 [% master %] <br />
526 [% subsql %]
527 [% END %]
528
529
530 [% IF ( retresults ) %]
531 <h1>Saved Report Results</h1>
532 <h2>[% name %]</h2>
533 <p>[% notes %]</p>
534 <table>
535 [% FOREACH result IN results %]
536 [% result.row %]
537 [% END %]
538 </table>
539 [% END %]
540
541 [% IF ( showsql ) %]
542 <textarea id="sql">[% sql %]</textarea>
543 [% END %]
544
545 [% IF ( editsql ) %]
546 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
547 <input type="hidden" name="phase" value="Update SQL" />
548 <input type="hidden" name="id" value="[% id %]"/>
549 <fieldset class="rows">
550 <legend>Edit SQL</legend>
551 <ol>
552 <li><label for="reportname">Report Name:</label><input type="text" id="reportname" name="reportname" value="[% reportname %]" /></li>
553 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
554 <li><textarea id="sql" name="sql" rows="10" cols="60">[% sql %]</textarea></li>
555 </ol>
556 </fieldset>
557
558 <fieldset class="action">
559 <input type="submit" name="submit" value="Update SQL" /></fieldset>
560 </form>
561
562
563 [% END %]
564
565 [% IF ( save_successful ) %]
566 [% UNLESS ( errors ) %]
567 <h2>Your report has been saved</h2>
568 <p>The report you have created has now been saved. You can now</p>
569 <ul>
570     <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports Page</a></li>
571     <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
572     <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided Reports</a></li>
573 </ul>
574 [% END %]
575 [% END %]
576
577 [% IF ( errors ) %]
578 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
579 <div class="dialog alert">
580 <b>The following error was encountered:</b><br />
581 [% FOREACH error IN errors %]
582     [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr %]</b>.
583     <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
584     <br />Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
585     [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr %]<br />Please check the log for further details.
586     [% ELSE %]
587     [% END %]
588 [% END %]
589 </div>
590 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
591 <input type="submit" name="submit" value="Saved Reports" /></fieldset>
592 </form>
593 [% END %]
594
595 </div>
596 </div>
597 <div class="yui-b">
598 [% INCLUDE 'guided-reports-view.inc' %]
599 </div>
600 </div>
601 <script type="text/javascript">
602 //<![CDATA[
603 function addColumn() {
604     $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
605 }
606 function delColumn() {
607     $("#selectedColumns option:selected").remove();
608 }
609 $("#column_submit").submit(function() {
610     if ($("#selectedColumns option").size() < 1) {
611         alert(_("No columns selected!"));
612         return false;
613     }
614     $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
615     return true;
616 });
617 //]]>
618 </script>
619 [% INCLUDE 'intranet-bottom.inc' %]