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

(-)a/C4/Members.pm (-6 / +58 lines)
Lines 45-50 BEGIN { Link Here
45
		&Search
45
		&Search
46
		&SearchMember 
46
		&SearchMember 
47
		&GetMemberDetails
47
		&GetMemberDetails
48
        &GetMemberRelatives
48
		&GetMember
49
		&GetMember
49
50
50
		&GetGuarantees 
51
		&GetGuarantees 
Lines 580-585 sub GetMember { Link Here
580
    return;
581
    return;
581
}
582
}
582
583
584
=head2 GetMemberRelatives
585
586
 @borrowernumbers = GetMemberRelatives($borrowernumber);
587
588
 C<GetMemberRelatives> returns a borrowersnumber's list of guarantor/guarantees of the member given in parameter
589
590
=cut 
591
sub GetMemberRelatives {
592
    my $borrowernumber = shift;
593
    my $dbh = C4::Context->dbh;
594
    my @glist;
595
596
    # Getting guarantor
597
    my $query = "SELECT guarantorid FROM borrowers WHERE borrowernumber=?";
598
    my $sth = $dbh->prepare($query);
599
    $sth->execute($borrowernumber);
600
    my $data = $sth->fetchrow_arrayref();
601
    push @glist, $data->[0] if $data->[0];
602
    my $guarantor = $data->[0] if $data->[0];
603
604
    # Getting guarantees
605
    $query = "SELECT borrowernumber FROM borrowers WHERE guarantorid=?";
606
    $sth = $dbh->prepare($query);
607
    $sth->execute($borrowernumber);
608
    while ($data = $sth->fetchrow_arrayref()) {
609
       push @glist, $data->[0];
610
    }
611
612
    # Getting sibling guarantees
613
    if ($guarantor) {
614
        $query = "SELECT borrowernumber FROM borrowers WHERE guarantorid=?";
615
        $sth = $dbh->prepare($query);
616
        $sth->execute($guarantor);
617
        while ($data = $sth->fetchrow_arrayref()) {
618
           push @glist, $data->[0] if ($data->[0] != $borrowernumber);
619
        }
620
    }
621
622
    return @glist;
623
}
583
624
584
=head2 IsMemberBlocked
625
=head2 IsMemberBlocked
585
626
Lines 961-967 sub UpdateGuarantees { Link Here
961
}
1002
}
962
=head2 GetPendingIssues
1003
=head2 GetPendingIssues
963
1004
964
  my $issues = &GetPendingIssues($borrowernumber);
1005
  my $issues = &GetPendingIssues(@borrowernumber);
