BUGFIXING mail alert on issue arrival
[koha_gimpoz] / reports / guided_reports.pl
index 861c67f..140f48a 100755 (executable)
 # 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
@@ -36,6 +35,7 @@ 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",
@@ -98,11 +98,13 @@ elsif ( $phase eq 'Show SQL'){
 
 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,
                );
        
 }
@@ -135,7 +137,7 @@ elsif ( $phase eq 'Choose this type' ) {
     );
 
     # get columns
-    my $columns = get_columns($area);
+    my $columns = get_columns($area,$input);
     $template->param( 'columns' => $columns );
 }
 
@@ -154,7 +156,7 @@ elsif ( $phase eq 'Choose these columns' ) {
         'type'   => $type,
         'column' => $column,
     );
-    my $criteria = get_criteria($area);
+    my $criteria = get_criteria($area,$input);
     $template->param( 'criteria' => $criteria,
        'definitions' => $definitions);
 }
@@ -317,6 +319,9 @@ elsif ( $phase eq 'Save Report' ) {
     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' ) {