View | Details | Raw Unified | Return to bug 25311
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (+11 lines)
Lines 34-39 Link Here
34
34
35
<div class="main container-fluid">
35
<div class="main container-fluid">
36
    <div class="row">
36
    <div class="row">
37
38
        [% IF messages %]
39
            [% FOR message IN messages %]
40
                [% SWITCH message.error %]
41
                    [% CASE 'error_on_insert_patron' %]
42
                        <div class="dialog alert">Something went wrong when creating the patron. Check the logs.</div>
43
                    [% CASE %]Unhandled error: [% message.error %]
44
                [% END %]
45
            [% END %]
46
        [% END %]
47
37
        [% IF ( opadd ) %]
48
        [% IF ( opadd ) %]
38
            <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
49
            <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
39
        [% ELSE %]
50
        [% ELSE %]
(-)a/members/memberentry.pl (-17 / +23 lines)
Lines 103-108 my @errors; Link Here
103
my $borrower_data;
103
my $borrower_data;
104
my $NoUpdateLogin;
104
my $NoUpdateLogin;
105
my $userenv = C4::Context->userenv;
105
my $userenv = C4::Context->userenv;
106
my @messages;
106
107
107
## Deal with guarantor stuff
108
## Deal with guarantor stuff
108
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
109
$template->param( relationships => scalar $patron->guarantor_relationships ) if $patron;
Lines 439-444 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
439
            # FIXME Urgent error handling here, we cannot fail without relevant feedback
440
            # FIXME Urgent error handling here, we cannot fail without relevant feedback
440
            # Lot of code will need to be removed from this script to handle exceptions raised by Koha::Patron->store
441
            # Lot of code will need to be removed from this script to handle exceptions raised by Koha::Patron->store
441
            warn "Patron creation failed! - $@"; # Maybe we must die instead of just warn
442
            warn "Patron creation failed! - $@"; # Maybe we must die instead of just warn
443
            push @messages, {error => 'error_on_insert_patron'};
444
            $op = "add";
442
        } else {
445
        } else {
443
            add_guarantors( $patron, $input );
446
            add_guarantors( $patron, $input );
444
            $borrowernumber = $patron->borrowernumber;
447
            $borrowernumber = $patron->borrowernumber;
Lines 479-488 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
479
            }
482
            }
480
        }
483
        }
481
484
482
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
485
        if ($patron && C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
483
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
486
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
484
        }
487
        }
485
        if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
488
        if ($patron && C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
486
            C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template, 1, $newdata{'categorycode'});
489
            C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template, 1, $newdata{'categorycode'});
487
        }
490
        }
488
491
Lines 492-498 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
492
        $hsbnd_chooser = 1 if $input->param('housebound_chooser');
495
        $hsbnd_chooser = 1 if $input->param('housebound_chooser');
493
        $hsbnd_deliverer = 1 if $input->param('housebound_deliverer');
496
        $hsbnd_deliverer = 1 if $input->param('housebound_deliverer');
494
        # Only create a HouseboundRole if patron has a role.
497
        # Only create a HouseboundRole if patron has a role.
495
        if ( $hsbnd_chooser || $hsbnd_deliverer ) {
498
        if ( $patron && ( $hsbnd_chooser || $hsbnd_deliverer ) ) {
496
            Koha::Patron::HouseboundRole->new({
499
            Koha::Patron::HouseboundRole->new({
497
                borrowernumber_id    => $borrowernumber,
500
                borrowernumber_id    => $borrowernumber,
498
                housebound_chooser   => $hsbnd_chooser,
501
                housebound_chooser   => $hsbnd_chooser,
Lines 549-573 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
549
        }
552
        }
550
553
551
        add_guarantors( $patron, $input );
554
        add_guarantors( $patron, $input );
552
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
553
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
554
        }
555
        if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
555
        if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
556
            C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template);
556
            C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template);
557
        }
557
        }
558
	}
558
	}
559
559
560
    if ( $destination eq 'circ' and not C4::Auth::haspermission( C4::Context->userenv->{id}, { circulate => 'circulate_remaining_permissions' } ) ) {
560
    if ( $patron ) {
561
        # If we want to redirect to circulation.pl and need to check if the logged in user has the necessary permission
561
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
562
        $destination = 'not_circ';
562
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
563
        }
564
565
        if ( $destination eq 'circ' and not C4::Auth::haspermission( C4::Context->userenv->{id}, { circulate => 'circulate_remaining_permissions' } ) ) {
566
            # If we want to redirect to circulation.pl and need to check if the logged in user has the necessary permission
567
            $destination = 'not_circ';
568
        }
569
        print scalar( $destination eq "circ" )
570
          ? $input->redirect(
571
            "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber")
572
          : $input->redirect(
573
            "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"
574
          );
575
        exit; # You can only send 1 redirect!  After that, content or other headers don't matter.
563
    }
576
    }
564
    print scalar( $destination eq "circ" )
565
      ? $input->redirect(
566
        "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber")
567
      : $input->redirect(
568
        "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"
569
      );
570
    exit; # You can only send 1 redirect!  After that, content or other headers don't matter.
571
}
577
}
572
578
573
if ($delete){
579
if ($delete){
Lines 828-833 if ( C4::Context->preference('TranslateNotices') ) { Link Here
828
    $template->param( languages => $translated_languages );
834
    $template->param( languages => $translated_languages );
829
}
835
}
830
836
837
$template->param( messages => \@messages );
831
output_html_with_http_headers $input, $cookie, $template->output;
838
output_html_with_http_headers $input, $cookie, $template->output;
832
839
833
sub  parse_extended_patron_attributes {
840
sub  parse_extended_patron_attributes {
834
- 

Return to bug 25311