MT#58422 fix persisting "don't change" topup lock level

while the api is strict with expecting NULL values,
we now tolerate '' (empty string) for topup and underrun
lock level values.

Change-Id: I77357f0d1152b5af43e39389f8d4d4f3e0b81b2a
mr12.1
Rene Krenn 2 years ago
parent a7f82c264b
commit 0bdd78e230

@ -1155,6 +1155,25 @@ sub check_underrun_lock_level {
return 1;
}
sub check_topup_lock_level {
my (%params) = @_;
my ($c,$resource,$err_code) = @params{qw/c resource err_code/};
my $schema = $c->model('DB');
if (!defined $err_code || ref $err_code ne 'CODE') {
$err_code = sub { return 0; };
}
if (defined $resource->{topup_lock_level}) {
if (length($resource->{topup_lock_level})) {
#...
} else {
undef $resource->{topup_lock_level};
}
}
return 1;
}
sub check_profiles {
my (%params) = @_;
my ($c,$resource,$mappings_to_create,$err_code) = @params{qw/c resource mappings_to_create err_code/};
@ -1221,6 +1240,7 @@ sub prepare_profile_package {
return 0 unless check_carry_over_mode(c => $c, resource => $resource, err_code => $err_code);
return 0 unless check_underrun_lock_level(c => $c, resource => $resource, err_code => $err_code);
return 0 unless check_topup_lock_level(c => $c, resource => $resource, err_code => $err_code);
return 0 unless check_profiles(c => $c, resource => $resource, mappings_to_create => $mappings_to_create, err_code => $err_code);

Loading…
Cancel
Save