=cut
-sub build_authorized_values_list ($$$$$$$) {
+sub build_authorized_values_list {
my ( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ) = @_;
my @authorised_values;
=cut
-sub CreateKey(){
+sub CreateKey {
return int(rand(1000000));
}
=cut
-sub GetMandatoryFieldZ3950($){
+sub GetMandatoryFieldZ3950 {
my $frameworkcode = shift;
my @isbn = GetMarcFromKohaField('biblioitems.isbn',$frameworkcode);
my @title = GetMarcFromKohaField('biblio.title',$frameworkcode);
$value eq '' &&
!$tdef->{$subfield}->{mandatory} &&
!$tdef->{mandatory};
+ # expand all subfields of 773 if there is a host item provided in the input
+ $subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
+
+
# it's an authorised field
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
$subfield_data{marc_value} =
}
elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) {
- # opening plugin. Just check wether we are on a developper computer on a production one
+ # opening plugin. Just check whether we are on a developer computer on a production one
# (the cgidir differs)
my $cgidir = C4::Context->intranetdir . "/cgi-bin/cataloguing/value_builder";
unless ( opendir( DIR, "$cgidir" ) ) {
return $ind_value;
}
-sub build_tabs ($$$$$) {
+sub build_tabs {
my ( $template, $record, $dbh, $encoding,$input ) = @_;
# fill arrays
# always include in the form regardless of the hidden setting - bug 2206
next
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
- push(
+ push(
@subfields_data,
&create_input(
$tag, $subfield, '', $index_tag, $tabloop, $record,
my $frameworkcode = $input->param('frameworkcode');
my $redirect = $input->param('redirect');
my $dbh = C4::Context->dbh;
+my $hostbiblionumber = $input->param('hostbiblionumber');
+my $hostitemnumber = $input->param('hostitemnumber');
my $userflags = 'edit_catalogue';
frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
);
if ($frameworkcode eq $thisframeworkcode){
- $row{'selected'}="selected=\"selected\"";
+ $row{'selected'} = 1;
}
push @frameworkcodeloop, \%row;
}
if ($breedingid) {
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
}
+#populate hostfield if hostbiblionumber is available
+if ($hostbiblionumber){
+ my $marcflavour = C4::Context->preference("marcflavour");
+ $record=MARC::Record->new();
+ $record->leader('');
+ my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$marcflavour);
+ $record->append_fields($field);
+}
$is_a_modif = 0;
);
# getting html input
my @params = $input->param();
- $record = TransformHtmlToMarc( \@params , $input );
+ $record = TransformHtmlToMarc( $input );
# check for a duplicate
my ( $duplicatebiblionumber, $duplicatetitle );
if ( !$is_a_modif ) {
$biblionumber = "";
}
+ if ( $record ne -1 ) {
#FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding
- eval {
- my $uxml = $record->as_xml;
- MARC::Record::default_record_format("UNIMARC")
- if ( C4::Context->preference("marcflavour") eq "UNIMARC" );
- my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' );
- $record = $urecord;
- };
+ eval {
+ my $uxml = $record->as_xml;
+ MARC::Record::default_record_format("UNIMARC")
+ if ( C4::Context->preference("marcflavour") eq "UNIMARC" );
+ my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' );
+ $record = $urecord;
+ };
+ }
build_tabs( $template, $record, $dbh, $encoding,$input );
$template->param(
biblionumber => $biblionumber,
biblioitemnumtagfield => $biblioitemnumtagfield,
biblioitemnumtagsubfield => $biblioitemnumtagsubfield,
biblioitemnumber => $biblioitemnumber,
+ hostbiblionumber => $hostbiblionumber,
+ hostitemnumber => $hostitemnumber
);
}
$template->param( title => $record->title() ) if ( $record ne "-1" );
-if (C4::Context->preference("marcflavour") eq "MARC21"){
- $template->param(MARC21 => 1);
-}
-
-
$template->param(
popup => $mode,
frameworkcode => $frameworkcode,
itemtype => $frameworkcode,
- borrowernumber => $loggedinuser
+ borrowernumber => $loggedinuser,
+ marcflavour => C4::Context->preference("marcflavour"),
);
output_html_with_http_headers $input, $cookie, $template->output;