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

Evergreen Git git at git.evergreen-ils.org
Fri Jul 12 14:30:27 EDT 2013


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  e3089098b4b27022597f7514af44108d4b3f5021 (commit)
      from  213dcee877b95aa3987de4d93e83012d24d5d93c (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 e3089098b4b27022597f7514af44108d4b3f5021
Author: Mike Rylander <mrylander at gmail.com>
Date:   Mon Mar 19 18:35:52 2012 -0400

    Teach Fieldmapper (Perl) to record and expose field datatype
    
    We record most everything from the IDL, but until now we skipped datatype
    because it's generally not useful in perl.  But, there might be uses.  So
    now we record it, and expose it through the class and instance FieldDatatype
    method.  Also added is a more general FieldInfo method, which returns a hash
    containing field attributes, including but not limited to:
    
     * virtual  [1|0]
     * required [1|0]
     * position [array position for internal implementation]
     * datatype [bool|float|id|int|interval|link|money|number|org_unit|text|timestamp]
     * validate [regexp]
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
index 0a89824..4cd02a2 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
@@ -82,11 +82,13 @@ sub load_fields {
                 $virtual = "false";
             }
             my $selector = get_attribute( $attribute_list, 'reporter:selector' );
+           my $datatype = get_attribute( $attribute_list, 'reporter:datatype' );
 
             $$fieldmap{$fm}{fields}{ $name } =
                 { virtual => ( $virtual eq 'true' ) ? 1 : 0,
                   required => ( $required eq 'true' ) ? 1 : 0,
                   position => $array_position,
+                 datatype => $datatype,
                 };
 
             $$fieldmap{$fm}{fields}{ $name }{validate} = qr/$validate/ if (defined($validate));
@@ -378,6 +380,22 @@ sub ValidateField {
     return $self->$f =~ $$fieldmap{$self->class_name}{fields}{$f}{validate};
 }
 
+sub FieldInfo {
+   my $self = shift;
+   my $field = shift;
+   my $class_name = $self->class_name;
+   return undef unless ($field && $$fieldmap{$class_name}{fields}{$field});
+   return $$fieldmap{$class_name}{fields}{$field};
+}
+
+sub FieldDatatype {
+   my $self = shift;
+   my $field = shift;
+   my $class_name = $self->class_name;
+   return undef unless ($field && $$fieldmap{$class_name}{fields}{$field});
+   return $$fieldmap{$class_name}{fields}{$field}{datatype};
+}
+
 sub class_name {
     my $class_name = shift;
     return ref($class_name) || $class_name;

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

Summary of changes:
 .../src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm  |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list