]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/fieldmapper.pl
started opac details page..
[Evergreen.git] / Open-ILS / src / extras / fieldmapper.pl
1 #!/usr/bin/perl
2 use strict; use warnings;
3 use Data::Dumper; 
4 use OpenILS::Utils::Fieldmapper;  
5
6 my $map = $Fieldmapper::fieldmap;
7
8 # if a true value is provided, we generate the web (light) version of the fieldmapper
9 my $web = $ARGV[0];
10 if(!$web) { $web = ""; }
11
12 # List of classes needed by the opac
13 my @web_hints = qw/asv asva asvr asvq 
14                 circ acp acpl acn ccs ahn ahr aua ac 
15                 actscecm crcd crmf crrf mus mbts aoc aus/;
16
17 my @web_core = qw/ aou au perm_ex ex aout mvr ccs /;
18
19
20 print "var _c = {};\n";
21
22 for my $object (keys %$map) {
23
24         if($web eq "web") {
25                 my $hint = $map->{$object}->{hint};
26                 next unless (grep { $_ eq $hint } @web_hints );
27         }
28
29         if($web eq "web_core") {
30                 my $hint = $map->{$object}->{hint};
31                 next unless (grep { $_ eq $hint } @web_core );
32         }
33
34         my $short_name = $map->{$object}->{hint};
35
36         my @fields;
37         for my $field (keys %{$map->{$object}->{fields}}) {
38                 my $position = $map->{$object}->{fields}->{$field}->{position};
39                 $fields[$position] = $field;
40         }
41
42         print "_c[\"$short_name\"] = [";
43         for my $f (@fields) { 
44                 if( $f ne "isnew" and $f ne "ischanged" and $f ne "isdeleted" ) {
45                         print "\"$f\","; 
46                 }
47         }
48         print "];\n";
49
50
51 }
52
53 print "fmclasses = _c;\n";
54