Bug 10271: (follow-up) correct tabs
[koha_fer] / cataloguing / value_builder / dateaccessioned.pl
index 3a9a3da..5e834a4 100755 (executable)
@@ -1,7 +1,5 @@
 #!/usr/bin/perl
 
-# $Id: usmarc_field_952v.pl,v 1.1.2.2 2006/09/20 02:59:53 kados Exp $
-
 # Copyright 2000-2002 Katipo Communications
 #
 # This file is part of Koha.
@@ -19,8 +17,8 @@
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-#use strict;
-#use warnings; FIXME - Bug 2505
+use strict;
+use warnings;
 
 =head1
 
@@ -73,14 +71,21 @@ function Focus$function_name(subfield_managed, id, force) {
     //  summary += i + ": " + document.f.tag[i].value + " " + document.f.subfield[i].value + ": " + document.f.field_value[i].value + "\\n"; 
     //}
     //alert("Got focus, subfieldmanaged: " + subfield_managed + "\\n" + summary);
-    set_to_today(id); // defined in additem.pl HEAD
+    set_to_today(id);
     return 0;
 }
 
 function Clic$function_name(id) {
-    set_to_today(id, 1); // defined in additem.pl HEAD
+    set_to_today(id, 1);
     return 0;
 }
+
+function set_to_today(id, force) {
+    if (! id) { alert(_("Bad id ") + id + _(" sent to set_to_today()")); return 0; }
+    if (\$("#" + id).val() == '' || \$("#" + id).val() == '0000-00-00' || force) {
+        \$("#" + id).val("$date");
+    }
+}
 //]]>
 </script>
 END_OF_JS