}
my $sth = $dbh->prepare($sql);
$sth->execute();
- my $colnames=$sth->{'NAME'};
- my @results;
- my $row;
- my %temphash;
- $row = join ('</th><th>',@$colnames);
- $row = "<tr><th>$row</th></tr>";
- $temphash{'row'} = $row;
- push @results, \%temphash;
+ my $colnames=$sth->{'NAME'};
+ my @results;
+ my $row;
+ my %temphash;
+ $row = join ('</th><th>',@$colnames);
+ $row = "<tr><th>$row</th></tr>";
+ $temphash{'row'} = $row;
+ push @results, \%temphash;
my $string;
- my @xmlarray;
+ my @xmlarray;
while ( my @data = $sth->fetchrow_array() ) {
-
+ # if the field is a date field, it needs formatting
+ foreach my $data (@data) {
+ next unless $data =~ C4::Dates->regexp("iso");
+ my $date = C4::Dates->new($data, "iso");
+ $data = $date->output();
+ }
# tabular
my %temphash;
my $row = join( '</td><td>', @data );
<script type="text/javascript">
Calendar.setup({
inputField : "<!-- TMPL_VAR NAME="name" -->_start_value",
-ifFormat : "%Y-%m-%d",
+ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
button : "buttonfrom1",
align : "Tl"
});
<td>End of date range</td>
<td>
<input type="text" size="10" id="<!-- TMPL_VAR NAME="name" -->_end_value" name="<!-- TMPL_VAR NAME="name" -->_end_value" value="" />
-<img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfrom1" style="cursor: pointer;" />
+<img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfrom2" style="cursor: pointer;" />
<script type="text/javascript">
Calendar.setup({
inputField : "<!-- TMPL_VAR NAME="name" -->_end_value",
-ifFormat : "%Y-%m-%d",
-button : "buttonfrom1",
+ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+button : "buttonfrom2",
align : "Tl"
});
</script>
<input type="submit" name="submit" value="Next >>" /></fieldset>
</form>
</div>
-<div class="yui-gb"><div class="yui-u first">Tabular:
-<img src="<!-- TMPL_VAR name="themelang" -->/../img/reports-tabular-graphic.gif" alt="" /></div>
+<div class="yui-gb"><div class="yui-u first"></div>
<!--- Summary and Matrix reports have not yet been implemented-->
<!--<div class="yui-u">Summary:
/><img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="buttonfrom<!-- TMPL_VAR NAME="name" -->" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
<script type="text/javascript">
Calendar.setup({
-inputField : "<!-- TMPL_VAR NAME="name" -->_value",
-ifFormat : "%Y-%m-%d",
-button : "buttonfrom<!-- TMPL_VAR NAME="name" -->",
+inputField : "<!-- TMPL_VAR NAME="name" -->_value",
+ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+button : "buttonfrom<!-- TMPL_VAR NAME="name" -->",
align : "Tl"
});
</script>
use CGI;
use C4::Output;
use C4::Reports;
+use C4::Dates qw( DHTMLcalendar );
=head1 NAME
'definition_description' => $definition_description,
'columns' => \@column_loop,
'columnstring' => $columnstring,
-
+ 'DHTMLcalendar_dateformat' => C4::Dates->DHTMLcalendar(),
);
}
foreach my $crit (@criteria) {
my $value = $input->param( $crit . "_value" );
if ($value) {
- $query_criteria .= " AND $crit='$value'";
- my %tmp_hash;
- $tmp_hash{'name'}=$crit;
- $tmp_hash{'value'} = $value;
- push @criteria_loop,\%tmp_hash;
+ my %tmp_hash;
+ $tmp_hash{'name'}=$crit;
+ $tmp_hash{'value'} = $value;
+ push @criteria_loop,\%tmp_hash;
+ if ($value =~ C4::Dates->regexp(C4::Context->preference('dateformat'))) {
+ my $date = C4::Dates->new($value);
+ $value = $date->output("iso");
+ }
+ $query_criteria .= " AND $crit='$value'";
}
-
$value = $input->param( $crit . "_start_value" );
if ($value) {
- $query_criteria .= " AND $crit > '$value'";
- my %tmp_hash;
- $tmp_hash{'name'}="$crit Start";
- $tmp_hash{'value'} = $value;
- push @criteria_loop,\%tmp_hash;
+ my %tmp_hash;
+ $tmp_hash{'name'}="$crit Start";
+ $tmp_hash{'value'} = $value;
+ push @criteria_loop,\%tmp_hash;
+ if ($value =~ C4::Dates->regexp(C4::Context->preference('dateformat'))) {
+ my $date = C4::Dates->new($value);
+ $value = $date->output("iso");
+ }
+ $query_criteria .= " AND $crit >= '$value'";
}
$value = $input->param( $crit . "_end_value" );
if ($value) {
- $query_criteria .= " AND $crit <= '$value'";
- my %tmp_hash;
- $tmp_hash{'name'}="$crit End";
- $tmp_hash{'value'} = $value;
- push @criteria_loop,\%tmp_hash;
+ my %tmp_hash;
+ $tmp_hash{'name'}="$crit End";
+ $tmp_hash{'value'} = $value;
+ push @criteria_loop,\%tmp_hash;
+ if ($value =~ C4::Dates->regexp(C4::Context->preference('dateformat'))) {
+ my $date = C4::Dates->new($value);
+ $value = $date->output("iso");
+ }
+ $query_criteria .= " AND $crit <= '$value'";
}
}
$template->param( 'step_5' => 1,
$no_html=1;
my $id = $input->param('id');
delete_definition($id);
- print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=View%20Dictionary");
+ print $input->redirect("/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary");
}
$template->param( 'referer' => $referer );
use C4::Reports;
use C4::Auth;
use C4::Output;
+use C4::Dates qw( DHTMLcalendar );
+
=head1 NAME
Script to control the guided report creation
foreach my $crit (@criteria) {
my $value = $input->param( $crit . "_value" );
if ($value) {
+ if ($value =~ C4::Dates->regexp(C4::Context->preference('dateformat'))) {
+ my $date = C4::Dates->new($value);
+ $value = $date->output("iso");
+ }
$query_criteria .= " AND $crit='$value'";
}
}
'area' => $area,
'type' => $type,
'column' => $column,
- 'definition' => $definition,
+ 'definition' => $definition,
'criteriastring' => $query_criteria,
);
'column' => $column,
'criteriastring' => $criteria,
'totals' => $totals,
- 'definition' => $definition,
+ 'definition' => $definition,
);
# get columns
my $results = execute_query($sql,$type);
$template->param(
'results' => $results,
- 'sql' => $sql,
+ 'sql' => $sql,
'execute' => 1
);
}
my $report = $input->param('reports');
my ($sql,$type,$name,$notes) = get_saved_report($report);
my $results = execute_query($sql,$type);
- $template->param(
- 'results' => $results,
- 'sql' => $sql,
- 'execute' => 1,
- 'name' => $name,
- 'notes' => $notes,
- );
+ $template->param(
+ 'results' => $results,
+ 'sql' => $sql,
+ 'execute' => 1,
+ 'name' => $name,
+ 'notes' => $notes,
+ );
}
elsif ($phase eq 'Export'){
}
-$template->param( 'referer' => $referer );
+$template->param( 'referer' => $referer,
+ 'DHTMLcalendar_dateformat' => C4::Dates->DHTMLcalendar(),
+ );
if (!$no_html){