From 9254092a3fb3ab5dd735aaae920463fee6be30b7 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Tue, 10 Jan 2023 14:03:34 +0100 Subject: [PATCH] MT#56234 get_usr_preference_rs and prov_subscriber * get_usr_prerefence_rs is streamlined to the other get_*_preference_rs functions and prov_subscriber param is now optional there, that allows to return a resultset of usr preferences matching the attribute name. * this fix also fixes DELETE soundset where if contract_id is defined, the logic tries to remove all 'contract_sound_set' usr_preference across all subscribers that have it assigned. Change-Id: Ia43327c8bcf93047d29da6401cbd97bce2971578 --- lib/NGCP/Panel/Utils/Preferences.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Utils/Preferences.pm b/lib/NGCP/Panel/Utils/Preferences.pm index b06e343571..8e4cfcd521 100644 --- a/lib/NGCP/Panel/Utils/Preferences.pm +++ b/lib/NGCP/Panel/Utils/Preferences.pm @@ -2472,14 +2472,14 @@ sub get_usr_preference_rs { my $prov_subscriber = $params{prov_subscriber}; my $schema = $params{schema} // $c->model('DB'); - return unless $prov_subscriber; - my $preference = $schema->resultset('voip_preferences')->find({ attribute => $attribute, usr_pref => 1, }); return unless $preference; + return $preference->voip_usr_preferences unless $prov_subscriber; + return $preference->voip_usr_preferences->search_rs({ subscriber_id => $prov_subscriber->id, });