| dateexpiry | date | YES | | NULL | |
| gonenoaddress | tinyint(1) | YES | | NULL | |
| lost | tinyint(1) | YES | | NULL | |
- | debarred | tinyint(1) | YES | | NULL | |
+ | debarred | date | YES | | NULL | |
+ | debarredcomment | varchar(255) | YES | | NULL | |
| contactname | mediumtext | YES | | NULL | |
| contactfirstname | text | YES | | NULL | |
| contacttitle | text | YES | | NULL | |
$searchstring = q{%} . $searchstring . q{%};
my $query =
'select aqbooksellers.*, count(*) as basketcount from aqbooksellers left join aqbasket '
- . 'on aqbasket.booksellerid = aqbooksellers.id where name lIke ? group by aqbooksellers.id order by name';
+ . 'on aqbasket.booksellerid = aqbooksellers.id where name like ? group by aqbooksellers.id order by name';
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare($query);
INSERT INTO aqbooksellers
(
name, address1, address2, address3, address4,
- postal, phone, fax, url, contact,
+ postal, phone, accountnumber, fax, url,
+ contact,
contpos, contphone, contfax, contaltphone, contemail,
contnotes, active, listprice, invoiceprice, gstreg,
listincgst,invoiceincgst, gstrate, discount,
notes
)
- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
;
my $sth = $dbh->prepare($query);
$sth->execute(
$data->{'name'}, $data->{'address1'},
$data->{'address2'}, $data->{'address3'},
$data->{'address4'}, $data->{'postal'},
- $data->{'phone'}, $data->{'fax'},
+ $data->{'phone'}, $data->{'accountnumber'},
+ $data->{'fax'},
$data->{'url'}, $data->{'contact'},
$data->{'contpos'}, $data->{'contphone'},
$data->{'contfax'}, $data->{'contaltphone'},
my $dbh = C4::Context->dbh;
my $query = 'UPDATE aqbooksellers
SET name=?,address1=?,address2=?,address3=?,address4=?,
- postal=?,phone=?,fax=?,url=?,contact=?,contpos=?,
+ postal=?,phone=?,accountnumber=?,fax=?,url=?,contact=?,contpos=?,
contphone=?,contfax=?,contaltphone=?,contemail=?,
contnotes=?,active=?,listprice=?, invoiceprice=?,
gstreg=?,listincgst=?,invoiceincgst=?,
$data->{'name'}, $data->{'address1'},
$data->{'address2'}, $data->{'address3'},
$data->{'address4'}, $data->{'postal'},
- $data->{'phone'}, $data->{'fax'},
+ $data->{'phone'}, $data->{'accountnumber'},
+ $data->{'fax'},
$data->{'url'}, $data->{'contact'},
$data->{'contpos'}, $data->{'contphone'},
$data->{'contfax'}, $data->{'contaltphone'},
Date_to_Days
Day_of_Week
Add_Delta_Days
+ check_date
);
use POSIX qw(strftime);
use C4::Branch; # GetBranches
if ($borrowernumber) {
my $fix = _FixOverduesOnReturn($borrowernumber, $item->{itemnumber}, $exemptfine, $dropbox);
defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->{itemnumber}...) failed!"; # zero is OK, check defined
+
+ # fix fine days
+ my $debardate = _FixFineDaysOnReturn( $borrower, $item, $issue->{date_due} );
+ $messages->{'Debarred'} = $debardate if ($debardate);
}
# find reserves.....
$sth_del->execute($borrowernumber, $itemnumber);
}
+=head2 _FixFineDaysOnReturn
+
+ &_FixFineDaysOnReturn($borrower, $item, $datedue);
+
+C<$borrower> borrower hashref
+
+C<$item> item hashref
+
+C<$datedue> date due
+
+Internal function, called only by AddReturn that calculate and update the user fine days, and debars him
+
+=cut
+
+sub _FixFineDaysOnReturn {
+ my ( $borrower, $item, $datedue ) = @_;
+
+ if ($datedue) {
+ $datedue = C4::Dates->new( $datedue, "iso" );
+ } else {
+ return;
+ }
+
+ my $branchcode = _GetCircControlBranch( $item, $borrower );
+ my $calendar = C4::Calendar->new( branchcode => $branchcode );
+ my $today = C4::Dates->new();
+
+ my $deltadays = $calendar->daysBetween( $datedue, C4::Dates->new() );
+
+ my $circcontrol = C4::Context::preference('CircControl');
+ my $issuingrule = GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode );
+ my $finedays = $issuingrule->{finedays};
+
+ # exit if no finedays defined
+ return unless $finedays;
+ my $grace = $issuingrule->{firstremind};
+
+ if ( $deltadays - $grace > 0 ) {
+ my @newdate = Add_Delta_Days( Today(), $deltadays * $finedays );
+ my $isonewdate = join( '-', @newdate );
+ my ( $deby, $debm, $debd ) = split( /-/, $borrower->{debarred} );
+ if ( check_date( $deby, $debm, $debd ) ) {
+ my @olddate = split( /-/, $borrower->{debarred} );
+
+ if ( Delta_Days( @olddate, @newdate ) > 0 ) {
+ C4::Members::DebarMember( $borrower->{borrowernumber}, $isonewdate );
+ return $isonewdate;
+ }
+ } else {
+ C4::Members::DebarMember( $borrower->{borrowernumber}, $isonewdate );
+ return $isonewdate;
+ }
+ }
+}
+
=head2 _FixOverduesOnReturn
&_FixOverduesOnReturn($brn,$itm, $exemptfine, $dropboxmode);
if ( $borrower->{lost} eq 1 ) {
$out = undef;
}
- if ( $borrower->{debarred} eq 1 ) {
+ if ( $borrower->{debarred} ) {
$out = undef;
}
my @reserves = GetReservesFromBorrowernumber( $borrower->{'borrowernumber'} );
use C4::Context;
use C4::Dates qw(format_date_in_iso);
use Digest::MD5 qw(md5_base64);
-use Date::Calc qw/Today Add_Delta_YM/;
+use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
use C4::Log; # logaction
use C4::Overdues;
use C4::Reserves;
$flaginfo{'noissues'} = 1;
$flags{'LOST'} = \%flaginfo;
}
- if ( $patroninformation->{'debarred'}
- && $patroninformation->{'debarred'} == 1 )
- {
- my %flaginfo;
- $flaginfo{'message'} = 'Borrower is Debarred.';
- $flaginfo{'noissues'} = 1;
- $flags{'DBARRED'} = \%flaginfo;
+ if ( $patroninformation->{'debarred'} && check_date( split( /-/, $patroninformation->{'debarred'} ) ) ) {
+ if ( Date_to_Days(Date::Calc::Today) < Date_to_Days( split( /-/, $patroninformation->{'debarred'} ) ) ) {
+ my %flaginfo;
+ $flaginfo{'debarredcomment'} = $patroninformation->{'debarredcomment'};
+ $flaginfo{'message'} = $patroninformation->{'debarredcomment'};
+ $flaginfo{'noissues'} = 1;
+ $flaginfo{'dateend'} = $patroninformation->{'debarred'};
+ $flags{'DBARRED'} = \%flaginfo;
+ }
}
if ( $patroninformation->{'borrowernotes'}
&& $patroninformation->{'borrowernotes'} )
my $borrowernumber = shift;
my $dbh = C4::Context->dbh;
- # does patron have current fine days?
- my $strsth=qq{
- SELECT
- ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due) ) AS blockingdate,
- DATEDIFF(ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due)),NOW()) AS blockedcount
- FROM old_issues
- };
- if(C4::Context->preference("item-level_itypes")){
- $strsth.=
- qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber)
- LEFT JOIN issuingrules ON (issuingrules.itemtype=items.itype)}
- }else{
- $strsth .=
- qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber)
- LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
- LEFT JOIN issuingrules ON (issuingrules.itemtype=biblioitems.itemtype) };
- }
- $strsth.=
- qq{ WHERE finedays IS NOT NULL
- AND date_due < returndate
- AND borrowernumber = ?
- ORDER BY blockingdate DESC, blockedcount DESC
- LIMIT 1};
- my $sth=$dbh->prepare($strsth);
- $sth->execute($borrowernumber);
- my $row = $sth->fetchrow_hashref;
- my $blockeddate = $row->{'blockeddate'};
- my $blockedcount = $row->{'blockedcount'};
+ my $blockeddate = CheckBorrowerDebarred($borrowernumber);
- return (1, $blockedcount) if $blockedcount > 0;
+ return ( 1, $blockeddate ) if $blockeddate;
# if he have late issues
- $sth = $dbh->prepare(
+ my $sth = $dbh->prepare(
"SELECT COUNT(*) as latedocs
FROM issues
WHERE borrowernumber = ?
$sth->execute($borrowernumber);
my $latedocs = $sth->fetchrow_hashref->{'latedocs'};
- return (-1, $latedocs) if $latedocs > 0;
+ return ( -1, $latedocs ) if $latedocs > 0;
- return (0, 0);
+ return ( 0, 0 );
}
=head2 GetMemberIssuesAndFines
=head2 DebarMember
- my $success = DebarMember( $borrowernumber );
+my $success = DebarMember( $borrowernumber, $todate );
marks a Member as debarred, and therefore unable to checkout any more
items.
sub DebarMember {
my $borrowernumber = shift;
+ my $todate = shift;
return unless defined $borrowernumber;
return unless $borrowernumber =~ /^\d+$/;
- return ModMember( borrowernumber => $borrowernumber,
- debarred => 1 );
-
+ return ModMember(
+ borrowernumber => $borrowernumber,
+ debarred => $todate
+ );
+
}
=head2 ModPrivacy
SELECT debarred
FROM borrowers
WHERE borrowernumber=?
+ AND debarred > NOW()
|;
my $sth = $dbh->prepare($query);
$sth->execute($borrowernumber);
- my ($debarredstatus) = $sth->fetchrow;
- return ( $debarredstatus eq '1' ? 1 : 0 );
+ my $debarredstatus = $sth->fetchrow;
+ return $debarredstatus;
}
=head2 UpdateBorrowerDebarred
- ($borrowerstatut) = &UpdateBorrowerDebarred($borrowernumber);
+($borrowerstatut) = &UpdateBorrowerDebarred($borrowernumber, $todate);
update status of borrowers in borrowers table (field debarred)
=cut
sub UpdateBorrowerDebarred{
- my($borrowernumber) = @_;
- my $dbh = C4::Context->dbh;
- my $query=qq|UPDATE borrowers
- SET debarred='1'
+ my ( $borrowernumber, $todate ) = @_;
+ my $dbh = C4::Context->dbh;
+ my $query = qq|UPDATE borrowers
+ SET debarred=?
WHERE borrowernumber=?
|;
- my $sth=$dbh->prepare($query);
- $sth->execute($borrowernumber);
- $sth->finish;
- return 1;
+ my $sth = $dbh->prepare($query);
+ $sth->execute( $todate, $borrowernumber );
+ $sth->finish;
+ return 1;
}
=head2 CheckExistantNotifyid
my @languages = split(",", C4::Context->preference(
$is_intranet ? 'language' : 'opaclanguages'));
my $lang;
- $lang = $query->cookie('KohaOpacLanguage')
- if defined $query and $query->cookie('KohaOpacLanguage');
+ $lang = getlanguagecookie($query);
unless ($lang) {
my $http_accept_language = $ENV{ HTTP_ACCEPT_LANGUAGE };
$lang = accept_language( $http_accept_language,
$lang = $ENV{HTTP_ACCEPT_LANGUAGE};
}
- $lang = substr($lang, 0, 2);
-
+ $lang =~ s/[^a-zA-Z_-]*//; #sanitzie
return $lang;
}
address3 => $supplier->{'address3'},
address4 => $supplier->{'address4'},
phone => $supplier->{'phone'},
+ accountnumber => $supplier->{'accountnumber'},
fax => $supplier->{'fax'},
url => $supplier->{'url'},
contact => $supplier->{'contact'},
address3 => $supplier->{'address3'},
address4 => $supplier->{'address4'},
phone => $supplier->{'phone'},
+ accountnumber=> $supplier->{'accountnumber'},
fax => $supplier->{'fax'},
url => $supplier->{'url'},
contact => $supplier->{'contact'},
$data{'address3'}=$addresses[2];
$data{'address4'}=$addresses[3];
$data{'phone'}=$input->param('company_phone');
+$data{'accountnumber'}=$input->param('accountnumber');
$data{'fax'}=$input->param('company_fax');
$data{'url'}=$input->param('website');
$data{'contact'}=$input->param('company_contact_name');
use C4::Branch; # GetBranches
use C4::Koha; # GetPrinter
use C4::Circulation;
+use C4::Overdues qw/CheckBorrowerDebarred/;
use C4::Members;
use C4::Biblio;
use C4::Reserves;
issuecount => $issue,
finetotal => $fines
);
+
+ my $debar = CheckBorrowerDebarred($borrowernumber);
+ if ($debar) {
+ $template->param( 'userdebarred' => 1 );
+ $template->param( 'debarredcomment' => $borrower->{debarredcomment} );
+ if ( $debar ne "9999-12-31" ) {
+ $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) );
+ }
+ }
+
}
#
}
elsif ( $code eq 'Wrongbranch' ) {
}
-
+ elsif ( $code eq 'Debarred' ) {
+ $err{debarred} = format_date( $messages->{'Debarred'} );
+ $err{debarcardnumber} = $borrower->{cardnumber};
+ $err{debarborrowernumber} = $borrower->{borrowernumber};
+ $err{debarname} = "$borrower->{firstname} $borrower->{surname}";
+ }
else {
die "Unknown error code $code"; # note we need all the (empty) elsif's above, or we die.
# This forces the issue of staying in sync w/ Circulation.pm
$refer = $query->referer() if !$refer || $refer eq 'undefined';
$refer =~ /koha\/(.*)\.pl/;
-my $from = "help/$1.tt";
+my $file = $1;
+$file =~ s/[^a-zA-Z0-9_\-\/]*//g;
+my $from = "help/$file.tt";
my $template = C4::Templates::gettemplate($from, 'intranet', $query);
$template->param( referer => $refer );
$tmplbase=~ s/\.tmpl$/.tt/;
my $filename = "$path/modules/" . $tmplbase;
my $interface = 'intranet';
- my $template = C4::Templates->new( $interface, $filename, $tmplbase);
+ my $template = C4::Templates->new( $interface, $filename, $tmplbase, $query);
my ( $user, $cookie, $sessionID, $flags ) = checkauth(
$in->{'query'},
}
sub _get_template_language {
- #verify if opac language exists in staff (bug 5660)
- #conditions are 1) dir exists and 2) enabled in prefs
- my ($opaclang)= @_;
- return 'en' unless $opaclang;
- my $path= C4::Context->config('intrahtdocs')."/prog/$opaclang";
- -d $path ? $opaclang : 'en';
+
+ #verify if opac language exists in staff (bug 5660)
+ #conditions are 1) dir exists and 2) enabled in prefs
+ my ($opaclang) = @_;
+ return 'en' unless $opaclang;
+ $opaclang =~ s/[^a-zA-Z_-]*//g;
+ my $path = C4::Context->config('intrahtdocs') . "/prog/$opaclang";
+ -d $path ? $opaclang : 'en';
}
=item checkauth
my $filename = "$path/modules/$template_name";
$filename =~ s/\.tmpl$/.tt/;
my $interface = 'intranet';
- my $template = C4::Templates->new( $interface, $filename);
+ my $template = C4::Templates->new( $interface, $filename, '', $query);
$template->param(
INPUTS => \@inputs,
`dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
`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
`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
- `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
+ `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)
+ `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of the patron
`contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
`contactfirstname` text, -- used for children to include first name of guarentor
`contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
`dateexpiry` date default NULL, -- date the patron/borrower's card is set to expire (YYYY-MM-DD)
`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
`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
- `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
+ `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)
+ `debarredcomment` VARCHAR(255) DEFAULT NULL, -- comment on the stop of patron
`contactname` mediumtext, -- used for children and profesionals to include surname or last name of guarentor or organization name
`contactfirstname` text, -- used for children to include first name of guarentor
`contacttitle` text, -- used for children to include title (Mr., Mrs., etc) of guarentor
SetVersion($DBversion);
}
+
$DBversion = "3.05.00.011";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$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')");
SetVersion ($DBversion);
}
+$DBversion = "3.06.00.001";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ my $borrowers = $dbh->selectcol_arrayref( "SELECT borrowernumber from borrowers where debarred <>0;", { Columns => [1] } );
+ $dbh->do("ALTER TABLE borrowers MODIFY debarred DATE DEFAULT NULL;");
+ $dbh->do( "UPDATE borrowers set debarred='9999-12-31' where borrowernumber IN (" . join( ",", @$borrowers ) . ");" ) if ($borrowers and scalar(@$borrowers)>0);
+ $dbh->do("ALTER TABLE borrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
+ $dbh->do("ALTER TABLE deletedborrowers MODIFY debarred DATE DEFAULT NULL;");
+ $dbh->do("ALTER TABLE deletedborrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
+ print "Upgrade done (Change borrowers.debarred into Date )\n";
+
+ SetVersion($DBversion);
+}
+
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
# Framework Selection is achieved through checking boxes.
my $langchoice = $query->param('fwklanguage');
$langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
+ $langchoice =~ s/[^a-zA-Z_-]*//g;
my $marcflavour = $query->param('marcflavour');
if ($marcflavour){
$installer->set_marcflavour_syspref($marcflavour);
# Marcflavour Selection is achieved through radiobuttons.
my $langchoice = $query->param('fwklanguage');
$langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
+ $langchoice =~ s/[^a-zA-Z_-]*//g;
my $dir =
C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/marcflavour";
unless (opendir( MYDIR, $dir )) {
{ text: _("Renew Patron"), onclick: { fn: confirm_reregistration } },
{ text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=[% borrowernumber %]"[% UNLESS CAN_user_permissions %], disabled: true[% END %]},
{ text: _("Delete"), [% UNLESS CAN_user_borrowers %]disabled: true, [% END %] onclick: { fn: confirm_deletion } },
- { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }[% UNLESS is_child" %], disabled: true[% END %]}
+ { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }[% UNLESS is_child %], disabled: true[% END %]}
];
new YAHOO.widget.Button({
<li><label for="company_fax">Fax</label>
<input type="text" size="20" id="company_fax" name="company_fax" value="[% fax %]" /></li>
<li><label for="website">Website</label>
- <input type="text" size="40" id="website" name="website" value="[% url %]" /></li></ol>
+ <input type="text" size="40" id="website" name="website" value="[% url %]" /></li>
+ <li><label for="accountnumber">Account number</label>
+ <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol>
</fieldset>
<fieldset class="rows">
<legend>Contact details</legend>
<input type="text" size="6" id="discount" name="discount" value="[% discount %]" />%</li>
<li><label for="gstrate">Tax rate</label><input type="text" name="gstrate" id="gstrate" size="6" value="[% gstrate %]"/>% (leave blank for default tax of [% default_gst_rate %]%)</li>
<li><label for="notes">Notes</label>
- <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
+ <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
</fieldset>
<fieldset class="action"><input type="button" value="Save" onclick="check(this.form);" /> [% IF ( id ) %]
<a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% id %]">[% ELSE %]<a class="cancel" href="/cgi-bin/koha/acqui/acqui-home.pl">
<p><span class="label">Phone: </span>[% phone %]</p>
<p><span class="label">Fax: </span>[% fax %]</p>
[% IF ( url ) %]
- <p><span class="label">Web site: </span><a href="[% url %]">[% url %]</a></p>
+ <p><span class="label">Website: </span><a href="[% url %]">[% url %]</a></p>
+ [% END %]
+ [% IF ( accountnumber ) %]
+ <p><span class="label">Account number: </span>[% accountnumber %]</p>
[% END %]
</div>
<div id="supplier-contact-details" class="yui-u">
[% IF ( MARCAUTHORS ) %]
<li><strong>Additional Authors:</strong><ul>
[% FOREACH MARCAUTHOR IN MARCAUTHORS %]
- <li>[% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %]<a title="‡[% MARCAUTHOR_SUBFIELDS_LOO.code %] [% MARCAUTHOR_SUBFIELDS_LOO.value |url %]" href="/cgi-bin/koha/catalogue/search.pl?q=[% FOREACH link_loo IN MARCAUTHOR_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit %]:[% link_loo.link |url %][% END %]">[% MARCAUTHOR_SUBFIELDS_LOO.value %]</a>[% END %]</li>
+ <li>[% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %]<a title="‡[% MARCAUTHOR_SUBFIELDS_LOO.code %] [% MARCAUTHOR_SUBFIELDS_LOO.value |url %]" href="/cgi-bin/koha/catalogue/search.pl?q=[% FOREACH link_loo IN MARCAUTHOR_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit %]:[% link_loo.link |url %][% END %]">[% MARCAUTHOR_SUBFIELDS_LOO.value %]</a>[% END %]</li>
[% END %]
</ul>
<li><strong>Subjects:</strong>
<ul>
[% FOREACH MARCSUBJCT IN MARCSUBJCTS %]
- <li>[% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] [% MARCSUBJECT_SUBFIELDS_LOO.separator %] <a title="‡[% MARCSUBJECT_SUBFIELDS_LOO.code %] [% MARCSUBJECT_SUBFIELDS_LOO.value %]" href="/cgi-bin/koha/catalogue/search.pl?q=[% FOREACH link_loo IN MARCSUBJECT_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit %]:[% link_loo.link |url %][% END %]">[% MARCSUBJECT_SUBFIELDS_LOO.value |html %]</a>[% END %]</li>
+ <li>[% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %] [% MARCSUBJECT_SUBFIELDS_LOO.separator %] <a title="‡[% MARCSUBJECT_SUBFIELDS_LOO.code %] [% MARCSUBJECT_SUBFIELDS_LOO.value %]" href="/cgi-bin/koha/catalogue/search.pl?q=[% FOREACH link_loo IN MARCSUBJECT_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit %]:[% link_loo.link |url %][% END %]">[% MARCSUBJECT_SUBFIELDS_LOO.value |html %]</a>[% END %]</li>
[% END %]
</ul>
</li>
<li class="blocker"><span class="circ-hlt">Lost: </span>Patron's card is lost</li>
[% END %]
- [% IF ( dbarred ) %]<li class="blocker">
- <span class="circ-hlt"> Restricted:</span> Patron's account is restricted <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&cardnumber=[% cardnumber %]&destination=circ&status=0">Lift restriction</a>
-</li>[% END %]
+ [% IF ( userdebarred ) %]
+ <li class="blocker">
+ <span class="circ-hlt"> Restricted:</span> Patron's account is restricted [% IF (userdebarreddate ) %] until [% userdebarreddate %] [% END %] [% IF (debarredcomment ) %]([% debarredcomment %])[% END %]
+ <form class="inline compact" action="/cgi-bin/koha/members/setstatus.pl" method="post">
+ <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
+ <input type="hidden" name="destination" value="circ" />
+ <input type="hidden" name="cardnumber" value="[% cardnumber %]" />
+ <input type="submit" value="Lift Debarment" />
+ </form>
+ </li>[% END %]
[% IF ( odues ) %]<li>[% IF ( nonreturns ) %]<span class="circ-hlt">Overdues:</span> Patron has <span class="circ-hlt">ITEMS OVERDUE</span>. See highlighted items <a href="#checkouts">below</a>[% END %]</li>
[% END %]
[% IF ( errmsgloo.withdrawn ) %]
<p class="problem">Item is withdrawn.</p>
[% END %]
+ [% IF ( errmsgloo.debarred ) %]
+ <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>
+ [% END %]
[% END %]
[% IF ( soundon ) %]
<audio src="/intranet-tmpl/prog/sound/critical.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
<input type="radio" id="no[% flagloo.name %]" name="[% flagloo.name %]" value="0" />
[% END %]
-</li>
+ </li>
[% END %]
+ <li>
+ <label for="yesdebarred" class="radio">Debarred: </label>
+ [% IF ( debarred ) %]
+ <label for="yesdebarred">Yes </label>
+ <input type="radio" id="yesdebarred" name="debarred" value="1" checked="checked"/>
+ <label for="nodebarred">No </label>
+ <input type="radio" id="nodebarred" name="debarred" value="0"/>
+ [% ELSE %]
+ <label for="yesdebarred">Yes </label>
+ <input type="radio" id="yesdebarred" name="debarred" value="1" />
+ <label for="nodebarred">No </label>
+ <input type="radio" id="nodebarred" name="debarred" value="0" checked="checked"/>
+ [% END %]
+
+ <br />
+ <label for="datedebarred" class="radio">until:</label>
+ [% IF opduplicate %]
+ <input type="text" name="datedebarred" id="debarred" class="debarred" value="[% datedebarred %]" onclick="this.value=''" />
+ [% ELSE %]
+ <input type="text" name="datedebarred" id="debarred" class="debarred" value="[% datedebarred %]" />
+ [% END %]
+ <img src="[% themelang %]/lib/calendar/cal.gif" id="debarred_button" alt="Show Calendar" />
+ <script language="JavaScript" type="text/javascript">
+ Calendar.setup(
+ {
+ inputField : "debarred",
+ ifFormat : "[% DHTMLcalendar_dateformat %]",
+ button : "debarred_button"
+ }
+ );
+ </script>
+ <br />
+ <label for="debarredcomment" class="radio">Comment:</label>
+ [% IF ( opduplicate ) %]
+ <textarea id="debarredcomment" name="debarredcomment" cols="55" rows="3" onclick="this.value=''">[% debarredcomment %]</textarea>
+ [% ELSE %]
+ <textarea id="debarredcomment" name="debarredcomment" cols="55" rows="3" ">[% debarredcomment %]</textarea>
+ [% END %]
+ </li>
+
</ol>
</fieldset>
+
[% END %]
[% END %]
[% IF ( flagged ) %]
<ul>
- [% IF ( debarred ) %]
- <li>Patron is restricted
+ [% IF ( userdebarred ) %]
+ <li>Patron is restricted[% IF ( userdebarreddate ) %] until [% userdebarreddate%] [% IF (debarredcomment ) %]([% debarredcomment %])[% END %][% END %]
<form class="inline compact" action="/cgi-bin/koha/members/setdebar.pl" method="post">
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
- <input type="hidden" name="status" value="0" />
- <input type="submit" value="Lift Restriction" />
+ <input type="submit" value="Lift Debarment" />
</form>
</li>
[% END %]
[% IF ( MARCAUTHORS ) %]
<span class="results_summary"><span class="label">Authors:</span>
[% FOREACH MARCAUTHOR IN MARCAUTHORS %]
- [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %]<a title="‡[% MARCAUTHOR_SUBFIELDS_LOO.code %] [% MARCAUTHOR_SUBFIELDS_LOO.value %]" href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link_loo IN MARCAUTHOR_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit |url %]:[% link_loo.link |url %][% END %]">[% MARCAUTHOR_SUBFIELDS_LOO.value %]</a>[% END %]
+ [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %][% MARCAUTHOR_SUBFIELDS_LOO.separator %]<a title="‡[% MARCAUTHOR_SUBFIELDS_LOO.code %] [% MARCAUTHOR_SUBFIELDS_LOO.value %]" href="/cgi-bin/koha/opac-search.pl?q=[% FOREACH link_loo IN MARCAUTHOR_SUBFIELDS_LOO.link_loop %][% link_loo.operator |url %][% link_loo.limit |url %]:[% link_loo.link |url %][% END %]">[% MARCAUTHOR_SUBFIELDS_LOO.value %]</a>[% END %]
[% UNLESS ( loop.last ) %]|
[% END %]
[% END %]
<div class="dialog alert">
<ul>
[% IF ( BORROWER_INF.debarred ) %]
- <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>
+ <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>
[% END %]
[% IF ( BORROWER_INF.gonenoaddress ) %]
<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>
use strict;
sub kohaversion {
- our $VERSION = '3.06.00.000';
+ our $VERSION = '3.06.00.001';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
$newdata{$key} =~ s/\"/"/g unless $key eq 'borrowernotes' or $key eq 'opacnote';
}
}
+
+ ## Manipulate debarred
+ if ( $newdata{debarred} ) {
+ $newdata{debarred} = $newdata{datedebarred} ? $newdata{datedebarred} : "9999-12-31";
+ } elsif ( exists( $newdata{debarred} ) && !( $newdata{debarred} ) ) {
+ undef( $newdata{debarred} );
+ undef( $newdata{debarredcomment} );
+ } elsif ( exists( $newdata{debarredcomment} ) && $newdata{debarredcomment} eq "" ) {
+ undef( $newdata{debarredcomment} );
+ }
+
my $dateobject = C4::Dates->new();
my $syspref = $dateobject->regexp(); # same syspref format for all 3 dates
my $iso = $dateobject->regexp('iso'); #
}
my %flags = ( 'gonenoaddress' => ['gonenoaddress' ],
- 'lost' => ['lost'],
- 'debarred' => ['debarred']);
+ 'lost' => ['lost']);
my @flagdata;
$data{'surname'} =uc($data{'surname'} );
$data{'contactname'}=uc($data{'contactname'});
}
-foreach (qw(dateenrolled dateexpiry dateofbirth)) {
+
+$data{debarred} = C4::Overdues::CheckBorrowerDebarred($borrowernumber);
+$data{datedebarred} = $data{debarred} if ( $data{debarred} ne "9999-12-31" );
+foreach (qw(dateenrolled dateexpiry dateofbirth datedebarred)) {
$data{$_} = format_date($data{$_}); # back to syspref for display
$template->param( $_ => $data{$_});
}
use C4::Biblio;
use C4::Reserves;
use C4::Branch; # GetBranchName
+use C4::Overdues qw/CheckBorrowerDebarred/;
use C4::Form::MessagingPreferences;
use C4::NewsChannels; #get slip news
use List::MoreUtils qw/uniq/;
}
$data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' );
-for (qw(debarred gonenoaddress lost borrowernotes)) {
+for (qw(gonenoaddress lost borrowernotes)) {
$data->{$_} and $template->param(flagged => 1) and last;
}
+my $debar = CheckBorrowerDebarred($borrowernumber);
+if ($debar) {
+ $template->param( 'userdebarred' => 1, 'flagged' => 1 );
+ if ( $debar ne "9999-12-31" ) {
+ $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) );
+ $template->param( 'debarredcomment' => $data->{debarredcomment} );
+ }
+}
+
$data->{'ethnicity'} = fixEthnicity( $data->{'ethnicity'} );
$data->{ "sex_".$data->{'sex'}."_p" } = 1;
#!/usr/bin/perl
# Copyright 2000-2002 Katipo Communications
+# Parts copyright 2011 BibLibre
#
# This file is part of Koha.
#
my ( $loggedinuser, $cookie, $sessionID ) =
checkauth( $input, 0, $flagsrequired );
-my $destination = $input->param("destination") || '';
-my $cardnumber = $input->param("cardnumber");
my $borrowernumber = $input->param('borrowernumber');
-my $status = $input->param('status');
my $dbh = C4::Context->dbh;
my $sth =
- $dbh->prepare("Update borrowers set debarred = ? where borrowernumber = ?");
-$sth->execute( $status, $borrowernumber );
+ $dbh->prepare("Update borrowers set debarred = NULL where borrowernumber = ?");
+$sth->execute( $borrowernumber );
$sth->finish;
-if ( $destination eq "circ" ) {
- print $input->redirect(
- "/cgi-bin/koha/circ/circulation.pl?findborrower=".$cardnumber);
-}
-else {
- print $input->redirect(
- "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber");
-}
+print $input->redirect(
+ "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber");
# re-reregistration function to automatic calcul of date expiry
$dateexpiry = ExtendMemberSubscriptionTo( $borrowernumber );
} else {
- my $sth=$dbh->prepare("Update borrowers set debarred = ? where borrowernumber = ?");
- $sth->execute($status,$borrowernumber);
+ my $sth = $dbh->prepare("UPDATE borrowers SET debarred = ?, debarredcomment = '' WHERE borrowernumber = ?");
+ $sth->execute( $status, $borrowernumber );
$sth->finish;
}
if ( $overdue_rules->{"debarred$i"} ) {
#action taken is debarring
- C4::Members::DebarMember($borrowernumber);
+ C4::Members::DebarMember($borrowernumber, '9999-12-31');
$verbose and warn "debarring $borrowernumber $firstname $lastname\n";
}
my @params = ($listall ? ( $borrowernumber , 1 , $MAX ) : ( $borrowernumber, $mindays, $maxdays ));
#!/usr/bin/perl
+# This file is part of Koha.
+#
+# Copyright (C) 2007 LibLime
+# Parts Copyright BSZ 2011
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
use strict;
-#use warnings; FIXME - Bug 2505
+use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
$| = 1;
# command-line parameters
+my $encoding = "";
my $match_bibs = 0;
my $add_items = 0;
my $input_file = "";
my $no_replace ;
my $result = GetOptions(
+ 'encoding:s' => \$encoding,
'file:s' => \$input_file,
- 'match-bibs:s' => \$match_bibs,
+ 'match-bibs:s' => \$match_bibs,
'add-items' => \$add_items,
'no-replace' => \$no_replace,
'comment:s' => \$batch_comment,
'h|help' => \$want_help
);
+if ($encoding eq "") {
+ $encoding = "utf8";
+}
+
if (not $result or $input_file eq "" or $want_help) {
print_usage();
exit 0;
}
close IN;
- my $marc_flavor = C4::Context->preference('marcflavour');
-
print "... staging MARC records -- please wait\n";
my ($batch_id, $num_valid, $num_items, @import_errors) =
- BatchStageMarcRecords($marc_flavor, $marc_records, $input_file, $batch_comment, '', $add_items, 0,
+ BatchStageMarcRecords($encoding, $marc_records, $input_file, $batch_comment, '', $add_items, 0,
100, \&print_progress_and_commit);
print "... finished staging MARC records\n";
Parameters:
--file <file_name> name of input MARC bib file
+ --encoding <encoding> encoding of MARC records, default is utf8.
+ Other possible options are: MARC-8,
+ ISO_5426, ISO_6937, ISO_8859-1, EUC-KR
--match-bibs <match_id> use this option to match bibs
in the file with bibs already in
the database for future overlay.
);
my $libravatar_enabled = 0;
-eval 'use Libravatar::URL';
-if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
- $libravatar_enabled = 1;
+if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
+ eval {
+ require Libravatar::URL;
+ Libravatar::URL->import();
+ };
+ if (!$@ ) {
+ $libravatar_enabled = 1;
+ }
}
my $reviews = getreviews( $biblionumber, 1 );
use C4::Context;
use C4::Members;
use C4::Branch; # GetBranches
+use C4::Overdues;
use C4::Debug;
# use Data::Dumper;
lost => 1
);
}
-if ( $borr->{debarred} && ($borr->{debarred} eq 1) ) {
+if ( CheckBorrowerDebarred($borrowernumber) ) {
$noreserves = 1;
$template->param(
message => 1,
}
my $libravatar_enabled = 0;
-eval 'use Libravatar::URL';
-if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
- $libravatar_enabled = 1;
+if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
+ eval {
+ require Libravatar::URL;
+ Libravatar::URL->import();
+ };
+ if ( !$@ ) {
+ $libravatar_enabled = 1;
+ }
}
my $reviews = getallreviews(1,$offset,$results_per_page);
}
$borr->{'amountoutstanding'} = sprintf "%.02f", $borr->{'amountoutstanding'};
+$borr->{'debarred'} = C4::Dates->new($borr->{'debarred'},'iso')->output;
my @bordat;
$bordat[0] = $borr;
ok( ! $details->{'flags'}->{'DBARRED'}, 'this member is NOT debarred' );
# Now, let's debar this member and see what happens
- my $success = C4::Members::DebarMember( $self->{'memberid'} );
+ my $success = C4::Members::DebarMember( $self->{'memberid'}, '2099-12-31' );
ok( $success, 'we were able to debar the member' );
my @warnings;
while (<PH>) {
# ignore some noise on STDERR
- next if /^\.* done\.$/;
- next if /^\.* terminé\.$/;
+ # the output of msmerge, that consist in .... followed by a "done" (localized), followed by a .
+ # The "done" localized can include diacritics, so ignoring the whole word
+ # FIXME PP: the flow is not correct UTF8, testing \p{IsLetter} does not work, but I think this regexp will do the job
+ next if (/^\.+ .*\.$/);
+ # other Koha-specific catses that should not worry us
next if /^Warning: Can't determine original templates' charset/;
next if /^Warning: Charset Out defaulting to/;
next if /^Removing empty file /;