[Koha-patches] [PATCH] Bug 6125: repairs dateaccessioned plugin

Adrien Saurat adrien.saurat at biblibre.com
Tue Mar 20 14:01:29 CET 2012


1/ It now works with neworderempty.pl
2/ The set_to_today function was moved from
additem.tt to dateaccessioned.pl (so it's
available to all pages using the plugin)
---
 cataloguing/additem.pl                             |    2 --
 cataloguing/value_builder/dateaccessioned.pl       |   13 ++++++++++---
 .../prog/en/modules/cataloguing/additem.tt         |    7 -------
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index 4bf06b5..695181b 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -308,8 +308,6 @@ my ($template, $loggedinuser, $cookie)
 
 
 my $today_iso = C4::Dates->today('iso');
-$template->param(today_iso => $today_iso);
-
 my $tagslib = &GetMarcStructure(1,$frameworkcode);
 my $record = GetMarcBiblio($biblionumber);
 my $oldrecord = TransformMarcToKoha($dbh,$record);
diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl
index af1a285..5e834a4 100755
--- a/cataloguing/value_builder/dateaccessioned.pl
+++ b/cataloguing/value_builder/dateaccessioned.pl
@@ -18,7 +18,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
-#use warnings; FIXME - Bug 2505
+use warnings;
 
 =head1
 
@@ -71,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
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
index 008af82..4c39bff 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
@@ -157,13 +157,6 @@ $(document).ready(function() {
         function () {$(this).attr("class",""         );}
     );
 });
-
-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("[% today_iso %]");
-    }
-}
 //]]>
 </script>
 <link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
-- 
1.7.4.1



More information about the Koha-patches mailing list