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

(-)a/C4/Reports/Guided.pm (-3 / +6 lines)
Lines 468-474 sub execute_query ($;$$$) { Link Here
468
468
469
=item save_report($sql,$name,$type,$notes)
469
=item save_report($sql,$name,$type,$notes)
470
470
471
Given some sql and a name this will saved it so that it can resued
471
Given some sql and a name this will saved it so that it can reused
472
Returns id of the newly created report
472
473
473
=cut
474
=cut
474
475
Lines 478-485 sub save_report { Link Here
478
    $sql =~ s/(\s*\;\s*)$//; # removes trailing whitespace and /;/
479
    $sql =~ s/(\s*\;\s*)$//; # removes trailing whitespace and /;/
479
    my $query =
480
    my $query =
480
"INSERT INTO saved_sql (borrowernumber,date_created,last_modified,savedsql,report_name,type,notes)  VALUES (?,now(),now(),?,?,?,?)";
481
"INSERT INTO saved_sql (borrowernumber,date_created,last_modified,savedsql,report_name,type,notes)  VALUES (?,now(),now(),?,?,?,?)";
481
    my $sth = $dbh->prepare($query);
482
    $dbh->do( $query, undef, $borrowernumber, $sql, $name, $type, $notes );
482
    $sth->execute( $borrowernumber, $sql, $name, $type, $notes );
483
    my $id = $dbh->selectrow_array("SELECT max(id) FROM saved_sql WHERE borrowernumber=? AND report_name=?", undef,
484
                                   $borrowernumber, $name);
485
    return $id;
483
}
486
}
484
487
485
sub update_sql {
488
sub update_sql {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl (+3 lines)
Lines 617-622 Sub report:<select name="subreport"> Link Here
617
<h2>Your report has been saved</h2>
617
<h2>Your report has been saved</h2>
618
<p>The report you have created has now been saved. You can now</p>
618
<p>The report you have created has now been saved. You can now</p>
619
<ul>
619
<ul>
620
    <!-- TMPL_IF NAME="id"  -->
621
    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Run%20this%20report">Run this report</a></li>
622
    <!-- /TMPL_IF -->
620
    <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports Page</a></li>
623
    <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved Reports Page</a></li>
621
    <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
624
    <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler Tool</a></li>
622
    <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided Reports</a></li>
625
    <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided Reports</a></li>
(-)a/reports/guided_reports.pl (-2 / +2 lines)
Lines 367-375 elsif ( $phase eq 'Save Report' ) { Link Here
367
        );
367
        );
368
    }
368
    }
369
    else {
369
    else {
370
        save_report( $borrowernumber, $sql, $name, $type, $notes );
370
        my $id = save_report( $borrowernumber, $sql, $name, $type, $notes );
371
        $template->param(
371
        $template->param(
372
            'save_successful'       => 1,
372
            'save_successful'       => 1,
373
            'id'                    => $id,
373
        );
374
        );
374
    }
375
    }
375
}
376
}
376
- 

Return to bug 6024