Bug 24545: Fix license statements
[srvgit] / svc / members / search
index 2599519..ae46d33 100755 (executable)
@@ -25,6 +25,7 @@ use C4::Output qw( output_with_http_headers );
 use C4::Utils::DataTables qw( dt_get_params );
 use C4::Utils::DataTables::Members qw( search );
 use Koha::DateUtils qw( output_pref dt_from_string );
+use Koha::Patrons;
 
 my $input = new CGI;
 
@@ -35,7 +36,7 @@ my ($template, $user, $cookie) = get_template_and_user({
     query           => $input,
     type            => "intranet",
     authnotrequired => 0,
-    flagsrequired   => { borrowers => 1 }
+    flagsrequired   => { borrowers => 'edit_borrowers' }
 });
 
 my $searchmember = $input->param('searchmember');
@@ -47,10 +48,6 @@ my $searchfieldstype = $input->param('searchfieldstype') || 'standard';
 my $has_permission = $input->param('has_permission');
 my $selection_type = $input->param('selection_type');
 
-if ( $searchfieldstype eq "dateofbirth" ) {
-    $searchmember = output_pref({dt => dt_from_string($searchmember), dateformat => 'iso', dateonly => 1});
-}
-
 # variable information for DataTables (id)
 my $sEcho = $input->param('sEcho');
 
@@ -67,11 +64,11 @@ if ( $searchmember
     and $searchfieldstype
     and $searchfieldstype eq 'standard' )
 {
-    my $member = C4::Members::GetMember( cardnumber => $searchmember );
+    my $member = Koha::Patrons->find( { cardnumber => $searchmember } );
     $results = {
         iTotalRecords        => 1,
         iTotalDisplayRecords => 1,
-        patrons              => [ $member ],
+        patrons              => [ $member->unblessed ],
     } if $member;
 }
 
@@ -94,7 +91,7 @@ if ($has_permission) {
     my ( $permission, $subpermission ) = split /\./, $has_permission;
     my @patrons_with_permission;
     for my $patron ( @{ $results->{patrons} } ) {
-        my $perms = haspermission( $patron->{userid} );
+        my $perms = haspermission( $patron->{userid}, undef );
         if (   $perms->{superlibrarian} == 1
             or $perms->{$permission} == 1 )
         {
@@ -157,10 +154,15 @@ terms of the GNU General Public License as published by the Free Software
 Foundation; either version 2 of the License, or (at your option) any later
 version.
 
-Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+Koha is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+Koha is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
-with Koha; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+You should have received a copy of the GNU General Public License
+along with Koha; if not, see <http://www.gnu.org/licenses>.