diff --git a/acqui.simple/addbiblio.pl b/acqui.simple/addbiblio.pl index 66c9d9b460..767fb1a463 100755 --- a/acqui.simple/addbiblio.pl +++ b/acqui.simple/addbiblio.pl @@ -79,8 +79,12 @@ my $record=-1; $record = MARCgetbiblio($dbh,$bibid) if ($bibid); $record = MARCfindbreeding($dbh,$isbn) if ($isbn); my $is_a_modif=0; +my ($oldbiblionumtagfield,$oldbiblionumtagsubfield); if ($bibid) { $is_a_modif=1; +($oldbiblionumtagfield,$oldbiblionumtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"biblio.biblionumber"); +warn "==>$oldbiblionumtagfield,$oldbiblionumtagsubfield"; + } #------------------------------------------------------------------------------------------------------------------------------ if ($op eq "addbiblio") { @@ -101,7 +105,7 @@ if ($op eq "addbiblio") { my $oldbibnum; my $oldbibitemnum; if ($is_a_modif) { - ($bibid,$oldbibnum,$oldbibitemnum) = NEWmodbiblio($dbh,$record,$bibid); + NEWmodbiblio($dbh,$record,$bibid); } else { ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewbiblio($dbh,$record); } @@ -116,7 +120,7 @@ if ($op eq "addbiblio") { my @loop_data =(); my $tag; my $i=0; - my $authorised_values_sth = $dbh->prepare("select authorised_value from authorised_values where category=?"); + my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from authorised_values where category=? order by authorised_value"); # loop through each tab 0 through 9 for (my $tabloop = 0; $tabloop<=9;$tabloop++) { # my @fields = $record->fields(); @@ -142,6 +146,7 @@ if ($op eq "addbiblio") { $indicator = $x if $x; if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { my @authorised_values; + my %authorised_lib; # builds list, depending on authorised value... #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { @@ -150,6 +155,7 @@ if ($op eq "addbiblio") { push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); while (my ($branchcode,$branchname) = $sth->fetchrow_array) { push @authorised_values, $branchcode; + $authorised_lib{$branchcode}=$branchname; } #----- itemtypes } elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") { @@ -158,28 +164,32 @@ if ($op eq "addbiblio") { push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); while (my ($itemtype,$description) = $sth->fetchrow_array) { push @authorised_values, $itemtype; + $authorised_lib{$itemtype}=$description; } #---- "true" authorised value } else { $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value}); push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); - while ((my $value) = $authorised_values_sth->fetchrow_array) { + while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) { push @authorised_values, $value; + $authorised_lib{$value}=$lib; } } $subfield_data{marc_value}= CGI::scrolling_list(-name=>'field_value', -values=> \@authorised_values, -default=>"$value", + -labels => \%authorised_lib, -size=>1, -multiple=>0, ); } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) { - $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; #" + $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; #" } elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) { my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; require $plugin; my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,$tabloop); - $subfield_data{marc_value}=" {$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">..."; + my ($function_name,$javascript) = plugin_javascript($dbh,$record,$tagslib,$i,$tabloop); + $subfield_data{marc_value}=" ... $javascript"; } else { $subfield_data{marc_value}=""; } @@ -189,34 +199,39 @@ if ($op eq "addbiblio") { ($x,$value) = find_value($tag,$subfield,$record) if ($record ne -1); if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { my @authorised_values; + my %authorised_lib; # builds list, depending on authorised value... #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - my $sth=$dbh->prepare("select branchcode,branchname from branches"); + my $sth=$dbh->prepare("select branchcode,branchname from branches order by branchcode"); $sth->execute; push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); while (my ($branchcode,$branchname) = $sth->fetchrow_array) { push @authorised_values, $branchcode; + $authorised_lib{$branchcode}=$branchname; } #----- itemtypes } elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") { - my $sth=$dbh->prepare("select itemtype,description from itemtypes"); + my $sth=$dbh->prepare("select itemtype,description from itemtypes order by itemtype"); $sth->execute; push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); while (my ($itemtype,$description) = $sth->fetchrow_array) { push @authorised_values, $itemtype; + $authorised_lib{$itemtype}=$description; } #---- "true" authorised value } else { $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value}); push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); - while ((my $value) = $authorised_values_sth->fetchrow_array) { + while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) { push @authorised_values, $value; + $authorised_lib{$value}=$lib; } } $subfield_data{marc_value}= CGI::scrolling_list(-name=>'field_value', -values=> \@authorised_values, -default=>"$value", + -labels => \%authorised_lib, -size=>1, -multiple=>0, ); @@ -226,7 +241,8 @@ if ($op eq "addbiblio") { my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; require $plugin; my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,$tabloop); - $subfield_data{marc_value}=" {$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">..."; + my ($function_name,$javascript) = plugin_javascript($dbh,$record,$tagslib,$i,$tabloop); + $subfield_data{marc_value}=" ... $javascript"; } else { $subfield_data{marc_value}=""; } @@ -266,6 +282,8 @@ if ($op eq "addbiblio") { } $template->param( oldbiblionumber => $oldbiblionumber, - bibid => $bibid); + bibid => $bibid, + oldbiblionumtagfield => $oldbiblionumtagfield, + oldbiblionumtagsubfield => $oldbiblionumtagsubfield); } print "Content-Type: text/html\n\n", $template->output; diff --git a/acqui.simple/addbooks.pl b/acqui.simple/addbooks.pl index c1bcedfa92..c4f84bbba5 100755 --- a/acqui.simple/addbooks.pl +++ b/acqui.simple/addbooks.pl @@ -35,14 +35,18 @@ use CGI; use strict; +use C4::Auth; use C4::Catalogue; use C4::Biblio; use C4::Output; use HTML::Template; my $query = new CGI; +my ($loggedinuser, $cookie, $sessionID) = checkauth($query); my $error = $query->param('error'); my $success = $query->param('biblioitem'); my $template= gettemplate("acqui.simple/addbooks.tmpl"); -print "Content-Type: text/html\n\n",$template->output; \ No newline at end of file +$template->param(loggedinuser => $loggedinuser); + +print $query->header(-cookie => $cookie),$template->output; diff --git a/acqui.simple/additem.pl b/acqui.simple/additem.pl index 2254808b38..cfa5c31343 100755 --- a/acqui.simple/additem.pl +++ b/acqui.simple/additem.pl @@ -70,7 +70,7 @@ if ($op eq "additem") { } my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); # MARC::Record builded => now, record in DB - my ($bibid,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid); + my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWnewitem($dbh,$record,$bibid); $nextop = "additem"; #------------------------------------------------------------------------------------------------------------------------------ } elsif ($op eq "edititem") { @@ -88,13 +88,14 @@ if ($op eq "additem") { # build indicator hash. my @ind_tag = $input->param('ind_tag'); my @indicator = $input->param('indicator'); +# my $itemnum = $input->param('itemnum'); my %indicators; for (my $i=0;$i<=$#ind_tag;$i++) { $indicators{$ind_tag[$i]} = $indicator[$i]; } my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); # MARC::Record builded => now, record in DB - my ($bibid,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0); + my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0); $nextop="additem"; } @@ -155,7 +156,7 @@ foreach my $subfield_code (sort keys(%witness)) { # next item form my @loop_data =(); my $i=0; -my $authorised_values_sth = $dbh->prepare("select authorised_value from authorised_values where category=?"); +my $authorised_values_sth = $dbh->prepare("select authorised_value,lib from authorised_values where category=? order by authorised_value"); foreach my $tag (sort keys %{$tagslib}) { my $previous_tag = ''; @@ -174,6 +175,7 @@ foreach my $tag (sort keys %{$tagslib}) { ($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord); if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { my @authorised_values; + my %authorised_lib; # builds list, depending on authorised value... #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { @@ -182,6 +184,7 @@ foreach my $tag (sort keys %{$tagslib}) { push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); while (my ($branchcode,$branchname) = $sth->fetchrow_array) { push @authorised_values, $branchcode; + $authorised_lib{$branchcode}=$branchname; } #----- itemtypes } elsif ($tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes") { @@ -190,28 +193,32 @@ foreach my $tag (sort keys %{$tagslib}) { push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); while (my ($itemtype,$description) = $sth->fetchrow_array) { push @authorised_values, $itemtype; + $authorised_lib{$itemtype}=$description; } #---- "true" authorised value } else { $authorised_values_sth->execute($tagslib->{$tag}->{$subfield}->{authorised_value}); push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); - while ((my $value) = $authorised_values_sth->fetchrow_array) { + while (my ($value,$lib) = $authorised_values_sth->fetchrow_array) { push @authorised_values, $value; + $authorised_lib{$value}=$lib; } } $subfield_data{marc_value}= CGI::scrolling_list(-name=>'field_value', -values=> \@authorised_values, -default=>"$value", + -labels => \%authorised_lib, -size=>1, -multiple=>0, ); } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) { - $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; + $subfield_data{marc_value}=" {$tag}->{$subfield}->{thesaurus_category}&index=$i',$i)\">..."; } elsif ($tagslib->{$tag}->{$subfield}->{'value_builder'}) { my $plugin="../value_builder/".$tagslib->{$tag}->{$subfield}->{'value_builder'}; require $plugin; my $extended_param = plugin_parameters($dbh,$record,$tagslib,$i,0); - $subfield_data{marc_value}=" {$tag}->{$subfield}->{value_builder}&index=$i$extended_param',$i)\">..."; + my ($function_name,$javascript) = plugin_javascript($dbh,$record,$tagslib,$i,0); + $subfield_data{marc_value}=" ... $javascript"; } else { $subfield_data{marc_value}=""; } @@ -227,5 +234,8 @@ $template->param(item_loop => \@item_value_loop, bibid => $bibid, item => \@loop_data, itemnum => $itemnum, - op => $nextop); + itemtagfield => $itemtagfield, + itemtagsubfield =>$itemtagsubfield, + op => $nextop, + opisadd => ($nextop eq "saveitem")?0:1); print "Content-Type: text/html\n\n", $template->output;