Bugzilla – Attachment 31894 Details for
Bug 6279
Can't delete lists from the second page of lists in the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6279: Follow-up for pagination and confirm
Bug-6279-Follow-up-for-pagination-and-confirm.patch (text/plain), 12.67 KB, created by
Jonathan Druart
on 2014-09-26 10:49:09 UTC
(
hide
)
Description:
Bug 6279: Follow-up for pagination and confirm
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-09-26 10:49:09 UTC
Size:
12.67 KB
patch
obsolete
>From 9a0378b51f6021ed4e19f52461c78b83b14a4cb5 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 26 Sep 2014 12:08:36 +0200 >Subject: [PATCH] Bug 6279: Follow-up for pagination and confirm > >This follow-up patch restores the pagination and removes the Confirm >buttons. This is not really needed since you already confirmed a >javascript messagebox. >The code needs refactoring. This is a quick fix. > >Test plan: >Delete lists from the second page (from list view and detail view) in both >OPAC and staff. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/VirtualShelves/Page.pm | 26 +++++++++------------- > .../prog/en/modules/virtualshelves/shelves.tt | 24 +++----------------- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 22 +++++------------- > 3 files changed, 18 insertions(+), 54 deletions(-) > >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index fa0ded0..066704a 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -379,20 +379,7 @@ sub shelfpage { > } > my $contents; > ( $contents, $totshelves ) = GetShelfContents( $number, $shelveslimit, $shelvesoffset ); >- if ( $totshelves > 0 ) { >- unless ( scalar grep { /^CONFIRM-$number$/ } $query->param() ) { >- if ( defined $shelflist->{$number} ) { >- push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $totshelves, single => ($totshelves eq 1 ? 1:0) } ); >- $shelflist->{$number}->{confirm} = $number; >- } else { >- push( @paramsloop, { need_confirm => $privshelflist->{$number}->{shelfname}, count => $totshelves } ); >- $privshelflist->{$number}->{confirm} = $number; >- } >- $stay = 0; >- next; >- } >- } >- my $name; >+ my $name=$number; > if ( defined $shelflist->{$number} ) { > $name = $shelflist->{$number}->{'shelfname'}; > delete $shelflist->{$number}; >@@ -423,8 +410,15 @@ sub shelfpage { > my @shelveslooppriv; > my $numberCanManage = 0; > >- # rebuild shelflist in case a shelf has been added >- ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ) unless $delflag; >+ # rebuild shelflist >+ ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ); >+ if( $shelvesoffset > 0 && !keys %$shelflist ) { >+ #retry if we deleted the last list of the page >+ $shelfoff--; >+ $shelvesoffset-= $shelflimit; >+ $template->param( shelfoff => $shelfoff ); >+ ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ); >+ } > foreach my $element ( sort { lc( $shelflist->{$a}->{'shelfname'} ) cmp lc( $shelflist->{$b}->{'shelfname'} ) } keys %$shelflist ) { > my %line; > $shelflist->{$element}->{shelf} = $element; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 97e47a7..c6d851a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -91,7 +91,7 @@ $(document).ready(function(){ > > function confirmDelete(message){ > if (window.confirm(message)) { >- location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1&shelfoff=[% shelfoff %]"; >+ location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1&CONFIRM-[% shelfnumber %]&shelfoff=[% shelfoff %]"; > } else { > return false; > } >@@ -232,16 +232,6 @@ function placeHold () { > [% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %] > [% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] > [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No list number given.</div>[% END %] >- [% IF ( paramsloo.need_confirm ) %] >- <div class="dialog alert">The list <i>[% paramsloo.need_confirm %]</i> is not empty. >- [% IF ( paramsloo.single ) %] >- <br />It has <b>[% paramsloo.count %]</b> entry. >- [% ELSE %] >- <br />It has <b>[% paramsloo.count %]</b> entries. >- [% END %] >- <br />Use the "Confirm" button below to confirm deletion. >- </div> >- [% END %] > [% IF ( paramsloo.nopermission ) %] > <div class="dialog alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission %].</div> > [% END %] >@@ -562,12 +552,8 @@ function placeHold () { > <input type="hidden" name="shelves" value="1" /> > <input type="hidden" name="display" value="privateshelves" /> > <input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" /> >- [% IF ( shelveslooppri.confirm ) %] >- <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" /> >- <input type="submit" class="approve" value="Confirm" /> >- [% ELSE %] >+ <input type="hidden" name="CONFIRM-[% shelveslooppri.shelf %]" value="1" /> > <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" /> >- [% END %] > </form> > [% ELSE %] > None >@@ -610,12 +596,8 @@ function placeHold () { > <input type="hidden" name="shelfoff" value="[% shelfoff %]" /> > <input type="hidden" name="shelves" value="1" /> > <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" /> >- [% IF ( shelvesloo.confirm ) %] >- <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" /> >- <input type="submit" class="approve" value="Confirm" /> >- [% ELSE %] >+ <input type="hidden" name="CONFIRM-[% shelvesloo.shelf %]" value="1" /> > <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" /> >- [% END %] > </form> > [% ELSE %] > None >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 67322ed..f8fbe3c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -113,13 +113,6 @@ > [% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %] > [% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %] > [% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %] >- [% IF ( paramsloo.need_confirm ) %] >- <div class="alert"> >- The list <i>[% paramsloo.need_confirm %]</i> is not empty. >- <br />It has <b>[% paramsloo.count %]</b> [% IF ( paramsloo.single ) %]entry[% ELSE %]entries[% END %]. >- <br />Use the "Confirm" button below to confirm deletion. >- </div> >- [% END %] > [% IF ( paramsloo.nopermission ) %] > <div class="alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission |html%].</div> > [% END %] >@@ -493,6 +486,7 @@ > <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline"> > <input type="hidden" value="1" name="shelves"/> > <input type="hidden" value="1" name="DEL-[% shelfnumber %]"/> >+ <input type="hidden" value="1" name="CONFIRM-[% shelfnumber %]"/> > [% IF ( showprivateshelves ) %] > <input type="hidden" name="display" value="privateshelves"/> > [% END %] >@@ -519,6 +513,7 @@ > [% ELSIF ( !itemsloop && manageshelf ) %] > <form method="post" action="opac-shelves.pl"> > <input type="hidden" name="DEL-[% shelfnumber %]" value="1" /> >+ <input type="hidden" name="CONFIRM-[% shelfnumber %]" value="1" /> > <input type="hidden" name="shelves" value="1" /> > <input type="hidden" name="shelfoff" value="[% shelfoff %]" /> > <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" /> >@@ -654,13 +649,9 @@ > <input type="hidden" name="shelves" value="1" /> > <input type="hidden" name="display" value="privateshelves" /> > <input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" /> >+ <input type="hidden" name="CONFIRM-[% shelveslooppri.shelf %]" value="1" /> > <input type="hidden" name="shelfoff" value="[% shelfoff %]" /> >- [% IF ( shelveslooppri.confirm ) %] >- <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" /> >- <input type="submit" class="btn btn-danger confirm" value="Confirm" /> >- [% ELSE %] > <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" /> >- [% END %] > </form> > [% IF Koha.Preference('OpacAllowSharingPrivateLists') %] > <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelveslooppri.shelf %]" class="">Share</a> >@@ -726,13 +717,10 @@ > </form> > <form action="opac-shelves.pl" method="post" class="form-inline"> > <input type="hidden" name="shelves" value="1" /> >+ <input type="hidden" name="shelfoff" value="[% shelfoff %]" /> > <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" /> >- [% IF ( shelvesloo.confirm ) %] >- <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" /> >- <input type="submit" class="btn btn-danger confirm" value="Confirm" /> >- [% ELSE %] >+ <input type="hidden" name="CONFIRM-[% shelvesloo.shelf %]" value="1" /> > <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" /> >- [% END %] > </form> > [% END %] > </td> >-- >2.1.0
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 6279
:
15627
|
31883
|
31892
|
31893
|
31894
|
31898
|
31899