It appears that has never worked.
Could someone confirm?
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
#
sub manualinvoice {
- my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note, $skip_notify ) = @_;
+ my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_;
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
my $dbh = C4::Context->dbh;
- my $notifyid = 0;
my $insert;
my $accountno = getnextacctno($borrowernumber);
my $amountleft = $amount;
- $skip_notify //= 0;
-
- if ( ( $type eq 'L' )
- or ( $type eq 'F' )
- or ( $type eq 'A' )
- or ( $type eq 'N' )
- or ( $type eq 'M' ) )
- {
- $notifyid = 1 unless $skip_notify;
- }
my $accountline = Koha::Account::Line->new(
{
accounttype => $type,
amountoutstanding => $amountleft,
itemnumber => $itemnum || undef,
- notify_id => $notifyid,
note => $note,
manager_id => $manager_id,
}
description => $desc,
accounttype => $type,
amountoutstanding => $amountleft,
- notify_id => $notifyid,
note => $note,
itemnumber => $itemnum,
manager_id => $manager_id,
&GetNoticeEmailAddress
&GetMemberAccountRecords
- &GetBorNotifyAcctRecord
&GetBorrowersToExpunge
return ( $total, $total - $other_charges, $other_charges);
}
-=head2 GetBorNotifyAcctRecord
-
- ($total, $acctlines, $count) = &GetBorNotifyAcctRecord($params,$notifyid);
-
-Looks up accounting data for the patron with the given borrowernumber per file number.
-
-C<&GetBorNotifyAcctRecord> returns a three-element array. C<$acctlines> is a
-reference-to-array, where each element is a reference-to-hash; the
-keys are the fields of the C<accountlines> table in the Koha database.
-C<$count> is the number of elements in C<$acctlines>. C<$total> is the
-total amount outstanding for all of the account lines.
-
-=cut
-
-sub GetBorNotifyAcctRecord {
- my ( $borrowernumber, $notifyid ) = @_;
- my $dbh = C4::Context->dbh;
- my @acctlines;
- my $numlines = 0;
- my $sth = $dbh->prepare(
- "SELECT *
- FROM accountlines
- WHERE borrowernumber=?
- AND notify_id=?
- AND amountoutstanding != '0'
- ORDER BY notify_id,accounttype
- ");
-
- $sth->execute( $borrowernumber, $notifyid );
- my $total = 0;
- while ( my $data = $sth->fetchrow_hashref ) {
- if ( $data->{itemnumber} ) {
- my $item = Koha::Items->find( $data->{itemnumber} );
- my $biblio = $item->biblio;
- $data->{biblionumber} = $biblio->biblionumber;
- $data->{title} = $biblio->title;
- }
- $acctlines[$numlines] = $data;
- $numlines++;
- $total += int(100 * $data->{'amountoutstanding'});
- }
- $total /= 100;
- return ( $total, \@acctlines, $numlines );
-}
-
sub checkcardnumber {
my ( $cardnumber, $borrowernumber ) = @_;
&CalcFine
&Getoverdues
&checkoverdues
- &NumberNotifyId
- &AmountNotify
&UpdateFine
&GetFine
&get_chargeable_units
return 0;
}
-=head2 NumberNotifyId
-
- (@notify) = &NumberNotifyId($borrowernumber);
-
-Returns amount for all file per borrowers
-C<@notify> array contains all file per borrowers
-
-C<$notify_id> contains the file number for the borrower number nad item number
-
-=cut
-
-sub NumberNotifyId{
- my ($borrowernumber)=@_;
- my $dbh = C4::Context->dbh;
- my $query=qq| SELECT distinct(notify_id)
- FROM accountlines
- WHERE borrowernumber=?|;
- my @notify;
- my $sth = $dbh->prepare($query);
- $sth->execute($borrowernumber);
- while ( my ($numberofnotify) = $sth->fetchrow ) {
- push( @notify, $numberofnotify );
- }
- return (@notify);
-}
-
-=head2 AmountNotify
-
- ($totalnotify) = &AmountNotify($notifyid);
-
-Returns amount for all file per borrowers
-C<$notifyid> is the file number
-
-C<$totalnotify> contains amount of a file
-
-C<$notify_id> contains the file number for the borrower number and item number
-
-=cut
-
-sub AmountNotify{
- my ($notifyid,$borrowernumber)=@_;
- my $dbh = C4::Context->dbh;
- my $query=qq| SELECT sum(amountoutstanding)
- FROM accountlines
- WHERE notify_id=? AND borrowernumber = ?|;
- my $sth=$dbh->prepare($query);
- $sth->execute($notifyid,$borrowernumber);
- my $totalnotify=$sth->fetchrow;
- $sth->finish;
- return ($totalnotify);
-}
-
=head2 GetItems
($items) = &GetItems($itemnumber);
items.location,
items.itemnumber,
itemtypes.description,
- accountlines.notify_id,
- accountlines.notify_level,
accountlines.amountoutstanding
FROM accountlines
LEFT JOIN issues ON issues.itemnumber = accountlines.itemnumber
this module is a new interface, allow to the librarian to check all items on overdues (based on the acountlines type 'FU' )
this interface is filtered by branches (automatically), and by location (optional) ....
- FIXME for this time, we have only four methods to notify :
- - mail : work with a batch programm
- - letter : for us, the letters are generated by an open-office program
- - phone : Simple method, when the method 'phone' is selected, we consider, that the borrower as been notified, and the notify send date is implemented
- - considered lost : for us if the document is on the third overduelevel,
-
- FIXME the methods are actually hardcoded for the levels : (maybe can be improved by a new possibility in overduerule)
-
- level 1 : three methods are possible : - mail, letter, phone
- level 2 : only one method is possible : - letter
- level 3 : only methode is possible : - Considered Lost
-
- the documents displayed on this interface, are checked on three points
- - 1) the document must be on accountlines (Type 'FU')
- - 2) item issues is not returned
- - 3) this item as not been already notify
-
- FIXME: who is the author?
- FIXME: No privisions (i.e. "actions") for handling notices are implemented.
- FIXME: This is linked as "Overdue Fines" but the relationship to fines in GetOverduesForBranch is more complicated than that.
-
=cut
my $input = new CGI;
my $itemnumber = $input->param('itemnumber');
my $method = $input->param('method');
my $overduelevel = $input->param('overduelevel');
-my $notifyId = $input->param('notifyId');
my $location = $input->param('location');
# FIXME: better check that borrowernumber is defined and valid.
$overdueforbranch{'itemnumber'} = $num->{'itemnumber'};
$overdueforbranch{'cardnumber'} = $num->{'cardnumber'};
- # now we add on the template, the differents values of notify_level
- # FIXME: numerical comparison, not string eq.
- if ( $num->{'notify_level'} eq '1' ) {
- $overdueforbranch{'overdue1'} = 1;
- $overdueforbranch{'overdueLevel'} = 1;
- }
- elsif ( $num->{'notify_level'} eq '2' ) {
- $overdueforbranch{'overdue2'} = 1;
- $overdueforbranch{'overdueLevel'} = 2;
- }
- elsif ( $num->{'notify_level'} eq '3' ) {
- $overdueforbranch{'overdue3'} = 1;
- $overdueforbranch{'overdueLevel'} = 3;
- }
- $overdueforbranch{'notify_id'} = $num->{'notify_id'};
-
push( @overduesloop, \%overdueforbranch );
}
`amountoutstanding` decimal(28,6) default NULL,
`lastincrement` decimal(28,6) default NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `notify_id` int(11) NOT NULL default 0,
- `notify_level` int(2) NOT NULL default 0,
`note` text NULL default NULL,
`manager_id` int(11) NULL,
PRIMARY KEY (`accountlines_id`),
<td align="center">
[% IF ( overduesloo.overdue1 ) %]
[% IF ( overduesloo.borroweremail ) %]
- <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=mail&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]&notifyId=[% overduesloo.notify_id %]">Mail</a>
+ <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=mail&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]">Mail</a>
[% ELSE %]
Mail
[% END %]
|
- <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=phone&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]&notifyId=[% overduesloo.notify_id %]">Phone</a>
+ <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=phone&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]">Phone</a>
|
- <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=letter&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]&notifyId=[% overduesloo.notify_id %]">Notice</a>
+ <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=letter&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]">Notice</a>
[% END %]
[% IF ( overduesloo.overdue2 ) %]
- <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=letter&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]&notifyId=[% overduesloo.notify_id %]">Notice</a>
+ <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=letter&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]">Notice</a>
[% END %]
[% IF ( overduesloo.overdue3 ) %]
- <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=lost&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]&notifyId=[% overduesloo.notify_id %]">Considered lost</a>
+ <a href="branchoverdues.pl?action=add&borrowernumber=[% overduesloo.borrowernumber %]&itemnumber=[% overduesloo.itemnumber %]&method=lost&location=[% overduesloo.location %]&overduelevel=[% overduesloo.overdueLevel %]">Considered lost</a>
[% END %]
</td>
<th>Borrower</th>
<th>Location</th>
<th>Overdue status</th>
- <th>Notified by</th>
<th>Cancel</th>
</tr>
[% FOREACH todayoverduesloo IN todayoverduesloop %]
[% END %]
</b>
</td>
- <td align="center">
- <b>[% todayoverduesloo.notify_method %]</b>
- </td>
<td>
- <a href="branchoverdues.pl?action=remove&borrowernumber=[% todayoverduesloo.borrowernumber %]&itemnumber=[% todayoverduesloo.itemnumber %]&method=phone&location=[% todayoverduesloo.location %]&notify_date=[% todayoverduesloo.notify_date %]">Cancel notification</a>
+ <a href="branchoverdues.pl?action=remove&borrowernumber=[% todayoverduesloo.borrowernumber %]&itemnumber=[% todayoverduesloo.itemnumber %]&method=phone&location=[% todayoverduesloo.location %]">Cancel notification</a>
</td>
</tr>
[% END %]
<input type="hidden" name="accountlines_id[% line.accountlines_id %]" value="[% line.accountlines_id %]" />
<input type="hidden" name="amountoutstanding[% line.accountlines_id %]" value="[% line.amountoutstanding %]" />
<input type="hidden" name="borrowernumber[% line.accountlines_id %]" value="[% line.borrowernumber %]" />
- <input type="hidden" name="notify_id[% line.accountlines_id %]" value="[% line.notify_id %]" />
- <input type="hidden" name="notify_level[% line.accountlines_id %]" value="[% line.notify_level %]" />
<input type="hidden" name="totals[% line.accountlines_id %]" value="[% line.totals %]" />
</td>
<td>
</td>
<td><input type="text" name="payment_note_[% line.accountlines_id %]" /></td>
<td>[% line.accounttype %]</td>
- <td>[% line.notify_id %]</td>
- <td>[% line.notify_level %]</td>
<td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
<td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
</tr>
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
<input type="hidden" name="description" id="description" value="[% description %]" />
<input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
- <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
- <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
<input type="hidden" name="amount" id="amount" value="[% amount %]" />
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
[% individual_description %]
</td>
<td>[% accounttype %]</td>
- <td>[% notify_id %]</td>
- <td>[% notify_level %]</td>
<td class="debit">[% amount | format('%.2f') %]</td>
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
</tr></tbody>
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
<input type="hidden" name="description" id="description" value="[% description %]" />
<input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
- <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
- <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
<input type="hidden" name="amount" id="amount" value="[% amount %]" />
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
<tbody><tr>
<td>[% description %] [% title %]</td>
<td>[% accounttype %]</td>
- <td>[% notify_id %]</td>
- <td>[% notify_level %]</td>
<td class="debit">[% amount | format('%.2f') %]</td>
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
</tr></tbody>
my ( $total, undef, undef ) = GetMemberAccountRecords($borrowernumber);
my $accounts = [];
- my @notify = NumberNotifyId($borrowernumber);
-
- my $notify_groups = [];
- for my $notify_id (@notify) {
- my ( $acct_total, $accountlines, undef ) =
- GetBorNotifyAcctRecord( $borrowernumber, $notify_id );
- if ( @{$accountlines} ) {
- my $totalnotify = AmountNotify( $notify_id, $borrowernumber );
- push @{$accounts},
- { accountlines => $accountlines,
- notify => $notify_id,
- total => $totalnotify,
- };
- }
- }
borrower_add_additional_fields($borrower);
$template->param(%$borrower);
$redirect .= get_for_redirect( 'description', "description$line_no", 0 );
$redirect .= get_for_redirect( 'title', "title$line_no", 0 );
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 );
- $redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 );
- $redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 );
$redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 );
$redirect .= q{&} . 'payment_note' . q{=} . uri_escape_utf8( scalar $input->param("payment_note_$line_no") );
$redirect .= '&remote_user=';
my $itemnumber = $input->param('itemnumber');
my $description = $input->param('description');
my $title = $input->param('title');
- my $notify_id = $input->param('notify_id');
- my $notify_level = $input->param('notify_level');
$total_due = $amountoutstanding;
$template->param(
accounttype => $accounttype,
title => $title,
itemnumber => $itemnumber,
individual_description => $description,
- notify_id => $notify_id,
- notify_level => $notify_level,
payment_note => $payment_note,
);
} elsif ($select_lines) {