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

(-)a/C4/Circulation.pm (+60 lines)
Lines 43-48 use Date::Calc qw( Link Here
43
  Date_to_Days
43
  Date_to_Days
44
  Day_of_Week
44
  Day_of_Week
45
  Add_Delta_Days	
45
  Add_Delta_Days	
46
  check_date
46
);
47
);
47
use POSIX qw(strftime);
48
use POSIX qw(strftime);
48
use C4::Branch; # GetBranches
49
use C4::Branch; # GetBranches
Lines 1626-1631 sub AddReturn { Link Here
1626
    if ($borrowernumber) {
1627
    if ($borrowernumber) {
1627
        my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox);
1628
        my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox);
1628
        defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!";  # zero is OK, check defined
1629
        defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!";  # zero is OK, check defined
1630
        
1631
        # fix fine days
1632
        my $debardate = _FixFineDaysOnReturn( $borrower, $item, $issue->{date_due} );
1633
        $messages->{'Debarred'} = $debardate if ($debardate);
1629
    }
1634
    }
1630
1635
1631
    # find reserves.....
1636
    # find reserves.....
Lines 1749-1754 sub MarkIssueReturned { Link Here
1749
    $sth_del->execute($borrowernumber, $itemnumber);
1754
    $sth_del->execute($borrowernumber, $itemnumber);
1750
}
1755
}
1751
1756
1757
=head2 _FixFineDaysOnReturn
1758
1759
    &_FixFineDaysOnReturn($borrower, $item, $datedue);
1760
1761
C<$borrower> borrower hashref
1762
1763
C<$item> item hashref
1764
1765
C<$datedue> date due
1766
1767
Internal function, called only by AddReturn that calculate and update the user fine days, and debars him
1768
1769
=cut
1770
1771
sub _FixFineDaysOnReturn {
1772
    my ( $borrower, $item, $datedue ) = @_;
1773
1774
    if ($datedue) {
1775
        $datedue = C4::Dates->new( $datedue, "iso" );
1776
    } else {
1777
        return;
1778
    }
1779
1780
    my $branchcode = _GetCircControlBranch( $item, $borrower );
1781
    my $calendar = C4::Calendar->new( branchcode => $branchcode );
1782
    my $today = C4::Dates->new();
1783
1784
    my $deltadays = $calendar->daysBetween( $datedue, C4::Dates->new() );
1785
1786
    my $circcontrol = C4::Context::preference('CircControl');
1787
    my $issuingrule = GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode );
1788
    my $finedays    = $issuingrule->{finedays};
1789
1790
    # exit if no finedays defined
1791
    return unless $finedays;
1792
    my $grace = $issuingrule->{firstremind};
1793
1794
    if ( $deltadays - $grace > 0 ) {
1795
        my @newdate = Add_Delta_Days( Today(), $deltadays * $finedays );
1796
        my $isonewdate = join( '-', @newdate );
1797
        my ( $deby, $debm, $debd ) = split( /-/, $borrower->{debarred} );
1798
        if ( check_date( $deby, $debm, $debd ) ) {
1799
            my @olddate = split( /-/, $borrower->{debarred} );
1800
1801
            if ( Delta_Days( @olddate, @newdate ) > 0 ) {
1802
                C4::Members::DebarMember( $borrower->{borrowernumber}, $isonewdate );
1803
                return $isonewdate;
1804
            }
1805
        } else {
1806
            C4::Members::DebarMember( $borrower->{borrowernumber}, $isonewdate );
1807
            return $isonewdate;
1808
        }
1809
    }
1810
}
1811
1752
=head2 _FixOverduesOnReturn
1812
=head2 _FixOverduesOnReturn
1753
1813
1754
   &_FixOverduesOnReturn($brn,$itm, $exemptfine, $dropboxmode);
1814
   &_FixOverduesOnReturn($brn,$itm, $exemptfine, $dropboxmode);
(-)a/C4/Members.pm (-36 / +12 lines)
Lines 661-699 sub IsMemberBlocked { Link Here
661
    my $borrowernumber = shift;
661
    my $borrowernumber = shift;
662
    my $dbh            = C4::Context->dbh;
662
    my $dbh            = C4::Context->dbh;
663
663
664
    # does patron have current fine days?
664
    my $blockeddate = CheckBorrowerDebarred($borrowernumber);
665
	my $strsth=qq{
666
            SELECT
667
            ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due) ) AS blockingdate,
