[open-ils-commits] [GIT] Evergreen ILS branch rel_2_6 updated. 287b576f9995e388b8151df33a8e1b9e30ae55ec

Evergreen Git git at git.evergreen-ils.org
Wed Apr 23 09:12:20 EDT 2014


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, rel_2_6 has been updated
       via  287b576f9995e388b8151df33a8e1b9e30ae55ec (commit)
      from  5293788305f45c4c1a7beb5b51ec5e199422b81e (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 287b576f9995e388b8151df33a8e1b9e30ae55ec
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Apr 23 01:45:43 2014 -0400

    LP#1311467: fix heading validation in bib editor
    
    This patch fixes a regression whereby clicking the validate button
    in the bib editor would result in no headings getting checked.
    
    In the process, it enables 'startwith' to be used as a JSON query
    operator for all types of predicates, not just the results of
    transformed values.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index adfcd2e..f318da8 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -2352,6 +2352,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field name="source" />
 			<field reporter:label="Control Set" name="control_set" reporter:datatype="link"/>
 			<field reporter:label="Owner" name="owner"  reporter:datatype="org_unit"/>
+			<field name="heading" />
+			<field name="simple_heading" />
 			<field name="fixed_fields" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field name="bib_links" oils_persist:virtual="true" reporter:datatype="link"/>
diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c
index e72bb49..dac5d8c 100644
--- a/Open-ILS/src/c-apps/oils_sql.c
+++ b/Open-ILS/src/c-apps/oils_sql.c
@@ -2656,14 +2656,23 @@ static char* searchFunctionPredicate( const char* class_alias, osrfHash* field,
 	if( !val )
 		return NULL;
 
+	const char* right_percent = "";
+	const char* real_op       = op;
+
+	if( !strcasecmp( op, "startwith") ) {
+		real_op = "like";
+		right_percent = "|| '%'";
+	}
+
 	growing_buffer* sql_buf = buffer_init( 32 );
 	buffer_fadd(
 		sql_buf,
-		"\"%s\".%s %s %s",
+		"\"%s\".%s %s %s%s",
 		class_alias,
 		osrfHashGet( field, "name" ),
-		op,
-		val
+		real_op,
+		val,
+		right_percent
 	);
 
 	free( val );
@@ -2899,8 +2908,16 @@ static char* searchSimplePredicate( const char* op, const char* class_alias,
 			op = "IS";
 	}
 
+	const char* right_percent = "";
+	const char* real_op       = op;
+
+	if( !strcasecmp( op, "startwith") ) {
+		real_op = "like";
+		right_percent = "|| '%'";
+	}
+
 	growing_buffer* sql_buf = buffer_init( 32 );
-	buffer_fadd( sql_buf, "\"%s\".%s %s %s", class_alias, osrfHashGet(field, "name"), op, val );
+	buffer_fadd( sql_buf, "\"%s\".%s %s %s%s", class_alias, osrfHashGet(field, "name"), real_op, val, right_percent );
 	char* pred = buffer_release( sql_buf );
 
 	free( val );

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

Summary of changes:
 Open-ILS/examples/fm_IDL.xml   |    2 ++
 Open-ILS/src/c-apps/oils_sql.c |   25 +++++++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list