From 0b607e5b5742cc0cee8a9a85a5f4fb718f09121a Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Tue, 24 Nov 2015 05:20:54 +0100 Subject: [PATCH] MT#16605 topup log records not persisted for subscribers with lock level +failed txn due to to binding a row object instead of value +remove warning with topup voucher validation +remove warning when preparing topup log row data Change-Id: I3a08b6ef297f9b197f30731d886e9d07686336dd --- lib/NGCP/Panel/Utils/Preferences.pm | 2 +- lib/NGCP/Panel/Utils/ProfilePackages.pm | 2 +- lib/NGCP/Panel/Utils/Voucher.pm | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/NGCP/Panel/Utils/Preferences.pm b/lib/NGCP/Panel/Utils/Preferences.pm index 6e7e494f2e..66807fcf40 100644 --- a/lib/NGCP/Panel/Utils/Preferences.pm +++ b/lib/NGCP/Panel/Utils/Preferences.pm @@ -923,7 +923,7 @@ sub get_provisoning_voip_subscriber_first_int_attr_value { attribute => $attribute, ); try { - return $rs->first; + return ($rs->first ? $rs->first->value : undef); } catch($e) { $c->log->error("failed to get provisioning_voip_subscriber attribute '$attribute': $e"); $e->rethrow; diff --git a/lib/NGCP/Panel/Utils/ProfilePackages.pm b/lib/NGCP/Panel/Utils/ProfilePackages.pm index 3608cf6989..4b667de8ef 100644 --- a/lib/NGCP/Panel/Utils/ProfilePackages.pm +++ b/lib/NGCP/Panel/Utils/ProfilePackages.pm @@ -525,7 +525,7 @@ sub create_topup_log_record { lock_level_after => (exists $log_vals->{new_lock_level} ? $log_vals->{new_lock_level} : undef), contract_balance_before_id => (exists $log_vals->{old_balance} ? $log_vals->{old_balance}->{id} : undef), contract_balance_after_id => (exists $log_vals->{new_balance} ? $log_vals->{new_balance}->{id} : undef), - request_token => substr((defined $request_token ? $request_token : $resource->{request_token}),0,255), + request_token => substr((defined $request_token ? $request_token : $resource->{request_token} // ''),0,255), }); } diff --git a/lib/NGCP/Panel/Utils/Voucher.pm b/lib/NGCP/Panel/Utils/Voucher.pm index c6e5035b8d..cfa162e5f3 100644 --- a/lib/NGCP/Panel/Utils/Voucher.pm +++ b/lib/NGCP/Panel/Utils/Voucher.pm @@ -89,12 +89,13 @@ sub check_topup { if (defined $plain_code || defined $voucher_id) { my $voucher; + my $dtf = $schema->storage->datetime_parser; if (defined $plain_code) { $voucher = $schema->resultset('vouchers')->search_rs({ code => encrypt_code($c, $plain_code), used_at => { '=' => \"'0000-00-00 00:00:00'" } , #used_by_subscriber_id => undef, - valid_until => { '>=' => $now }, + valid_until => { '>=' => $dtf->format_datetime($now) }, reseller_id => $contract->contact->reseller_id, },{ for => 'update', @@ -110,7 +111,7 @@ sub check_topup { $voucher = $schema->resultset('vouchers')->search_rs({ id => $voucher_id, used_at => { '=' => \"'0000-00-00 00:00:00'" }, #used_by_subscriber_id => undef, - valid_until => { '>=' => $now }, + valid_until => { '>=' => $dtf->format_datetime($now) }, reseller_id => $contract->contact->reseller_id, },{ for => 'update',