668
            DATEDIFF(ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due)),NOW()) AS blockedcount
669
            FROM old_issues
670
	};
671
    if(C4::Context->preference("item-level_itypes")){
672
        $strsth.=
673
		qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber)
674
            LEFT JOIN issuingrules ON (issuingrules.itemtype=items.itype)}
675
    }else{
676
        $strsth .= 
677
		qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber)
678
            LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
679
            LEFT JOIN issuingrules ON (issuingrules.itemtype=biblioitems.itemtype) };
680
    }
681
	$strsth.=
682
        qq{ WHERE finedays IS NOT NULL
683
            AND  date_due < returndate
684
            AND borrowernumber = ?
685
            ORDER BY blockingdate DESC, blockedcount DESC
686
            LIMIT 1};
687
	my $sth=$dbh->prepare($strsth);
688
    $sth->execute($borrowernumber);
689
    my $row = $sth->fetchrow_hashref;
690
    my $blockeddate  = $row->{'blockeddate'};
691
    my $blockedcount = $row->{'blockedcount'};
692
665
693
    return (1, $blockedcount) if $blockedcount > 0;
666
    return ( 1, $blockeddate ) if $blockeddate;
694
667
695
    # if he have late issues
668
    # if he have late issues
696
    $sth = $dbh->prepare(
669
    my $sth = $dbh->prepare(
697
        "SELECT COUNT(*) as latedocs
670
        "SELECT COUNT(*) as latedocs
698
         FROM issues
671
         FROM issues
699
         WHERE borrowernumber = ?
672
         WHERE borrowernumber = ?
Lines 702-710 sub IsMemberBlocked { Link Here
702
    $sth->execute($borrowernumber);
675
    $sth->execute($borrowernumber);
703
    my $latedocs = $sth->fetchrow_hashref->{'latedocs'};
676
    my $latedocs = $sth->fetchrow_hashref->{'latedocs'};
704
677
705
    return (-1, $latedocs) if $latedocs > 0;
678
    return ( -1, $latedocs ) if $latedocs > 0;
706
679
707
    return (0, 0);
680
    return ( 0, 0 );
708
}
681
}
709
682
710
=head2 GetMemberIssuesAndFines
683
=head2 GetMemberIssuesAndFines
Lines 2114-2120 sub GetBorrowersNamesAndLatestIssue { Link Here
2114
2087
2115
=head2 DebarMember
2088
=head2 DebarMember
2116
2089
2117
  my $success = DebarMember( $borrowernumber );
2090
my $success = DebarMember( $borrowernumber, $todate );
2118
2091
2119
marks a Member as debarred, and therefore unable to checkout any more
2092
marks a Member as debarred, and therefore unable to checkout any more
2120
items.
2093
items.
Lines 2126-2138 true on success, false on failure Link Here
2126
2099
2127
sub DebarMember {
2100
sub DebarMember {
2128
    my $borrowernumber = shift;
2101
    my $borrowernumber = shift;
2102
    my $todate         = shift;
2129
2103
2130
    return unless defined $borrowernumber;
2104
    return unless defined $borrowernumber;
2131
    return unless $borrowernumber =~ /^\d+$/;
2105
    return unless $borrowernumber =~ /^\d+$/;
2132
2106
2133
    return ModMember( borrowernumber => $borrowernumber,
2107
    return ModMember(
2134
                      debarred       => 1 );
2108
        borrowernumber => $borrowernumber,
2135
    
2109
        debarred       => $todate
2110
    );
2111
2136
}
2112
}
2137
2113
2138
=head2 ModPrivacy
2114
=head2 ModPrivacy
(-)a/C4/Overdues.pm (-11 / +12 lines)
Lines 1048-1063 sub CheckBorrowerDebarred { Link Here
1048
        SELECT debarred
1048
        SELECT debarred
1049
        FROM borrowers
1049
        FROM borrowers
1050
        WHERE borrowernumber=?
1050
        WHERE borrowernumber=?
1051
        AND debarred > NOW()
1051
    |;
1052
    |;
1052
    my $sth = $dbh->prepare($query);
1053
    my $sth = $dbh->prepare($query);
1053
    $sth->execute($borrowernumber);
1054
    $sth->execute($borrowernumber);
1054
    my ($debarredstatus) = $sth->fetchrow;
1055
    my $debarredstatus = $sth->fetchrow;
1055
    return ( $debarredstatus eq '1' ? 1 : 0 );
1056
    return $debarredstatus;
1056
}
1057
}
1057
1058
1058
=head2 UpdateBorrowerDebarred
1059
=head2 UpdateBorrowerDebarred
1059
1060
1060
    ($borrowerstatut) = &UpdateBorrowerDebarred($borrowernumber);
1061
($borrowerstatut) = &UpdateBorrowerDebarred($borrowernumber, $todate);
1061
1062
1062
update status of borrowers in borrowers table (field debarred)
1063
update status of borrowers in borrowers table (field debarred)
1063
1064
Lines 1066-1081 C<$borrowernumber> borrower number Link Here
1066
=cut
1067
=cut
1067
1068
1068
sub UpdateBorrowerDebarred{
1069
sub UpdateBorrowerDebarred{
1069
    my($borrowernumber) = @_;
1070
    my ( $borrowernumber, $todate ) = @_;
1070
    my $dbh = C4::Context->dbh;
1071
    my $dbh   = C4::Context->dbh;
1071
        my $query=qq|UPDATE borrowers
1072
    my $query = qq|UPDATE borrowers
1072
             SET debarred='1'
1073
             SET debarred=?
1073
                     WHERE borrowernumber=?
1074
                     WHERE borrowernumber=?
1074
            |;
1075
            |;
1075
    my $sth=$dbh->prepare($query);
1076
    my $sth = $dbh->prepare($query);
1076
        $sth->execute($borrowernumber);
1077
    $sth->execute( $todate, $borrowernumber );
1077
        $sth->finish;
1078
    $sth->finish;
1078
        return 1;
1079
    return 1;
1079
}
1080
}
1080
1081
1081
=head2 CheckExistantNotifyid
1082
=head2 CheckExistantNotifyid
(-)a/circ/circulation.pl (+11 lines)
Lines 30-35 use C4::Dates qw/format_date/; Link Here
30
use C4::Branch; # GetBranches
30
use C4::Branch; # GetBranches
31
use C4::Koha;   # GetPrinter
31
use C4::Koha;   # GetPrinter
32
use C4::Circulation;
32
use C4::Circulation;
33
use C4::Overdues qw/CheckBorrowerDebarred/;
33
use C4::Members;
34
use C4::Members;
34
use C4::Biblio;
35
use C4::Biblio;
35
use C4::Reserves;
36
use C4::Reserves;
Lines 259-264 if ($borrowernumber) { Link Here
259
        issuecount   => $issue,
260
        issuecount   => $issue,
260
        finetotal    => $fines
261
        finetotal    => $fines
261
    );
262
    );
