# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
+
use strict;
-use C4::Auth;
use CGI;
-use C4::Output;
use C4::Reports;
-
+use C4::Auth;
+use C4::Output;
=head1 NAME
Script to control the guided report creation
my $input = new CGI;
my $referer = $input->referer();
+
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "reports/guided_reports_start.tmpl",
}
+elsif ( $phase eq 'Show SQL'){
+
+ my $id = $input->param('reports');
+ my $sql = get_sql($id);
+ $template->param(
+ 'sql' => $sql,
+ 'showsql' => 1,
+ );
+}
+
elsif ($phase eq 'retrieve results') {
my $id = $input->param('id');
- my $results = format_results($id);
+ my ($results,$name,$notes) = format_results($id);
# do something
$template->param(
'retresults' => 1,
'results' => $results,
+ 'name' => $name,
+ 'notes' => $notes,
);
}
);
# get columns
- my $columns = get_columns($area);
+ my $columns = get_columns($area,$input);
$template->param( 'columns' => $columns );
}
'type' => $type,
'column' => $column,
);
- my $criteria = get_criteria($area);
+ my $criteria = get_criteria($area,$input);
$template->param( 'criteria' => $criteria,
'definitions' => $definitions);
}
my $type = $input->param('type');
my $notes = $input->param('notes');
save_report( $sql, $name, $type, $notes );
+ $template->param(
+ 'save_successful' => 1,
+ );
}
elsif ( $phase eq 'Execute' ) {
elsif ($phase eq 'Run this report'){
# execute a saved report
my $report = $input->param('reports');
- my ($sql,$type) = get_saved_report($report);
+ my ($sql,$type,$name,$notes) = get_saved_report($report);
my $results = execute_query($sql,$type);
$template->param(
'results' => $results,
'sql' => $sql,
- 'execute' => 1
+ 'execute' => 1,
+ 'name' => $name,
+ 'notes' => $notes,
);
}