Bug 34478: Add op to reports/dictionary
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
cb79f321e6
commit
2c83be0309
|
|
@ -8,7 +8,7 @@
|
|||
</ul>
|
||||
<h5>Reports dictionary</h5>
|
||||
<ul>
|
||||
<li><a href="/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary">View dictionary</a></li>
|
||||
<li><a href="/cgi-bin/koha/reports/dictionary.pl">View dictionary</a></li>
|
||||
</ul>
|
||||
<h5>Useful resources</h5>
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
[% IF ( start_dictionary ) %]
|
||||
<div id="toolbar">
|
||||
<a id="newdictionary" class="btn btn-default" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition"><i class="fa fa-plus"></i> New definition</a>
|
||||
<a id="newdictionary" class="btn btn-default" href="/cgi-bin/koha/reports/dictionary.pl?op=add_form"><i class="fa fa-plus"></i> New definition</a>
|
||||
</div>
|
||||
[% END %]
|
||||
<h1>Dictionary</h1>
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<h2>Current terms</h2>
|
||||
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="phase" value="View Dictionary" />
|
||||
<input type="hidden" name="op" value="list" />
|
||||
[% IF ( areas ) %]
|
||||
Filter by area
|
||||
<select name="area">
|
||||
|
|
@ -120,17 +120,20 @@
|
|||
<td>[% definition.description | html %]</td>
|
||||
<td>[% definition.areaname | html %]</td>
|
||||
<td>[% definition.saved_sql | html %]</td>
|
||||
<td class="actions"><form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
|
||||
<input type="hidden" name="id" value="[% definition.id | html %]" />
|
||||
<input type="hidden" name="phase" value="Delete Definition" />
|
||||
<button type="submit" name="submit" class="btn btn-default btn-xs" id="delete"><i class="fa fa-trash-can"></i> Delete</button>
|
||||
</form></td>
|
||||
<td class="actions">
|
||||
<form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-delete" />
|
||||
<input type="hidden" name="id" value="[% definition.id | html %]" />
|
||||
<button type="submit" name="submit" class="btn btn-default btn-xs" id="delete"><i class="fa fa-trash-can"></i> Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
</div> <!-- /.page-section -->
|
||||
[% ELSE %]
|
||||
<div class="dialog message">There are no saved definitions. <a id="newdictionary" href="/cgi-bin/koha/reports/dictionary.pl?phase=Add%20New%20Definition">Add a definition to the dictionary.</a></div>
|
||||
<div class="dialog message">There are no saved definitions. <a id="newdictionary" href="/cgi-bin/koha/reports/dictionary.pl?op=add_form">Add a definition to the dictionary.</a></div>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
|
|
@ -149,7 +152,8 @@
|
|||
</li>
|
||||
</ol></fieldset>
|
||||
|
||||
<fieldset class="action"><input type="hidden" name="phase" value="New Term step 2" />
|
||||
<fieldset class="action">
|
||||
<input type="hidden" name="op" value="cud-add_form_2" />
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Next" /></fieldset>
|
||||
</form>
|
||||
[% END %]
|
||||
|
|
@ -162,7 +166,7 @@
|
|||
<legend>Step 2 of 5: Choose the area</legend>
|
||||
<ol>
|
||||
<li>
|
||||
<input type="hidden" name="phase" value="New Term step 3" />
|
||||
<input type="hidden" name="op" value="cud-add_form_3" />
|
||||
<input type="hidden" name="definition_name" value="[% definition_name | html %]" />
|
||||
<input type="hidden" name="definition_description" value="[% definition_description | html %]" />
|
||||
<label for="area">Select table:</label><select name="area" id="area">
|
||||
|
|
@ -208,7 +212,7 @@
|
|||
</optgroup>
|
||||
</select>
|
||||
|
||||
<input type="hidden" name="phase" value="New Term step 4" />
|
||||
<input type="hidden" name="op" value="cud-add_form_4" />
|
||||
</fieldset>
|
||||
<fieldset class="action"><input type="submit" name="submit" class="btn btn-primary" value="Next" /></fieldset>
|
||||
</form>
|
||||
|
|
@ -257,7 +261,7 @@
|
|||
|
||||
[% END %]
|
||||
</ol>
|
||||
<input type="hidden" name="phase" value="New Term step 5" />
|
||||
<input type="hidden" name="op" value="cud-add_form_5" />
|
||||
</fieldset>
|
||||
<fieldset class="action">
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Next" />
|
||||
|
|
@ -306,7 +310,7 @@
|
|||
</fieldset>
|
||||
|
||||
<fieldset class="action"><input type="hidden" name="sql" value="[% query | html %]" />
|
||||
<input type="hidden" name="phase" value="New Term step 6" />
|
||||
<input type="hidden" name="op" value="cud-add_form_6" />
|
||||
<input type="submit" name="submit" class="btn btn-primary" value="Save" /> </fieldset>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
<h5>Reports dictionary</h5>
|
||||
<ul>
|
||||
<li><a href="/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary">View dictionary</a></li>
|
||||
<li><a href="/cgi-bin/koha/reports/dictionary.pl">View dictionary</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Statistics wizards</h2>
|
||||
|
|
|
|||
|
|
@ -34,34 +34,26 @@ Script to control the guided report creation
|
|||
my $input = CGI->new;
|
||||
my $referer = $input->referer();
|
||||
|
||||
my $phase = $input->param('phase') || 'View Dictionary';
|
||||
my $op = $input->param('op') || q{list};
|
||||
my $definition_name = $input->param('definition_name');
|
||||
my $definition_description = $input->param('definition_description');
|
||||
my $area = $input->param('area') || '';
|
||||
my $no_html = 0; # this will be set if we dont want to print out an html::template
|
||||
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
||||
{ template_name => "reports/dictionary.tt",
|
||||
query => $input,
|
||||
type => "intranet",
|
||||
flagsrequired => { reports => '*' },
|
||||
{
|
||||
template_name => "reports/dictionary.tt",
|
||||
query => $input,
|
||||
type => "intranet",
|
||||
flagsrequired => { reports => '*' },
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
if ($phase eq 'View Dictionary'){
|
||||
# view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town
|
||||
my $definitions = get_from_dictionary($area);
|
||||
$template->param(
|
||||
'areas' => areas( $area ),
|
||||
'start_dictionary' => 1,
|
||||
'definitions' => $definitions,
|
||||
);
|
||||
} elsif ( $phase eq 'Add New Definition' ) {
|
||||
if ( $op eq 'add_form' ) {
|
||||
|
||||
# display form allowing them to add a new definition
|
||||
$template->param( 'new_dictionary' => 1, );
|
||||
}
|
||||
|
||||
elsif ( $phase eq 'New Term step 2' ) {
|
||||
elsif ( $op eq 'cud-add_form_2' ) {
|
||||
|
||||
# Choosing the area
|
||||
$template->param(
|
||||
|
|
@ -72,7 +64,7 @@ elsif ( $phase eq 'New Term step 2' ) {
|
|||
);
|
||||
}
|
||||
|
||||
elsif ( $phase eq 'New Term step 3' ) {
|
||||
elsif ( $op eq 'cud-add_form_3' ) {
|
||||
|
||||
# Choosing the columns
|
||||
my $columns = get_columns( $area, $input );
|
||||
|
|
@ -85,7 +77,7 @@ elsif ( $phase eq 'New Term step 3' ) {
|
|||
);
|
||||
}
|
||||
|
||||
elsif ( $phase eq 'New Term step 4' ) {
|
||||
elsif ( $op eq 'cud-add_form_4' ) {
|
||||
|
||||
# Choosing the values
|
||||
my @columns = $input->multi_param('columns');
|
||||
|
|
@ -123,7 +115,7 @@ elsif ( $phase eq 'New Term step 4' ) {
|
|||
);
|
||||
}
|
||||
|
||||
elsif ( $phase eq 'New Term step 5' ) {
|
||||
elsif ( $op eq 'cud-add_form_5' ) {
|
||||
# Confirmation screen
|
||||
my $columnstring = $input->param('columnstring');
|
||||
my @criteria = $input->multi_param('criteria_column');
|
||||
|
|
@ -175,27 +167,33 @@ elsif ( $phase eq 'New Term step 5' ) {
|
|||
);
|
||||
}
|
||||
|
||||
elsif ( $phase eq 'New Term step 6' ) {
|
||||
elsif ( $op eq 'cud-add_form_6' ) {
|
||||
# Saving
|
||||
my $area = $input->param('area');
|
||||
my $sql = $input->param('sql');
|
||||
save_dictionary( $definition_name, $definition_description, $sql, $area );
|
||||
$no_html = 1;
|
||||
print $input->redirect("/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary");
|
||||
$op = "list";
|
||||
|
||||
} elsif ( $phase eq 'Delete Definition' ) {
|
||||
$no_html = 1;
|
||||
} elsif ( $op eq 'cud-delete' ) {
|
||||
my $id = $input->param('id');
|
||||
delete_definition($id);
|
||||
print $input->redirect("/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary");
|
||||
$op = "list";
|
||||
}
|
||||
|
||||
if ($op eq 'list'){
|
||||
# view the dictionary we use to set up abstract variables such as all borrowers over fifty who live in a certain town
|
||||
my $definitions = get_from_dictionary($area);
|
||||
$template->param(
|
||||
'areas' => areas( $area ),
|
||||
'start_dictionary' => 1,
|
||||
'definitions' => $definitions,
|
||||
);
|
||||
}
|
||||
|
||||
$template->param( 'referer' => $referer );
|
||||
|
||||
|
||||
if (!$no_html){
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
}
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
||||
sub areas {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue