]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/fieldmapper.pl
now checking if deleted == true. if so, disabling actions (e.g. place hold) and displ...
[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
13 my @web_core = qw/ 
14         aou au perm_ex ex aout 
15         mvr ccs ahr aua ac actscecm cbreb acpl 
16         cbrebi acpn acp acnn acn bren asc asce 
17         clfm cifm citm cam ahtc
18         asv asva asvr asvq 
19         circ ccs ahn bre
20         crcd crmf crrf mbts aoc aus 
21         mous mobts mb ancc cnct
22         /;
23
24 my @reports = qw/ perm_ex ex ao aou aout /;
25
26
27 print "var _c = {};\n";
28
29 for my $object (keys %$map) {
30
31         my $hint = $map->{$object}->{hint};
32
33         if($web eq "web_core") {
34                 next unless (grep { $_ eq $hint } @web_core );
35         }
36
37         if($web eq "reports") {
38                 next unless (grep { $_ eq $hint } @web_core );
39         }
40
41
42         my $short_name = $map->{$object}->{hint};
43
44         my @fields;
45         for my $field (keys %{$map->{$object}->{fields}}) {
46                 my $position = $map->{$object}->{fields}->{$field}->{position};
47                 $fields[$position] = $field;
48         }
49
50         print "_c[\"$short_name\"] = [";
51         for my $f (@fields) { 
52                 if( $f ne "isnew" and $f ne "ischanged" and $f ne "isdeleted" ) {
53                         print "\"$f\","; 
54                 }
55         }
56         print "];\n";
57
58
59 }
60
61 print "fmclasses = _c;\n";
62