Bugzilla – Attachment 56768 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), 12.26 KB, created by
Jonathan Druart
on 2016-10-24 13:24:48 UTC
(
hide
)
Description:
Bug 15801: Koha::BiblioFrameworks - Remove C4::Koha::getframeworkinfo
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-10-24 13:24:48 UTC
Size:
12.26 KB
patch
obsolete
>From 0d40bd95480966a94541f8fb93b01307589a080f 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 see a "Fast cataloguing" link >if the FA framework exists. > >Note that the admin/marctagstructure.pl has already been tested in the >previous patch. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Link pops Ok >No errors > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Koha.pm | 29 ++++-------------- > admin/marctagstructure.pl | 7 ++--- > circ/circulation-home.pl | 8 ++--- > circ/circulation.pl | 3 +- > .../prog/en/modules/admin/marctagstructure.tt | 34 +++++++++++----------- > 5 files changed, 29 insertions(+), 52 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 0ab2531..9b28ecb 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -39,13 +39,12 @@ BEGIN { > require Exporter; > @ISA = qw(Exporter); > @EXPORT = qw( >- &GetPrinters &GetPrinter >- &GetItemTypes &getitemtypeinfo >+ &GetPrinters &GetPrinter >+ &GetItemTypes &getitemtypeinfo > &GetItemTypesCategorized &GetItemTypesByCategory >- &getframeworkinfo >- &getallthemes >- &getFacets >- &getnbpages >+ &getallthemes >+ &getFacets >+ &getnbpages > &get_infos_of > &get_notforloan_label_of > &getitemtypeimagedir >@@ -223,24 +222,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 2d46b86..575f4f4 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, > ); >@@ -209,7 +207,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 eaecef7..e1ca58f 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -47,6 +47,7 @@ use Koha::Patron; > use Koha::Patron::Debarments qw(GetDebarments); > use Koha::DateUtils; > use Koha::Database; >+use Koha::BiblioFrameworks; > use Koha::Patron::Messages; > use Koha::Patron::Images; > use Koha::SearchEngine; >@@ -579,7 +580,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 be536e8..6e46b6b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt >@@ -38,15 +38,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> >@@ -58,17 +58,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> >@@ -112,7 +112,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 %] >@@ -126,10 +126,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> >@@ -138,7 +138,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 %] >@@ -146,8 +146,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 %] >@@ -168,11 +168,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.1.4
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