263
264
    my $debar = CheckBorrowerDebarred($borrowernumber);
265
    if ($debar) {
266
        $template->param( 'userdebarred'    => 1 );
267
        $template->param( 'debarredcomment' => $borrower->{debarredcomment} );
268
        if ( $debar ne "9999-12-31" ) {
269
            $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) );
270
        }
271
    }
272
262
}
273
}
263
274
264
#
275
#
(-)a/circ/returns.pl (-1 / +6 lines)
Lines 456-462 foreach my $code ( keys %$messages ) { Link Here
456
    }
456
    }
457
    elsif ( $code eq 'Wrongbranch' ) {
457
    elsif ( $code eq 'Wrongbranch' ) {
458
    }
458
    }
459
459
    elsif ( $code eq 'Debarred' ) {
460
        $err{debarred}            = format_date( $messages->{'Debarred'} );
461
        $err{debarcardnumber}     = $borrower->{cardnumber};
462
        $err{debarborrowernumber} = $borrower->{borrowernumber};
463
        $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
464
    }
460
    else {
465
    else {
461
        die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
466
        die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
462
        # This forces the issue of staying in sync w/ Circulation.pm
467
        # This forces the issue of staying in sync w/ Circulation.pm
(-)a/installer/data/mysql/kohastructure.sql (-2 / +4 lines)
Lines 232-238 CREATE TABLE `borrowers` ( -- this table includes information about your patrons Link Here
232
  `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
232
  `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
233
  `gonenoaddress` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address
233
  `gonenoaddress` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address
234
  `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card
234
  `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card
235
  `debarred` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as being restricted
235
  `debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYY-MM-DD)
236
  `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of the patron
236
  `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
237
  `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
237
  `contactfirstname` text, -- used for children to include first name of guarentor
238
  `contactfirstname` text, -- used for children to include first name of guarentor
238
  `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
239
  `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
Lines 692-698 CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower Link Here
692
  `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
693
  `dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
693
  `gonenoaddress` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address
694
  `gonenoaddress` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address
694
  `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card
695
  `lost` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card
695
  `debarred` tinyint(1) default NULL, -- set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as being restricted
696
  `debarred` date default NULL, -- until this date the patron can only check-in (no loans, no holds, etc.), is a fine based on days instead of money (YYY-MM-DD)
697
  `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of patron
696
  `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
698
  `contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
697
  `contactfirstname` text, -- used for children to include first name of guarentor
699
  `contactfirstname` text, -- used for children to include first name of guarentor
698
  `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
700
  `contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
(-)a/installer/data/mysql/updatedatabase.pl (+15 lines)
Lines 4439-4444 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4439
    SetVersion($DBversion);
4439
    SetVersion($DBversion);
4440
}
4440
}
4441
4441
4442
4442
$DBversion = "3.05.00.011";
4443
$DBversion = "3.05.00.011";
4443
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4444
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4444
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea')");
4445
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea')");
Lines 4447-4452 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4447
}
4448
}
4448
4449
4449
4450
4451
$DBversion = "3.05.00.XXX";
4452
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4453
    my $borrowers = $dbh->selectcol_arrayref( "SELECT borrowernumber from borrowers where debarred <>0;", { Columns => [1] } );
