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

(-)a/reports/issues_avg_stats.pl (-19 / +4 lines)
Lines 254-260 sub calculate { Link Here
254
    $linefilter[2] = @$filters[6] if ($line =~ /returndate/ )  ;
254
    $linefilter[2] = @$filters[6] if ($line =~ /returndate/ )  ;
255
    $linefilter[3] = @$filters[7] if ($line =~ /returndate/ )  ;
255
    $linefilter[3] = @$filters[7] if ($line =~ /returndate/ )  ;
256
    $linefilter[0] = @$filters[8] if ($line =~ /category/ )  ;
256
    $linefilter[0] = @$filters[8] if ($line =~ /category/ )  ;
257
    $linefilter[0] = @$filters[9] if ($line =~ /itemtype/ )  ;
257
    $linefilter[0] = @$filters[9] if ($line eq $itype);
258
    $linefilter[0] = @$filters[10] if ($line =~ /branch/ )  ;
258
    $linefilter[0] = @$filters[10] if ($line =~ /branch/ )  ;
259
    $linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ;
259
    $linefilter[0] = @$filters[11] if ($line =~ /sort1/ ) ;
260
    $linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ;
260
    $linefilter[0] = @$filters[12] if ($line =~ /sort2/ ) ;
Lines 271-277 sub calculate { Link Here
271
    $colfilter[2] = @$filters[6] if ($column =~ /returndate/ )  ;
271
    $colfilter[2] = @$filters[6] if ($column =~ /returndate/ )  ;
272
    $colfilter[3] = @$filters[7] if ($column =~ /returndate/ )  ;
272
    $colfilter[3] = @$filters[7] if ($column =~ /returndate/ )  ;
273
    $colfilter[0] = @$filters[8] if ($column =~ /category/ )  ;
273
    $colfilter[0] = @$filters[8] if ($column =~ /category/ )  ;
274
    $colfilter[0] = @$filters[9] if ($column =~ $itype )  ;
274
    $colfilter[0] = @$filters[9] if ($column eq $itype);
275
    $colfilter[0] = @$filters[10] if ($column =~ /branch/ )  ;
275
    $colfilter[0] = @$filters[10] if ($column =~ /branch/ )  ;
276
    $colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ;
276
    $colfilter[0] = @$filters[11] if ($column =~ /sort1/ ) ;
277
    $colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ;
277
    $colfilter[0] = @$filters[12] if ($column =~ /sort2/ ) ;
Lines 305-314 sub calculate { Link Here
305
                LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber
305
                LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber
306
                LEFT JOIN items ON old_issues.itemnumber=items.itemnumber
306
                LEFT JOIN items ON old_issues.itemnumber=items.itemnumber
307
                LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) 
307
                LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) 
308
                LEFT JOIN issuingrules ON 
309
                    (issuingrules.branchcode=old_issues.branchcode
310
                    AND  issuingrules.itemtype=$itype
311
                    AND  issuingrules.categorycode=borrowers.categorycode) 
312
                WHERE 1";
308
                WHERE 1";
313
    
309
    
314
    if (($line=~/timestamp/) or ($line=~/returndate/)){
310
    if (($line=~/timestamp/) or ($line=~/returndate/)){
Lines 375-384 sub calculate { Link Here
375
                  LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber
371
                  LEFT JOIN borrowers ON borrowers.borrowernumber=old_issues.borrowernumber
376
                  LEFT JOIN items  ON items.itemnumber=old_issues.itemnumber  
372
                  LEFT JOIN items  ON items.itemnumber=old_issues.itemnumber  
377
                  LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) 
373
                  LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) 
378
                  LEFT JOIN issuingrules ON 
379
                    (issuingrules.branchcode=old_issues.branchcode 
380
                    AND  issuingrules.itemtype=$itype
381
                    AND  issuingrules.categorycode=borrowers.categorycode) 
382
                  WHERE 1";
374
                  WHERE 1";
383
    
375
    
384
    if (($column=~/timestamp/) or ($column=~/returndate/)){
376
    if (($column=~/timestamp/) or ($column=~/returndate/)){
Lines 404-416 sub calculate { Link Here
404
    
396
    
405
    my $sth2 = $dbh->prepare( $strsth2 );
397
    my $sth2 = $dbh->prepare( $strsth2 );
406
398
407
    if (( @colfilter ) and ($colfilter[1])){
399
    $sth2->execute;
408
        $sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'");
409
    } elsif ($colfilter[0]) {
410
        $sth2->execute;
411
    } else {
412
        $sth2->execute;
413
    }
414
400
415
    while (my ($celvalue) = $sth2->fetchrow) {
401
    while (my ($celvalue) = $sth2->fetchrow) {
416
        my %cell;
402
        my %cell;
Lines 445-451 sub calculate { Link Here
445
    
431
    
446
# Processing average loanperiods
432
# Processing average loanperiods
447
    $strcalc .= "SELECT $linefield, $colfield, ";
433
    $strcalc .= "SELECT $linefield, $colfield, ";
448
    $strcalc .= " issuedate, returndate, old_issues.timestamp, COUNT(*), date_due, old_issues.renewals, issuelength FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=branchcode AND  issuingrules.itemtype=$itype AND  issuingrules.categorycode=categorycode) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber";
434
    $strcalc .= " issuedate, returndate, COUNT(*) FROM `old_issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) WHERE old_issues.itemnumber=items.itemnumber AND old_issues.borrowernumber=borrowers.borrowernumber";
449
435
450
    @$filters[0]=~ s/\*/%/g if (@$filters[0]);
436
    @$filters[0]=~ s/\*/%/g if (@$filters[0]);
451
    $strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] );
437
    $strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] );
452
- 

Return to bug 13452