965
1006
966
Looks up what the patron with the given borrowernumber has borrowed.
1007
Looks up what the patron with the given borrowernumber has borrowed.
967
1008
Lines 974-987 The keys include C<biblioitems> fields except marc and marcxml. Link Here
974
1015
975
#'
1016
#'
976
sub GetPendingIssues {
1017
sub GetPendingIssues {
977
    my ($borrowernumber) = @_;
1018
    my (@borrowernumbers) = @_;
1019
1020
    # Borrowers part of the query
1021
    my $bquery = '';
1022
    for (my $i = 0; $i < @borrowernumbers; $i++) {
1023
        $bquery .= " borrowernumber = ?";
1024
        $bquery .= " OR" if ($i < (scalar(@borrowernumbers) - 1));
1025
    }
1026
978
    # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
1027
    # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
979
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
1028
    # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
980
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
1029
    # FIXME: circ/ciculation.pl tries to sort by timestamp!
981
    # FIXME: C4::Print::printslip tries to sort by timestamp!
1030
    # FIXME: C4::Print::printslip tries to sort by timestamp!
982
    # FIXME: namespace collision: other collisions possible.
1031
    # FIXME: namespace collision: other collisions possible.
983
    # FIXME: most of this data isn't really being used by callers.
1032
    # FIXME: most of this data isn't really being used by callers.
984
    my $sth = C4::Context->dbh->prepare(
1033
    my $query =
985
   "SELECT issues.*,
1034
   "SELECT issues.*,
986
            items.*,
1035
            items.*,
987
           biblio.*,
1036
           biblio.*,
Lines 998-1013 sub GetPendingIssues { Link Here
998
           biblioitems.url,
1047
           biblioitems.url,
999
           issues.timestamp AS timestamp,
1048
           issues.timestamp AS timestamp,
1000
           issues.renewals  AS renewals,
1049
           issues.renewals  AS renewals,
1050
           issues.borrowernumber AS borrowernumber,
1001
            items.renewals  AS totalrenewals
1051
            items.renewals  AS totalrenewals
1002
    FROM   issues
1052
    FROM   issues
1003
    LEFT JOIN items       ON items.itemnumber       =      issues.itemnumber
1053
    LEFT JOIN items       ON items.itemnumber       =      issues.itemnumber
1004
    LEFT JOIN biblio      ON items.biblionumber     =      biblio.biblionumber
1054
    LEFT JOIN biblio      ON items.biblionumber     =      biblio.biblionumber
1005
    LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
1055
    LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
1006
    WHERE
1056
    WHERE
1007
      borrowernumber=?
1057
      $bquery
1008
    ORDER BY issues.issuedate"
1058
    ORDER BY issues.issuedate"
1009
    );
1059
    ;
1010
    $sth->execute($borrowernumber);
1060
1061
    my $sth = C4::Context->dbh->prepare($query);
1062
    $sth->execute(@borrowernumbers);
1011
    my $data = $sth->fetchall_arrayref({});
1063
    my $data = $sth->fetchall_arrayref({});
1012
    my $today = C4::Dates->new->output('iso');
1064
    my $today = C4::Dates->new->output('iso');
1013
    foreach (@$data) {
1065
    foreach (@$data) {
(-)a/circ/circulation.pl (-5 / +35 lines)
Lines 42-47 use Date::Calc qw( Link Here
42
  Add_Delta_Days
42
  Add_Delta_Days
43
  Date_to_Days
43
  Date_to_Days
44
);
44
);
45
use List::MoreUtils qw/uniq/;
45
46
46
47
47
#
48
#
Lines 419-433 my $todaysissues = ''; Link Here
419
my $previssues   = '';
420
my $previssues   = '';
420
my @todaysissues;
421
my @todaysissues;
421
my @previousissues;
422
my @previousissues;
423
my @relissues;
424
my @relprevissues;
425
my $displayrelissues;
422
426
423
my $totalprice = 0;
427
my $totalprice = 0;
424
428
425
if ($borrower) {
429
sub build_issue_data {
426
# get each issue of the borrower & separate them in todayissues & previous issues
430
    my $issueslist = shift;
427
    my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'});
431
    my $relatives = shift;
432
428
    # split in 2 arrays for today & previous
433
    # split in 2 arrays for today & previous
429
    foreach my $it ( @$issueslist ) {
434
    foreach my $it ( @$issueslist ) {
430
        my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} );
435
        my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $it->{'itype'} : $it->{'itemtype'} );
436
437
        # Getting borrower details
438
        my $memberdetails = GetMemberDetails($it->{'borrowernumber'});
439
        $it->{'borrowername'} = $memberdetails->{'firstname'} . " " . $memberdetails->{'surname'};
440
431
        # set itemtype per item-level_itype syspref - FIXME this is an ugly hack
441
        # set itemtype per item-level_itype syspref - FIXME this is an ugly hack
432
        $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'};
442
        $it->{'itemtype'} = ( C4::Context->preference( 'item-level_itypes' ) ) ? $it->{'itype'} : $it->{'itemtype'};
433
443
Lines 455-465 if ($borrower) { Link Here
455
        $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}};
465
        $it->{'renew_failed'} = $renew_failed{$it->{'itemnumber'}};
456
466
457
        if ( $todaysdate eq $it->{'issuedate'} or $todaysdate eq $it->{'lastreneweddate'} ) {
467
        if ( $todaysdate eq $it->{'issuedate'} or $todaysdate eq $it->{'lastreneweddate'} ) {
458
            push @todaysissues, $it;
468
            (!$relatives) ? push @todaysissues, $it : push @relissues, $it;
459
        } else {
469
        } else {
460
            push @previousissues, $it;
470
            (!$relatives) ? push @previousissues, $it : push @relprevissues, $it;
461
        }
471
        }
462
    }
472
    }
473
}
474
475
if ($borrower) {
476
477
    # Getting borrower relatives
478
    my @relborrowernumbers = GetMemberRelatives($borrower->{'borrowernumber'});
479
    #push @borrowernumbers, $borrower->{'borrowernumber'};
480
481
    # get each issue of the borrower & separate them in todayissues & previous issues
482
    my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'});
483
    my ($relissueslist) = GetPendingIssues(@relborrowernumbers);
484
485
    build_issue_data($issueslist, 0);
486
    build_issue_data($relissueslist, 1);
487
  
488
    $displayrelissues = scalar($relissueslist);
489
463
    if ( C4::Context->preference( "todaysIssuesDefaultSortOrder" ) eq 'asc' ) {
490
    if ( C4::Context->preference( "todaysIssuesDefaultSortOrder" ) eq 'asc' ) {
464
        @todaysissues   = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
491
        @todaysissues   = sort { $a->{'timestamp'} cmp $b->{'timestamp'} } @todaysissues;
465
    }
492
    }
Lines 657-662 $template->param( Link Here
657
    totaldue          => sprintf('%.2f', $total),
684
    totaldue          => sprintf('%.2f', $total),
658
    todayissues       => \@todaysissues,
685
    todayissues       => \@todaysissues,
659
    previssues        => \@previousissues,
686
    previssues        => \@previousissues,
687
    relissues			=> \@relissues,
688
    relprevissues		=> \@relprevissues,
689
    displayrelissues		=> $displayrelissues,
660
    inprocess         => $inprocess,
690
    inprocess         => $inprocess,
661
    memberofinstution => $member_of_institution,
691
    memberofinstution => $member_of_institution,
662
    CGIorganisations  => $CGIorganisations,
692
    CGIorganisations  => $CGIorganisations,
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc (-1 / +1 lines)
Lines 1-6 Link Here
1
<tfoot>
1
<tfoot>
2
	<tr>
2
	<tr>
3
		<td colspan="5" style="text-align: right; font-weight:bold;">Totals:</td>
3
        <td colspan="5" style="text-align: right; font-weight:bold;">Totals:</td>
4
		<td><!-- TMPL_VAR NAME="totaldue" --></td>
4
		<td><!-- TMPL_VAR NAME="totaldue" --></td>
5
		<td><!-- TMPL_VAR NAME="totalprice" --></td>
5
		<td><!-- TMPL_VAR NAME="totalprice" --></td>
6
		<td colspan="2">
6
		<td colspan="2">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl (-1 / +99 lines)
Lines 24-32 if($.cookie("holdfor") != <!-- TMPL_VAR NAME="borrowernumber" -->){ $.cookie("ho Link Here
24
		dateFormat: 'uk',<!-- /TMPL_IF -->
24
		dateFormat: 'uk',<!-- /TMPL_IF -->
25
		headers: { 1: { sorter: 'articles' },5: { sorter: false },6:{sorter:false},7:{sorter:false},8:{sorter:false}}
25
		headers: { 1: { sorter: 'articles' },5: { sorter: false },6:{sorter:false},7:{sorter:false},8:{sorter:false}}
26
		});
26
		});
27
		$("#relissuest").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
28
		dateFormat: 'uk',<!-- /TMPL_IF -->
29
		headers: { 1: { sorter: 'articles' },5: { sorter: false },6:{sorter:false},7:{sorter:false},8:{sorter:false}}
30
		});
