--- /dev/null
+-- Function: actor.ignore_update_default_search_location()
+
+-- DROP FUNCTION actor.ignore_update_default_search_location();
+
+CREATE OR REPLACE FUNCTION actor.ignore_update_default_search_location()
+ RETURNS trigger AS
+$BODY$
+
+BEGIN
+
+ IF TG_OP = 'UPDATE' AND new.value NOT ILIKE '"1"' AND new.name ILIKE 'opac.default_search_location' THEN
+ SELECT '"1"' INTO new.value FROM actor.usr AS au WHERE au.id = new.usr;
+ ELSIF TG_OP = 'INSERT' AND new.value NOT ILIKE '"1"' AND new.name ILIKE 'opac.default_search_location' THEN
+ SELECT '"1"' INTO new.value FROM actor.usr AS au WHERE au.id = new.usr;
+ END IF;
+
+ RETURN new;
+
+END;
+$BODY$
+ LANGUAGE plpgsql VOLATILE
+ COST 500;
+ALTER FUNCTION actor.ignore_update_default_search_location()
+ OWNER TO evergreen;
+
+
+-- Trigger: actor_only_kcls_for_default_search_location on actor.usr_setting
+
+-- DROP TRIGGER actor_only_kcls_for_default_search_location ON actor.usr_setting;
+
+CREATE TRIGGER actor_only_kcls_for_default_search_location
+ BEFORE INSERT OR UPDATE
+ ON actor.usr_setting
+ FOR EACH ROW
+ EXECUTE PROCEDURE actor.ignore_update_default_search_location();
\ No newline at end of file
return $self->cgi->cookie('eg_pref_lib');
}
- if ($ctx->{user}) {
- # See if the user has a search library preference
- my $lset = $self->editor->search_actor_user_setting({
- usr => $ctx->{user}->id,
- name => 'opac.default_search_location'
- })->[0];
- return OpenSRF::Utils::JSON->JSON2perl($lset->value) if $lset;
-
- # Otherwise return the user's home library
- my $ou = $ctx->{user}->home_ou;
- return ref($ou) ? $ou->id : $ou;
- }
+ #kmig57 - default search location is not used by KCLS
+ # if ($ctx->{user}) {
+ # # See if the user has a search library preference
+ # my $lset = $self->editor->search_actor_user_setting({
+ # usr => $ctx->{user}->id,
+ # name => 'opac.default_search_location'
+ # })->[0];
+ # return OpenSRF::Utils::JSON->JSON2perl($lset->value) if $lset;
+
+ # # Otherwise return the user's home library
+ # my $ou = $ctx->{user}->home_ou;
+ # return ref($ou) ? $ou->id : $ou;
+ #}
if ($ctx->{physical_loc}) {
return $ctx->{physical_loc};