&PrepHostMarcField
&CountItemsIssued
+ &CountBiblioInOrders
+ &GetSubscriptionsId
+ &GetHolds
);
# To modify something
=head2 DelBiblio
- my $error = &DelBiblio($dbh,$biblionumber);
+ my $error = &DelBiblio($biblionumber);
Exported function (core API) for deleting a biblio in koha.
Deletes biblio record from Zebra and Koha tables (biblio,biblioitems,items)
$bkup_sth->finish;
# delete the biblio
- my $del_sth = $dbh->prepare("DELETE FROM biblio WHERE biblionumber=?");
- $del_sth->execute($biblionumber);
- $del_sth->finish;
+ my $sth2 = $dbh->prepare("DELETE FROM biblio WHERE biblionumber=?");
+ $sth2->execute($biblionumber);
+ # update the timestamp (Bugzilla 7146)
+ $sth2= $dbh->prepare("UPDATE deletedbiblio SET timestamp=NOW() WHERE biblionumber=?");
+ $sth2->execute($biblionumber);
+ $sth2->finish;
}
$sth->finish;
return undef;
$bkup_sth->finish;
# delete the biblioitem
- my $del_sth = $dbh->prepare("DELETE FROM biblioitems WHERE biblioitemnumber=?");
- $del_sth->execute($biblioitemnumber);
- $del_sth->finish;
+ my $sth2 = $dbh->prepare("DELETE FROM biblioitems WHERE biblioitemnumber=?");
+ $sth2->execute($biblioitemnumber);
+ # update the timestamp (Bugzilla 7146)
+ $sth2= $dbh->prepare("UPDATE deletedbiblioitems SET timestamp=NOW() WHERE biblioitemnumber=?");
+ $sth2->execute($biblioitemnumber);
+ $sth2->finish;
}
$sth->finish;
return undef;
return $authorised_values;
}
+=head2 CountBiblioInOrders
+
+=over 4
+$count = &CountBiblioInOrders( $biblionumber);
+
+=back
+
+This function return count of biblios in orders with $biblionumber
+
+=cut
+
+sub CountBiblioInOrders {
+ my ($biblionumber) = @_;
+ my $dbh = C4::Context->dbh;
+ my $query = "SELECT count(*)
+ FROM aqorders
+ WHERE biblionumber=? AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($biblionumber);
+ my $count = $sth->fetchrow;
+ return ($count);
+}
+
+=head2 GetSubscriptionsId
+
+=over 4
+$subscriptions = &GetSubscriptionsId($biblionumber);
+
+=back
+
+This function return an array of subscriptionid with $biblionumber
+
+=cut
+
+sub GetSubscriptionsId {
+ my ($biblionumber) = @_;
+ my $dbh = C4::Context->dbh;
+ my $query = "SELECT subscriptionid
+ FROM subscription
+ WHERE biblionumber=?";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($biblionumber);
+ my @subscriptions = $sth->fetchrow_array;
+ return (@subscriptions);
+}
+
+=head2 GetHolds
+
+=over 4
+$holds = &GetHolds($biblionumber);
+
+=back
+
+This function return the count of holds with $biblionumber
+
+=cut
+
+sub GetHolds {
+ my ($biblionumber) = @_;
+ my $dbh = C4::Context->dbh;
+ my $query = "SELECT count(*)
+ FROM reserves
+ WHERE biblionumber=?";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($biblionumber);
+ my $holds = $sth->fetchrow;
+ return ($holds);
+}
+
+
1;
__END__