Bugzilla – Attachment 51387 Details for
Bug 15801
Move the framework related code to Koha::BiblioFramework[s] - part 2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15801: Koha::BiblioFrameworks - Remove C4::Koha::getframeworkinfo
Bug-15801-KohaBiblioFrameworks---Remove-C4Kohagetf.patch (text/plain), 11.87 KB, created by
Jonathan Druart
on 2016-05-10 15:27:40 UTC
(
hide
)
Description:
Bug 15801: Koha::BiblioFrameworks - Remove C4::Koha::getframeworkinfo
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-05-10 15:27:40 UTC
Size:
11.87 KB
patch
obsolete
>From d101ab8da14c1242eb4afdb4e34f37418e10bda7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 10 Feb 2016 17:26:35 +0000 >Subject: [PATCH] Bug 15801: Koha::BiblioFrameworks - Remove > C4::Koha::getframeworkinfo > >This was the "Get" subroutine for the framework, it can be easily >replaced with a call to the Koha::BiblioFrameworks->find method. >This patch also replaces some confusing wordings (framework vs frameworkcode). > >Test plan: >On the circulation home page, you should get a warning message if you >don't have the FA (Fast cataloguing) framework > >Note that the admin/marctagstructure.pl has already been tested in the >previous patch. >--- > C4/Koha.pm | 19 ------------ > admin/marctagstructure.pl | 7 ++--- > circ/circulation-home.pl | 8 ++--- > circ/circulation.pl | 3 +- > .../prog/en/modules/admin/marctagstructure.tt | 34 +++++++++++----------- > 5 files changed, 24 insertions(+), 47 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 8b6b220..c8291bf 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -42,7 +42,6 @@ BEGIN { > &GetItemTypes &getitemtypeinfo > &GetItemTypesCategorized &GetItemTypesByCategory > &GetSupportName &GetSupportList >- &getframeworkinfo > &getallthemes > &getFacets > &getnbpages >@@ -302,24 +301,6 @@ sub GetItemTypesByCategory { > return @$tmp; > } > >-=head2 getframeworkinfo >- >- $frameworkinfo = &getframeworkinfo($frameworkcode); >- >-Returns information about an frameworkcode. >- >-=cut >- >-sub getframeworkinfo { >- my ($frameworkcode) = @_; >- my $dbh = C4::Context->dbh; >- my $sth = >- $dbh->prepare("select * from biblio_framework where frameworkcode=?"); >- $sth->execute($frameworkcode); >- my $res = $sth->fetchrow_hashref; >- return $res; >-} >- > =head2 getitemtypeinfo > > $itemtype = &getitemtypeinfo($itemtype, [$interface]); >diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl >index b7ee972..8fa0739 100755 >--- a/admin/marctagstructure.pl >+++ b/admin/marctagstructure.pl >@@ -35,8 +35,6 @@ my $input = new CGI; > my $frameworkcode = $input->param('frameworkcode') || ''; # set to select framework > my $existingframeworkcode = $input->param('existingframeworkcode') || ''; > my $searchfield = $input->param('searchfield') || 0; >-# set when we have to create a new framework (in frameworkcode) by copying an old one (in existingframeworkcode) >-my $frameworkinfo = getframeworkinfo($frameworkcode); > $searchfield=~ s/\,//g; > > my $offset = $input->param('offset') || 0; >@@ -76,10 +74,10 @@ unless ($frameworkexist) { > } > } > >+my $framework = $frameworks->search({ frameworkcode => $frameworkcode })->next; > $template->param( > frameworks => $frameworks, >- frameworkcode => $frameworkcode, >- frameworktext => $frameworkinfo->{frameworktext}, >+ framework => $framework, > script_name => $script_name, > ( $op || 'else' ) => 1, > ); >@@ -205,7 +203,6 @@ if ($op eq 'add_form') { > } > $template->param(existingframeworkloop => \@existingframeworkloop, > frameworkcode => $frameworkcode, >-# FRtext => $frameworkinfo->{frameworktext}, > ); > ################## DEFAULT ################################## > } else { # DEFAULT >diff --git a/circ/circulation-home.pl b/circ/circulation-home.pl >index 3821007..4f29f49 100755 >--- a/circ/circulation-home.pl >+++ b/circ/circulation-home.pl >@@ -16,13 +16,12 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > # > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Output; > use C4::Context; >-use C4::Koha; >+use Koha::BiblioFrameworks; > > my $query = new CGI; > my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( >@@ -36,8 +35,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( > ); > > # Checking if there is a Fast Cataloging Framework >-my $fa = getframeworkinfo('FA'); >-$template->param( fast_cataloging => 1 ) if (defined $fa); >+$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); > > # Checking if the transfer page needs to be displayed > $template->param( display_transfer => 1 ) if ( ($flags->{'superlibrarian'} == 1) || (C4::Context->preference("IndependentBranches") == 0) ); >diff --git a/circ/circulation.pl b/circ/circulation.pl >index e31c7c5..9309d64 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -47,6 +47,7 @@ use Koha::Patron; > use Koha::Patron::Debarments qw(GetDebarments IsDebarred); > use Koha::DateUtils; > use Koha::Database; >+use Koha::BiblioFrameworks; > use Koha::Patron::Messages; > use Koha::Patron::Images; > use Koha::SearchEngine; >@@ -578,7 +579,7 @@ my $patron_messages = Koha::Patron::Messages->search( > ); > > my $fast_cataloging = 0; >-if (defined getframeworkinfo('FA')) { >+if ( Koha::BiblioFrameworks->find('FA') ) { > $fast_cataloging = 1 > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >index 2ff5822..3ba918c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >@@ -33,15 +33,15 @@ $(document).ready(function() { > › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> > › <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a> > [% IF ( add_form ) %] >-› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a> >+› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% framework.frameworktext %] ([% framework.frameworkcode %])</a> > › [% action %] [% searchfield %] > [% ELSIF ( else ) %] >-› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% IF ( frameworkcode ) %][% frameworktext %] ([% frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a> >+› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a> > [% ELSIF ( delete_confirm ) %] >-› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a> >+› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% framwork.frameworktext %] ([% framework.frameworkcode %])</a> > › Confirm deletion of tag '[% searchfield %]' > [% ELSIF ( delete_confirmed ) %] >-› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a> >+› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% framework.frameworktext %] ([% framework.frameworkcode %])</a> > › Data deleted > [% END %] > </div> >@@ -53,17 +53,17 @@ $(document).ready(function() { > > [% IF ( else ) %] > <div id="toolbar" class="btn-toolbar"> >- <a class="btn btn-small" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&frameworkcode=[% frameworkcode %]"><i class="fa fa-plus"></i> New tag</a> >+ <a class="btn btn-small" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&frameworkcode=[% framework.frameworkcode %]"><i class="fa fa-plus"></i> New tag</a> > </div>[% END %] > >-<h1>MARC Framework for [% IF ( frameworkcode ) %][% frameworktext %] ([% frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1> >+<h1>MARC Framework for [% IF framework %][% framework.frameworktext %] ([% framework.frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1> > > [% IF ( add_form ) %] > > <form action="[% script_name %]" name="Aform" method="post" class="validated"> > > <fieldset class="rows"><legend>[% IF ( use_heading_flags_p ) %][% IF ( heading_modify_tag_p ) %]Modify tag <input type="hidden" name="modif" value="1" />[% searchfield %][% END %][% IF ( heading_add_tag_p ) %]Add tag[% END %][% ELSE %][% action %][% END %]</legend> <input type="hidden" name="op" value="add_validate" /> >- <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /> >+ <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" /> > > <ol> > <li> >@@ -107,7 +107,7 @@ $(document).ready(function() { > </ol></fieldset> > <fieldset class="action"> > <input type="submit" value="Save changes" /> >- <a class="cancel" href="[% script_name %]?frameworkcode=[% frameworkcode %]">Cancel</a> >+ <a class="cancel" href="[% script_name %]?frameworkcode=[% framework.frameworkcode %]">Cancel</a> > </fieldset> > </form> > [% END %] >@@ -121,10 +121,10 @@ $(document).ready(function() { > <form action="[% script_name %]" method="post"> > <input type="hidden" name="op" value="delete_confirmed" /> > <input type="hidden" name="searchfield" value="[% searchfield %]" /> >- <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /> >+ <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" /> > <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this tag</button> > </form> >- <form action="[% script_name %]" method="get"><input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /> >+ <form action="[% script_name %]" method="get"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" /> > <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button> > </form> > </div> >@@ -133,7 +133,7 @@ $(document).ready(function() { > [% IF ( delete_confirmed ) %] > > <div class="dialog message"><h3>Tag deleted</h3> >- <form action="[% script_name %]" method="post"><input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /> >+ <form action="[% script_name %]" method="post"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" /> > <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button> > </form></div> > [% END %] >@@ -141,8 +141,8 @@ $(document).ready(function() { > > <form action="[% script_name %]" method="post"> > <input type="hidden" name="op" value="framework_create_confirm" /> >- <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /> >- Create framework for [% frameworkcode %] ([% frameworktext %]) using >+ <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" /> >+ Create framework for [% frameworkcode %] ([% framework.frameworktext %]) using > <select name="existingframeworkcode"> > <option value="">Default</option> > [% FOREACH existingframeworkloo IN existingframeworkloop %] >@@ -163,11 +163,11 @@ $(document).ready(function() { > <label for="frameworkcode"><strong>In framework:</strong> </label> > <select id="frameworkcode" name="frameworkcode"> > <option value="">Default</option> >- [% FOREACH framework IN frameworks %] >- [% IF framework.frameworkcode == frameworkcode %] >- <option value="[% framework.frameworkcode %]" selected="selected">[% framework.frameworktext %]</option> >+ [% FOREACH f IN frameworks %] >+ [% IF f.frameworkcode == framework.frameworkcode %] >+ <option value="[% f.frameworkcode %]" selected="selected">[% f.frameworktext %]</option> > [% ELSE %] >- <option value="[% framework.frameworkcode %]">[% framework.frameworktext %]</option> >+ <option value="[% f.frameworkcode %]">[% f.frameworktext %]</option> > [% END %] > [% END %] > </select> >-- >2.7.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 15801
:
47923
|
47924
|
47925
|
48938
|
48939
|
48940
|
50259
|
51385
|
51386
|
51387
|
51426
|
51427
|
51432
|
51433
|
51434
|
51435
|
54348
|
54349
|
54350
|
54351
|
55688
|
55689
|
55690
|
55691
|
56452
|
56453
|
56454
|
56455
|
56766
|
56767
|
56768
|
56769