french translation updated
[koha_gimpoz] / misc / sync_koha_plugin.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 BEGIN {
5     # find Koha's Perl modules
6     # test carefully before changing this
7     use FindBin;
8     eval { require "$FindBin::Bin/kohalib.pl" };
9 }
10 use C4::Context;
11 use Getopt::Long;
12
13 my %opt = ();
14 GetOptions(
15     \%opt,
16     qw/head_dir=s rel_2_2_dir=s help/
17 ) or die "\nHouston, we got a problem\n";
18
19 if (exists $opt{help}) {
20     print <<FIN;
21 Sync the Koha plugin with the appropriate files from HEAD. Assumes
22 that you've set up your Koha install to use CVS symlinked to the
23 normal locations.
24
25 Usage: sync_koha_plugin.pl --head_dir=<cvs head directory>
26                            --rel_2_2_dir=<cvs rel_2_2 directory>
27                         [--help]
28
29 --head_dir: is the directory where your Koha HEAD cvs is checked out.
30
31 --rel_2_2_dir: is the directory where your Koha rel_2_2 cvs is checked
32 out and symlinked to your Koha install directories.
33
34 --help: show this help
35
36 FIN
37
38       exit(0);
39 }
40 # Configurable Variables
41 foreach my $option (qw/head_dir rel_2_2_dir/) {
42   if (not exists $opt{$option}) {
43     die 'option "', $option, '" is mandatory', "\n";
44   }
45
46   if (not -d $opt{$option}) {
47     die '"', $opt{$option}, '" must be an existing directory', "\n";
48   }
49
50   if (not $opt{$option} =~ m{^/}) {
51     die '--', $option, ' must be an absolute path', "\n";
52   }
53 }
54
55 ## Modules
56 system(
57     'cp',
58     $opt{head_dir}.'/C4/Biblio.pm',
59     $opt{rel_2_2_dir}.'/C4/'
60 );
61 system(
62     'cp',
63     $opt{head_dir}.'/C4/Context.pm',
64     $opt{rel_2_2_dir}.'/C4/'
65 );
66 system(
67     'cp',
68     $opt{head_dir}.'/C4/SearchMarc.pm',
69     $opt{rel_2_2_dir}.'/C4/'
70 );
71 system(
72     'cp',
73     $opt{head_dir}.'/C4/Log.pm',
74     $opt{rel_2_2_dir}.'/C4/'
75 );
76
77 system(
78     'cp',
79     $opt{head_dir}.'/C4/Review.pm',
80     $opt{rel_2_2_dir}.'/C4/'
81 );
82 system(
83     'cp',
84     $opt{head_dir}.'/misc/plugin/Search.pm',
85     $opt{rel_2_2_dir}.'/C4/'
86 );
87
88 ## Intranet
89 system(
90     'cp',
91     $opt{head_dir}.'/cataloguing/addbiblio.pl',
92     $opt{rel_2_2_dir}.'/acqui.simple/addbiblio.pl'
93 );
94 system(
95     'cp',
96     $opt{head_dir}.'/cataloguing/additem.pl',
97     $opt{rel_2_2_dir}.'/acqui.simple/'
98 );
99 system(
100     'cp',
101     $opt{head_dir}.'/catalogue/detail.pl',
102     $opt{rel_2_2_dir}.'/'
103 );
104 system(
105     'cp',
106     $opt{head_dir}.'/catalogue/MARCdetail.pl',
107     $opt{rel_2_2_dir}.'/'
108 );
109 system(
110     'cp',
111     $opt{head_dir}.'/catalogue/ISBDdetail.pl',
112     $opt{rel_2_2_dir}.'/'
113 );
114
115 # OPAC
116 system(
117     'cp',
118     $opt{head_dir}.'/opac/opac-detail.pl',
119     $opt{rel_2_2_dir}.'/opac/'
120 );
121 system(
122     'cp',
123     $opt{head_dir}.'/opac/opac-MARCdetail.pl',
124     $opt{rel_2_2_dir}.'/opac/'
125 );
126 system(
127     'cp',
128     $opt{head_dir}.'/opac/opac-ISBDdetail.pl',
129     $opt{rel_2_2_dir}.'/opac/'
130 );
131
132 ## Add the symlink necessary due to changes in the dir structure
133 system(
134     'ln',
135     '-s',
136     $opt{rel_2_2_dir}.'/koha-tmpl/intranet-tmpl/npl/en/acqui.simple',
137     $opt{rel_2_2_dir}.'/koha-tmpl/intranet-tmpl/npl/en/cataloguing'
138 );
139
140 ## Add the 'record.abs' symlink 
141 system(
142     'ln',
143     '-s',
144     $opt{head_dir}.'/misc/zebra/usmarc/collection.abs',
145     $opt{head_dir}.'/misc/zebra/usmarc/record.abs'
146 );
147
148 ## Create symlink from intranet/zebra to head zebra directory
149 system(
150     'ln',
151     '-s',
152     $opt{head_dir}.'/misc/zebra/usmarc',
153     C4::Context->config("intranetdir").'/zebra'
154 );
155
156 print "Finished\n\nRemember, you still need to:
157
158 1. Edit moredetail.tmpl and detail.tmpl to allow for deletions
159
160 2. add  <option value=''>Relevance</option> to the search
161    pages to sort by relevance by default
162
163 \n";
164