From 73a5126e02bd48940bbbab46166f4a4ba40d709b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Oct 2017 10:43:17 -0300 Subject: [PATCH] Bug 10021: Drop columns notify_id and notify_level from accountlines It appears that has never worked. Could someone confirm? --- C4/Accounts.pm | 19 ++------ C4/Members.pm | 46 ------------------ C4/Overdues.pm | 56 ---------------------- circ/branchoverdues.pl | 38 --------------- installer/data/mysql/kohastructure.sql | 2 - .../prog/en/modules/circ/branchoverdues.tt | 16 +++---- .../intranet-tmpl/prog/en/modules/members/pay.tt | 4 -- .../prog/en/modules/members/paycollect.tt | 8 ---- members/pay.pl | 17 ------- members/paycollect.pl | 4 -- 10 files changed, 9 insertions(+), 201 deletions(-) diff --git a/C4/Accounts.pm b/C4/Accounts.pm index 7daff23e05..6d22c66443 100644 --- a/C4/Accounts.pm +++ b/C4/Accounts.pm @@ -159,11 +159,11 @@ sub chargelostitem{ unless ($existing_charges) { #add processing fee if ($processfee && $processfee > 0){ - manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1); + manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote); } #add replace cost if ($replacementprice > 0){ - manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice, undef, 1); + manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice); } } } @@ -195,24 +195,13 @@ should be the empty string. # 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( { @@ -224,7 +213,6 @@ sub manualinvoice { accounttype => $type, amountoutstanding => $amountleft, itemnumber => $itemnum || undef, - notify_id => $notifyid, note => $note, manager_id => $manager_id, } @@ -247,7 +235,6 @@ sub manualinvoice { description => $desc, accounttype => $type, amountoutstanding => $amountleft, - notify_id => $notifyid, note => $note, itemnumber => $itemnum, manager_id => $manager_id, diff --git a/C4/Members.pm b/C4/Members.pm index f31ef8d40c..29ccc0822c 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -68,7 +68,6 @@ BEGIN { &GetNoticeEmailAddress &GetMemberAccountRecords - &GetBorNotifyAcctRecord &GetBorrowersToExpunge @@ -814,51 +813,6 @@ sub GetMemberAccountBalance { 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 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 ) = @_; diff --git a/C4/Overdues.pm b/C4/Overdues.pm index b315511a82..6b75e3898a 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -50,8 +50,6 @@ BEGIN { &CalcFine &Getoverdues &checkoverdues - &NumberNotifyId - &AmountNotify &UpdateFine &GetFine &get_chargeable_units @@ -701,58 +699,6 @@ sub GetFine { 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); @@ -840,8 +786,6 @@ sub GetOverduesForBranch { items.location, items.itemnumber, itemtypes.description, - accountlines.notify_id, - accountlines.notify_level, accountlines.amountoutstanding FROM accountlines LEFT JOIN issues ON issues.itemnumber = accountlines.itemnumber diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index 1430caaa32..29aad88092 100755 --- a/circ/branchoverdues.pl +++ b/circ/branchoverdues.pl @@ -35,27 +35,6 @@ use Data::Dumper; 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; @@ -77,7 +56,6 @@ my $borrowernumber = $input->param('borrowernumber'); 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. @@ -118,22 +96,6 @@ foreach my $num (@getoverdues) { $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 ); } diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 837d74bfaf..187ef7106b 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2711,8 +2711,6 @@ CREATE TABLE `accountlines` ( `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`), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt index 5a503693ae..2753bed64b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt @@ -75,22 +75,22 @@ [% IF ( overduesloo.overdue1 ) %] [% IF ( overduesloo.borroweremail ) %] - Mail + Mail [% ELSE %] Mail [% END %]  |  - Phone + Phone  |  - Notice + Notice [% END %] [% IF ( overduesloo.overdue2 ) %] - Notice + Notice [% END %] [% IF ( overduesloo.overdue3 ) %] - Considered lost + Considered lost [% END %] @@ -110,7 +110,6 @@ Borrower Location Overdue status - Notified by Cancel [% FOREACH todayoverduesloo IN todayoverduesloop %] @@ -150,12 +149,9 @@ [% END %] - - [% todayoverduesloo.notify_method %] - - Cancel notification + Cancel notification [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index ead4ce4cb9..243f777015 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -112,8 +112,6 @@ function enableCheckboxActions(){ - - @@ -145,8 +143,6 @@ function enableCheckboxActions(){ [% line.accounttype %] - [% line.notify_id %] - [% line.notify_level %] [% line.amount | $Price %] [% line.amountoutstanding | $Price %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index a1458b58f1..e6c1b44de1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -106,8 +106,6 @@ function moneyFormat(textObj) { - - @@ -133,8 +131,6 @@ function moneyFormat(textObj) { [% individual_description %] [% accounttype %] - [% notify_id %] - [% notify_level %] [% amount | format('%.2f') %] [% amountoutstanding | format('%.2f') %] @@ -162,8 +158,6 @@ function moneyFormat(textObj) { - - @@ -182,8 +176,6 @@ function moneyFormat(textObj) { [% description %] [% title %] [% accounttype %] - [% notify_id %] - [% notify_level %] [% amount | format('%.2f') %] [% amountoutstanding | format('%.2f') %] diff --git a/members/pay.pl b/members/pay.pl index 70e45e2098..6d60556880 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -134,21 +134,6 @@ sub add_accounts_to_template { 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); @@ -196,8 +181,6 @@ sub redirect_to_paycollect { $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='; diff --git a/members/paycollect.pl b/members/paycollect.pl index f880f575c8..ae70309fba 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -85,8 +85,6 @@ if ( $individual || $writeoff ) { 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, @@ -96,8 +94,6 @@ if ( $individual || $writeoff ) { title => $title, itemnumber => $itemnumber, individual_description => $description, - notify_id => $notify_id, - notify_level => $notify_level, payment_note => $payment_note, ); } elsif ($select_lines) { -- 2.11.0