Bug 10021: Drop columns notify_id and notify_level from accountlines
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 18 Oct 2017 13:43:17 +0000 (10:43 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 11 Dec 2017 14:34:18 +0000 (11:34 -0300)
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>
C4/Accounts.pm
C4/Members.pm
C4/Overdues.pm
circ/branchoverdues.pl
installer/data/mysql/kohastructure.sql
koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
members/pay.pl
members/paycollect.pl

index 0717215..b84627b 100644 (file)
@@ -266,24 +266,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(
         {
@@ -295,7 +284,6 @@ sub manualinvoice {
             accounttype       => $type,
             amountoutstanding => $amountleft,
             itemnumber        => $itemnum || undef,
-            notify_id         => $notifyid,
             note              => $note,
             manager_id        => $manager_id,
         }
@@ -318,7 +306,6 @@ sub manualinvoice {
             description       => $desc,
             accounttype       => $type,
             amountoutstanding => $amountleft,
-            notify_id         => $notifyid,
             note              => $note,
             itemnumber        => $itemnum,
             manager_id        => $manager_id,
index 2031485..d8985bc 100644 (file)
@@ -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<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 ) = @_;
 
index b315511..6b75e38 100644 (file)
@@ -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
index 1430caa..29aad88 100755 (executable)
@@ -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 );
 }
 
index cdf977b..f031503 100644 (file)
@@ -2712,8 +2712,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`),
index 5a50369..2753bed 100644 (file)
                     <td align="center">
                     [% IF ( overduesloo.overdue1 ) %]
                         [% IF ( overduesloo.borroweremail ) %]
-                            <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=mail&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]&amp;notifyId=[% overduesloo.notify_id %]">Mail</a>
+                            <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=mail&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]">Mail</a>
                         [% ELSE %]
                             Mail
                         [% END %]
                             &nbsp;|&nbsp;
-                            <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=phone&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]&amp;notifyId=[% overduesloo.notify_id %]">Phone</a>
+                            <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=phone&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]">Phone</a>
                             &nbsp;|&nbsp;
-                            <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=letter&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]&amp;notifyId=[% overduesloo.notify_id %]">Notice</a>
+                            <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=letter&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]">Notice</a>
                     [% END %]
 
                     [% IF ( overduesloo.overdue2 ) %]
-                        <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=letter&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]&amp;notifyId=[% overduesloo.notify_id %]">Notice</a>
+                        <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=letter&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]">Notice</a>
                     [% END %]
 
                     [% IF ( overduesloo.overdue3 ) %]
-                    <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=lost&amp;location=[% overduesloo.location %]&amp;overduelevel=[% overduesloo.overdueLevel %]&amp;notifyId=[% overduesloo.notify_id %]">Considered lost</a>
+                    <a href="branchoverdues.pl?action=add&amp;borrowernumber=[% overduesloo.borrowernumber %]&amp;itemnumber=[% overduesloo.itemnumber %]&amp;method=lost&amp;location=[% overduesloo.location %]&amp;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&amp;borrowernumber=[% todayoverduesloo.borrowernumber %]&amp;itemnumber=[% todayoverduesloo.itemnumber %]&amp;method=phone&amp;location=[% todayoverduesloo.location %]&amp;notify_date=[% todayoverduesloo.notify_date %]">Cancel notification</a>
+                        <a href="branchoverdues.pl?action=remove&amp;borrowernumber=[% todayoverduesloo.borrowernumber %]&amp;itemnumber=[% todayoverduesloo.itemnumber %]&amp;method=phone&amp;location=[% todayoverduesloo.location %]">Cancel notification</a>
                         </td>
                     </tr>
                 [% END %]
index ead4ce4..243f777 100644 (file)
@@ -112,8 +112,6 @@ function enableCheckboxActions(){
     <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>
@@ -145,8 +143,6 @@ function enableCheckboxActions(){
     </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>
index 12b2c4b..4dc541e 100644 (file)
@@ -107,8 +107,6 @@ function moneyFormat(textObj) {
     <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 %]" />
@@ -134,8 +132,6 @@ function moneyFormat(textObj) {
                 [% 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>
@@ -164,8 +160,6 @@ function moneyFormat(textObj) {
     <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 %]" />
@@ -184,8 +178,6 @@ function moneyFormat(textObj) {
     <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>
index 70e45e2..6d60556 100755 (executable)
@@ -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=';
index 9ec3077..b4ea12b 100755 (executable)
@@ -86,8 +86,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,
@@ -97,8 +95,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) {