Bug 6678 - Fix some problems with the standard NORMARC framework
[koha.git] / cataloguing / value_builder / dateaccessioned.pl
blob3a9a3dae894337115ffd32dd4777502d88755d91
1 #!/usr/bin/perl
3 # $Id: usmarc_field_952v.pl,v 1.1.2.2 2006/09/20 02:59:53 kados Exp $
5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along
19 # with Koha; if not, write to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #use strict;
23 #use warnings; FIXME - Bug 2505
25 =head1
27 plugin_parameters : useless here
29 =cut
31 sub plugin_parameters {
32 # my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
33 return "";
36 =head1
38 plugin_javascript : the javascript function called when the user enters the subfield.
39 contain 3 javascript functions :
40 * one called when the field is entered (OnFocus) named FocusXXX
41 * one called when the field is left (onBlur ) named BlurXXX
42 * one called when the ... link is clicked (onClick) named ClicXXX
44 returns :
45 * XXX
46 * a variable containing the 3 scripts.
47 the 3 scripts are inserted after the <input> in the html code
49 =cut
51 sub plugin_javascript {
52 # my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
53 my $function_name = "dateaccessioned".(int(rand(100000))+1);
55 require C4::Dates;
56 my $date = C4::Dates->today('iso');
58 # find the tag/subfield mapped to items.dateaccessioned
59 my ($tag,$subfield) = GetMarcFromKohaField("items.dateaccessioned","");
60 my $res = <<END_OF_JS;
61 <script type="text/javascript">
62 //<![CDATA[
63 //
64 // from: cataloguing/value_builder/dateaccessioned.pl
66 function Blur$function_name(index) {
67 //date validation could go here
70 function Focus$function_name(subfield_managed, id, force) {
71 //var summary = "";
72 //for (i=0 ; i<document.f.field_value.length ; i++) {
73 // summary += i + ": " + document.f.tag[i].value + " " + document.f.subfield[i].value + ": " + document.f.field_value[i].value + "\\n";
74 //}
75 //alert("Got focus, subfieldmanaged: " + subfield_managed + "\\n" + summary);
76 set_to_today(id); // defined in additem.pl HEAD
77 return 0;
80 function Clic$function_name(id) {
81 set_to_today(id, 1); // defined in additem.pl HEAD
82 return 0;
84 //]]>
85 </script>
86 END_OF_JS
87 return ($function_name, $res);
90 =head1
92 plugin: useless here.
94 =cut
96 sub plugin {
97 # my ($input) = @_;
98 return "";