View | Details | Raw Unified | Return to bug 11672
Collapse All | Expand All

(-)a/C4/Reports/Guided.pm (-1 / +5 lines)
Lines 83-90 my $AREA_NAME_SQL_SNIPPET Link Here
83
  = "CASE report_area " .
83
  = "CASE report_area " .
84
    join (" ", map "WHEN '$_->[0]' THEN '$_->[1]'", @REPORT_AREA) .
84
    join (" ", map "WHEN '$_->[0]' THEN '$_->[1]'", @REPORT_AREA) .
85
    " END AS areaname";
85
    " END AS areaname";
86
86
sub get_report_areas {
87
sub get_report_areas {
87
    return \@REPORT_AREA
88
89
    my $report_areas = [ 'CIRC', 'CAT', 'PAT', 'ACQ', 'ACC' ];
90
91
    return $report_areas;
88
}
92
}
89
93
90
my %table_areas = (
94
my %table_areas = (
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt (-57 / +72 lines)
Lines 8-13 Link Here
8
[% INCLUDE 'header.inc' %]
8
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'circ-search.inc' %]
9
[% INCLUDE 'circ-search.inc' %]
10
10
11
[%- BLOCK area_name -%]
12
    [%- SWITCH area -%]
13
        [%- CASE 'CIRC' -%]Circulation
14
        [%- CASE 'CAT'  -%]Catalog
15
        [%- CASE 'PAT'  -%]Patrons
16
        [%- CASE 'ACQ'  -%]Acquisitions
17
        [%- CASE 'ACC'  -%]Accounts
18
    [%- END -%]
19
[%- END -%]
20
11
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
21
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
12
[% IF ( new_dictionary ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Name the new definition</strong>
22
[% IF ( new_dictionary ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Name the new definition</strong>
13
[% ELSIF ( step_2 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 2: Choose the area </strong> 
23
[% ELSIF ( step_2 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 2: Choose the area </strong> 
Lines 36-56 Link Here
36
        <h2>Current terms</h2>
46
        <h2>Current terms</h2>
37
		<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
47
		<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
38
        <input type="hidden" name="phase" value="View Dictionary" />
48
        <input type="hidden" name="phase" value="View Dictionary" />
39
		[% IF ( areas ) %]
49
  [% IF ( areas ) %]
40
			Filter by area <select name="area">
50
        Filter by area
41
			<option value="">All</option>
51
        <select name="area">
42
			[% FOREACH area IN areas %]
52
          <option value="">All</option>
43
			    [% IF ( area.selected ) %]
53
        [% FOREACH area IN areas %]
44
			        <option value="[% area.id %]" selected="selected" >[% area.name %]</option>
54
          [%- IF ( area.selected ) -%]
45
			    [% ELSE %]
55
          <option value="[% area.id %]" selected="selected">[%- PROCESS area_name area=area.id -%]</option>
46
			        <option value="[% area.id %]">[% area.name %]</option>
56
          [%- ELSE -%]
47
			    [% END %]
57
          <option value="[% area.id %]">[%- PROCESS area_name area=area.id -%]</option>
48
			[% END %]
58
          [%- END -%]
49
			</select>
59
        [% END %]
50
			<input name="submit" value="Go" type="submit" />
60
        </select>
51
			</form>
61
      <input name="submit" value="Go" type="submit" />
52
			<br />
62
  [% END %]
53
		[% END %]
63
      </form>
64
      <br />
54
		<table border="1" cellspacing="0" cellpadding="5">
65
		<table border="1" cellspacing="0" cellpadding="5">
55
		<tr>
66
		<tr>
56
		<th>Name</th>
67
		<th>Name</th>
Lines 99-122 Link Here
99
</form>
110
</form>
100
[% END %]
111
[% END %]
101
112
102
[% IF ( step_2 ) %]
113
[%- IF ( step_2 ) -%]
103
<h3>Add new definition</h3>
114
<h3>Add new definition</h3>
104
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
115
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
105
<fieldset class="rows">
116
  <fieldset class="rows">
106
<legend>Step 2 of 5: Choose the area</legend>
117
    <legend>Step 2 of 5: Choose the area</legend>
107
<ol><li><input type="hidden" name="phase" value="New Term step 3" />
118
    <ol>
108
<input type="hidden" name="definition_name" value="[% definition_name %]" />
119
      <li>
109
<input type="hidden" name="definition_description" value="[% definition_description %]" />
120
        <input type="hidden" name="phase" value="New Term step 3" />
110
<label for="area">Select table </label><select name="area" id="area">
121
        <input type="hidden" name="definition_name" value="[% definition_name %]" />
111
[% FOREACH area IN areas %]     
122
        <input type="hidden" name="definition_description" value="[% definition_description %]" />
112
<option value="[% area.id %]">[% area.name %]</option>                  
123
        <label for="area">Select table </label><select name="area" id="area">
113
[% END %]                
124
      [%- FOREACH area IN areas -%]
114
</select></li>
125
        <option value="[%- area.id -%]">[%- PROCESS area_name area=area.id -%]</option>
115
</ol>
126
      [%- END -%]
116
</fieldset>                                                                            
127
        </select>
117
<fieldset class="action"><input name="submit" value="Next" type="submit" /></fieldset>
128
      </li>
129
    </ol>
130
  </fieldset>
131
  <fieldset class="action"><input name="submit" value="Next" type="submit" /></fieldset>
118
</form>
132
</form>
119
[% END %]
133
[%- END -%]
120
134
121
[% IF ( step_3 ) %]
135
[% IF ( step_3 ) %]
122
<h3>Add new definition</h3>
136
<h3>Add new definition</h3>
Lines 227-259 Link Here
227
<h3>Add new definition</h3>
241
<h3>Add new definition</h3>
228
242
229
<fieldset class="rows">
243
<fieldset class="rows">
230
<legend>Step 5 of 5: Confirm details</legend>
244
  <legend>Step 5 of 5: Confirm details</legend>
231
<ol><li>
245
  <ol>
232
<span class="label">Name:</span>
246
    <li>
233
[% definition_name %]
247
      <span class="label">Name:</span>[%- definition_name -%]
234
</li>
248
    </li>
235
<li>
249
    <li>
236
<span class="label">Description:</span>
250
      <span class="label">Description:</span>[%- definition_description -%]
237
[% definition_description %]
251
    </li>
238
</li>
252
    <li>
239
<li>
253
      <span class="label">Area:</span>[%- PROCESS area_name area=area -%]
240
<span class="label">Area:</span>
254
    </li>
241
[% areaname %]
255
    <li>
242
</li>
256
      <span class="label">Data:</span>
243
<li>
257
      <table>
244
<span class="label">Data:</span>
258
        <tr>
245
<table>
259
          <th>Columns</th>
246
<tr>
260
          <th>Values</th>
247
<th>Columns</th>
261
        </tr>
248
<th>Values</th>
262
      [%- FOREACH criteria_loo IN criteria_loop -%]
249
</tr>
263
        <tr>
250
[% FOREACH criteria_loo IN criteria_loop %]
264
          <td>[%- criteria_loo.name -%]</td>
251
<tr>
265
          <td>[%- criteria_loo.value -%]</td>
252
<td>[% criteria_loo.name %]</td>
266
        </tr>
253
<td>[% criteria_loo.value %]</td>
267
      [%- END -%]
254
</tr>
268
      </table>
255
[% END %]
269
    </li>
256
</table></li></ol> </fieldset>  
270
  </ol>
271
</fieldset>
257
272
258
<fieldset class="action"><input type="hidden" name="sql" value="[% query %]" />
273
<fieldset class="action"><input type="hidden" name="sql" value="[% query %]" />
259
<input type="hidden" name="phase" value="New Term step 6" />
274
<input type="hidden" name="phase" value="New Term step 6" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-5 / +20 lines)
Lines 1-4 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
3
[%- BLOCK area_name -%]
4
    [%- SWITCH area -%]
5
        [%- CASE 'CIRC' -%]Circulation
6
        [%- CASE 'CAT'  -%]Catalog
7
        [%- CASE 'PAT'  -%]Patrons
8
        [%- CASE 'ACQ'  -%]Acquisitions
9
        [%- CASE 'ACC'  -%]Accounts
10
    [%- END -%]
11
[%- END -%]
12
2
[% INCLUDE 'doc-head-open.inc' %]
13
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Reports &rsaquo; Guided reports wizard
14
<title>Koha &rsaquo; Reports &rsaquo; Guided reports wizard
4
[% IF ( saved1 ) %]&rsaquo; Saved reports
15
[% IF ( saved1 ) %]&rsaquo; Saved reports
Lines 403-413 canned reports and writing custom SQL reports.</p> Link Here
403
<form action="/cgi-bin/koha/reports/guided_reports.pl">
414
<form action="/cgi-bin/koha/reports/guided_reports.pl">
404
<fieldset class="rows">
415
<fieldset class="rows">
405
<legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and Choose report visibility </legend>
416
<legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and Choose report visibility </legend>
406
<ol><li><label for="area">Choose: </label><select name="area" id="area">
417
<ol>
407
[% FOREACH area IN areas %]
418
  <li>
408
<option value="[% area.id %]">[% area.name %]</option>
419
    <label for="area">Choose: </label>
409
[% END %]
420
      <select name="area" id="area">
410
</select></li>
421
    [%- FOREACH area IN areas -%]
422
      <option value="[% area %]">[%- PROCESS area_name area=area -%]</option>
423
    [%- END -%]
424
      </select>
425
  </li>
411
[% IF (public) %]
426
[% IF (public) %]
412
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
427
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
413
[% ELSE %]
428
[% ELSE %]
(-)a/reports/dictionary.pl (-8 / +9 lines)
Lines 55-61 if ($phase eq 'View Dictionary'){ Link Here
55
    # view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town
55
    # view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town
56
    my $definitions = get_from_dictionary($area);
56
    my $definitions = get_from_dictionary($area);
57
    $template->param(
57
    $template->param(
58
        'areas'=> areas(),
58
        'areas'            => areas( $area ),
59
        'start_dictionary' => 1,
59
        'start_dictionary' => 1,
60
        'definitions'      => $definitions,
60
        'definitions'      => $definitions,
61
    );
61
    );
Lines 70-76 elsif ( $phase eq 'New Term step 2' ) { Link Here
70
    # Choosing the area
70
    # Choosing the area
71
    $template->param(
71
    $template->param(
72
        'step_2'                 => 1,
72
        'step_2'                 => 1,
73
        'areas'                  => areas(),
73
        'areas'                  => areas( $area ),
74
        'definition_name'        => $definition_name,
74
        'definition_name'        => $definition_name,
75
        'definition_description' => $definition_description,
75
        'definition_description' => $definition_description,
76
    );
76
    );
Lines 172-182 elsif ( $phase eq 'New Term step 5' ) { Link Here
172
            $query_criteria .= " AND $crit <= '$value'";
172
            $query_criteria .= " AND $crit <= '$value'";
173
        }
173
        }
174
    }
174
    }
175
    my %report_areas = map @$_, get_report_areas();
176
    $template->param(
175
    $template->param(
177
        'step_5'                 => 1,
176
        'step_5'                 => 1,
178
        'area'                   => $area,
177
        'area'                   => $area,
179
        'areaname'               => $report_areas{$area},
180
        'definition_name'        => $definition_name,
178
        'definition_name'        => $definition_name,
181
        'definition_description' => $definition_description,
179
        'definition_description' => $definition_description,
182
        'query'                  => $query_criteria,
180
        'query'                  => $query_criteria,
Lines 208-221 if (!$no_html){ Link Here
208
}
206
}
209
207
210
sub areas {
208
sub areas {
209
210
    my $selected = shift;
211
211
    my $areas = get_report_areas();
212
    my $areas = get_report_areas();
212
    my @a;
213
    my @a;
213
    foreach (@$areas) {
214
    foreach my $area ( @$areas ) {
214
        push @a, {
215
        push @a, {
215
            id => $_->[0],
216
            id       => $area,
216
            name => $_->[1],
217
            selected => ( $area eq $selected )
217
            selected => ($_->[0] eq $area),
218
        };
218
        };
219
    }
219
    }
220
220
    return \@a;
221
    return \@a;
221
}
222
}
(-)a/reports/guided_reports.pl (-5 / +3 lines)
Lines 87-98 if ( !$phase ) { Link Here
87
elsif ( $phase eq 'Build new' ) {
87
elsif ( $phase eq 'Build new' ) {
88
    # build a new report
88
    # build a new report
89
    $template->param( 'build1' => 1 );
89
    $template->param( 'build1' => 1 );
90
    my $areas = get_report_areas();
91
    $template->param(
90
    $template->param(
92
        'areas' => [map { id => $_->[0], name => $_->[1] }, @$areas],
91
        'areas'        => get_report_areas(),
93
        'usecache' => $usecache,
92
        'usecache'     => $usecache,
94
        'cache_expiry' => 300,
93
        'cache_expiry' => 300,
95
        'public' => '0',
94
        'public'       => '0',
96
    );
95
    );
97
} elsif ( $phase eq 'Use saved' ) {
96
} elsif ( $phase eq 'Use saved' ) {
98
97
99
- 

Return to bug 11672