use C4::Letters;
use C4::Branch; # GetBranches
use C4::Form::MessagingPreferences;
+use Koha::Borrower::Debarments;
+use Koha::DateUtils;
use vars qw($debug);
flagsrequired => {borrowers => 1},
debug => ($debug) ? 1 : 0,
});
+
my $guarantorid = $input->param('guarantorid');
my $borrowernumber = $input->param('borrowernumber');
my $actionType = $input->param('actionType') || '';
my $NoUpdateLogin;
my $userenv = C4::Context->userenv;
+
+## Deal with debarments
+$template->param(
+ debarments => GetDebarments( { borrowernumber => $borrowernumber } ) );
+my @debarments_to_remove = $input->param('remove_debarment');
+foreach my $d ( @debarments_to_remove ) {
+ DelDebarment( $d );
+}
+if ( $input->param('add_debarment') ) {
+
+ my $expiration = $input->param('debarred_expiration');
+ $expiration = $expiration ? output_pref( dt_from_string($expiration), 'iso' ) : undef;
+
+ AddUniqueDebarment(
+ {
+ borrowernumber => $borrowernumber,
+ type => 'MANUAL',
+ comment => $input->param('debarred_comment'),
+ expiration => $expiration,
+ }
+ );
+}
+
$template->param("uppercasesurnames" => C4::Context->preference('uppercasesurnames'));
my $minpw = C4::Context->preference('minPasswordLength');
}
}
- ## Manipulate debarred
- if ( $newdata{debarred} ) {
- $newdata{debarred} = $newdata{datedebarred} ? $newdata{datedebarred} : "9999-12-31";
- } elsif ( exists( $newdata{debarred} ) && !( $newdata{debarred} ) ) {
- undef( $newdata{debarred} );
- undef( $newdata{debarredcomment} );
- } elsif ( exists( $newdata{debarredcomment} ) && $newdata{debarredcomment} eq "" ) {
- undef( $newdata{debarredcomment} );
- }
-
my $dateobject = C4::Dates->new();
my $syspref = $dateobject->regexp(); # same syspref format for all 3 dates
my $iso = $dateobject->regexp('iso'); #
$newdata{'surname'} = uc($newdata{'surname'});
}
- if (C4::Context->preference("IndependantBranches")) {
+ if (C4::Context->preference("IndependentBranches")) {
if ($userenv && $userenv->{flags} % 2 != 1){
$debug and print STDERR " $newdata{'branchcode'} : ".$userenv->{flags}.":".$userenv->{branch};
unless (!$newdata{'branchcode'} || $userenv->{branch} eq $newdata{'branchcode'}){
foreach my $attr (@$extended_patron_attributes) {
unless (C4::Members::Attributes::CheckUniqueness($attr->{code}, $attr->{value}, $borrowernumber)) {
push @errors, "ERROR_extended_unique_id_failed";
- $template->param(ERROR_extended_unique_id_failed => "$attr->{code}/$attr->{value}");
+ $template->param(ERROR_extended_unique_id_failed_value => "$attr->{code}/$attr->{value}");
}
}
}
$template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1);
}
}
-if (C4::Context->preference("IndependantBranches")) {
+if (C4::Context->preference("IndependentBranches")) {
my $userenv = C4::Context->userenv;
if ($userenv->{flags} % 2 != 1 && $data{'branchcode'}){
unless ($userenv->{branch} eq $data{'branchcode'}){
$data{'contactname'} &&= uc( $data{'contactname'} );
}
-$data{debarred} = C4::Overdues::CheckBorrowerDebarred($borrowernumber);
-$data{datedebarred} = $data{debarred} if ( $data{debarred} && $data{debarred} ne "9999-12-31" );
-foreach (qw(dateenrolled dateexpiry dateofbirth datedebarred)) {
+foreach (qw(dateenrolled dateexpiry dateofbirth)) {
$data{$_} = format_date($data{$_}); # back to syspref for display
$template->param( $_ => $data{$_});
}
borrotitlepopup => $borrotitlepopup,
guarantorinfo => $guarantorinfo,
flagloop => \@flagdata,
- dateformat => C4::Dates->new()->visual(),
- C4::Context->preference('dateformat') => 1,
check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function
category_type =>$category_type,
modify => $modify,