4454
    $dbh->do("ALTER TABLE borrowers MODIFY debarred DATE DEFAULT NULL;");
4455
    $dbh->do( "UPDATE borrowers set debarred='9999-12-31' where borrowernumber IN (" . join( ",", @$borrowers ) . ");" ) if ($borrowers and scalar(@$borrowers)>0);
4456
    $dbh->do("ALTER TABLE borrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
4457
    $dbh->do("ALTER TABLE deletedborrowers MODIFY debarred DATE DEFAULT NULL;");
4458
    $dbh->do("ALTER TABLE deletedborrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
4459
    print "Upgrade done (Change borrowers.debarred into Date )\n";
4460
4461
    SetVersion($DBversion);
4462
}
4463
4464
4450
=head1 FUNCTIONS
4465
=head1 FUNCTIONS
4451
4466
4452
=head2 DropAllForeignKeys($table)
4467
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+11 lines)
Lines 562-567 No patron matched <span class="ex">[% message %]</span> Link Here
562
			<li class="blocker"><span class="circ-hlt">Lost: </span>Patron's card is lost</li>
562
			<li class="blocker"><span class="circ-hlt">Lost: </span>Patron's card is lost</li>
563
			[% END %]
563
			[% END %]
564
564
565
            [% IF ( userdebarred ) %]
566
               <li class="blocker">
567
               <span class="circ-hlt"> Restricted:</span> Patron's account is restricted [% IF (userdebarreddate ) %] until [% userdebarreddate %] [% END %] [% IF (debarredcomment ) %]([% debarredcomment %])[% END %]
568
               <form class="inline compact" action="/cgi-bin/koha/members/setstatus.pl" method="post">
569
	                <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
570
	                <input type="hidden" name="destination" value="circ" />
571
	                <input type="hidden" name="cardnumber" value="[% cardnumber %]" />
572
	                <input type="submit" value="Lift Debarment" />
573
               </form>
574
			</li>[% END %]
575
565
            [% IF ( dbarred ) %]<li class="blocker">
576
            [% IF ( dbarred ) %]<li class="blocker">
566
               <span class="circ-hlt"> Restricted:</span> Patron's account is restricted <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=circ&amp;status=0">Lift restriction</a>
577
               <span class="circ-hlt"> Restricted:</span> Patron's account is restricted <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=circ&amp;status=0">Lift restriction</a>
