use strict;
require Exporter;
-use utf8;
+# use utf8;
use C4::Context;
use MARC::Record;
use MARC::File::USMARC;
&GetMarcBiblio
&GetMarcAuthors
&GetMarcSeries
+ GetMarcUrls
&GetUsedMarcStructure
&GetItemsInfo
+ &GetItemsByBiblioitemnumber
&GetItemnumberFromBarcode
&get_itemnumbers_of
&GetXmlBiblio
# get the items before and append them to the biblio before updating the record, atm we just have the biblio
my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",$frameworkcode);
my $oldRecord = GetMarcBiblio( $biblionumber );
- #$oldRecord->encoding('UTF-8');
- my @fields = $oldRecord->field( $itemtag );
- foreach (@fields){
- if ( !utf8::is_utf8( $_ ) ) {
- utf8::decode( $_ );
- }
+ # parse each item, and, for an unknown reason, re-encode each subfield
+ # if you don't do that, the record will have encoding mixed
+ # and the biblio will be re-encoded.
+ # strange, I (Paul P.) searched more than 1 day to understand what happends
+ # but could only solve the problem this way...
+ my @fields = $oldRecord->field( $itemtag );
+ foreach my $fielditem ( @fields ){
+ my $field;
+ foreach ($fielditem->subfields()) {
+ if ($field) {
+ $field->add_subfields(Encode::encode('utf-8',$_->[0]) => Encode::encode('utf-8',$_->[1]));
+ } else {
+ $field = MARC::Field->new("$itemtag",'','',Encode::encode('utf-8',$_->[0]) => Encode::encode('utf-8',$_->[1]));
+ }
+ }
+ $record->append_fields($field);
}
- $record->append_fields( @fields ); # FIXME : encoding error...
# adding biblionumber
my ($tag_biblionumber, $subfield_biblionumber) = GetMarcFromKohaField('biblio.biblionumber',$frameworkcode);
$record->append_fields(
- MARC::Field->new(
- $tag_biblionumber,'','',$subfield_biblionumber => $biblionumber
- )
- );
+ MARC::Field->new(
+ $tag_biblionumber,'','',$subfield_biblionumber => $biblionumber
+ )
+ ) unless ($record->subfield($tag_biblionumber,$subfield_biblionumber));
# update the MARC record (that now contains biblio and items) with the new record data
&ModBiblioMarc( $record, $biblionumber, $frameworkcode );
return;
}
-##New sub to dotransfer in marc tables as well. Not exported -TG 10/04/2006
-# sub domarctransfer {
-# my ( $dbh, $itemnumber ) = @_;
-# $itemnumber =~ s /\'//g; ##itemnumber seems to come with quotes-TG
-# my $sth =
-# $dbh->prepare(
-# "select biblionumber,holdingbranch from items where itemnumber=$itemnumber"
-# );
-# $sth->execute();
-# while ( my ( $biblionumber, $holdingbranch ) = $sth->fetchrow ) {
-# &ModItemInMarconefield( $biblionumber, $itemnumber,
-# 'items.holdingbranch', $holdingbranch );
-# }
-# return;
-# }
-
=head2 ModBiblioframework
ModBiblioframework($biblionumber,$frameworkcode);
my ( $biblionumber ) = @_;
my $dbh = C4::Context->dbh;
my $error; # for error handling
+
+ # First make sure this biblio has no items attached
+ my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber=?");
+ $sth->execute($biblionumber);
+ if (my $itemnumber = $sth->fetchrow){
+ # Fix this to use a status the template can understand
+ $error .= "This Biblio has items attached, please delete them first before deleting this biblio ";
+ }
- # First make sure there are no items with issues are still attached
- my $sth =
- $dbh->prepare(
- "SELECT itemnumber FROM items WHERE biblionumber=?");
- $sth->execute($biblionumber);
- while ( my $itemnumber = $sth->fetchrow ) {
- my $issues = GetItemIssues($itemnumber);
- foreach my $issue (@$issues) {
- if ( ( $issue->{date_due} )
- && ( $issue->{date_due} ne "Available" ) )
- {
-
-#FIXME: we need a status system in Biblio like in Circ to return standard codes and messages
-# instead of hard-coded strings
- $error .=
-"Item is checked out to a patron -- you must return it before deleting the Biblio";
- }
- }
- }
return $error if $error;
# Delete in Zebra. Be careful NOT to move this line after _koha_delete_biblio
# delete this biblioitem
$error = &_koha_delete_biblioitems( $dbh, $biblioitemnumber );
return $error if $error;
-
- # delete items
- my $items_sth =
- $dbh->prepare(
- "SELECT itemnumber FROM items WHERE biblioitemnumber=?");
- $items_sth->execute($biblioitemnumber);
- while ( my $itemnumber = $items_sth->fetchrow ) {
- $error = &_koha_delete_item( $dbh, $itemnumber );
- return $error if $error;
- }
}
&logaction(C4::Context->userenv->{'number'},"CATALOGUING","DELETE",$biblionumber,"")
if C4::Context->preference("CataloguingLog");
sub DelItem {
my ( $biblionumber, $itemnumber ) = @_;
my $dbh = C4::Context->dbh;
+
+ # check the item has no current issues
+
+
&_koha_delete_item( $dbh, $itemnumber );
# get the MARC record
my $record = GetMarcBiblio($biblionumber);
my $dbh = C4::Context->dbh;
my $query = "
- SELECT * , biblioitems.notes AS bnotes, biblio.notes
+ SELECT * , biblioitems.notes AS bnotes, itemtypes.notforloan as bi_notforloan, biblio.notes
FROM biblio
LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber
LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
my ( $biblionumber, $type ) = @_;
my $dbh = C4::Context->dbh;
my $query = "SELECT *,items.notforloan as itemnotforloan
- FROM items, biblio, biblioitems
+ FROM items
+ LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+ LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
LEFT JOIN itemtypes on biblioitems.itemtype = itemtypes.itemtype
WHERE items.biblionumber = ?
- AND biblioitems.biblioitemnumber = items.biblioitemnumber
- AND biblio.biblionumber = items.biblionumber
ORDER BY items.dateaccessioned desc
";
my $sth = $dbh->prepare($query);
while ( my $data = $sth->fetchrow_hashref ) {
my $datedue = '';
my $isth = $dbh->prepare(
- "SELECT issues.*,borrowers.cardnumber
- FROM issues, borrowers
+ "SELECT issues.*,borrowers.cardnumber,borrowers.surname,borrowers.firstname
+ FROM issues LEFT JOIN borrowers ON issues.borrowernumber=borrowers.borrowernumber
WHERE itemnumber = ?
- AND returndate IS NULL
- AND issues.borrowernumber=borrowers.borrowernumber"
+ AND returndate IS NULL"
);
$isth->execute( $data->{'itemnumber'} );
if ( my $idata = $isth->fetchrow_hashref ) {
$data->{borrowernumber} = $idata->{borrowernumber};
$data->{cardnumber} = $idata->{cardnumber};
+ $data->{surname} = $idata->{surname};
+ $data->{firstname} = $idata->{firstname};
$datedue = format_date( $idata->{'date_due'} );
}
if ( $datedue eq '' ) {
#'
sub GetBiblioItemData {
- my ($bibitem) = @_;
+ my ($biblioitemnumber) = @_;
my $dbh = C4::Context->dbh;
my $sth =
$dbh->prepare(
-"Select *,biblioitems.notes as bnotes from biblioitems, biblio,itemtypes where biblio.biblionumber = biblioitems.biblionumber and biblioitemnumber = ? and biblioitems.itemtype = itemtypes.itemtype"
+ "SELECT *,biblioitems.notes AS bnotes
+ FROM biblioitems,biblio,itemtypes
+ WHERE biblio.biblionumber = biblioitems.biblionumber
+ AND biblioitemnumber = ? "
);
my $data;
-
- $sth->execute($bibitem);
-
+ $sth->execute($biblioitemnumber);
$data = $sth->fetchrow_hashref;
-
$sth->finish;
return ($data);
} # sub &GetBiblioItemData
my ( $itemnumber ) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
- "SELECT * FROM biblio,items,biblioitems
- WHERE items.itemnumber = ?
- AND biblio.biblionumber = items.biblionumber
- AND biblioitems.biblioitemnumber = items.biblioitemnumber"
+ "SELECT * FROM items
+ LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+ LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
+ WHERE items.itemnumber = ?"
);
$sth->execute($itemnumber);
return get_infos_of( $query, 'itemnumber' );
}
+=head2 GetItemsByBiblioitemnumber
+
+=over 4
+
+GetItemsByBiblioitemnumber($biblioitemnumber);
+
+Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP
+Called by moredetail.pl
+
+=back
+
+=cut
+
+sub GetItemsByBiblioitemnumber {
+ my ( $bibitem ) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("SELECT * FROM items WHERE items.biblioitemnumber = ?") || die $dbh->errstr;
+ # Get all items attached to a biblioitem
+ my $i = 0;
+ my @results;
+ $sth->execute($bibitem) || die $sth->errstr;
+ while ( my $data = $sth->fetchrow_hashref ) {
+ # Foreach item, get circulation information
+ my $sth2 = $dbh->prepare( "SELECT * FROM issues,borrowers
+ WHERE itemnumber = ?
+ AND returndate is NULL
+ AND issues.borrowernumber = borrowers.borrowernumber"
+ );
+ $sth2->execute( $data->{'itemnumber'} );
+ if ( my $data2 = $sth2->fetchrow_hashref ) {
+ # if item is out, set the due date and who it is out too
+ $data->{'date_due'} = $data2->{'date_due'};
+ $data->{'cardnumber'} = $data2->{'cardnumber'};
+ $data->{'borrowernumber'} = $data2->{'borrowernumber'};
+ }
+ else {
+ # set date_due to blank, so in the template we check itemlost, and wthdrawn
+ $data->{'date_due'} = '';
+ } # else
+ $sth2->finish;
+ # Find the last 3 people who borrowed this item.
+ my $query2 = "SELECT * FROM issues, borrowers WHERE itemnumber = ?
+ AND issues.borrowernumber = borrowers.borrowernumber
+ AND returndate is not NULL
+ ORDER BY returndate desc,timestamp desc LIMIT 3";
+ $sth2 = $dbh->prepare($query2) || die $dbh->errstr;
+ $sth2->execute( $data->{'itemnumber'} ) || die $sth2->errstr;
+ my $i2 = 0;
+ while ( my $data2 = $sth2->fetchrow_hashref ) {
+ $data->{"timestamp$i2"} = $data2->{'timestamp'};
+ $data->{"card$i2"} = $data2->{'cardnumber'};
+ $data->{"borrower$i2"} = $data2->{'borrowernumber'};
+ $i2++;
+ }
+ $sth2->finish;
+ push(@results,$data);
+ }
+ $sth->finish;
+ return (\@results);
+}
+
+
=head2 GetBiblioItemInfosOf
=over 4
$marcxml =~ s/\x1f//g;
$marcxml =~ s/\x1d//g;
$marcxml =~ s/\x0f//g;
- $marcxml =~ s/\x0c//g;
+ $marcxml =~ s/\x0c//g;
# warn $marcxml;
my $record = MARC::Record->new();
- $record = MARC::Record::new_from_xml( $marcxml, "utf8",C4::Context->preference('marcflavour')) if $marcxml;
+
+ $record = eval {MARC::Record::new_from_xml( $marcxml, "utf8",C4::Context->preference('marcflavour'))} if ($marcxml);
+ if ($@) {warn $@;}
# $record = MARC::Record::new_from_usmarc( $marc) if $marc;
return $record;
}
sub GetMarcAuthors {
my ( $record, $marcflavour ) = @_;
my ( $mintag, $maxtag );
+ # tagslib useful for UNIMARC author reponsabilities
+ my $tagslib = &GetMarcStructure( 1, '' ); # FIXME : we don't have the framework available, we take the default framework. May be bugguy on some setups, will be usually correct.
if ( $marcflavour eq "MARC21" ) {
$mintag = "100";
$maxtag = "111";
$marcflavour ne 'MARC21'
and (
($authors_subfield->[0] eq '3') or
- ($authors_subfield->[0] eq '4') or
($authors_subfield->[0] eq '5')
)
)
}
$count_auth++;
my $subfieldcode = $authors_subfield->[0];
- my $value = $authors_subfield->[1];
+ my $value;
+ # deal with UNIMARC author responsibility
+ if (
+ $marcflavour ne 'MARC21'
+ and ($authors_subfield->[0] eq '4')
+ )
+ {
+ $value = "(".GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib ).")";
+ } else {
+ $value = $authors_subfield->[1];
+ }
$hash{tag} = $field->tag;
$hash{value} .= $value . " " if ($subfieldcode != 9) ;
$hash{link} .= $value if ($subfieldcode eq 9);
return \@marcauthors;
}
+=head2 GetMarcUrls
+
+=over 4
+
+$marcurls = GetMarcUrls($record,$marcflavour);
+Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop.
+Assumes web resources (not uncommon in MARC21 to omit resource type ind)
+
+=back
+
+=cut
+
+sub GetMarcUrls {
+ my ($record, $marcflavour) = @_;
+ my @marcurls;
+ my $marcurl;
+ for my $field ($record->field('856')) {
+ my $url = $field->subfield('u');
+ my @notes;
+ for my $note ( $field->subfield('z')) {
+ push @notes , {note => $note};
+ }
+ $marcurl = { MARCURL => $url,
+ notes => \@notes,
+ };
+ if($marcflavour eq 'MARC21') {
+ my $s3 = $field->subfield('3');
+ my $link = $field->subfield('y');
+ $marcurl->{'linktext'} = $link || $s3 || $url ;;
+ $marcurl->{'part'} = $s3 if($link);
+ $marcurl->{'toc'} = 1 if($s3 =~ /^[Tt]able/) ;
+ } else {
+ $marcurl->{'linktext'} = $url;
+ }
+ push @marcurls, $marcurl;
+ }
+ return \@marcurls;
+} #end GetMarcUrls
+
=head2 GetMarcSeries
=over 4
-$marcseriessarray = GetMarcSeries($record,$marcflavour);
+$marcseriesarray = GetMarcSeries($record,$marcflavour);
Get all series from the MARC record and returns them in an array.
The series are stored in differents places depending on MARC flavour
my $record = MARC::Record->new();
my $i=0;
my @fields;
-
while ($params->[$i]){ # browse all CGI params
my $param = $params->[$i];
-
- if($param =~ /^tag_(\d*)_indicator_/){ # new field start when having 'input name="..._indicator_..."
+ my $newfield=0;
+ # if we are on biblionumber, store it in the MARC::Record (it may not be in the edited fields)
+ if ($param eq 'biblionumber') {
+ my ( $biblionumbertagfield, $biblionumbertagsubfield ) =
+ &GetMarcFromKohaField( "biblio.biblionumber", '' );
+ if ($biblionumbertagfield < 10) {
+ $newfield = MARC::Field->new(
+ $biblionumbertagfield,
+ $cgi->param($param),
+ );
+ } else {
+ $newfield = MARC::Field->new(
+ $biblionumbertagfield,
+ '',
+ '',
+ "$biblionumbertagsubfield" => $cgi->param($param),
+ );
+ }
+ push @fields,$newfield if($newfield);
+ }
+ elsif ($param =~ /^tag_(\d*)_indicator_/){ # new field start when having 'input name="..._indicator_..."
my $tag = $1;
my $ind1 = substr($cgi->param($param),0,1);
my $ind2 = substr($cgi->param($param),1,1);
-
- my $newfield=0;
+ $newfield=0;
my $j=$i+1;
if($tag < 10){ # no code for theses fields
- my $inner_param = $params->[$j];
- $newfield = MARC::Field->new(
- $tag,
- $cgi->param($params->[$j+1]),
- );
+ # in MARC editor, 000 contains the leader.
+ if ($tag eq '000' ) {
+ $record->leader($cgi->param($params->[$j+1])) if length($cgi->param($params->[$j+1]))==24;
+ # between 001 and 009 (included)
+ } else {
+ $newfield = MARC::Field->new(
+ $tag,
+ $cgi->param($params->[$j+1]),
+ );
+ }
+ # > 009, deal with subfields
} else {
while($params->[$j] =~ /_code_/){ # browse all it's subfield
my $inner_param = $params->[$j];
&TransformMarcToKohaOneField( "biblio", $field, $record, $result,
$frameworkcode );
}
+ my $sth2 = $dbh->prepare("SHOW COLUMNS from biblioitems");
$sth2->execute;
while ( ($field) = $sth2->fetchrow ) {
if ( $field eq 'notes' ) { $field = 'bnotes'; }
next unless $_; # skip empty values (multiple spaces)
# if the entry is already here, improve weight
# warn "managing $_";
- if ($result{$key}->{$_} =~ /$biblionumber,$title\-(\d);/) {
+ if ($result{$key}->{"$_"} =~ /$biblionumber,$title\-(\d);/) {
my $weight=$1+1;
- $result{$key}->{$_} =~ s/$biblionumber,$title\-(\d);//;
- $result{$key}->{$_} .= "$biblionumber,$title-$weight;";
+ $result{$key}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
+ $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
} else {
# get the value if it exist in the nozebra table, otherwise, create it
$sth2->execute($server,$key,$_);
my $existing_biblionumbers = $sth2->fetchrow;
# it exists
if ($existing_biblionumbers) {
- $result{$key}->{$_} =$existing_biblionumbers;
+ $result{$key}->{"$_"} =$existing_biblionumbers;
my $weight=$1+1;
- $result{$key}->{$_} =~ s/$biblionumber,$title\-(\d);//;
- $result{$key}->{$_} .= "$biblionumber,$title-$weight;";
+ $result{$key}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
+ $result{$key}->{"$_"} .= "$biblionumber,$title-$weight;";
# create a new ligne for this entry
} else {
# warn "INSERT : $server / $key / $_";
$dbh->do('INSERT INTO nozebra SET server='.$dbh->quote($server).', indexname='.$dbh->quote($key).',value='.$dbh->quote($_));
- $result{$key}->{$_}.="$biblionumber,$title-1;";
+ $result{$key}->{"$_"}.="$biblionumber,$title-1;";
}
}
}
foreach (split / /,$line) {
next unless $_; # skip empty values (multiple spaces)
# if the entry is already here, improve weight
- if ($result{'__RAW__'}->{$_} =~ /$biblionumber,$title\-(\d);/) {
+ if ($result{'__RAW__'}->{"$_"} =~ /$biblionumber,$title\-(\d);/) {
my $weight=$1+1;
- $result{'__RAW__'}->{$_} =~ s/$biblionumber,$title\-(\d);//;
- $result{'__RAW__'}->{$_} .= "$biblionumber,$title-$weight;";
+ $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
+ $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
} else {
# get the value if it exist in the nozebra table, otherwise, create it
$sth2->execute($server,'__RAW__',$_);
my $existing_biblionumbers = $sth2->fetchrow;
# it exists
if ($existing_biblionumbers) {
- $result{'__RAW__'}->{$_} =$existing_biblionumbers;
+ $result{'__RAW__'}->{"$_"} =$existing_biblionumbers;
my $weight=$1+1;
- $result{'__RAW__'}->{$_} =~ s/$biblionumber,$title\-(\d);//;
- $result{'__RAW__'}->{$_} .= "$biblionumber,$title-$weight;";
+ $result{'__RAW__'}->{"$_"} =~ s/$biblionumber,$title\-(\d);//;
+ $result{'__RAW__'}->{"$_"} .= "$biblionumber,$title-$weight;";
# create a new ligne for this entry
} else {
$dbh->do('INSERT INTO nozebra SET server='.$dbh->quote($server).', indexname="__RAW__",value='.$dbh->quote($_));
- $result{'__RAW__'}->{$_}.="$biblionumber,$title-1;";
+ $result{'__RAW__'}->{"$_"}.="$biblionumber,$title-1;";
}
}
}
$sth->finish;
$sth = $dbh->prepare(
"INSERT INTO biblio
- SET biblionumber = ?, title = ?, author = ?, copyrightdate = ?, serial = ?, seriestitle = ?, notes = ?, abstract = ?, unititle = ?, frameworkcode = ? "
+ SET datecreated=NOW(), biblionumber = ?, title = ?, author = ?, copyrightdate = ?, serial = ?, seriestitle = ?, notes = ?, abstract = ?, unititle = ?, frameworkcode = ? "
);
$sth->execute(
$biblionumber, $biblio->{'title'},
$biblioitem->{'bnotes'} = $dbh->quote( $biblioitem->{'bnotes'} );
$biblioitem->{'size'} = $dbh->quote( $biblioitem->{'size'} );
$biblioitem->{'place'} = $dbh->quote( $biblioitem->{'place'} );
+ $biblioitem->{'collectiontitle'} = $dbh->quote( $biblioitem->{'collectiontitle'} );
+ $biblioitem->{'collectionissn'} = $dbh->quote( $biblioitem->{'collectionissn'} );
+ $biblioitem->{'collectionvolume'} = $dbh->quote( $biblioitem->{'collectionvolume'} );
+ $biblioitem->{'editionstatement'} = $dbh->quote( $biblioitem->{'editionstatement'} );
+ $biblioitem->{'editionresponsibility'} = $dbh->quote( $biblioitem->{'editionresponsibility'} );
$biblioitem->{'ccode'} = $dbh->quote( $biblioitem->{'ccode'} );
$biblioitem->{'biblionumber'} =
$dbh->quote( $biblioitem->{'biblionumber'} );
- $query = "Update biblioitems set
+ $query = "UPDATE biblioitems SET
itemtype = $biblioitem->{'itemtype'},
url = $biblioitem->{'url'},
isbn = $biblioitem->{'isbn'},
notes = $biblioitem->{'bnotes'},
size = $biblioitem->{'size'},
place = $biblioitem->{'place'},
+ collectiontitle = $biblioitem->{'collectiontitle'},
+ collectionissn = $biblioitem->{'collectionissn'},
+ collectionvolume= $biblioitem->{'collectionvolume'},
+ editionstatement= $biblioitem->{'editionstatement'},
+ editionresponsibility= $biblioitem->{'editionresponsibility'},
ccode = $biblioitem->{'ccode'}
where biblionumber = $biblioitem->{'biblionumber'}";
volumeddesc = ?, illus = ?,
pages = ?, notes = ?,
size = ?, lccn = ?,
- marc = ?, lcsort =?,
- place = ?, ccode = ?
+ marc = ?, lcsort = ?,
+ place = ?, ccode = ?,
+ collectiontitle = ?, collectionissn = ?,
+ collectionvolume = ?, editionstatement= ?,
+ editionresponsibility= ?
"
);
my ($lcsort) =
$biblioitem->{'pages'}, $biblioitem->{'bnotes'},
$biblioitem->{'size'}, $biblioitem->{'lccn'},
$biblioitem->{'marc'}, $biblioitem->{'place'},
- $lcsort, $biblioitem->{'ccode'}
+ $lcsort, $biblioitem->{'ccode'},
+ $biblioitem->{'collectiontitle'},$biblioitem->{'collectionissn'},
+ $biblioitem->{'collectionvolume'},$biblioitem->{'editionstatement'},
+ $biblioitem->{'editionresponsibility'}
);
$sth->finish;
return ($bibitemnum);
$sth = $dbh->prepare(
"Insert into items set
itemnumber = ?, biblionumber = ?,
- multivolumepart = ?,
biblioitemnumber = ?, barcode = ?,
booksellerid = ?, dateaccessioned = NOW(),
homebranch = ?, holdingbranch = ?,
price = ?, replacementprice = ?,
replacementpricedate = NOW(), datelastseen = NOW(),
- multivolume = ?, stack = ?,
+ stack = ?,
itemlost = ?, wthdrawn = ?,
paidfor = ?, itemnotes = ?,
itemcallnumber =?, notforloan = ?,
);
$sth->execute(
$itemnumber, $item->{'biblionumber'},
- $item->{'multivolumepart'}, $item->{'biblioitemnumber'},
+ $item->{'biblioitemnumber'},
$barcode, $item->{'booksellerid'},
$item->{'homebranch'}, $item->{'holdingbranch'},
$item->{'price'}, $item->{'replacementprice'},
- $item->{multivolume}, $item->{stack},
+ $item->{stack},
$item->{itemlost}, $item->{wthdrawn},
$item->{paidfor}, $item->{'itemnotes'},
$item->{'itemcallnumber'}, $item->{'notforloan'},
$sth = $dbh->prepare(
"INSERT INTO items SET
itemnumber = ?, biblionumber = ?,
- multivolumepart = ?,
biblioitemnumber = ?, barcode = ?,
booksellerid = ?, dateaccessioned = ?,
homebranch = ?, holdingbranch = ?,
price = ?, replacementprice = ?,
replacementpricedate = NOW(), datelastseen = NOW(),
- multivolume = ?, stack = ?,
+ stack = ?,
itemlost = ?, wthdrawn = ?,
paidfor = ?, itemnotes = ?,
itemcallnumber = ?, notforloan = ?,
);
$sth->execute(
$itemnumber, $item->{'biblionumber'},
- $item->{'multivolumepart'}, $item->{'biblioitemnumber'},
+ $item->{'biblioitemnumber'},
$barcode, $item->{'booksellerid'},
$item->{'dateaccessioned'}, $item->{'homebranch'},
$item->{'holdingbranch'}, $item->{'price'},
- $item->{'replacementprice'}, $item->{multivolume},
+ $item->{'replacementprice'},
$item->{stack}, $item->{itemlost},
$item->{wthdrawn}, $item->{paidfor},
$item->{'itemnotes'}, $item->{'itemcallnumber'},
# if all we're doing is setting statuses, just update those and get out
if ( $op eq "setstatus" ) {
my $query =
- "UPDATE items SET itemlost=?,wthdrawn=?,binding=? WHERE itemnumber=?";
+ "UPDATE items SET itemlost=?,wthdrawn=? WHERE itemnumber=?";
my @bind = (
$item->{'itemlost'}, $item->{'wthdrawn'},
- $item->{'binding'}, $item->{'itemnumber'}
+ $item->{'itemnumber'}
);
my $sth = $dbh->prepare($query);
$sth->execute(@bind);
itemcalculator( $dbh, $item->{'bibitemnum'}, $item->{'itemcallnumber'} );
my $query = "UPDATE items SET
-barcode=?,itemnotes=?,itemcallnumber=?,notforloan=?,location=?,multivolumepart=?,multivolume=?,stack=?,wthdrawn=?,holdingbranch=?,homebranch=?,cutterextra=?, onloan=?, binding=?";
+barcode=?,itemnotes=?,itemcallnumber=?,notforloan=?,location=?,stack=?,wthdrawn=?,holdingbranch=?,homebranch=?,cutterextra=?, onloan=?";
my @bind = (
$item->{'barcode'}, $item->{'notes'},
$item->{'itemcallnumber'}, $item->{'notforloan'},
- $item->{'location'}, $item->{multivolumepart},
- $item->{multivolume}, $item->{stack},
+ $item->{'location'}, $item->{stack},
$item->{wthdrawn}, $item->{holdingbranch},
$item->{homebranch}, $cutterextra,
- $item->{onloan}, $item->{binding}
+ $item->{onloan},
);
if ( $item->{'lost'} ne '' ) {
$query =
"update items set biblioitemnumber=?,barcode=?,itemnotes=?,homebranch=?,
itemlost=?,wthdrawn=?,itemcallnumber=?,notforloan=?,
- location=?,multivolumepart=?,multivolume=?,stack=?,wthdrawn=?,holdingbranch=?,cutterextra=?,onloan=?, binding=?";
+ location=?,stack=?,wthdrawn=?,holdingbranch=?,cutterextra=?,onloan=?";
@bind = (
$item->{'bibitemnum'}, $item->{'barcode'},
$item->{'notes'}, $item->{'homebranch'},
$item->{'lost'}, $item->{'wthdrawn'},
$item->{'itemcallnumber'}, $item->{'notforloan'},
- $item->{'location'}, $item->{multivolumepart},
- $item->{multivolume}, $item->{stack},
+ $item->{'location'}, $item->{stack},
$item->{wthdrawn}, $item->{holdingbranch},
- $cutterextra, $item->{onloan},
- $item->{binding}
+ $cutterextra, $item->{onloan}
);
if ( $item->{homebranch} ) {
$query .= ",homebranch=?";
$sth =
$dbh->prepare(
"update biblioitems set marc=?,marcxml=? where biblionumber=?");
- $sth->execute( $record->as_usmarc(), $record->as_xml_record(),
+ $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding),
$biblionumber );
$sth->finish;
return $biblionumber;