&GetBiblioItemInfosOf
&GetBiblioItemByBiblioNumber
&GetBiblioFromItemNumber
+ &GetBiblioSummary
&GetRecordValue
&GetFieldMapping
=cut
sub GetISBDView {
- my $biblionumber = shift;
+ my ($biblionumber, $template) = @_;
my $record = GetMarcBiblio($biblionumber);
my $itemtype = &GetFrameworkCode($biblionumber);
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$itemtype);
my $tagslib = &GetMarcStructure( 1, $itemtype );
my $ISBD = C4::Context->preference('ISBD');
+ if($template eq "opac"){
+ $ISBD = C4::Context->preference('OPACISBD');
+ }
+
my $bloc = $ISBD;
my $res;
my $blocres;
my $tagsubf = $tag . $subfvalue;
$calculated =~
s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g;
- $calculated =~s#/cgi-bin/koha/[^/]+/([^.]*.pl\?.*)$#opac-$1#g;
# field builded, store the result
if ( $calculated && !$hasputtextbefore )
$valuecode # replace by the value code
/gx;
- $calculated =~
- s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g;
- $calculated =~s#/cgi-bin/koha/[^/]+/([^.]*.pl\?.*)$#opac-$1#g;
}
# field builded, store the result
$genre = ($mtx eq 'dc') ? "&rft.type=$genre" : "&rft.genre=$genre";
# Setting datas
- $aulast = $record->subfield('700','a');
- $aufirst = $record->subfield('700','b');
+ $aulast = $record->subfield('700','a') || '';
+ $aufirst = $record->subfield('700','b') || '';
$oauthors = "&rft.au=$aufirst $aulast";
# others authors
if($record->field('200')){
}
$title = ( $mtx eq 'dc' ) ? "&rft.title=".$record->subfield('200','a') :
"&rft.title=".$record->subfield('200','a')."&rft.btitle=".$record->subfield('200','a');
- $pubyear = $record->subfield('210','d');
- $publisher = $record->subfield('210','c');
- $isbn = $record->subfield('010','a');
- $issn = $record->subfield('011','a');
+ $pubyear = $record->subfield('210','d') || '';
+ $publisher = $record->subfield('210','c') || '';
+ $isbn = $record->subfield('010','a') || '';
+ $issn = $record->subfield('011','a') || '';
}else{
# MARC21 need some improve
my $fmts;
return $coins_value;
}
+=head2 GetBiblioSummary
+
+=over 4
+
+$summary = GetBiblioSummary($marcrecord);
+
+Return the summary of a record.
+
+=back
+
+=cut
+
+sub GetBiblioSummary {
+ my $recorddata =shift @_;
+
+ my $marcflavour = C4::Context->preference("marcflavour");
+ my $marc=MARC::Record::new_from_xml($recorddata,"utf-8",$marcflavour);
+
+ my $str;
+
+ if($marcflavour eq "MARC21"){
+ $str="<b>".$marc->subfield('245',"a")."</b>" if $marc->subfield('245','a');
+ $str.= " <i>".$marc->subfield('245',"b")."</i> " if $marc->subfield('245','b');
+
+ if ($marc->field('245')){
+ $str.=" / ";
+ foreach ($marc->field('100')->subfield("a")) {
+ $str.=$_." ; ";
+ }
+ $str=~s/ ; $/. /;
+ }
+
+ if ($marc->field('260')){
+ $str.=" - ";
+ $str.=$marc->subfield('260',"a")." " if $marc->subfield('260','a');
+ $str.=" : ".$marc->subfield('260',"b")." " if $marc->subfield('260','b');
+ $str.=", ".$marc->subfield('260',"c")." " if $marc->subfield('260','c');
+ }
+ if ($marc->field('300')){
+ $str.=" - ";
+ $str.=$marc->subfield('300','a') if ($marc->subfield(300,'a'));
+ $str.=" ; ".$marc->subfield('300','b') if $marc->subfield('300','b');
+ $str.=" ; ".$marc->subfield('300','c') if $marc->subfield('300','c');
+ $str.=" ; ".$marc->subfield('300','e') if $marc->subfield('300','e');
+ }
+ foreach ($marc->field('500')){
+ $str.= " - ";
+ foreach ($_->subfield("a")){
+ $str.=$_."; "
+ }
+ }
+ my $itemtypes=GetItemTypes();
+ $str.=" - <u>".$itemtypes->{$marc->subfield('942','c')}->{'description'}."</u> ";
+ $str.="<br />\n";
+
+ }else{
+ $str = "<b>".$marc->subfield('200','a')."</b>" if $marc->subfield('200','a');
+ $str.= " <i>".$marc->subfield('200','e')."</i> " if $marc->subfield('200','e');
+ if ($marc->field('200')){
+ $str.=" / ";
+ foreach ($marc->field('200')->subfield("f")) {
+ $str.=$_." ; ";
+ }
+ $str=~s/ ; $/. /;
+ }
+
+ if ($marc->subfield('200','g')){
+ $str.=" ; ";
+ foreach ($marc->field('200')->subfield("g")){
+ $str.=$_." ; ";
+ }
+ $str=~s/ ; $/. /;
+ }
+
+ if ($marc->field('461')){
+ $str.="- In :";
+ $str.= $marc->subfield('461','t') if $marc->subfield('461','t');
+ $str.=", ".$marc->subfield('461','d') if $marc->subfield('461','d');
+ $str.=", ".$marc->subfield('461','v') if $marc->subfield('461','v');
+ $str.=", ".$marc->subfield('461','h') if $marc->subfield('461','h');
+ $str.=" ; ".$marc->subfield('461','x') if $marc->subfield('461','x');
+ }
+
+ if ($marc->field('210')){
+ $str.=" - ";
+ $str.=$marc->subfield('210',"a")." " if $marc->subfield('210','a');
+ $str.=" : ".$marc->subfield('210',"c")." " if $marc->subfield('210','c');
+ $str.=", ".$marc->subfield('210',"d")." " if $marc->subfield('210','d');
+ }
+
+ if ($marc->field('215')){
+ $str.=" - ";
+ $str.=$marc->subfield('215','a') if ($marc->subfield(215,'a'));
+ $str.=" ; ".$marc->subfield('215','d') if $marc->subfield('215','d');
+ $str.=" ; ".$marc->subfield('215','c') if $marc->subfield('215','c');
+ $str.=" ; ".$marc->subfield('215','e') if $marc->subfield('215','e');
+ }
+ foreach ($marc->field('300')){
+ $str.=" - ";
+ foreach ($_->subfield("a")){
+ $str.=$_."; "
+ }
+ }
+
+ my $itemtypes=GetItemTypes;
+ if($itemtypes->{$marc->subfield('200','b')}){
+ $str.=" - <u>".$itemtypes->{$marc->subfield('200','b')}->{'description'}."</u> ";
+ }
+ $str.="<br />\n";
+ }
+ return $str;
+}
+
=head2 GetAuthorisedValueDesc
=over 4
my $prevtag = -1;
my $first = 1;
my $j = -1;
- @$indicator=map{sprintf("%2s",$_) unless ( length($_)<2)}@$indicator;
for ( my $i = 0 ; $i < @$tags ; $i++ ) {
if (C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a") {
# if we have a 100 field and it's values are not correct, skip them.
# }
if ( ( @$tags[$i] ne $prevtag ) ) {
$j++ unless ( @$tags[$i] eq "" );
+ my $indicator1=eval{substr( @$indicator[$j], 0, 1 )};
+ my $indicator2=eval{substr( @$indicator[$j], 1, 1 )};
+ my $ind1 = _default_ind_to_space($indicator1);
+ my $ind2;
+ if ( @$indicator[$j] ) {
+ $ind2 = _default_ind_to_space($indicator2);
+ }
+ else {
+ warn "Indicator in @$tags[$i] is empty";
+ $ind2 = " ";
+ }
if ( !$first ) {
$xml .= "</datafield>\n";
if ( ( @$tags[$i] && @$tags[$i] > 10 )
&& ( @$values[$i] ne "" ) )
{
- my $ind1 = _default_ind_to_space(substr( @$indicator[$j], 0, 1 ));
- my $ind2;
- if ( @$indicator[$j] ) {
- $ind2 = _default_ind_to_space(substr( @$indicator[$j], 1, 1 ));
- }
- else {
- warn "Indicator in @$tags[$i] is empty";
- $ind2 = " ";
- }
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
$first = 0;
$first = 1;
}
else {
- my $ind1 = _default_ind_to_space( substr( @$indicator[$j], 0, 1 ) );
- my $ind2 = _default_ind_to_space( substr( @$indicator[$j], 1, 1 ) );
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
$first = 0;
}
}
else { # @$tags[$i] eq $prevtag
- if ( @$values[$i] eq "" ) {
+ my $indicator1=eval{substr( @$indicator[$j], 0, 1 )};
+ my $indicator2=eval{substr( @$indicator[$j], 1, 1 )};
+ my $ind1 = _default_ind_to_space($indicator1);
+ my $ind2;
+ if ( @$indicator[$j] ) {
+ $ind2 = _default_ind_to_space($indicator2);
+ }
+ else {
+ warn "Indicator in @$tags[$i] is empty";
+ $ind2 = " ";
+ }
+ if ( @$values[$i] eq "" ) {
}
else {
if ($first) {
- my $ind1 = _default_ind_to_space( substr( @$indicator[$j], 0, 1 ) );
- my $ind2 = _default_ind_to_space( substr( @$indicator[$j], 1, 1 ) );
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
$first = 0;
}
&GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
my $tagslib = &GetMarcStructure( 1, $frameworkcode );
my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum) if ($itemnum);
+ # FIXME : I'd rather have GetMarcBiblio called out of this.
+ # Since it gets the whole Biblio record for each item
+ my $marcrecord = GetMarcBiblio( $bibnum) if ($bibnum);
my @loop_data;
my $authorised_values_sth =
$dbh->prepare(
substr( C4::Context->preference('itemcallnumber'), 0, 3 );
my $CNsubfield =
substr( C4::Context->preference('itemcallnumber'), 3, 1 );
- my $temp = $itemrecord->field($CNtag) if ($itemrecord);
+ my $temp = $marcrecord->field($CNtag) if ($marcrecord);
if ($temp) {
$value = $temp->subfield($CNsubfield);
}