Bug 10752

Summary: Impossible to add 2 identical suggestions, but without any explanation
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: abl, chris, jonathan.druart, tomascohen, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 10752: Alert the librarian if the suggestion has not been added
Bug 10752: Alert the librarian if the suggestion has not been added
Bug 10752: Remove the specific css for links in an error dialog
Bug 10752: Alert if the suggestion has not been added - OPAC
[Signed-off] Bug 10752: Alert the librarian if the suggestion has not been added
[Signed-off] Bug 10752: Remove the specific css for links in an error dialog
[Signed-off] Bug 10752: Alert if the suggestion has not been added - OPAC
[PASSED QA] Bug 10752: Alert the librarian if the suggestion has not been added
[PASSED QA] Bug 10752: Remove the specific css for links in an error dialog
[PASSED QA] Bug 10752: Alert if the suggestion has not been added - OPAC
Bug 14022: Follow-up - rephrase erorr messages a little

Description Katrin Fischer 2013-08-18 19:47:09 UTC
To reproduce:

- Create a new suggestion, chose a short term as your title and copy it. 
- Leave all other fields of the suggestion form untouched.
- Save your first suggestion.
- Enter a second suggestion with the same title.

It won't save and there is no error message or explanation given.
Comment 1 Katrin Fischer 2014-11-10 22:34:08 UTC
*** Bug 13086 has been marked as a duplicate of this bug. ***
Comment 2 Marc Véron 2015-02-24 20:06:20 UTC
Still valid on 3.19.00.012

Seems to be by design

See: suggestion/suggestion.pl around line 132

        ###FIXME:Search here if suggestion already exists.
        my $suggestions_loop =
            SearchSuggestion( $suggestion_only );
        if (@$suggestions_loop>=1){
            #some suggestion are answering the request Donot Add
        }
        else {
            ## Adding some informations related to suggestion
            &NewSuggestion($suggestion_only);
        }
Comment 3 Jonathan Druart 2015-04-16 14:59:16 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-04-16 15:01:07 UTC
QA: I already used the message trick in some other bugs: bug 10363, bug 10855, bug 11023
Comment 5 Mark Tompsett 2015-04-16 21:30:13 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2015-04-17 21:34:23 UTC
This works really nicely, but there are 2 small problems:

1)  I notice is that the link is not visible as a link - the font is all red and hiding away that you can click on the text in the parenthesis. - wondering, do we have another style we could use here?

2) Enter the first as "Test" then another as "Test " - you can save it without any complaint. Now create another "Test" - the error message is appearing twice?

3) The other problem... is that this also appears in the OPAC where the user is left with questionmarks why his/her suggestion didn't save. :( Not a blocker, but would be great to see it fixed!
Comment 7 Jonathan Druart 2015-04-20 08:10:03 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2015-04-20 08:10:09 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2015-04-20 08:13:23 UTC
(In reply to Katrin Fischer from comment #6)
> This works really nicely, but there are 2 small problems:
> 
> 1)  I notice is that the link is not visible as a link - the font is all red
> and hiding away that you can click on the text in the parenthesis. -
> wondering, do we have another style we could use here?

Ok fixed, I have deleted few css lines. I think they were not used.

> 2) Enter the first as "Test" then another as "Test " - you can save it
> without any complaint. Now create another "Test" - the error message is
> appearing twice?

Yes, it's caused by the way the search is done.
To know if a suggestion exists, a LIKE "%$term%" is done, so if one exists with "Test" in the same, it won't be inserted.
I prefer to show all results rather than choose 1 of them. 

> 3) The other problem... is that this also appears in the OPAC where the user
> is left with questionmarks why his/her suggestion didn't save. :( Not a
> blocker, but would be great to see it fixed!

Done in the last patch.
Comment 10 Marc Véron 2015-04-20 17:25:31 UTC Comment hidden (obsolete)
Comment 11 Marc Véron 2015-04-20 17:28:08 UTC Comment hidden (obsolete)
Comment 12 Marc Véron 2015-04-20 17:29:50 UTC Comment hidden (obsolete)
Comment 13 Katrin Fischer 2015-04-20 20:17:14 UTC
Created attachment 38213 [details] [review]
[PASSED QA] Bug 10752: Alert the librarian if the suggestion has not been added

Test plan:
- Create a new suggestion, chose a short term as your title and copy it.
- Leave all other fields of the suggestion form untouched.
- Save your first suggestion.
- Enter a second suggestion with the same title.

Before this patch, the suggestion was not inserted without alert.
With this patch, an alert is displayed on the interface.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: Love the simplicity and ability to expand. :)

Tested with all pateches applied. Wors as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2015-04-20 20:17:25 UTC
Created attachment 38214 [details] [review]
[PASSED QA] Bug 10752: Remove the specific css for links in an error dialog

Comes from commit c28f7d7de5d1e1a8d5e0038b76fce74397c3c489
Date:   Tue Mar 20 15:20:25 2012 +0100
    Bug 6209 [Revised] Standardize on one plugin for client-side form
    validation

It did not find how it could be useful.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Katrin Fischer 2015-04-20 20:17:31 UTC
Created attachment 38215 [details] [review]
[PASSED QA] Bug 10752: Alert if the suggestion has not been added - OPAC

Same as previous patches for the OPAC.

Test plan is the same.

Tested with all patches applied. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Katrin Fischer 2015-04-20 20:17:36 UTC
Created attachment 38216 [details] [review]
Bug 14022: Follow-up - rephrase erorr messages a little

Rephrased error messages a little and changed the link to
look like it does on other pages, for example when looking
at an order created from a suggestion.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Tomás Cohen Arazi 2015-04-28 18:38:24 UTC
(In reply to Katrin Fischer from comment #16)
> Created attachment 38216 [details] [review] [review]
> Bug 14022: Follow-up - rephrase erorr messages a little
> 
> Rephrased error messages a little and changed the link to
> look like it does on other pages, for example when looking
> at an order created from a suggestion.
> 
> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Katrin, is the bug number on the patch subject wrong and this really belongs here? (it seems so, just over-checking)
Comment 18 Katrin Fischer 2015-04-28 18:39:49 UTC
No idea where i got the number from... can you please fix? The patch at least belongs here.
Comment 19 Tomás Cohen Arazi 2015-04-28 19:49:06 UTC
Patches pushed to master.

Thanks Jonathan!
Comment 20 Chris Cormack 2015-05-17 04:24:41 UTC
Pushed to 3.18.x will be in 3.18.7