31
32
		//FIXME: Sorting does not work when there are previous checkouts only
33
		// (It works fine when there are only checkouts of the day, or both previous and today checkouts)
27
		$("#issuest").bind("sortEnd",function() {
34
		$("#issuest").bind("sortEnd",function() {
28
        	$("#previous").parents("tr").remove();  // 'previous checkouts' header chokes table sorter
35
        	$("#previous").parents("tr").remove();  // 'previous checkouts' header chokes table sorter
29
	    });
36
	    });
37
		$("#relissuest").bind("sortEnd",function() {
38
		    $("#relprevious").parents("tr").remove();  // 'previous checkouts' header chokes table sorter
39
		});
30
		$("#holdst").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
40
		$("#holdst").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
31
		dateFormat: 'uk',<!-- /TMPL_IF -->
41
		dateFormat: 'uk',<!-- /TMPL_IF -->
32
			sortList: [[0,0]],
42
			sortList: [[0,0]],
Lines 62-67 var allcheckboxes = $(".checkboxed"); Link Here
62
		$(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false;
72
		$(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false;
63
	});
73
	});
64
74
75
    $("#relrenew_all").click(function(){
76
        $(allcheckboxes).checkCheckboxes(":input[name*=items]");
77
        $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]");
78
    });
79
    $("#relCheckAllitems").click(function(){
80
        $(allcheckboxes).checkCheckboxes(":input[name*=items]");
81
        $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false;
82
    });
83
    $("#relCheckNoitems").click(function(){
84
        $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false;
85
    });
86
    $("#relCheckAllreturns").click(function(){
87
        $(allcheckboxes).checkCheckboxes(":input[name*=barcodes]");
88
        $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false;
89
    });
90
    $("#relCheckNoreturns").click(function(){
91
        $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false;
92
    });
93
65
    <!-- TMPL_IF NAME="CAN_user_circulate_override_renewals" -->
94
    <!-- TMPL_IF NAME="CAN_user_circulate_override_renewals" -->
66
    <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
95
    <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
