Bugzilla – Attachment 163434 Details for
Bug 31791
Add the ability to lock records to prevent modification through the Koha staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31791: Remove CanBeEdited template helper
Bug-31791-Remove-CanBeEdited-template-helper.patch (text/plain), 4.37 KB, created by
Martin Renvoize (ashimema)
on 2024-03-19 14:13:44 UTC
(
hide
)
Description:
Bug 31791: Remove CanBeEdited template helper
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-03-19 14:13:44 UTC
Size:
4.37 KB
patch
obsolete
>From 861f9b5dea08fce24d4434cc81a2d1c9d709be56 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 19 Mar 2024 14:08:48 +0000 >Subject: [PATCH] Bug 31791: Remove CanBeEdited template helper > >We've opted to rely on the objects directly in templates whenever we can >now. As such, I opt to remove this new template helper and use the >object method directly instead. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Template/Plugin/Biblio.pm | 6 -- > .../prog/en/includes/cat-toolbar.inc | 2 +- > t/db_dependent/Template/Plugin/Biblio.t | 68 ------------------- > 3 files changed, 1 insertion(+), 75 deletions(-) > delete mode 100755 t/db_dependent/Template/Plugin/Biblio.t > >diff --git a/Koha/Template/Plugin/Biblio.pm b/Koha/Template/Plugin/Biblio.pm >index f0a3dd9f0fd..e339263b9c9 100644 >--- a/Koha/Template/Plugin/Biblio.pm >+++ b/Koha/Template/Plugin/Biblio.pm >@@ -69,10 +69,4 @@ sub RecallsCount { > return $recalls->count; > } > >-sub CanBeEdited { >- my ( $self, $biblio, $patron ) = @_; >- >- return $biblio->can_be_edited($patron); >-} >- > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index 5924deeeaac..7b3582172fb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -40,7 +40,7 @@ > <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit <span class="caret"></span></button> > <ul class="dropdown-menu"> > [% IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >- [% IF Biblio.CanBeEdited( biblio, logged_in_user) %] >+ [% IF biblio.can_be_edited(logged_in_user) %] > <li><a id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | html %]">Edit record</a></li> > [% ELSE %] > <li class="disabled"><a id="editbiblio" href="#" data-toggle="tooltip" data-placement="left" title="This record is locked">Edit record</a></li> >diff --git a/t/db_dependent/Template/Plugin/Biblio.t b/t/db_dependent/Template/Plugin/Biblio.t >deleted file mode 100755 >index 368ff0d02c5..00000000000 >--- a/t/db_dependent/Template/Plugin/Biblio.t >+++ /dev/null >@@ -1,68 +0,0 @@ >-#!/usr/bin/perl >- >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 3 of the License, or (at your option) any later >-# version. >-# >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >- >-use Test::More tests => 2; >-use Test::MockModule; >- >-use Koha::Database; >- >-use t::lib::TestBuilder; >- >-BEGIN { >- use_ok('Koha::Template::Plugin::Biblio'); >-} >- >-my $schema = Koha::Database->schema; >-my $builder = t::lib::TestBuilder->new; >- >-subtest 'CanBeEdited() tests' => sub { >- >- plan tests => 3; >- >- $schema->storage->txn_begin; >- >- my $biblio = $builder->build_sample_biblio(); >- my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >- >- my $can_be_edited; >- >- my $mock_biblio = Test::MockModule->new('Koha::Biblio'); >- $mock_biblio->mock( 'can_be_edited', sub { return $can_be_edited; } ); >- >- my $plugin = Koha::Template::Plugin::Biblio->new(); >- >- $can_be_edited = undef; >- is( >- $plugin->CanBeEdited( $biblio, $patron ), undef, >- 'CanBeEdited is just a wrapper around Koha::Biblio->can_be_edited()' >- ); >- >- $can_be_edited = 0; >- is( >- $plugin->CanBeEdited( $biblio, $patron ), 0, >- 'CanBeEdited is just a wrapper around Koha::Biblio->can_be_edited()' >- ); >- >- $can_be_edited = 1; >- is( >- $plugin->CanBeEdited( $biblio, $patron ), 1, >- 'CanBeEdited is just a wrapper around Koha::Biblio->can_be_edited()' >- ); >- >- $schema->storage->txn_rollback; >-}; >-- >2.44.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 31791
:
163371
|
163372
|
163373
|
163374
|
163375
|
163376
|
163377
|
163378
|
163405
|
163408
|
163410
|
163411
|
163413
|
163414
|
163415
|
163416
|
163426
|
163427
|
163428
|
163429
|
163430
|
163431
|
163432
|
163433
|
163434
|
163531
|
163532
|
163533
|
163534
|
163535
|
163536
|
163537
|
163538
|
163539
|
163545
|
164193
|
164194
|
164195
|
164196
|
164197
|
164696
|
164697
|
164698
|
164699
|
164700
|
164701
|
164702
|
164703
|
164704
|
164705
|
165044
|
165045
|
165046
|
165047
|
165048
|
165049
|
165050
|
165051
|
165052
|
165053
|
165697