Bug 31420: Managing funds: Labels of statistic fields overlap with pull downs
[koha-ffzg.git] / opac / opac-memberentry.pl
index 3eb94b2..17345c7 100755 (executable)
@@ -35,14 +35,12 @@ use Koha::Patron::Consent;
 use Koha::Patron::Modification;
 use Koha::Patron::Modifications;
 use C4::Scrubber;
-use Koha::DateUtils qw( dt_from_string output_pref );
+use Koha::DateUtils qw( dt_from_string );
 use Koha::Email;
 use Koha::Libraries;
 use Koha::Patron::Attribute::Types;
 use Koha::Patron::Attributes;
 use Koha::Patron::Images;
-use Koha::Patron::Modification;
-use Koha::Patron::Modifications;
 use Koha::Patron::Categories;
 use Koha::Token;
 use Koha::AuthorisedValues;
@@ -244,8 +242,8 @@ if ( $action eq 'create' ) {
                 $template->param( password_cleartext => $patron->plain_text_password );
                 $template->param( borrower => $patron->unblessed );
 
-                # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
-                if ( C4::Context->preference("AutoEmailOpacUser") ) {
+                # If 'AutoEmailNewUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode.
+                if ( C4::Context->preference("AutoEmailNewUser") ) {
                     #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead
                     my $emailaddr = $patron->notice_email_address;
                     # if we manage to find a valid email address, send notice
@@ -253,7 +251,7 @@ if ( $action eq 'create' ) {
                         eval {
                             my $letter = GetPreparedLetter(
                                 module      => 'members',
-                                letter_code => 'ACCTDETAILS',
+                                letter_code => 'WELCOME',
                                 branchcode  => $patron->branchcode,,
                                 lang        => $patron->lang || 'default',
                                 tables      => {
@@ -275,6 +273,13 @@ if ( $action eq 'create' ) {
                         };
                     }
                 }
+
+                # Notify library of new patron registration
+                my $notify_library = C4::Context->preference('EmailPatronRegistrations');
+                if ($notify_library) {
+                    $patron->notify_library_of_registration($notify_library);
+                }
+
             } else {
                 # FIXME Handle possible errors here
             }
@@ -545,20 +550,6 @@ sub ParseCgiForBorrower {
         }
     }
 
-    if ( defined $borrower{'dateofbirth'} ) {
-        my $dob_dt;
-        $dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); }
-            if ( $borrower{'dateofbirth'} );
-
-        if ( $dob_dt ) {
-            $borrower{'dateofbirth'} = output_pref( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' } );
-        }
-        else {
-            # Trigger validation
-            $borrower{'dateofbirth'} = undef;
-        }
-    }
-
     # Replace checkbox 'agreed' by datetime in gdpr_proc_consent
     $borrower{gdpr_proc_consent} = dt_from_string if  $borrower{gdpr_proc_consent} && $borrower{gdpr_proc_consent} eq 'agreed';