67
    $( '#override_limit' ).click( function () {
96
    $( '#override_limit' ).click( function () {
Lines 659-664 No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> Link Here
659
        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;type=intra"><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong></a><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="itemnotes" -->- <span class="circ-hlt"><!-- TMPL_VAR name="itemnotes" --></span><!-- /TMPL_IF --> <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
688
        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;type=intra"><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong></a><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="itemnotes" -->- <span class="circ-hlt"><!-- TMPL_VAR name="itemnotes" --></span><!-- /TMPL_IF --> <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
660
        <td><!-- TMPL_UNLESS NAME="noItemTypeImages" --> <!-- TMPL_IF NAME="itemtype_image" --><img src="<!-- TMPL_VAR NAME="itemtype_image" -->" alt="" /><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- TMPL_VAR NAME="itemtype" --></td>
689
        <td><!-- TMPL_UNLESS NAME="noItemTypeImages" --> <!-- TMPL_IF NAME="itemtype_image" --><img src="<!-- TMPL_VAR NAME="itemtype_image" -->" alt="" /><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- TMPL_VAR NAME="itemtype" --></td>
661
        <td><!-- TMPL_VAR NAME="checkoutdate" --></td>
690
        <td><!-- TMPL_VAR NAME="checkoutdate" --></td>
691
        <!-- TMPL_IF NAME="multiple_borrowers" --><td><!-- TMPL_VAR NAME="borrowername" --></td><!-- /TMPL_IF -->
662
        <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
692
        <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
663
            <td><!-- TMPL_VAR NAME="charge" --></td>
693
            <td><!-- TMPL_VAR NAME="charge" --></td>
664
            <td><!-- TMPL_VAR NAME="replacementprice" --></td>
694
            <td><!-- TMPL_VAR NAME="replacementprice" --></td>
Lines 726-731 No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> Link Here
726
            <!-- TMPL_VAR NAME="itemtype" -->
756
            <!-- TMPL_VAR NAME="itemtype" -->
727
        </td>
757
        </td>
728
        <td><!-- TMPL_VAR NAME="displaydate" --></td>
758
        <td><!-- TMPL_VAR NAME="displaydate" --></td>
759
        <!-- TMPL_IF NAME="multiple_borrowers" --><td><!-- TMPL_VAR NAME="borrowername" --></td><!-- /TMPL_IF -->
729
        <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
760
        <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
730
        <td><!-- TMPL_VAR NAME="charge" --></td>
761
        <td><!-- TMPL_VAR NAME="charge" --></td>
731
        <td><!-- TMPL_VAR NAME="replacementprice" --></td>
762
        <td><!-- TMPL_VAR NAME="replacementprice" --></td>
Lines 787-796 No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span> Link Here
787
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
818
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
788
        </fieldset>
819
        </fieldset>
789
    <!-- /TMPL_IF -->
820
    <!-- /TMPL_IF -->
790
</form>
791
<!-- TMPL_ELSE -->
821
<!-- TMPL_ELSE -->
792
<p>Patron has nothing checked out.</p>
822
<p>Patron has nothing checked out.</p>
793
<!-- /TMPL_IF -->
823
<!-- /TMPL_IF -->
824
825
826
<!-- TMPL_IF NAME="displayrelissues" -->
827
<h2>Relatives issues</h2>
828
    <table id="relissuest">
829
    <thead>
830
    <tr>
831
        <th scope="col">Due date</th>
832
        <th scope="col">Title</th>
833
        <th scope="col">Item Type</th>
834
        <th scope="col">Branch</th>
835
        <th scope="col">Checked out on</th> 
836
        <th scope="col">Charge</th>
837
	<th scope="col">Borrower</th>
838
        <th scope="col">Material</th>
839
    </tr>
840
    </thead>
841
<!-- TMPL_IF NAME="relissues" -->	<tbody>
842
843
    <!-- TMPL_LOOP NAME="relissues" -->
844
    <!-- TMPL_IF NAME="__odd__" -->
845
    <tr>
846
    <!-- TMPL_ELSE -->
847
    <tr class="highlight">
848
    <!-- /TMPL_IF -->
849
        <!-- TMPL_IF NAME="overdue" --><td class="od"><!-- TMPL_ELSE --><td><!-- /TMPL_IF -->
850
            <!-- TMPL_VAR NAME="dd" --></td>
851
        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;type=intra"><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong></a><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="itemnotes" -->- <span class="circ-hlt"><!-- TMPL_VAR name="itemnotes" --></span><!-- /TMPL_IF --> <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
852
        <td><!-- TMPL_UNLESS NAME="noItemTypeImages" --> <!-- TMPL_IF NAME="itemtype_image" --><img src="<!-- TMPL_VAR NAME="itemtype_image" -->" alt="" /><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- TMPL_VAR NAME="itemtype" --></td>
853
	<td><!-- TMPL_VAR NAME="branchdisplay" -->
854
        <!--TMPL_IF Name="itemcallnumber"-->(<!-- TMPL_VAR NAME="itemcallnumber" -->)<!--/TMPL_IF--></td>
855
        <td><!-- TMPL_VAR NAME="displaydate" --></td>
856
            <td><!-- TMPL_VAR NAME="charge" --></td>
857
            <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="borrowername" --></a></td>
858
            <td><!-- TMPL_VAR NAME="materials" --></td>
859
    </tr>
860
    <!-- /TMPL_LOOP --> <!-- /loop todayissues -->
861
    <!-- /if todayissues --><!-- /TMPL_IF -->
862
<!-- TMPL_IF NAME="relprevissues" -->
863
<tr><th class="{sorter: false}" colspan="10"><a name="relprevious" id="relprevious"></a>Previous checkouts</th></tr>
864
    <!-- TMPL_LOOP NAME="relprevissues" -->
865
    <!-- TMPL_IF NAME="__odd__" -->
866
        <tr>
867
    <!-- TMPL_ELSE -->
868
        <tr class="highlight">
869
    <!-- /TMPL_IF -->
870
        <!-- TMPL_IF NAME="overdue" --><td class="od"><!-- TMPL_ELSE --><td><!-- /TMPL_IF -->
871
        <!-- TMPL_VAR NAME="dd" -->
872
        </td>
873
        <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;type=intra"><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong></a><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR NAME="author" --><!-- /TMPL_IF --> <!-- TMPL_IF NAME="itemnotes" -->- <!-- TMPL_VAR name="itemnotes" --><!-- /TMPL_IF --> <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
874
        <td>
875
            <!-- TMPL_VAR NAME="itemtype" -->
876
        </td>
877
	<td><!-- TMPL_VAR NAME="branchdisplay" -->
878
        <!--TMPL_IF NAME="itemcallnumber"-->(<!-- TMPL_VAR NAME="itemcallnumber" -->)<!--/TMPL_IF--></td>
879
        <td><!-- TMPL_VAR NAME="displaydate" --></td>
880
	<!-- TMPL_IF NAME="multiple_borrowers" --><td><!-- TMPL_VAR NAME="borrowername" --></td><!-- /TMPL_IF -->
881
        <td><!-- TMPL_VAR NAME="charge" --></td>
882
	<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="borrowername" --></a></td>
883
        <td><!-- TMPL_VAR NAME="materials" --></td>
884
    </tr>
885
    <!-- /loop previssues --><!-- /TMPL_LOOP -->
886
<!--/if previssues --><!-- /TMPL_IF -->
887
      </tbody>
888
    </table>
889
</form>
890
<!-- /TMPL_IF --><!-- end displayrelissues --> 
891
794
</div>
892
</div>
795
893
796
894
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl (-11 / +75 lines)
Lines 17-23 $(document).ready(function() { Link Here
17
	$.tablesorter.defaults.widgets = ['zebra'];
17
	$.tablesorter.defaults.widgets = ['zebra'];
18
	$("#issuest").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
18
	$("#issuest").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
19
		dateFormat: 'uk',<!-- /TMPL_IF -->
19
		dateFormat: 'uk',<!-- /TMPL_IF -->
20
		headers: { 1: { sorter: 'articles' },5: { sorter: false },6:{sorter:false},7:{sorter:false},8:{sorter:false}}
20
        headers: { 1: { sorter: 'articles' }}
21
	}); 
22
	$("#relissuest").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
23
		dateFormat: 'uk',<!-- /TMPL_IF -->
24
		headers: { 1: { sorter: 'articles' }}
21
	}); 
25
	}); 
