From 77ce0eee2fdc947e1f51dc04f600f545d9e9aa68 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 6 Nov 2007 03:56:49 +0000 Subject: [PATCH] ability to turn off i18n git-svn-id: svn://svn.open-ils.org/ILS/trunk@8020 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/c-apps/oils_cstore.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index d1055d79e2..9d55d7ad17 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -18,6 +18,7 @@ # define MODULENAME "open-ils.cstore" #endif +#define DISABLE_I18N 2 #define SELECT_DISTINCT 1 #define AND_OP_JOIN 0 #define OR_OP_JOIN 1 @@ -1787,6 +1788,8 @@ char* SELECT ( } else { if (locale) { char* i18n = osrfHashGet(field, "i18n"); + if (flags & SELECT_DISTINCT) + i18n = NULL; if ( i18n && !strncasecmp("true", i18n, 4)) { char* pkey = osrfHashGet(idlClass, "primarykey"); @@ -2122,6 +2125,8 @@ char* buildSELECT ( jsonObject* search_hash, jsonObject* order_hash, osrfHash* m if (locale) { char* i18n = osrfHashGet(field, "i18n"); + if (jsonBoolIsTrue(jsonObjectGetKey( order_hash, "no_i18n" ))) + i18n = NULL; if ( i18n && !strncasecmp("true", i18n, 4)) { char* pkey = osrfHashGet(idlClass, "primarykey"); @@ -2312,6 +2317,14 @@ int doJSONSearch ( osrfMethodContext* ctx ) { jsonObject* hash = jsonObjectGetIndex(ctx->params, 0); + int flags = 0; + + if (jsonBoolIsTrue(jsonObjectGetKey( hash, "distinct" ))) + flags |= SELECT_DISTINCT; + + if (jsonBoolIsTrue(jsonObjectGetKey( hash, "no_i18n" ))) + flags |= DISABLE_I18N; + osrfLogDebug(OSRF_LOG_MARK, "Building SQL ..."); char* sql = SELECT( ctx, @@ -2321,7 +2334,7 @@ int doJSONSearch ( osrfMethodContext* ctx ) { jsonObjectGetKey( hash, "order_by" ), jsonObjectGetKey( hash, "limit" ), jsonObjectGetKey( hash, "offset" ), - jsonBoolIsTrue(jsonObjectGetKey( hash, "distinct" )) ? SELECT_DISTINCT : 0 + flags ); if (!sql) { -- 2.11.0