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
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.
23 #use warnings; FIXME - Bug 2505
27 plugin_parameters : useless here
31 sub plugin_parameters
{
32 # my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
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
46 * a variable containing the 3 scripts.
47 the 3 scripts are inserted after the <input> in the html code
51 sub plugin_javascript
{
52 # my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
53 my $function_name = "dateaccessioned".(int(rand(100000))+1);
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">
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) {
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";
75 //alert("Got focus, subfieldmanaged: " + subfield_managed + "\\n" + summary);
76 set_to_today(id); // defined in additem.pl HEAD
80 function Clic$function_name(id) {
81 set_to_today(id, 1); // defined in additem.pl HEAD
87 return ($function_name, $res);