Bug 24370: Allow resetting library to ANY
[srvgit] / suggestion / suggestion.pl
index 370bac1..5f69087 100755 (executable)
 use Modern::Perl;
 require Exporter;
 use CGI qw ( -utf8 );
-use C4::Auth;    # get_template_and_user
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 use C4::Suggestions;
-use C4::Koha;
-use C4::Budgets;
-use C4::Search;
+use C4::Koha qw( GetAuthorisedValues );
+use C4::Budgets qw( GetBudget GetBudgets GetBudgetHierarchy CanUserUseBudget );
+use C4::Search qw( FindDuplicate GetDistinctValues );
 use C4::Members;
 use Koha::DateUtils qw( dt_from_string );
 use Koha::AuthorisedValues;
@@ -33,7 +33,7 @@ use Koha::Acquisition::Currencies;
 use Koha::Libraries;
 use Koha::Patrons;
 
-use URI::Escape;
+use URI::Escape qw( uri_escape );
 
 sub Init{
     my $suggestion= shift @_;
@@ -180,6 +180,9 @@ if ( $op =~ /save/i ) {
 
             $suggestion_only->{lastmodificationdate} = dt_from_string;
             $suggestion_only->{lastmodificationby}   = C4::Context->userenv->{number};
+            $suggestion_only->{branchcode} = undef
+              if exists $suggestion_only->{branchcode}
+              && $suggestion_only->{branchcode} eq "";
 
             &ModSuggestion($suggestion_only);