567
</li>[% END %]
578
</li>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (+3 lines)
Lines 318-323 function Dopop(link) { Link Here
318
                    [% IF ( errmsgloo.withdrawn ) %]
318
                    [% IF ( errmsgloo.withdrawn ) %]
319
                        <p class="problem">Item is withdrawn.</p>
319
                        <p class="problem">Item is withdrawn.</p>
320
                    [% END %]
320
                    [% END %]
321
                    [% IF ( errmsgloo.debarred ) %]
322
                        <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber %]">[% errmsgloo.debarname %]([% errmsgloo.debarcardnumber %])</a> is now debarred until [% errmsgloo.debarred %] </p>
323
                    [% END %]
321
            [% END %]
324
            [% END %]
322
[% IF ( soundon ) %]
325
[% IF ( soundon ) %]
323
<audio src="/intranet-tmpl/prog/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
326
<audio src="/intranet-tmpl/prog/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +34 lines)
Lines 1127-1136 Link Here
1127
				<input type="radio" id="no[% flagloo.name %]" name="[% flagloo.name %]" value="0" />
1127
				<input type="radio" id="no[% flagloo.name %]" name="[% flagloo.name %]" value="0" />
1128
				[% END %]
1128
				[% END %]
1129
1129
1130
</li>
1130
            </li>
1131
			[% END %]
1131
			[% END %]
1132
			<li>
1133
				<label for="yesdebarred" class="radio">Debarred: </label>
1134
				[% IF ( debarred ) %]
1135
				<label for="yesdebarred">Yes </label>
1136
				<input type="radio" id="yesdebarred" name="debarred" value="1" checked="checked"/>
1137
                <label for="nodebarred">No </label>
1138
                <input type="radio" id="nodebarred" name="debarred" value="0"/>
1139
				[% ELSE %]
1140
				<label for="yesdebarred">Yes </label>
1141
				<input type="radio" id="yesdebarred" name="debarred" value="1" />
1142
                <label for="nodebarred">No </label>
1143
                <input type="radio" id="nodebarred" name="debarred" value="0" checked="checked"/>
1144
				[% END %]
1145
				
1146
				<br />
1147
				<label for="datedebarred" class="radio">until:</label> 
1148
				<input type="text" name="datedebarred" id="debarred" class="debarred" value="[% datedebarred %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />
1149
				<img src="[% themelang %]/lib/calendar/cal.gif" id="debarred_button" alt="Show Calendar" />
1150
		         <script language="JavaScript" type="text/javascript">
1151
		            Calendar.setup(
1152
		            {
1153
		                inputField : "debarred",
1154
		                ifFormat : "[% DHTMLcalendar_dateformat %]",
1155
		                button : "debarred_button"
1156
		            }
1157
		            );
1158
		        </script>
1159
		        <br />
1160
		        <label for="debarredcomment" class="radio">Comment:</label>
1161
				<textarea id="debarredcomment" name="debarredcomment" cols="55" rows="3" [% IF ( opduplicate ) %] onclick="this.value=''"[% END %]>[% debarredcomment %]</textarea>
1162
	        </li>
1163
1132
			</ol>
1164
			</ol>
1133
			</fieldset>
1165
			</fieldset>
1166
    
1134
		[% END %]	
1167
		[% END %]	
