$usr_penalty->standing_penalty($penalty->id);
$usr_penalty->staff($staff_id);
+ my $message = $_->$contact_type;
+ if (defined($addl_note) && $addl_note !~ /^\s*$/) {
+ $message .= ' ' . $addl_note;
+ }
+
my ($result) = $U->simplereq('open-ils.actor', 'open-ils.actor.user.penalty.apply',
$editor->authtoken,
$usr_penalty,
- { message => $addl_note ? $_->$contact_type.' '.$addl_note : $_->$contact_type }
+ { message => $message }
);
# FIXME: this perpetuates a bug; the patron editor UI doesn't handle these error states well
PHONE => '218-555-0177',
EMAIL => 'nouser@evergreen-ils.test',
TESTMESSAGE => '123456 TEST Invalidate Message',
+ TESTMESSAGE_ZERO => '0',
PROFILE => 2, #patrons
};
my $penalty = $ausp->[0];
#print ref($penalty)."\n";
- my $message = $data{$type}[$i].($note ? ' '.$note : '');
+ my $message = $data{$type}[$i].(defined($note) ? ' '.$note : '');
isa_ok($penalty, 'Fieldmapper::actor::usr_message_penalty', 'User Penalty Found -- '.$type);
is($penalty->message(), $message, $type.' penalty note matches expected format.');
#Invalidate all notifications for user 2 - added note
diag("Patron 2 - Added note");
$user = $aus->[1];
-invalidate_all($user->id(),TESTMESSAGE,$user->home_ou(),undef);
+invalidate_all($user->id(),TESTMESSAGE_ZERO,$user->home_ou(),undef);
#Invalidate notifications for users 3,4,5 - using search method with test message
diag("Patron 3,4,5 - Added note - same contact info");
diag("Patron 2 - Added note");
$user = $aus->[1];
-check_all_penalties($user->id(),TESTMESSAGE,$user->home_ou(),undef,2);
+check_all_penalties($user->id(),TESTMESSAGE_ZERO,$user->home_ou(),undef,2);
diag("Patron 3 - Added note - same contact info");
$user = $aus->[2];
check_all_penalties($user->id(),TESTMESSAGE,$user->home_ou(),undef,3);
# Logout
-$script->logout(); # Not a test, just to be pedantic.
\ No newline at end of file
+$script->logout(); # Not a test, just to be pedantic.