Updating claims - commenting out the bits of code that were not implemented in the end
[koha.git] / tools / import.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 # Script for handling import of MARC data into Koha db
6 #   and Z39.50 lookups
7
8 # Koha library project  www.koha.org
9
10 # Licensed under the GPL
11
12
13 # Copyright 2000-2002 Katipo Communications
14 #
15 # This file is part of Koha.
16 #
17 # Koha is free software; you can redistribute it and/or modify it under the
18 # terms of the GNU General Public License as published by the Free Software
19 # Foundation; either version 2 of the License, or (at your option) any later
20 # version.
21 #
22 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
23 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
24 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License along with
27 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
28 # Suite 330, Boston, MA  02111-1307 USA
29
30 use strict;
31
32 # standard or CPAN modules used
33 use CGI;
34
35 # Koha modules used
36 use C4::Context;
37 use C4::Interface::CGI::Output;
38 use C4::Auth;
39 use C4::Breeding;
40
41 #------------------
42 # Constants
43
44
45
46 # HTML colors for alternating lines
47 my $lc1='#dddddd';
48 my $lc2='#ddaaaa';
49
50 #-------------
51 #-------------
52 # Initialize
53
54 my $userid=$ENV{'REMOTE_USER'};
55
56 my $input = new CGI;
57 my $dbh = C4::Context->dbh;
58
59 my $uploadmarc=$input->param('uploadmarc');
60 my $overwrite_biblio = $input->param('overwrite_biblio');
61 my $filename = $input->param('filename');
62 my $syntax = $input->param('syntax');
63 my ($template, $loggedinuser, $cookie)
64         = get_template_and_user({template_name => "tools/breeding.tmpl",
65                                         query => $input,
66                                         type => "intranet",
67                                         authnotrequired => 0,
68                                         flagsrequired => {parameters => 1, management => 1, tools => 1},
69                                         debug => 1,
70                                         });
71
72 $template->param(SCRIPT_NAME => $ENV{'SCRIPT_NAME'},
73                                                 uploadmarc => $uploadmarc);
74 if ($uploadmarc && length($uploadmarc)>0) {
75         my $marcrecord='';
76         while (<$uploadmarc>) {
77                 $marcrecord.=$_;
78         }
79         my ($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported) = ImportBreeding($marcrecord,$overwrite_biblio,$filename,$syntax,"");
80
81         $template->param(imported => $imported,
82                                                         alreadyindb => $alreadyindb,
83                                                         alreadyinfarm => $alreadyinfarm,
84                                                         notmarcrecord => $notmarcrecord,
85                                                         total => $imported+$alreadyindb+$alreadyinfarm+$notmarcrecord,
86                                                         );
87
88 }
89
90 output_html_with_http_headers $input, $cookie, $template->output;
91 my $menu;
92 my $file;
93
94
95 #---------------
96 # log cleared, as marcimport is (almost) rewritten from scratch.
97 # $Log$
98 # Revision 1.3  2006/09/27 21:19:22  tgarip1957
99 # Finalized XML version for intranet
100 #
101 # Revision 1.2.4.1  2005/04/07 10:10:52  tipaul
102 # copying processz3950queue from 2.0 branch. The 2.2 version misses an important fix
103 #