1135
1168
1136
[% END %]
1169
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-4 / +3 lines)
Lines 158-169 function validate1(date) { Link Here
158
158
159
    [% IF ( flagged ) %]
159
    [% IF ( flagged ) %]
160
    <ul>
160
    <ul>
161
        [% IF ( debarred ) %]
161
        [% IF ( userdebarred ) %]
162
            <li>Patron is restricted
162
            <li>Patron is restricted[% IF ( userdebarreddate ) %] until [% userdebarreddate%] [% IF (debarredcomment ) %]([% debarredcomment %])[% END %][% END %]
163
            <form class="inline compact" action="/cgi-bin/koha/members/setdebar.pl" method="post">
163
            <form class="inline compact" action="/cgi-bin/koha/members/setdebar.pl" method="post">
164
                <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
164
                <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
165
                <input type="hidden" name="status" value="0" />
165
                <input type="submit" value="Lift Debarment" />
166
                <input type="submit" value="Lift Restriction" />
167
            </form>
166
            </form>
168
            </li>
167
            </li>
169
        [% END %]
168
        [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-1 / +1 lines)
Lines 84-90 $.tablesorter.addParser({ Link Here
84
		<div class="dialog alert">
84
		<div class="dialog alert">
85
        <ul>
85
        <ul>
86
            [% IF ( BORROWER_INF.debarred ) %]
86
            [% IF ( BORROWER_INF.debarred ) %]
87
                <li><strong>Please note:</strong> Your account has been frozen. Usually the reason for freezing an account is old overdues or damage fees.If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please contact the library.</li>
87
                <li><strong>Please note:</strong> Your account has been frozen until [% BORROWER_INF.debarred %] - [% BORROWER_INF.debarredcomment %]. Usually the reason for freezing an account is old overdues or damage fees.If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please contact the library.</li>
88
            [% END %]
88
            [% END %]
89
            [% IF ( BORROWER_INF.gonenoaddress ) %]
89
            [% IF ( BORROWER_INF.gonenoaddress ) %]
90
                <li><strong>Please note:</strong> According to our records, we don't have up-to-date [% UNLESS ( BORROWER_INF.OPACPatronDetails ) %]<a href="/cgi-bin/koha/opac-userupdate.pl">contact information</a>[% ELSE %]contact information[% END %] on file.  Please contact the library[% IF ( BORROWER_INF.OPACPatronDetails ) %] or use the <a href="/cgi-bin/koha/opac-userupdate.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)[% END %].</li>
90
                <li><strong>Please note:</strong> According to our records, we don't have up-to-date [% UNLESS ( BORROWER_INF.OPACPatronDetails ) %]<a href="/cgi-bin/koha/opac-userupdate.pl">contact information</a>[% ELSE %]contact information[% END %] on file.  Please contact the library[% IF ( BORROWER_INF.OPACPatronDetails ) %] or use the <a href="/cgi-bin/koha/opac-userupdate.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)[% END %].</li>
(-)a/members/memberentry.pl (-3 / +16 lines)
Lines 131-136 if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) Link Here
131
            $newdata{$key} =~ s/\"/&quot;/g unless $key eq 'borrowernotes' or $key eq 'opacnote';
131
            $newdata{$key} =~ s/\"/&quot;/g unless $key eq 'borrowernotes' or $key eq 'opacnote';
132
        }
132
        }
133
    }
133
    }
134
135
    ## Manipulate debarred
136
    if ( $newdata{debarred} ) {
137
        $newdata{debarred} = $newdata{datedebarred} ? $newdata{datedebarred} : "9999-12-31";
138
    } elsif ( exists( $newdata{debarred} ) && !( $newdata{debarred} ) ) {
139
        undef( $newdata{debarred} );
140
        undef( $newdata{debarredcomment} );
141
    } elsif ( exists( $newdata{debarredcomment} ) && $newdata{debarredcomment} eq "" ) {
142
        undef( $newdata{debarredcomment} );
143
    }
144
    
134
    my $dateobject = C4::Dates->new();
145
    my $dateobject = C4::Dates->new();
135
    my $syspref = $dateobject->regexp();		# same syspref format for all 3 dates
146
    my $syspref = $dateobject->regexp();		# same syspref format for all 3 dates
136
    my $iso     = $dateobject->regexp('iso');	#
147
    my $iso     = $dateobject->regexp('iso');	#
Lines 515-522 while (@relationships) { Link Here
515
}
526
}
516
527
517
my %flags = ( 'gonenoaddress' => ['gonenoaddress' ],
528
my %flags = ( 'gonenoaddress' => ['gonenoaddress' ],
518
        'lost'          => ['lost'],
529
        'lost'          => ['lost']);
519
        'debarred'      => ['debarred']);
520
530
521
 
531
 
