From d162c4afb385b07b2e68d4104e8d1b66016176af Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Fri, 6 Dec 2019 10:30:20 +0000 Subject: [PATCH] Bug 23961: (follow-up) Remove data duplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In response to Séverine observations in comment #10, this patch removes the duplicate logging of the borrowernumber https://bugs.koha-community.org/show_bug.cgi?id=23971 --- C4/Acquisition.pm | 14 ++++---------- Koha/EDI.pm | 2 +- acqui/addorder.pl | 3 +-- acqui/basket.pl | 13 +++++-------- acqui/basketheader.pl | 3 +-- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 24df15d3a2..eb75009c48 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -224,7 +224,7 @@ close a basket (becomes unmodifiable, except for receives) =cut sub CloseBasket { - my ($basketno, $user, $edi_approval) = @_; + my ($basketno, $edi_approval) = @_; my $dbh = C4::Context->dbh; $dbh->do('UPDATE aqbasket SET closedate=now() WHERE basketno=?', {}, $basketno ); @@ -236,12 +236,10 @@ q{UPDATE aqorders SET orderstatus = 'ordered' WHERE basketno = ? AND orderstatus # Log the closure if (C4::Context->preference("AcqLog")) { my $action = $edi_approval ? 'APPROVE_BASKET' : 'CLOSE_BASKET'; - my $infos = $user ? sprintf("%010d", $user) : undef; logaction( 'ACQUISITIONS', $action, - $basketno, - $infos + $basketno ); } @@ -570,14 +568,10 @@ sub ModBasket { # Log the basket update if (C4::Context->preference("AcqLog")) { - my $infos = $basketinfo->{borrowernumber} ? - sprintf("%010d", $basketinfo->{borrowernumber}) : - undef; logaction( 'ACQUISITIONS', 'MODIFY_BASKET', - $basketinfo->{'basketno'}, - $infos + $basketinfo->{'basketno'} ); } @@ -620,7 +614,7 @@ case the AcqCreateItem syspref takes precedence). =cut sub ModBasketHeader { - my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items, $borrowernumber) = @_; + my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_; $is_standing ||= 0; my $query = qq{ diff --git a/Koha/EDI.pm b/Koha/EDI.pm index 32abcec893..c1735e98f4 100644 --- a/Koha/EDI.pm +++ b/Koha/EDI.pm @@ -576,7 +576,7 @@ sub process_quote { ); # Close the basket, passing a flag indicating that this action # originated from an approval - CloseBasket($b, undef, 1); + CloseBasket($b, 1); } } diff --git a/acqui/addorder.pl b/acqui/addorder.pl index 70b8e7a1e6..68d9f0bc11 100755 --- a/acqui/addorder.pl +++ b/acqui/addorder.pl @@ -361,8 +361,7 @@ if (C4::Context->preference("AcqLog") && $basketno) { logaction( 'ACQUISITIONS', 'MODIFY_BASKET', - $basketno, - sprintf("%010d", $loggedinuser) + $basketno ); } diff --git a/acqui/basket.pl b/acqui/basket.pl index bb6d9cba8d..95c47bd723 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -195,7 +195,7 @@ if ( $op eq 'delete_confirm' ) { if ($confirm) { my $basketno = $query->param('basketno'); my $booksellerid = $query->param('booksellerid'); - $basketno =~ /^\d+$/ and CloseBasket($basketno, $loggedinuser); + $basketno =~ /^\d+$/ and CloseBasket($basketno); # if requested, create basket group, close it and attach the basket if ($query->param('createbasketgroup')) { my $branchcode; @@ -210,8 +210,7 @@ if ( $op eq 'delete_confirm' ) { closed => 1, }); ModBasket( { basketno => $basketno, - basketgroupid => $basketgroupid, - borrowernumber => $loggedinuser } ); + basketgroupid => $basketgroupid } ); print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1'); } else { print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid); @@ -244,8 +243,7 @@ elsif ( $op eq 'ediorder' ) { $branch = undef if(defined $branch and $branch eq ''); ModBasket({ basketno => $basket->{basketno}, - branch => $branch, - borrowernumber => $loggedinuser + branch => $branch }); print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno"); exit; @@ -538,7 +536,7 @@ sub edi_close_and_order { if ( create_edi_order($edi_params) ) { #$template->param( edifile => 1 ); } - CloseBasket($basketno, $loggedinuser); + CloseBasket($basketno); # if requested, create basket group, close it and attach the basket if ( $query->param('createbasketgroup') ) { @@ -561,8 +559,7 @@ sub edi_close_and_order { ModBasket( { basketno => $basketno, - basketgroupid => $basketgroupid, - borrowernumber => $loggedinuser + basketgroupid => $basketgroupid } ); print $query->redirect( diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index ee4cf647b8..0eb479ff20 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -154,8 +154,7 @@ if ( $op eq 'add_form' ) { scalar $input->param('deliveryplace'), scalar $input->param('billingplace'), scalar $input->param('is_standing') ? 1 : undef, - scalar $input->param('create_items'), - $loggedinuser + scalar $input->param('create_items') ); } else { #New basket $basketno = NewBasket( -- 2.11.0