Bug 27136: (QA follow-up) Fix entries for multiple und undetermined language(s)
[koha-ffzg.git] / opac / opac-shareshelf.pl
index 8bb7b60..29edd82 100755 (executable)
@@ -25,13 +25,13 @@ use constant SHELVES_URL =>
   '/cgi-bin/koha/opac-shelves.pl?display=privateshelves&viewshelf=';
 
 use CGI qw ( -utf8 );
-use Email::Address;
 
 use C4::Auth qw( get_template_and_user );
 use C4::Context;
 use C4::Letters;
 use C4::Output qw( output_html_with_http_headers );
 
+use Koha::Email;
 use Koha::Patrons;
 use Koha::Virtualshelves;
 use Koha::Virtualshelfshares;
@@ -81,7 +81,7 @@ sub _init {
     $shelf = Koha::Virtualshelves->find( $shelfnumber ) unless $param->{errcode};
     $param->{shelfname} = $shelf ? $shelf->shelfname : q||;
     $param->{owner}     = $shelf ? $shelf->owner : -1;
-    $param->{category}  = $shelf ? $shelf->category : -1;
+    $param->{public}    = $shelf ? $shelf->public : 0;
 
     load_template($param);
     return $param;
@@ -128,7 +128,7 @@ sub show_accept {
     # You must not be the owner and the list must be private
     if( !$shelf ) {
         $param->{errcode} = 2;
-    } elsif( $shelf->category == 2 ) {
+    } elsif( $shelf->public ) {
         $param->{errcode} = 5;
     } elsif( $shelf->owner == $param->{loggedinuser} ) {
         $param->{errcode} = 8;
@@ -195,7 +195,7 @@ sub process_addrlist {
     foreach my $a (@temp) {
         $a =~ s/^\s+//;
         $a =~ s/\s+$//;
-        if ( $a =~ m/$Email::Address::mailbox/ ) {
+        if ( Koha::Email->is_valid($a) ) {
             push @appr_addr, $a;
         }
         else {
@@ -264,7 +264,7 @@ sub check_owner_category {
     #sharing user should be the owner
     #list should be private
     $param->{errcode} = 4 if $param->{owner} != $param->{loggedinuser};
-    $param->{errcode} = 5 if !$param->{errcode} && $param->{category} != 1;
+    $param->{errcode} = 5 if !$param->{errcode} && $param->{public};
     return !defined $param->{errcode};
 }