[open-ils-commits] [GIT] Evergreen ILS branch master updated. e087d43fc733c96563a50abdd3ce33865f234ee4

Evergreen Git git at git.evergreen-ils.org
Wed Jul 25 13:00:37 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  e087d43fc733c96563a50abdd3ce33865f234ee4 (commit)
      from  0b1d3ca56e7113be185f869a632fd8e49912d040 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e087d43fc733c96563a50abdd3ce33865f234ee4
Author: Dan Scott <dscott at laurentian.ca>
Date:   Wed Jul 25 12:45:27 2012 -0400

    Add evergreen.get_locale_name() function to base schema
    
    I added the evergreen.get_locale_name() function to the database schema
    upgrades in 0723 but failed to add it to the base schema, resulting in
    errors like: 'egweb: template error: undef error - Can't call method
    "maketext"'. Get rid of that problem!
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>

diff --git a/Open-ILS/src/sql/Pg/020.schema.functions.sql b/Open-ILS/src/sql/Pg/020.schema.functions.sql
index 81dcdfc..f69bfa4 100644
--- a/Open-ILS/src/sql/Pg/020.schema.functions.sql
+++ b/Open-ILS/src/sql/Pg/020.schema.functions.sql
@@ -412,3 +412,40 @@ $$ LANGUAGE plpgsql;
 
 CREATE TRIGGER proximity_update_tgr AFTER INSERT OR UPDATE OR DELETE ON actor.org_unit FOR EACH ROW EXECUTE PROCEDURE actor.org_unit_prox_update ();
 
+CREATE OR REPLACE FUNCTION evergreen.get_locale_name(
+    IN locale TEXT,
+    OUT name TEXT,
+    OUT description TEXT
+) AS $$
+DECLARE
+    eg_locale TEXT;
+BEGIN
+    eg_locale := LOWER(SUBSTRING(locale FROM 1 FOR 2)) || '-' || UPPER(SUBSTRING(locale FROM 4 FOR 2));
+        
+    SELECT i18nc.string INTO name
+    FROM config.i18n_locale i18nl
+       INNER JOIN config.i18n_core i18nc ON i18nl.code = i18nc.translation
+    WHERE i18nc.identity_value = eg_locale
+       AND code = eg_locale
+       AND i18nc.fq_field = 'i18n_l.name';
+
+    IF name IS NULL THEN
+       SELECT i18nl.name INTO name
+       FROM config.i18n_locale i18nl
+       WHERE code = eg_locale;
+    END IF;
+
+    SELECT i18nc.string INTO description
+    FROM config.i18n_locale i18nl
+       INNER JOIN config.i18n_core i18nc ON i18nl.code = i18nc.translation
+    WHERE i18nc.identity_value = eg_locale
+       AND code = eg_locale
+       AND i18nc.fq_field = 'i18n_l.description';
+
+    IF description IS NULL THEN
+       SELECT i18nl.description INTO description
+       FROM config.i18n_locale i18nl
+       WHERE code = eg_locale;
+    END IF;
+END;
+$$ LANGUAGE PLPGSQL COST 1 STABLE;

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/020.schema.functions.sql |   37 ++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list