Bugzilla – Attachment 89930 Details for
Bug 22905
Cannot update the status of suggestions if the branchcode filter is set to all
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22905: Fix update of suggestion's status if branchcode filter is 'all'
Bug-22905-Fix-update-of-suggestions-status-if-bran.patch (text/plain), 4.46 KB, created by
Marcel de Rooy
on 2019-05-21 07:07:14 UTC
(
hide
)
Description:
Bug 22905: Fix update of suggestion's status if branchcode filter is 'all'
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-05-21 07:07:14 UTC
Size:
4.46 KB
patch
obsolete
>From 7758617f24285a6f7ac076cb3a87ef160a72dade Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 16 May 2019 13:20:53 -0500 >Subject: [PATCH] Bug 22905: Fix update of suggestion's status if branchcode > filter is 'all' >MIME-Version: 1.0 >Content-Type: text/plain; charset=utf-8 >Content-Transfer-Encoding: 8bit >Content-Type: text/plain; charset=utf-8 > >Because of the "Library" filter on the left of the "Suggestions management" screen, there is something wrong happening: > >1. Create a suggestion from library A, login from library B >2. Go to Home ⺠Acquisitions ⺠Suggestions management >=> The suggestion does not appear - OK >3. In the filter on the left, select "all library" >=> The suggestion appears on the pending tab - KO >4. Select the suggestion and mark is as 'Accepted' >=> The suggestion still appears on the pending tab - Failure > >The log says: >DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`suggestions`, CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE) [for Statement "UPDATE `suggestions` SET `accepteddate` = ?, `branchcode` = ?, `currency` = ?, `manageddate` = ?, `price` = ?, `reason` = ?, `suggesteddate` = ?, `total` = ? WHERE ( `suggestionid` = ? )" with ParamValues: 0='2019-05-14T15:48:18', 1="", 2="CAD", 3='2019-05-14T15:48:18', 4="0.00", 5="", 6='2019-05-14T00:00:00', 7="0.00", 8=3] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836. > >Let forget what could have happened earlier in the script and do it the regular >way, from $input. Then call ModSuggestion with only what we need. > >Test plan: >Confirm that the steps described before work as expected once this patch is applied > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >https://bugs.koha-community.org/show_bug.cgi?id=22907 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > suggestion/suggestion.pl | 41 +++++++++++++++++++++++++++-------------- > 1 file changed, 27 insertions(+), 14 deletions(-) > >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 845ed0ecca..308e32623d 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -188,30 +188,43 @@ elsif ($op=~/edit/) { > $op ='save'; > } > elsif ($op eq "change" ) { >+ >+ my $suggestion; > # set accepted/rejected/managed informations if applicable > # ie= if the librarian has chosen some action on the suggestions >- if ($suggestion_only->{"STATUS"} eq "ACCEPTED"){ >- $suggestion_only->{accepteddate} = dt_from_string; >- $suggestion_only->{"acceptedby"}=C4::Context->userenv->{number}; >- } elsif ($suggestion_only->{"STATUS"} eq "REJECTED"){ >- $suggestion_only->{rejecteddate} = dt_from_string; >- $suggestion_only->{"rejectedby"}=C4::Context->userenv->{number}; >+ my $STATUS = $input->param('STATUS'); >+ my $accepted_by = $input->param('acceptedby'); >+ if ( $STATUS eq "ACCEPTED" ) { >+ $suggestion = { >+ STATUS => $STATUS, >+ accepteddate => dt_from_string, >+ acceptedby => C4::Context->userenv->{number}, >+ }; > } >- if ($suggestion_only->{"STATUS"}){ >- $suggestion_only->{manageddate} = dt_from_string; >- $suggestion_only->{"managedby"}=C4::Context->userenv->{number}; >+ elsif ( $STATUS eq "REJECTED" ) { >+ $suggestion = { >+ >+ STATUS => $STATUS, >+ rejecteddate => dt_from_string, >+ rejectedby => C4::Context->userenv->{number}, >+ }; > } >- if ( my $reason = $$suggestion_ref{"reason$tabcode"}){ >+ if ($STATUS) { >+ $suggestion->{manageddate} = dt_from_string; >+ $suggestion->{managedby} = C4::Context->userenv->{number}; >+ } >+ if ( my $reason = $input->param("reason$tabcode") ) { > if ( $reason eq "other" ) { >- $reason = $$suggestion_ref{"other_reason$tabcode"}; >+ $reason = $input->param("other_reason$tabcode"); > } >- $suggestion_only->{reason}=$reason; >+ $suggestion->{reason} = $reason; > } > > foreach my $suggestionid (@editsuggestions) { > next unless $suggestionid; >- $suggestion_only->{'suggestionid'}=$suggestionid; >- &ModSuggestion($suggestion_only); >+ $suggestion->{suggestionid} = $suggestionid; >+ use Data::Printer colored => 1; warn p $suggestion; >+ &ModSuggestion($suggestion); > } > my $params = ''; > foreach my $key ( >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22905
:
89828
|
89868
|
89870
|
89871
|
89884
| 89930 |
89931