Bug 5698: Add date picker option to SQL Runtime Parameters

Adds a date picker for SQL reports with the 'date' authorised_value.  Updates help
documentation for this new feature, as well.

To test:
1.  Create a new report with two date parameters, using the syntax:
<<Label for this selection of date|date>>
2.  Run the report
3.  Select dates
4.  The SQL generated should format the dates properly in ISO, and keep track of which
date is which

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Ian Walls 2012-03-10 09:03:20 -05:00 committed by Paul Poulain
parent 0576342cbb
commit 08b7589b85
2 changed files with 16 additions and 2 deletions

View file

@ -62,7 +62,7 @@
<ul> <ul>
<li>The &lt;&lt; and &gt;&gt; are just delimiters. You must put &lt;&lt; at the beginning and &gt;&gt; at the end of your parameter</li> <li>The &lt;&lt; and &gt;&gt; are just delimiters. You must put &lt;&lt; at the beginning and &gt;&gt; at the end of your parameter</li>
<li>The <strong>Question to ask</strong> will be displayed on the left of the string to enter. <li>The <strong>Question to ask</strong> will be displayed on the left of the string to enter.
<li>The <strong>authorised_value</strong> can be omitted if not applicable. If it contains an authorised value category, or <strong>branches</strong> or <strong>itemtype</strong> or <strong>categorycode</strong>, a list with the Koha authorised values will be displayed instead of a free field</li> <li>The <strong>authorised_value</strong> can be omitted if not applicable. If it contains an authorised value category, or <strong>branches</strong> or <strong>itemtype</strong> or <strong>categorycode</strong>, a list with the Koha authorised values will be displayed instead of a free field. If the authorised value is <strong>date</strong>, a date selector button will be added after the input field</li>
</ul> </ul>
<p>Note that you can have more than one parameter in a given SQL</p> <p>Note that you can have more than one parameter in a given SQL</p>

View file

@ -420,7 +420,21 @@ elsif ($phase eq 'Run this report'){
for(my $i=0;$i<($#split/2);$i++) { for(my $i=0;$i<($#split/2);$i++) {
my ($text,$authorised_value) = split /\|/,$split[$i*2+1]; my ($text,$authorised_value) = split /\|/,$split[$i*2+1];
my $input; my $input;
if ($authorised_value) { if ($authorised_value eq "date") {
$input = qq(<input id="date_$text" type="text" value="" size="10" name="sql_params">
<img id="date_picker_$text" alt="Show Calendar" src="/intranet-tmpl/prog/en/lib/calendar/cal.gif">
<script type="text/javascript">
Calendar.setup(
{
inputField : "date_$text",
ifFormat : "%Y-%m-%d",
button : "date_picker_$text"
}
);
</script>
);
}
elsif ($authorised_value) {
my $dbh=C4::Context->dbh; my $dbh=C4::Context->dbh;
my @authorised_values; my @authorised_values;
my %authorised_lib; my %authorised_lib;