22
	$("#holdst").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
26
	$("#holdst").tablesorter({<!-- TMPL_IF NAME="dateformat_metric" -->
23
		dateFormat: 'uk',<!-- /TMPL_IF -->
27
		dateFormat: 'uk',<!-- /TMPL_IF -->
Lines 42-47 $(document).ready(function() { Link Here
42
	$("#CheckAllreturns").click(function(){ $(".checkboxed").checkCheckboxes(":input[name*=barcodes]"); $(".checkboxed").unCheckCheckboxes(":input[name*=items]"); return false; });
46
	$("#CheckAllreturns").click(function(){ $(".checkboxed").checkCheckboxes(":input[name*=barcodes]"); $(".checkboxed").unCheckCheckboxes(":input[name*=items]"); return false; });
43
    $("#CheckNoreturns" ).click(function(){ $(".checkboxed").unCheckCheckboxes(":input[name*=barcodes]"); return false; });
47
    $("#CheckNoreturns" ).click(function(){ $(".checkboxed").unCheckCheckboxes(":input[name*=barcodes]"); return false; });
44
48
49
    $("#relrenew_all"      ).click(function(){ $(".checkboxed").checkCheckboxes(":input[name*=items]"   ); $(".checkboxed").unCheckCheckboxes(":input[name*=barcodes]"); });
50
    $("#relCheckAllitems"  ).click(function(){ $(".checkboxed").checkCheckboxes(":input[name*=items]"   ); $(".checkboxed").unCheckCheckboxes(":input[name*=barcodes]"); return false; });
51
    $("#relCheckNoitems"   ).click(function(){ $(".checkboxed").unCheckCheckboxes(":input[name*=items]"); return false; });
52
    $("#relCheckAllreturns").click(function(){ $(".checkboxed").checkCheckboxes(":input[name*=barcodes]"); $(".checkboxed").unCheckCheckboxes(":input[name*=items]"); return false; });
53
    $("#relCheckNoreturns" ).click(function(){ $(".checkboxed").unCheckCheckboxes(":input[name*=barcodes]"); return false; });
54
55
45
    <!-- TMPL_IF NAME="CAN_user_circulate_override_renewals" -->
56
    <!-- TMPL_IF NAME="CAN_user_circulate_override_renewals" -->
46
    <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
57
    <!-- TMPL_IF NAME="AllowRenewalLimitOverride" -->
47
    $( '#override_limit' ).click( function () {
58
    $( '#override_limit' ).click( function () {
Lines 398-408 function validate1(date) { Link Here
398
    <!-- /TMPL_IF -->
409
    <!-- /TMPL_IF -->
399
</div>
410
</div>
400
411
401
<div id="checkedout">
402
    <!-- TMPL_IF NAME="issueloop" -->
403
    <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post" class="checkboxed">
412
    <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post" class="checkboxed">
404
    <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
413
    <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
405
	<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
414
	<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
415
<div id="checkedout">
416
    <!-- TMPL_IF NAME="issueloop" -->
406
    <table id="issuest">
417
    <table id="issuest">
407
    <thead>
418
    <thead>
408
		<tr>
419
		<tr>
Lines 410-416 function validate1(date) { Link Here
410
            <th scope="col">Title</th>
421
            <th scope="col">Title</th>
411
            <th scope="col">Item Type</th>
422
            <th scope="col">Item Type</th>
412
            <th scope="col">Checked out on</th> 
423
            <th scope="col">Checked out on</th> 
413
        <th scope="col">Call no</th>
424
            <th scope="col">Call no</th>
414
            <th scope="col">Charge</th>
425
            <th scope="col">Charge</th>
415
            <th scope="col">Price</th>
426
            <th scope="col">Price</th>
416
            <th scope="col">Renew <p class="column-tool"><a href="#" id="CheckAllitems">select all</a> | <a href="#" id="CheckNoitems">none</a></p></th>
427
            <th scope="col">Renew <p class="column-tool"><a href="#" id="CheckAllitems">select all</a> | <a href="#" id="CheckNoitems">none</a></p></th>
Lines 494-500 function validate1(date) { Link Here
494
        <input type="submit" name="renew_checked" value="Renew or Return checked items" />
505
        <input type="submit" name="renew_checked" value="Renew or Return checked items" />
495
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
506
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
496
        </fieldset>
507
        </fieldset>
497
    </form><!-- TMPL_ELSE --><p>Patron has nothing checked out.</p><!-- /TMPL_IF -->
508
    <!-- TMPL_ELSE --><p>Patron has nothing checked out.</p>
509
<!-- /TMPL_IF -->
510
511
<!-- TMPL_IF NAME="relissuecount" -->
512
	<h2>Relatives issues</h2>
513
 <table id="relissuest">
514
    <thead>
515
	<tr>
516
            <th scope="col">Due date</th>
517
            <th scope="col">Title</th>
518
            <th scope="col">Collection</th>
519
            <th scope="col">Stock number</th>
520
            <th scope="col">Barcode</th>
521
            <th scope="col">Item Type</th>
522
            <th scope="col">Checked out on</th> 
523
            <th scope="col">Borrower</th>
524
	    <th scope="col">Call no</th>
525
            <th scope="col">Charge</th>
526
            <th scope="col">Price</th>
527
        </tr>
528
    </thead>
529
       <tbody>
530
       <!-- TMPL_LOOP name="relissueloop" -->
531
532
          <!-- TMPL_IF name="overdue" -->
533
          <tr class="problem">
534
          <!-- TMPL_ELSE -->
535
          <tr>
536
          <!-- /TMPL_IF -->
537
		  <td<!-- TMPL_IF NAME="red" --> class="od"<!-- /TMPL_IF -->><!-- TMPL_VAR NAME="date_due" -->
538
                <!-- TMPL_IF NAME="itemlost" -->
539
                                        <span class="lost"><!-- TMPL_VAR NAME="itemlost" --></span>
540
                    <!-- /TMPL_IF -->
541
                <!-- TMPL_IF NAME="damaged" -->
542
                                        <span class="dmg"><!-- TMPL_VAR NAME="itemdamaged" --></span>
543
                <!-- /TMPL_IF -->
544
</td>
545
            <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><strong><!-- TMPL_VAR NAME="title" escape="html" --></strong></a><!-- TMPL_IF NAME="author" -->, by <!-- TMPL_VAR name="author" --><!-- /TMPL_IF --> <!-- TMPL_IF name="publishercode" -->; <!-- TMPL_VAR name="publishercode" --> <!-- /TMPL_IF --> <!-- TMPL_IF name="publicationyear" -->, <!-- TMPL_VAR name="publicationyear" --><!-- /TMPL_IF --></td>
546
            <td><!-- TMPL_VAR NAME="collection" --></td>
547
            <td><!-- TMPL_VAR NAME="stocknumber" --></td>
548
            <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#item<!-- TMPL_VAR NAME="itemnumber" -->"><!-- TMPL_VAR NAME="barcode" --></a></td>
549
<td><!-- TMPL_UNLESS NAME="noItemTypeImages" --> <!-- TMPL_IF NAME="itemtype_image" --><img src="<!-- TMPL_VAR NAME="itemtype_image" -->" alt="" /><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- TMPL_VAR NAME="itemtype_description" --></td>
550
            <td><!-- TMPL_VAR NAME="issuedate" --></td>
551
	    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="borrowername" --></a></td>
552
	    <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
553
            <td><!-- TMPL_VAR NAME="charge" --></td>
554
            <td><!-- TMPL_VAR NAME="replacementprice" --></td>
555
        </tr>
556
  <!-- /tmpl_loop -->
557
        </tbody>
558
       </table>
559
<!-- /TMPL_IF -->
498
	</div>
560
	</div>
499
	
561
	
500
<div id="onhold">
562
<div id="onhold">
Lines 543-554 function validate1(date) { Link Here
543
        </tr>
605
        </tr>
544
		<!-- /TMPL_LOOP --></tbody>
606
		<!-- /TMPL_LOOP --></tbody>
545
    </table>
607
    </table>
546
        <fieldset class="action"><input type="submit" class="cancel" name="submit" value="Cancel Marked Requests" /></fieldset>
608
547
    </form>
609
        <fieldset class="action">
548
    <!-- TMPL_ELSE -->
610
        <input type="submit" name="renew_checked" value="Renew or Return checked items" />
549
    <p>Patron has nothing on hold.</p>
611
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
550
    <!-- /TMPL_IF -->
612
        </fieldset>
551
    </div>
613
    <!-- TMPL_ELSE --><p>Patron has nothing checked out.</p><!-- /TMPL_IF -->
614
	</div>
615
552
</div>
616
</div>
553
<!-- /TMPL_IF --> <!-- unknowuser -->
617
<!-- /TMPL_IF --> <!-- unknowuser -->
554
618
(-)a/members/moremember.pl (-59 / +82 lines)
Lines 51-56 use C4::Reserves; Link Here
51
use C4::Branch; # GetBranchName
51
use C4::Branch; # GetBranchName
52
use C4::Form::MessagingPreferences;
52
use C4::Form::MessagingPreferences;
53
use C4::NewsChannels; #get slip news
53
use C4::NewsChannels; #get slip news
54
use List::MoreUtils qw/uniq/;
54
55
55
#use Smart::Comments;
56
#use Smart::Comments;
56
#use Data::Dumper;
57
#use Data::Dumper;
Lines 239-311 if ( C4::Context->preference('OPACPrivacy') ) { Link Here
239
240
240
# current issues
241
# current issues
241
#
242
#
242
my $issue = GetPendingIssues($borrowernumber);
243
my @borrowernumbers = GetMemberRelatives($borrowernumber);
244
my $issue       = GetPendingIssues($borrowernumber);
245
my $relissue    = GetPendingIssues(@borrowernumbers);
243
my $issuecount = scalar(@$issue);
246
my $issuecount = scalar(@$issue);
247
my $relissuecount  = scalar(@$relissue);
244
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
248
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
245
my $today       = POSIX::strftime("%Y-%m-%d", localtime);	# iso format
249
my $today       = POSIX::strftime("%Y-%m-%d", localtime);	# iso format
246
my @issuedata;
250
my @issuedata;
251
my @borrowers_with_issues;
247
my $overdues_exist = 0;
252
my $overdues_exist = 0;
248
my $totalprice = 0;
253
my $totalprice = 0;
249
for ( my $i = 0 ; $i < $issuecount ; $i++ ) {
254
250
    my $datedue = $issue->[$i]{'date_due'};
255
my @issuedata = build_issue_data($issue, $issuecount);
251
    my $issuedate = $issue->[$i]{'issuedate'};
256
my @relissuedata = build_issue_data($relissue, $relissuecount);
252
    $issue->[$i]{'date_due'}  = C4::Dates->new($issue->[$i]{'date_due'}, 'iso')->output('syspref');
257
253
    $issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref');
258
sub build_issue_data {
254
    my $biblionumber = $issue->[$i]{'biblionumber'};
259
    my $issue = shift;
255
    my %row = %{ $issue->[$i] };
260
    my $issuecount = shift;
256
    $totalprice += $issue->[$i]{'replacementprice'};
261
257
    $row{'replacementprice'} = $issue->[$i]{'replacementprice'};
262
    my $localissue;
258
    # item lost, damaged loops
263
259
    if ($row{'itemlost'}) {
264
    for ( my $i = 0 ; $i < $issuecount ; $i++ ) {
260
        my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'});
265
        # Getting borrower details
261
        my $category = GetAuthValCode('items.itemlost',$fw);
266
        my $memberdetails = GetMemberDetails($issue->[$i]{'borrowernumber'});
262
        my $lostdbh = C4::Context->dbh;
267
        $issue->[$i]{'borrowername'} = $memberdetails->{'firstname'} . " " . $memberdetails->{'surname'};
263
        my $sth = $lostdbh->prepare("select lib from authorised_values where category=? and authorised_value =? ");
268
264
        $sth->execute($category, $row{'itemlost'});
269
        my $datedue = $issue->[$i]{'date_due'};
265
        my $loststat = $sth->fetchrow;
270
        my $issuedate = $issue->[$i]{'issuedate'};
266
        if ($loststat) {
271
        $issue->[$i]{'date_due'}  = C4::Dates->new($issue->[$i]{'date_due'}, 'iso')->output('syspref');
267
           $row{'itemlost'} = $loststat;
272
        $issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref');
273
        my $biblionumber = $issue->[$i]{'biblionumber'};
274
        my %row = %{ $issue->[$i] };
275
        $totalprice += $issue->[$i]{'replacementprice'};
276
        $row{'replacementprice'} = $issue->[$i]{'replacementprice'};
277
        # item lost, damaged loops
278
        if ($row{'itemlost'}) {
279
            my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'});
280
            my $category = GetAuthValCode('items.itemlost',$fw);
281
            my $lostdbh = C4::Context->dbh;
282
            my $sth = $lostdbh->prepare("select lib from authorised_values where category=? and authorised_value =? ");
283
            $sth->execute($category, $row{'itemlost'});
284
            my $loststat = $sth->fetchrow;
285
            if ($loststat) {
286
               $row{'itemlost'} = $loststat;
287
            }
268
        }
288
        }
269
    }
289
        if ($row{'damaged'}) {
270
    if ($row{'damaged'}) {
290
            my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'});
271
        my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'});
291
            my $category = GetAuthValCode('items.damaged',$fw);
272
        my $category = GetAuthValCode('items.damaged',$fw);
292
            my $damageddbh = C4::Context->dbh;
273
        my $damageddbh = C4::Context->dbh;
293
            my $sth = $damageddbh->prepare("select lib from authorised_values where category=? and authorised_value =? ");
274
        my $sth = $damageddbh->prepare("select lib from authorised_values where category=? and authorised_value =? ");
294
            $sth->execute($category, $row{'damaged'});
275
        $sth->execute($category, $row{'damaged'});
295
            my $damagedstat = $sth->fetchrow;
276
        my $damagedstat = $sth->fetchrow;
296
            if ($damagedstat) {
277
        if ($damagedstat) {
297
               $row{'itemdamaged'} = $damagedstat;
278
           $row{'itemdamaged'} = $damagedstat;
298
            }
279
        }
299
        }
300
        # end lost, damaged
301
        if ( $datedue lt $today ) {
302
            $overdues_exist = 1;
303
            $row{'red'} = 1;
304
        }
305
         if ( $issuedate eq $today ) {
306
            $row{'today'} = 1; 
307
         }
308
309
        #find the charge for an item
310
        my ( $charge, $itemtype ) =
311
          GetIssuingCharges( $issue->[$i]{'itemnumber'}, $borrowernumber );
312
313
        my $itemtypeinfo = getitemtypeinfo($itemtype);
314
        $row{'itemtype_description'} = $itemtypeinfo->{description};
315
        $row{'itemtype_image'}       = $itemtypeinfo->{imageurl};
316
317
        $row{'charge'} = sprintf( "%.2f", $charge );
318
319
        my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit );
320
        $row{'norenew'} = !$renewokay;
321
        $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
322
        $row{"norenew_reason_$renewerror"} = 1 if $renewerror;
323
        $row{'renew_failed'}  = $renew_failed{ $issue->[$i]{'itemnumber'} };
324
        $row{'return_failed'} = $return_failed{$issue->[$i]{'barcode'}};   
325
        push( @$localissue, \%row );
280
    }
326
    }
281
    # end lost, damaged
327
    return $localissue;
282
    if ( $datedue lt $today ) {
283
        $overdues_exist = 1;
284
        $row{'red'} = 1;
285
	}
286
	 if ( $issuedate eq $today ) {
287
        $row{'today'} = 1; 
288
	 }
289
290
    #find the charge for an item
291
    my ( $charge, $itemtype ) =
292
      GetIssuingCharges( $issue->[$i]{'itemnumber'}, $borrowernumber );
293
294
    my $itemtypeinfo = getitemtypeinfo($itemtype);
295
    $row{'itemtype_description'} = $itemtypeinfo->{description};
296
    $row{'itemtype_image'}       = $itemtypeinfo->{imageurl};
297
298
    $row{'charge'} = sprintf( "%.2f", $charge );
299
300
	my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit );
301
	$row{'norenew'} = !$renewokay;
302
	$row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
303
	$row{"norenew_reason_$renewerror"} = 1 if $renewerror;
304
	$row{'renew_failed'}  = $renew_failed{ $issue->[$i]{'itemnumber'} };
305
	$row{'return_failed'} = $return_failed{$issue->[$i]{'barcode'}};   
306
    push( @issuedata, \%row );
307
}
328
}
308
329
330
309
### ###############################################################################
331
### ###############################################################################
310
# BUILD HTML
332
# BUILD HTML
311
# show all reserves of this borrower, and the position of the reservation ....
333
# show all reserves of this borrower, and the position of the reservation ....
Lines 437-444 $template->param( Link Here
437
    totalprice      => sprintf("%.2f", $totalprice),
459
    totalprice      => sprintf("%.2f", $totalprice),
438
    totaldue        => sprintf("%.2f", $total),
460
    totaldue        => sprintf("%.2f", $total),
439
    totaldue_raw    => $total,
461
    totaldue_raw    => $total,
440
    issueloop       => \@issuedata,
462
    issueloop       => @issuedata,
441
	issuecount => $issuecount,
463
    relissueloop    => @relissuedata,
464
	issuecount      => $issuecount,
465
    relissuecount   => $relissuecount,
442
    overdues_exist  => $overdues_exist,
466
    overdues_exist  => $overdues_exist,
443
    error           => $error,
467
    error           => $error,
444
    $error          => 1,
468
    $error          => 1,
445
- 

Return to bug 5952