Bugzilla – Attachment 25862 Details for
Bug 9032
Share a list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9032: Consistent behavior when deleting lists
Bug-9032-Consistent-behavior-when-deleting-lists.patch (text/plain), 3.78 KB, created by
Marcel de Rooy
on 2014-03-05 15:55:39 UTC
(
hide
)
Description:
Bug 9032: Consistent behavior when deleting lists
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-03-05 15:55:39 UTC
Size:
3.78 KB
patch
obsolete
>From 83b42483e1294cd4dbbabb01b0295764d9949d13 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 5 Mar 2014 16:26:40 +0100 >Subject: [PATCH] Bug 9032: Consistent behavior when deleting lists >Content-Type: text/plain; charset=utf-8 > >DelShelf deletes a list regardless whether it is private, shared or >public. HandleDelBorrower had another approach, trying to save shared >and public lists by setting the owner to NULL. >This patch makes both routines behave consistent. >A new report 11889 has been opened to discuss the 'disowning' feature. > >Test plan: >Create a list P1 with user1 that allows adding by other users. >Add a patron (user2). >Login as user2 and create some lists, add some items. >Let user2 add some entries to P1 too. >Delete patron user2. >Verify that his lists are gone, but his entries in P1 are kept (nullified). >--- > C4/VirtualShelves.pm | 41 ++++++++++++++++------------------------- > 1 files changed, 16 insertions(+), 25 deletions(-) > >diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm >index a43bbf7..f5a6758 100644 >--- a/C4/VirtualShelves.pm >+++ b/C4/VirtualShelves.pm >@@ -631,8 +631,8 @@ sub ShelvesMax { > > When a member is deleted (DelMember in Members.pm), you should call me first. > This routine deletes/moves lists and entries for the deleted member/borrower. >-You could just delete everything (and lose more than you want), but instead we >-now try to save all public/shared stuff and keep others happy. >+Lists owned by the borrower are deleted, but entries from the borrower to >+other lists are kept. > > =cut > >@@ -641,31 +641,22 @@ sub HandleDelBorrower { > my $query; > my $dbh = C4::Context->dbh; > >- #Delete shares of this borrower (not lists !) >- #Although this would be done later via the FK cascaded delete, we do it now. >- #Because it makes the following delete statement on shelves more meaningful. >- $query="DELETE FROM virtualshelfshares WHERE borrowernumber=?"; >+ #Delete all lists and all shares of this borrower >+ #Consistent with the approach Koha uses on deleting individual lists >+ #Note that entries in virtualshelfcontents added by this borrower to >+ #lists of others will be handled by a table constraint: the borrower >+ #is set to NULL in those entries. >+ $query="DELETE FROM virtualshelves WHERE owner=?"; > $dbh->do($query,undef,($borrower)); > >- #Delete private lists without owner that now have no shares anymore >- $query="DELETE vs.* FROM virtualshelves vs LEFT JOIN virtualshelfshares sh USING (shelfnumber) WHERE category=1 AND vs.owner IS NULL AND sh.shelfnumber IS NULL"; >- $dbh->do($query); >- >- #Change owner for private lists which have shares >- $query="UPDATE virtualshelves LEFT JOIN virtualshelfshares sh USING (shelfnumber) SET owner=NULL where owner=? AND category=1 AND sh.borrowernumber IS NOT NULL"; >- $dbh->do($query,undef,($borrower)); >- >- #Delete unshared private lists >- $query="DELETE FROM virtualshelves WHERE owner=? AND category=1"; >- $dbh->do($query,undef,($borrower)); >- >- #Handle public lists owned by borrower >- $query="UPDATE virtualshelves SET owner=NULL WHERE owner=? AND category=2"; >- $dbh->do($query,undef,($borrower)); >- >- #Handle entries added by borrower to lists of others >- $query="UPDATE virtualshelfcontents SET borrowernumber=NULL WHERE borrowernumber=?"; >- $dbh->do($query,undef,($borrower)); >+ #NOTE: >+ #We could handle the above deletes via a constraint too. >+ #But a new BZ report 11889 has been opened to discuss another approach. >+ #Instead of deleting we could also disown lists (based on a pref). >+ #In that way we could save shared and public lists. >+ #The current table constraints support that idea now. >+ #This pref should then govern the results of other routines such as >+ #DelShelf too. > } > > =head2 AddShare >-- >1.7.7.6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9032
:
18260
|
18542
|
18543
|
18546
|
18547
|
18587
|
18619
|
18682
|
18692
|
19377
|
19378
|
19379
|
19394
|
19934
|
19935
|
25847
|
25848
|
25849
|
25850
|
25851
|
25852
|
25853
|
25862
|
25886
|
25893
|
26253
|
26291
|
26292
|
26293
|
26294
|
26295
|
26296
|
26297
|
26298
|
26299
|
26300
|
26302
|
26303
|
26351
|
26458
|
26509
|
26513
|
26577
|
26578
|
26579
|
26580
|
26581
|
26582
|
26583
|
26584
|
26585
|
26586
|
26587
|
26588