From 884d2a84f6153765f0098dfbb6905e4c7ee251e0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 11 Jul 2019 17:20:45 -0400 Subject: [PATCH] LP1825851 CStoreEditor instance specific personality Allow applying a CStoreEditor personality to individual editor instances without overwriting the default / process-wide personality. Signed-off-by: Bill Erickson Signed-off-by: Kyle Huckins Signed-off-by: Galen Charlton --- .../lib/OpenILS/Utils/CStoreEditor.pm | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm index e381b21996..dab85c0a19 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm @@ -52,9 +52,25 @@ our $personality = 'open-ils.cstore'; sub personality { my( $self, $app ) = @_; - $personality = $app if $app; - init() if $app; # rewrite if we changed personalities - return $personality; + + if (ref($self)) { + # Instance-specific personality + + if ($app) { + $self->{personality} = $app; + init(); + } + return $self->{personality} || $personality; + + } else { + # Process default personality + + if ($app) { + $personality = $app; + init(); + } + return $personality; + } } sub import { -- 2.43.2