From da097ec01b84771715949a5352bb307ea5de7b7a Mon Sep 17 00:00:00 2001 From: Flaviu Mates Date: Tue, 3 Dec 2019 12:59:43 +0200 Subject: [PATCH] TT#69407 - Add customer external_id to credit warning email Change-Id: I07c5ee47590e69a66597e74ab28a01fafd644c16 (cherry picked from commit 5cc2e21123e9cbc88d95234ae21646297a4aea2e) (cherry picked from commit cc3ec4cd7a86d804f2f89e3ce4ad63ef317c6c5c) --- bin/ngcp-credit-warning | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/bin/ngcp-credit-warning b/bin/ngcp-credit-warning index 804307c..43365b8 100755 --- a/bin/ngcp-credit-warning +++ b/bin/ngcp-credit-warning @@ -67,15 +67,10 @@ sub send_email { adminmail => $config->{adminmail} }; foreach my $data (@{$contracts}) { - if (exists $data->{threshold}) { - $vars->{contracts} .= sprintf <{contracts} .= sprintf <{contracts} .= sprintf ('contract_id: %s cash_balance: %s', @{$data}{qw(id cash_balance)}); + $vars->{contracts} .= ' external_id: '. $data->{external_id} if $data->{external_id}; + $vars->{contracts} .= ' threshold: '. $data->{threshold} if $data->{threshold}; + $vars->{contracts} .= "\n"; } my $tt = Template->new(); @@ -158,7 +153,7 @@ sub main { my $ratio = $balance->{ratio} // 1.0; my $threshold = $cwarning->{threshold} * $ratio; next if $balance->{cash_balance} >= $threshold; - my $data = { map { $_ => $balance->{$_} } qw(id cash_balance) }; + my $data = { map { $_ => $balance->{$_} } qw(id cash_balance external_id) }; $data->{threshold} = $threshold if $ratio < 1.0; push @contracts,$data; }