Bug 9928 - no way to see all purchase suggestions at all
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 26 Mar 2013 13:58:57 +0000 (09:58 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 30 Mar 2013 20:58:56 +0000 (16:58 -0400)
Test Plan:
1) Apply patch
3) Create suggestions for multiple libraries
2) Select 'Any' for the 'For' field under 'Acquisition information'
3) Note you are seeing the suggestions for all branches

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Works as described

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch fixes wrong behaviour.
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
C4/Suggestions.pm
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt

index ddd1d6a..131f117 100644 (file)
@@ -143,11 +143,22 @@ sub SearchSuggestion {
                 };
             }
         }
+    } else {
+        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
+            unless ( $suggestion->{branchcode} eq '__ANY__' ) {
+                push @sql_params, $suggestion->{branchcode};
+                push @query,      qq{ AND suggestions.branchcode=? };
+            }
+        } else {
+            push @query, qq{
+                AND (suggestions.branchcode='' OR suggestions.branchcode IS NULL)
+            };
+        }
     }
 
     # filter on nillable fields
     foreach my $field (
-        qw( STATUS branchcode itemtype suggestedby managedby acceptedby budgetid biblionumber )
+        qw( STATUS itemtype suggestedby managedby acceptedby budgetid biblionumber )
       )
     {
         if ( exists $suggestion->{$field} ) {
index fcb8eca..f8566c9 100644 (file)
@@ -325,7 +325,7 @@ $(document).ready(function() { calcNewsuggTotal(); });
     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
         <li><label for="branchcode">Library:</label>
             <select name="branchcode" id="branchcode">
-                <option value="">Any</option>[% FOREACH branchloo IN branchloop %]
+                <option value="__ANY__">Any</option>[% FOREACH branchloo IN branchloop %]
                 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %][% END %]
             </select>
         </li>
@@ -555,7 +555,7 @@ $(document).ready(function() { calcNewsuggTotal(); });
                     </select></li>
                     <li><label for="branchcode"> For:</label>
                     <select name="branchcode" id="branchcode">
-                        <option value="">Any</option>[% FOREACH branchloo IN branchloop %]
+                        <option value="__ANY__">Any</option>[% FOREACH branchloo IN branchloop %]
                             [% IF ( branchloo.selected ) %] <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %] <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
                             [% END %]
                     </select></li><li><input type="submit" value="Go" /></li></ol>