#!/usr/bin/perl
# Copyright 2006 SAN OUEST PROVENCE et Paul POULAIN
+# Copyright 2010 BibLibre
#
# This file is part of Koha.
#
if ($op eq 'insert'){
# we know it's not a duplicate borrowernumber or there would already be an error
$borrowernumber = &AddMember(%newdata);
+ $newdata{'borrowernumber'} = $borrowernumber;
# If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
if ( C4::Context->preference("AutoEmailOpacUser") == 1 && $newdata{'userid'} && $newdata{'password'}) {
if (!defined($data{'dateenrolled'}) or $data{'dateenrolled'} eq ''){
$data{'dateenrolled'}=C4::Dates->today('iso');
}
+if ( $op eq 'duplicate' ) {
+ $data{'dateenrolled'} = C4::Dates->today('iso');
+ $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, $data{'dateenrolled'} );
+}
if (C4::Context->preference('uppercasesurnames')) {
$data{'surname'} =uc($data{'surname'} );
$data{'contactname'}=uc($data{'contactname'});