+
+## 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,
+ }
+ );
+}
+