Merge remote branch 'kc/new/biblibre_reports' into kcmaster

This commit is contained in:
Chris Cormack 2010-12-14 06:31:00 +13:00
commit 5278aa0ca4
6 changed files with 90 additions and 38 deletions

View file

@ -715,8 +715,9 @@ sub _get_column_defs {
my $full_path_to_columns_def_file="$htdocs/$theme/$lang/$columns_def_file";
open (COLUMNS,$full_path_to_columns_def_file);
while (my $input = <COLUMNS>){
chomp $input;
my @row =split(/\t/,$input);
$columns{$row[0]}=$row[1];
$columns{$row[0]}= $row[1];
}
close COLUMNS;

View file

@ -96,6 +96,7 @@ statistics.itemnumber Item Number
statistics.itemtype Item Type
statistics.borrowernumber Borrower Number
biblio.frameworkcode Framework Code
biblio.author Author
biblio.datecreated Creation Date
biblio.timestamp Modification Date
biblioitems.biblioitemnumber Biblioitem Number

View file

@ -119,15 +119,27 @@ canned reports and writing custom SQL reports.</p>
<td><!-- TMPL_VAR NAME="date_created" --></td>
<td><!-- TMPL_IF NAME="date_run" --><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="date_run" --></a><!-- /TMPL_IF -->
</td>
<td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Show%20SQL">Show SQL</a>
&nbsp; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Edit%20SQL">Edit SQL</a></td>
<td>
<a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Show%20SQL">Show SQL</a>
<!-- TMPL_IF name="CAN_user_reports_create_reports" -->
&nbsp; <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Edit%20SQL">Edit SQL</a>
<!-- /TMPL_IF -->
</td>
<td><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Run%20this%20report">Run</a></td>
<td><a href="/cgi-bin/koha/tools/scheduler.pl?id=<!-- TMPL_VAR NAME="id" -->">Schedule</a></td>
<td><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Delete%20Saved">Delete</a></td></tr>
<!-- TMPL_IF name="CAN_user_reports_create_reports" -->
<td><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=<!-- TMPL_VAR NAME="id" -->&amp;phase=Delete%20Saved">Delete</a></td>
<!-- /TMPL_IF -->
</tr>
<!-- /TMPL_LOOP -->
</table>
</form>
<!-- TMPL_ELSE --><h4>There are no saved reports. <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new?</a></h4><!-- /TMPL_IF -->
<!-- TMPL_ELSE --><h4>There are no saved reports.
<!-- TMPL_IF name="CAN_user_reports_create_reports" -->
<a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new?</a>
<!-- /TMPL_IF -->
</h4>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->

View file

@ -271,6 +271,30 @@
</td>
</tr>
<!-- /TMPL_IF -->
<tr><td>Home branch</td>
<td><input type="radio" name="Line" value="items.homebranch" /></td>
<td><input type="radio" name="Column" value="items.homebranch" /></td>
<td><select name="Filter" id="homebranch">
<option value=""> </option>
<!-- TMPL_LOOP NAME="branchloop" -->
<!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
</td>
</tr>
<tr><td>Holding branch</td>
<td><input type="radio" name="Line" value="items.holdingbranch" /></td>
<td><input type="radio" name="Column" value="items.holdingbranch" /></td>
<td><select name="Filter" id="holdingbranch">
<option value=""> </option>
<!-- TMPL_LOOP NAME="branchloop" -->
<!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
</td>
</tr>
</tbody>
</table><br /></fieldset>

View file

@ -42,11 +42,11 @@ my $input = new CGI;
my $phase = $input->param('phase');
my $flagsrequired;
if ( $phase eq 'Build new' ) {
$flagsrequired = 'create_report';
if ( $phase eq 'Build new' or $phase eq 'Delete Saved' ) {
$flagsrequired = 'create_reports';
}
elsif ( $phase eq 'Use saved' ) {
$flagsrequired = 'execute_report';
$flagsrequired = 'execute_reports';
} else {
$flagsrequired = '*';
}

View file

@ -187,7 +187,7 @@ sub calculate {
# Checking filters
#
my @loopfilter;
for (my $i=0;$i<=10;$i++) {
for (my $i=0;$i<=12;$i++) {
my %cell;
(@$filters[$i]) or next;
if (($i==1) and (@$filters[$i-1])) {
@ -200,17 +200,21 @@ sub calculate {
$cell{filter} = format_date(@$filters[$i]);
}
$cell{crit} =
($i==0) ? "Period From" :
($i==1) ? "Period To" :
($i==2) ? "Patron Category =" :
($i==3) ? "Item Type =" :
($i==4) ? "Library =" :
($i==5) ? "Collection =" :
($i==6) ? "Location =" :
($i==7) ? "Item callnumber >=" :
($i==8) ? "Item callnumber <" :
($i==9) ? "sort1 =" :
($i==10)? "sort2 =" : "UNKNOWN FILTER ($i)";
( $i == 0 ) ? "Period From"
: ( $i == 1 ) ? "Period To"
: ( $i == 2 ) ? "Patron Category ="
: ( $i == 3 ) ? "Item Type ="
: ( $i == 4 ) ? "Library ="
: ( $i == 5 ) ? "Collection ="
: ( $i == 6 ) ? "Location ="
: ( $i == 7 ) ? "Item callnumber >="
: ( $i == 8 ) ? "Item callnumber <"
: ( $i == 9 ) ? "sort1 ="
: ( $i == 10 ) ? "sort2 ="
: ( $i == 11 ) ? "Home library ="
: ( $i == 12 )? "Holding library ="
: "UNKNOWN FILTER ($i)";
# FIXME - no translation mechanism !
push @loopfilter, \%cell;
}
@ -223,29 +227,39 @@ sub calculate {
$debug and warn "filtres ". join "|", @filters;
my ($colsource, $linesource);
$linefilter[1] = @$filters[1] if ($line =~ /datetime/);
$linefilter[0] = ($line =~ /datetime/) ? @$filters[0] :
($line =~ /category/) ? @$filters[2] :
($line =~ /itemtype/) ? @$filters[3] :
($line =~ /branch/ ) ? @$filters[4] :
($line =~ /ccode/ ) ? @$filters[5] :
($line =~ /location/) ? @$filters[6] :
($line =~ /sort1/ ) ? @$filters[9] :
($line =~ /sort2/ ) ? @$filters[10] : undef ;
if ($line =~ /ccode/ or $line =~ /location/) {
$linefilter[0] =
( $line =~ /datetime/ ) ? @$filters[0]
: ( $line =~ /category/ ) ? @$filters[2]
: ( $line =~ /itemtype/ ) ? @$filters[3]
: ( $line =~ /^branch/ ) ? @$filters[4]
: ( $line =~ /ccode/ ) ? @$filters[5]
: ( $line =~ /location/ ) ? @$filters[6]
: ( $line =~ /sort1/ ) ? @$filters[9]
: ( $line =~ /sort2/ ) ? @$filters[10]
: ( $line =~ /homebranch/) ? @$filters[11]
: ( $line =~ /holdingbranch/) ? @$filters[12]
: undef;
if ( $line =~ /ccode/ or $line =~ /location/ or $line =~ /homebranch/ or $line =~ /holdingbranch/ ) {
$linesource = 'items';
}
my @colfilter;
$colfilter[1] = @$filters[1] if ($column =~ /datetime/);
$colfilter[0] = ($column =~ /datetime/) ? @$filters[0] :
($column =~ /category/) ? @$filters[2] :
($column =~ /itemtype/) ? @$filters[3] :
($column =~ /branch/ ) ? @$filters[4] :
($column =~ /ccode/ ) ? @$filters[5] :
($column =~ /location/) ? @$filters[6] :
($column =~ /sort1/ ) ? @$filters[9] :
($column =~ /sort1/ ) ? @$filters[10] : undef ;
if ($column =~ /ccode/ or $column =~ /location/) {
$colfilter[0] =
( $column =~ /datetime/ ) ? @$filters[0]
: ( $column =~ /category/ ) ? @$filters[2]
: ( $column =~ /itemtype/ ) ? @$filters[3]
: ( $column =~ /^branch/ ) ? @$filters[4]
: ( $column =~ /ccode/ ) ? @$filters[5]
: ( $column =~ /location/ ) ? @$filters[6]
: ( $column =~ /sort1/ ) ? @$filters[9]
: ( $column =~ /sort1/ ) ? @$filters[10]
: ( $column =~ /homebranch/) ? @$filters[11]
: ( $column =~ /holdingbranch/) ? @$filters[12]
: undef;
if ( $column =~ /ccode/ or $column =~ /location/ or $column =~ /homebranch/ or $column =~ /holdingbranch/ ) {
$colsource = 'items';
}
# 1st, loop rows.