From: Bill Erickson <berickxx@gmail.com> Date: Thu, 11 Jul 2019 21:20:45 +0000 (-0400) Subject: LP1825851 CStoreEditor instance specific personality X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=884d2a84f6153765f0098dfbb6905e4c7ee251e0;p=evergreen%2Fjoelewis.git 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 <berickxx@gmail.com> Signed-off-by: Kyle Huckins <khuckins@catalyte.io> Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org> --- 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 {