]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/fieldmapper.pl
started working on the callnumber/copy details pane in the record 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 acpl ccs ahn  
15                 crcd crmf crrf mbts aoc aus 
16                 mous mobts mb /;
17
18 my @web_core = qw/ 
19         aou au perm_ex ex aout 
20         mvr ccs ahr aua ac actscecm cbreb 
21         cbrebi acpn acp acnn acn bren /;
22
23 my @reports = qw/ perm_ex ex ao aou aout /;
24
25
26 print "var _c = {};\n";
27
28 for my $object (keys %$map) {
29
30         my $hint = $map->{$object}->{hint};
31
32         if($web eq "web") {
33                 next unless (grep { $_ eq $hint } @web_hints );
34         }
35
36         if($web eq "web_core") {
37                 next unless (grep { $_ eq $hint } @web_core );
38         }
39
40         if($web eq "reports") {
41                 next unless (grep { $_ eq $hint } @web_core );
42         }
43
44
45         my $short_name = $map->{$object}->{hint};
46
47         my @fields;
48         for my $field (keys %{$map->{$object}->{fields}}) {
49                 my $position = $map->{$object}->{fields}->{$field}->{position};
50                 $fields[$position] = $field;
51         }
52
53         print "_c[\"$short_name\"] = [";
54         for my $f (@fields) { 
55                 if( $f ne "isnew" and $f ne "ischanged" and $f ne "isdeleted" ) {
56                         print "\"$f\","; 
57                 }
58         }
59         print "];\n";
60
61
62 }
63
64 print "fmclasses = _c;\n";
65