From 00ba07b595b0b505d201945d3308068476a35896 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Thu, 5 Feb 2009 13:04:20 -0600 Subject: [PATCH] Bug 2919 -- fix value_builder plugins for dateaccessioned, barcode This patch depends on my previous one "Begin cleanup on additem" and fixes one bug introduced in that patch. Overhaul of additem sections to factor out common pieces especially attributes. Plugin js vastly simplified and reimplemented in jquery. Performance improved. Note that a particularly busy cataloging department should still leave barcode blank for server-side autopopulation to avoid collision. Signed-off-by: Galen Charlton Signed-off-by: Henri-Damien LAURENT --- cataloguing/additem.pl | 281 ++++++------------ cataloguing/value_builder/barcode.pl | 166 ++++------- cataloguing/value_builder/dateaccessioned.pl | 67 ++--- .../prog/en/modules/cataloguing/additem.tmpl | 35 ++- 4 files changed, 210 insertions(+), 339 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index caa247dc7e..79884756c2 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -28,8 +28,7 @@ use C4::Context; use C4::Koha; # XXX subfield_is_koha_internal_p use C4::Branch; # XXX subfield_is_koha_internal_p use C4::ClassSource; - -use Date::Calc qw(Today); +use C4::Dates; use MARC::File::XML; @@ -75,9 +74,11 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); -# find itemtype my $frameworkcode = &GetFrameworkCode($biblionumber); +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); @@ -88,14 +89,14 @@ my @errors; # store errors found while checking data BEFORE saving item. if ($op eq "additem") { #------------------------------------------------------------------------------- # rebuild - my @tags = $input->param('tag'); + my @tags = $input->param('tag'); my @subfields = $input->param('subfield'); - my @values = $input->param('field_value'); + my @values = $input->param('field_value'); # build indicator hash. - my @ind_tag = $input->param('ind_tag'); + my @ind_tag = $input->param('ind_tag'); my @indicator = $input->param('indicator'); my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM'); - my $record=MARC::Record::new_from_xml($xml, 'UTF-8'); + my $record = MARC::Record::new_from_xml($xml, 'UTF-8'); # if autoBarcode is set to 'incremental', calculate barcode... # NOTE: This code is subject to change in 3.2 with the implemenation of ajax based autobarcode code # NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript @@ -128,7 +129,7 @@ if ($op eq "additem") { #------------------------------------------------------------------------------- # retrieve item if exist => then, it's a modif $itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); - $nextop="saveitem"; + $nextop = "saveitem"; #------------------------------------------------------------------------------- } elsif ($op eq "delitem") { #------------------------------------------------------------------------------- @@ -175,7 +176,7 @@ if ($op eq "additem") { push @errors,"barcode_not_unique"; } else { my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = ModItemFromMarc($itemtosave,$biblionumber,$itemnumber); - $itemnumber=""; + $itemnumber=""; } $nextop="additem"; } @@ -197,13 +198,14 @@ my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebran foreach my $field (@fields) { next if ($field->tag()<10); - my @subf=$field->subfields; + my @subf = $field->subfields; + (defined @subf) or @subf = (); my %this_row; # loop through each subfield for my $i (0..$#subf) { next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10 && ($field->tag() ne $itemtagfield - && $subf[$i][0] ne $itemtagsubfield)); + && $subf[$i][0] ne $itemtagsubfield)); $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10); if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10) { @@ -248,7 +250,7 @@ for (my $i=0;$i<=$#big_array; $i++) { $row_data{item_value} = $items_data; $row_data{itemnumber} = $big_array[$i]->{itemnumber}; #reporting this_row values - $row_data{'nomod'} = $big_array[$i]{'nomod'}; + $row_data{'nomod'} = $big_array[$i]{'nomod'}; push(@item_value_loop,\%row_data); } foreach my $subfield_code (sort keys(%witness)) { @@ -262,37 +264,39 @@ my @loop_data =(); my $i=0; my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); +my $onlymine = C4::Context->preference('IndependantBranches') && + C4::Context->userenv && + C4::Context->userenv->{flags}!=1 && + C4::Context->userenv->{branch}; +my $branches = GetBranches($onlymine); # build once ahead of time, instead of multiple times later. + foreach my $tag (sort keys %{$tagslib}) { - my $previous_tag = ''; # loop through each subfield foreach my $subfield (sort keys %{$tagslib->{$tag}}) { next if subfield_is_koha_internal_p($subfield); - next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10"); + next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10"); my %subfield_data; - my $index_subfield= int(rand(1000000)); - if($subfield eq '@'){ + my $index_subfield = int(rand(1000000)); + if ($subfield eq '@'){ $subfield_data{id} = "tag_".$tag."_subfield_00_".$index_subfield; } else { - $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; + $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; } - $subfield_data{tag}=$tag; - $subfield_data{subfield}=$subfield; - $subfield_data{random}=int(rand(1000000)); -# $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib}; - $subfield_data{marc_lib} ="{$tag}->{$subfield}->{lib}."\">".$tagslib->{$tag}->{$subfield}->{lib}.""; - $subfield_data{mandatory} =$tagslib->{$tag}->{$subfield}->{mandatory}; - $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; + $subfield_data{tag} = $tag; + $subfield_data{subfield} = $subfield; + $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? +# $subfield_data{marc_lib} = $tagslib->{$tag}->{$subfield}->{lib}; + $subfield_data{marc_lib} ="{$tag}->{$subfield}->{lib}."\">".$tagslib->{$tag}->{$subfield}->{lib}.""; + $subfield_data{mandatory} = $tagslib->{$tag}->{$subfield}->{mandatory}; + $subfield_data{repeatable} = $tagslib->{$tag}->{$subfield}->{repeatable}; my ($x,$value); ($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord); $value =~ s/"/"/g; unless ($value) { $value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; - # get today date & replace YYYY, MM, DD if provided in the default value - my ( $year, $month, $day ) = Today(); - $month = sprintf( "%02d", $month ); - $day = sprintf( "%02d", $day ); + my ( $year, $month, $day ) = split ',', $today_iso; $value =~ s/YYYY/$year/g; $value =~ s/MM/$month/g; $value =~ s/DD/$day/g; @@ -304,74 +308,52 @@ foreach my $tag (sort keys %{$tagslib}) { # (C4::Context->userenv->{flags} != 1) && ($value) && ($value ne C4::Context->userenv->{branch}) ; # $test and print $input->redirect(".pl?biblionumber=$biblionumber") and exit; # search for itemcallnumber if applicable - if (!$value && $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) { - my $CNtag = substr(C4::Context->preference('itemcallnumber'),0,3); - my $CNsubfield = substr(C4::Context->preference('itemcallnumber'),3,1); - my $CNsubfield2 = substr(C4::Context->preference('itemcallnumber'),4,1); + my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); + if (!$value && $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && $pref_itemcallnumber) { + my $CNtag = substr($pref_itemcallnumber, 0, 3); + my $CNsubfield = substr($pref_itemcallnumber, 3, 1); + my $CNsubfield2 = substr($pref_itemcallnumber, 4, 1); my $temp2 = $temp->field($CNtag); if ($temp2) { $value = ($temp2->subfield($CNsubfield)).' '.($temp2->subfield($CNsubfield2)); #remove any trailing space incase one subfield is used - $value=~s/^\s+|\s+$//g; + $value =~ s/^\s+|\s+$//g; } } + + my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" ); + my $attributes = qq($attributes_no_value value="$value" ); if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { my @authorised_values; my %authorised_lib; - my $dbh=C4::Context->dbh; - # builds list, depending on authorised value... - #---- branch - if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - #Use GetBranches($onlymine) - my $onlymine=C4::Context->preference('IndependantBranches') && - C4::Context->userenv && - C4::Context->userenv->{flags}!=1 && - C4::Context->userenv->{branch}; - my $branches = GetBranches($onlymine); - my @branchloop; + if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) { foreach my $thisbranch ( sort keys %$branches ) { push @authorised_values, $thisbranch; $authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'}; } - - #----- itemtypes } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) { - my $sth = - $dbh->prepare( - "select itemtype,description from itemtypes order by description"); + push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); + my $sth = $dbh->prepare("select itemtype,description from itemtypes order by description"); $sth->execute; - push @authorised_values, "" - unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); - + my $itemtype; # FIXME: double declaration of $itemtype while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) { push @authorised_values, $itemtype; $authorised_lib{$itemtype} = $description; } - - unless ( $value ) { - my $default_itemtype; - my $itype_sth = $dbh->prepare("SELECT itemtype FROM biblioitems WHERE biblionumber = ?"); - $itype_sth->execute( $biblionumber ); - ( $default_itemtype ) = $itype_sth->fetchrow_array; - $value = $default_itemtype; - } - - #---- class_sources + $value = $itemtype unless ($value); } elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) { - push @authorised_values, "" - unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); + push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); my $class_sources = GetClassSources(); - my $default_source = C4::Context->preference("DefaultClassificationSource"); foreach my $class_source (sort keys %$class_sources) { next unless $class_sources->{$class_source}->{'used'} or - ($value and $class_source eq $value) or + ($value and $class_source eq $value) or ($class_source eq $default_source); push @authorised_values, $class_source; $authorised_lib{$class_source} = $class_sources->{$class_source}->{'description'}; @@ -381,12 +363,8 @@ foreach my $tag (sort keys %{$tagslib}) { #---- "true" authorised value } else { - $authorised_values_sth->execute( - $tagslib->{$tag}->{$subfield}->{authorised_value} ); - - push @authorised_values, "" - unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); - + push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); + $authorised_values_sth->execute( $tagslib->{$tag}->{$subfield}->{authorised_value} ); while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { push @authorised_values, $value; $authorised_lib{$value} = $lib; @@ -407,140 +385,67 @@ foreach my $tag (sort keys %{$tagslib}) { # it's a thesaurus / authority field } elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { - $subfield_data{marc_value} = - " - {$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">... + $subfield_data{marc_value} = " + {$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}'); return false;\" title=\"Tag Editor\">... "; # it's a plugin field } - elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { - + elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { # opening plugin - my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; + my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; if (do $plugin) { my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); - - $subfield_data{marc_value} = - " - ... - $javascript"; + $subfield_data{marc_value} = qq[ + ... + $javascript]; } else { warn "Plugin Failed: $plugin"; - # supply default input form - $subfield_data{marc_value} = - " - "; + $subfield_data{marc_value} = ""; # supply default input form } - # it's an hidden field - } - elsif ( $tag eq '' ) { - $subfield_data{marc_value} = - " - "; } - elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { - $subfield_data{marc_value} = - ""; - - # it's a standard field + elsif ( $tag eq '' ) { # it's an hidden field + $subfield_data{marc_value} = qq(); } - else { - if ( - length($value) > 100 - or - ( C4::Context->preference("marcflavour") eq "UNIMARC" && $tag >= 300 - and $tag < 400 && $subfield eq 'a' ) - or ( $tag >= 500 - and $tag < 600 - && C4::Context->preference("marcflavour") eq "MARC21" ) - ) - { - $subfield_data{marc_value} = - " - "; - } - else { - $subfield_data{marc_value} = - " - "; - } + elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? + $subfield_data{marc_value} = qq(); } -# $subfield_data{marc_value}=""; - push(@loop_data, \%subfield_data); - $i++ + elsif ( length($value) > 100 + or (C4::Context->preference("marcflavour") eq "UNIMARC" and + 300 <= $tag && $tag < 400 && $subfield eq 'a' ) + or (C4::Context->preference("marcflavour") eq "MARC21" and + 500 <= $tag && $tag < 600 ) + ) { + # oversize field (textarea) + $subfield_data{marc_value} = "\n"; + } else { + # it's a standard field + $subfield_data{marc_value} = ""; } +# $subfield_data{marc_value}=""; + push (@loop_data, \%subfield_data); + $i++ + } } # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. $template->param( title => $record->title() ) if ($record ne "-1"); -$template->param(item_loop => \@item_value_loop, - item_header_loop => \@header_value_loop, - biblionumber => $biblionumber, - title => $oldrecord->{title}, - author => $oldrecord->{author}, - item => \@loop_data, - itemnumber => $itemnumber, - itemtagfield => $itemtagfield, - itemtagsubfield =>$itemtagsubfield, - op => $nextop, - opisadd => ($nextop eq "saveitem")?0:1); +$template->param( + biblionumber => $biblionumber, + title => $oldrecord->{title}, + author => $oldrecord->{author}, + item_loop => \@item_value_loop, + item_header_loop => \@header_value_loop, + item => \@loop_data, + itemnumber => $itemnumber, + itemtagfield => $itemtagfield, + itemtagsubfield => $itemtagsubfield, + op => $nextop, + opisadd => ($nextop eq "saveitem") ? 0 : 1, +); foreach my $error (@errors) { $template->param($error => 1); } diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index 13bb57142e..763bf6dc98 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -21,7 +21,7 @@ use C4::Context; - +require C4::Dates; my $DEBUG = 0; =head1 @@ -30,8 +30,8 @@ plugin_parameters : other parameters added when the plugin is called by the dopo =cut sub plugin_parameters { -my ($dbh,$record,$tagslib,$i,$tabloop) = @_; -return ""; +# my ($dbh,$record,$tagslib,$i,$tabloop) = @_; + return ""; } =head1 @@ -53,146 +53,110 @@ sub plugin_javascript { my $function_name= "barcode".(int(rand(100000))+1); # find today's date - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = - localtime(time); - $year +=1900; - $mon +=1; - if (length($mon)==1) { - $mon = "0".$mon; - } - if (length($mday)==1) { - $mday = "0".$mday; - } - if (length($hour)==1) { - $hour = "0".$hour; - } - if (length($min)==1) { - $min = "0".$min; - } - if (length($sec)==1) { - $hour = "0".$sec; - } - - my $date = "$year"; - - my ($tag,$subfield) = GetMarcFromKohaField("items.barcode",""); - my ($loctag,$locsubfield) = GetMarcFromKohaField("items.homebranch",""); + my ($year, $mon, $day) = split('-', C4::Dates->today('iso')); + my ($tag,$subfield) = GetMarcFromKohaField("items.barcode", ''); + my ($loctag,$locsubfield) = GetMarcFromKohaField("items.homebranch", ''); my $nextnum; my $query; - my $scr; + my $scr; my $autoBarcodeType = C4::Context->preference("autoBarcode"); - warn "Barcode type = $autoBarcodeType" if $DEBUG; - unless ($autoBarcodeType eq 'OFF' or !$autoBarcodeType) { - + warn "Barcode type = $autoBarcodeType" if $DEBUG; + if ((not $autoBarcodeType) or $autoBarcodeType eq 'OFF') { + # don't return a value unless we have the appropriate syspref set + return ($function_name, + ""); + } if ($autoBarcodeType eq 'annual') { $query = "select max(cast( substring_index(barcode, '-',-1) as signed)) from items where barcode like ?"; my $sth=$dbh->prepare($query); $sth->execute("$year%"); while (my ($count)= $sth->fetchrow_array) { - warn "Examining Record: $count" if $DEBUG; + warn "Examining Record: $count" if $DEBUG; $nextnum = $count if $count; } $nextnum++; $nextnum = sprintf("%0*d", "4",$nextnum); $nextnum = "$year-$nextnum"; - $scr = " - for (i=0 ; iprepare($query); + my $sth = $dbh->prepare($query); $sth->execute(); while (my ($count)= $sth->fetchrow_array) { $nextnum = $count; } $nextnum++; - $scr = " - for (i=0 ; iprepare($query); - $sth->execute("^[a-zA-Z]{1,}$year"); - while (my ($count)= $sth->fetchrow_array) { - $nextnum = $count if $count; - warn "Existing incremental number = $nextnum" if $DEBUG; - } - $nextnum++; - $nextnum = sprintf("%0*d", "4",$nextnum); - $nextnum = $year . $mon . $nextnum; - warn "New Barcode = $nextnum" if $DEBUG; - $scr = " - for (i=0 ; iprepare($query); + $sth->execute("^[a-zA-Z]{1,}$year"); + while (my ($count)= $sth->fetchrow_array) { + $nextnum = $count if $count; + warn "Existing incremental number = $nextnum" if $DEBUG; + } + $nextnum++; + $nextnum = sprintf("%0*d", "4",$nextnum); + $nextnum = $year . $mon . $nextnum; + warn "New hbyymmincr Barcode = $nextnum" if $DEBUG; + $scr = " + for (i=0 ; i + my $js = < // -"; - # don't return a value unless we have the appropriate syspref set - return ($function_name,$res); - } - else { - return ($function_name,""); - } +END_OF_JS + return ($function_name, $js); } =head1 -plugin : the true value_builded. The screen that is open in the popup window. +plugin: useless here =cut sub plugin { -my ($input) = @_; -return ""; + # my ($input) = @_; + return ""; } 1; diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 8c5cf74dc6..785d76a971 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -19,15 +19,13 @@ # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA - - =head1 -plugin_parameters : other parameters added when the plugin is called by the dopop function +plugin_parameters : useless here =cut sub plugin_parameters { - my ($dbh,$record,$tagslib,$i,$tabloop) = @_; + # my ($dbh,$record,$tagslib,$i,$tabloop) = @_; return ""; } @@ -35,9 +33,9 @@ sub plugin_parameters { plugin_javascript : the javascript function called when the user enters the subfield. contain 3 javascript functions : -* one called when the field is entered (OnFocus). Named FocusXXX -* one called when the field is leaved (onBlur). Named BlurXXX -* one called when the ... link is clicked () named ClicXXX +* one called when the field is entered (OnFocus) named FocusXXX +* one called when the field is left (onBlur ) named BlurXXX +* one called when the ... link is clicked (onClick) named ClicXXX returns : * XXX @@ -46,56 +44,53 @@ the 3 scripts are inserted after the in the html code =cut sub plugin_javascript { - my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; - my $function_name= "dateaccessioned".(int(rand(100000))+1); + # my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; + my $function_name = "dateaccessioned".(int(rand(100000))+1); - # find today's date - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = - localtime(time); - $year +=1900; - $mon +=1; - $pmon = sprintf("%0*d", "2",$mon); - - $pmday = sprintf("%0*d", "2",$mday); - my $date = "$year-$pmon-$pmday"; + require C4::Dates; + my $date = C4::Dates->today('iso'); # find the tag/subfield mapped to items.dateaccessioned my ($tag,$subfield) = GetMarcFromKohaField("items.dateaccessioned",""); - my $res = " - -"; - return ($function_name,$res); +END_OF_JS + return ($function_name, $res); } =head1 -plugin : the true value_builded. The screen that is open in the popup window. +plugin: useless here. =cut sub plugin { -my ($input) = @_; -return ""; +# my ($input) = @_; + return ""; } 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl index 7358fee11b..3a26489613 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl @@ -133,24 +133,31 @@ function CreateKey(){ return parseInt(Math.random() * 100000); } - $(document).ready(function() { +$(document).ready(function() { $("#cataloguing_additem_itemlist tr").hover( - function () { - $(this).attr("class","highlight"); - }, - function () { - $(this).attr("class",""); - } + function () {$(this).attr("class","highlight");}, + 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(""); + } +} //]]> /css/addbiblio.css" /> - +
@@ -196,7 +203,7 @@ function CreateKey(){

Add Item

-

Edit Item

+

Edit Item #

    @@ -205,8 +212,8 @@ function CreateKey(){ - " /> - " /> + " /> + " /> " /> ')">+ @@ -214,8 +221,8 @@ function CreateKey(){
- - + + " /> -- 2.39.5