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

Evergreen Git git at git.evergreen-ils.org
Wed Apr 23 09:11:05 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, master has been updated
       via  3665b7c34fffd76cb3b4aa6756ba477f6ff8075a (commit)
      from  cfd5d5219c1d8b43fc6e6d87e496e09384f6f919 (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 3665b7c34fffd76cb3b4aa6756ba477f6ff8075a
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