[Koha-devel] Deleting Orders

Colin Campbell colin.campbell at ptfs-europe.com
Fri Nov 26 12:06:30 CET 2010


Hi,
  I'm just looking at the branch of acquisitions fixes from Biblibre one
fix in there is an addition to DelOrder to delete any items associated
with the order on its deletion. However it goes further and deletes the
associated bib record if it has no items. thus:
> diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
> index c1b837b..54b01fa 100644
> --- a/C4/Acquisition.pm
> +++ b/C4/Acquisition.pm
> @@ -28,6 +28,7 @@ use C4::Suggestions;
>  use C4::Biblio;
>  use C4::Debug;
>  use C4::SQLHelper qw(InsertInTable);
> +use C4::Items;
>  
>  use Time::localtime;
>  use HTML::Entities;
> @@ -1219,6 +1220,10 @@ sub DelOrder {
>      my $sth = $dbh->prepare($query);
>      $sth->execute( $bibnum, $ordernumber );
>      $sth->finish;
> +
> +    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
> +    C4::Items::DelItem( $dbh, $bibnum, $_ ) for @itemnumbers;
> +    DelBiblio( $dbh, $bibnum ) if C4::Items::GetItemsCount( $bibnum ) == 0;
>  }
My gut feeling is that deleting the biblio automatically at this point
is not a good idea but I thought I'd throw it open for comments.
Cheers
Colin

-- 
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 208 366 1295 (phone)
+44 (0) 7759 633626  (mobile)
colin.campbell at ptfs-europe.com
skype: colin_campbell2

http://www.ptfs-europe.com


More information about the Koha-devel mailing list