522
my @flagdata;
532
my @flagdata;
Lines 637-643 if (C4::Context->preference('uppercasesurnames')) { Link Here
637
	$data{'surname'}    =uc($data{'surname'}    );
647
	$data{'surname'}    =uc($data{'surname'}    );
638
	$data{'contactname'}=uc($data{'contactname'});
648
	$data{'contactname'}=uc($data{'contactname'});
639
}
649
}
640
foreach (qw(dateenrolled dateexpiry dateofbirth)) {
650
651
$data{debarred} = C4::Overdues::CheckBorrowerDebarred($borrowernumber);
652
$data{datedebarred} = $data{debarred} if ( $data{debarred} ne "9999-12-31" );
653
foreach (qw(dateenrolled dateexpiry dateofbirth datedebarred)) {
641
	$data{$_} = format_date($data{$_});	# back to syspref for display
654
	$data{$_} = format_date($data{$_});	# back to syspref for display
642
	$template->param( $_ => $data{$_});
655
	$template->param( $_ => $data{$_});
643
}
656
}
(-)a/members/moremember.pl (-1 / +11 lines)
Lines 49-54 use C4::Letters; Link Here
49
use C4::Biblio;
49
use C4::Biblio;
50
use C4::Reserves;
50
use C4::Reserves;
51
use C4::Branch; # GetBranchName
51
use C4::Branch; # GetBranchName
52
use C4::Overdues qw/CheckBorrowerDebarred/;
52
use C4::Form::MessagingPreferences;
53
use C4::Form::MessagingPreferences;
53
use C4::NewsChannels; #get slip news
54
use C4::NewsChannels; #get slip news
54
use List::MoreUtils qw/uniq/;
55
use List::MoreUtils qw/uniq/;
Lines 148-157 foreach (qw(dateenrolled dateexpiry dateofbirth)) { Link Here
148
}
149
}
149
$data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' );
150
$data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' );
150
151
151
for (qw(debarred gonenoaddress lost borrowernotes)) {
152
for (qw(gonenoaddress lost borrowernotes)) {
152
	 $data->{$_} and $template->param(flagged => 1) and last;
153
	 $data->{$_} and $template->param(flagged => 1) and last;
153
}
154
}
154
155
156
my $debar = CheckBorrowerDebarred($borrowernumber);
157
if ($debar) {
158
    $template->param( 'userdebarred' => 1, 'flagged' => 1 );
159
    if ( $debar ne "9999-12-31" ) {
160
        $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) );
161
        $template->param( 'debarredcomment'  => $data->{debarredcomment} );
162
    }
163
}
164
155
$data->{'ethnicity'} = fixEthnicity( $data->{'ethnicity'} );
165
$data->{'ethnicity'} = fixEthnicity( $data->{'ethnicity'} );
156
$data->{ "sex_".$data->{'sex'}."_p" } = 1;
166
$data->{ "sex_".$data->{'sex'}."_p" } = 1;
157
167
(-)a/members/setstatus.pl (-2 / +2 lines)
Lines 51-58 if ( $reregistration eq 'y' ) { Link Here
51
	# re-reregistration function to automatic calcul of date expiry
51
	# re-reregistration function to automatic calcul of date expiry
52
	$dateexpiry = ExtendMemberSubscriptionTo( $borrowernumber );
52
	$dateexpiry = ExtendMemberSubscriptionTo( $borrowernumber );
53
} else {
53
} else {
54
	my $sth=$dbh->prepare("Update borrowers set debarred = ? where borrowernumber = ?");
54
    my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?");
55
	$sth->execute($status,$borrowernumber);	
55
    $sth->execute( $status, $borrowernumber );
56
	$sth->finish;
56
	$sth->finish;
57
	}
57
	}
58
58
(-)a/misc/cronjobs/overdue_notices.pl (-1 / +1 lines)
Lines 473-479 END_SQL Link Here
473
                if ( $overdue_rules->{"debarred$i"} ) {
473
                if ( $overdue_rules->{"debarred$i"} ) {
474
    
474
    
475
                    #action taken is debarring
475
                    #action taken is debarring
476
                    C4::Members::DebarMember($borrowernumber);
476
                    C4::Members::DebarMember($borrowernumber, '9999-12-31');
477
                    $verbose and warn "debarring $borrowernumber $firstname $lastname\n";
477
                    $verbose and warn "debarring $borrowernumber $firstname $lastname\n";
478
                }
478
                }
479
                my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
479
                my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
(-)a/opac/opac-user.pl (-1 / +1 lines)
Lines 95-100 if ( $borr->{'amountoutstanding'} < 0 ) { Link Here
95
}
95
}
96
96
97
$borr->{'amountoutstanding'} = sprintf "%.02f", $borr->{'amountoutstanding'};
97
$borr->{'amountoutstanding'} = sprintf "%.02f", $borr->{'amountoutstanding'};
98
$borr->{'debarred'} = C4::Dates->new($borr->{'debarred'},'iso')->output;
98
99
99
my @bordat;
100
my @bordat;
100
$bordat[0] = $borr;
101
$bordat[0] = $borr;
101
- 

Return to bug 6328