(MT #2966) fix opac-user.pl function problem
[srvgit] / members / moremember.pl
index 63b09bf..4d4d9bb 100755 (executable)
@@ -13,9 +13,9 @@
 # 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., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# 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.
 
 
 =head1 moremember.pl
@@ -32,6 +32,7 @@
 =cut
 
 use strict;
+#use warnings; FIXME - Bug 2505
 use CGI;
 use C4::Context;
 use C4::Auth;
@@ -359,6 +360,20 @@ foreach (@$alerts) {
     $_->{relatedto} = findrelatedto( $_->{type}, $_->{externalid} );
 }
 
+my $candeleteuser;
+my $userenv = C4::Context->userenv;
+if($userenv->{flags} % 2 == 1){
+    $candeleteuser = 1;
+}elsif ( C4::Context->preference("IndependantBranches") ) {
+    $candeleteuser = ( $data->{'branchcode'} eq $userenv->{branch} );
+}else{
+    if( C4::Auth::getuserflags( $userenv->{flags},$userenv->{number})->{borrowers} ) {
+        $candeleteuser = 1;
+    }else{
+        $candeleteuser = 0;
+    }
+}
+
 # check to see if patron's image exists in the database
 # basically this gives us a template var to condition the display of
 # patronimage related interface on
@@ -389,6 +404,7 @@ $template->param(
     detailview => 1,
     AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
     DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+    CANDELETEUSER    => $candeleteuser,
     roaddetails     => $roaddetails,
     borrowernumber  => $borrowernumber,
     categoryname    => $data->{'description'},