Bugzilla – Attachment 11168 Details for
Bug 7919
Display of values depending on the connexion library (authorised values, patron categories, extended attributes)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7919: Followup: Add a column "Branches limitations" for the 3 pages
Bug-7919-Followup-Add-a-column-Branches-limitation.patch (text/plain), 9.00 KB, created by
Jonathan Druart
on 2012-07-27 14:42:56 UTC
(
hide
)
Description:
Bug 7919: Followup: Add a column "Branches limitations" for the 3 pages
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-07-27 14:42:56 UTC
Size:
9.00 KB
patch
obsolete
>From ca2b4893675aae8595371ce29bb147009e2297e6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 27 Jul 2012 16:42:56 +0200 >Subject: [PATCH] Bug 7919: Followup: Add a column "Branches limitations" for > the 3 pages > >--- > admin/authorised_values.pl | 8 ++++++++ > admin/categorie.pl | 11 ++++++++++- > admin/patron-attr-types.pl | 8 ++++++-- > .../prog/en/modules/admin/authorised_values.tt | 12 ++++++++++++ > .../prog/en/modules/admin/categorie.tt | 12 ++++++++++++ > .../prog/en/modules/admin/patron-attr-types.tt | 12 ++++++++++++ > 6 files changed, 60 insertions(+), 3 deletions(-) > >diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl >index 06bb654..bf9ec5a 100755 >--- a/admin/authorised_values.pl >+++ b/admin/authorised_values.pl >@@ -268,7 +268,14 @@ sub default_form { > my $count = scalar(@$results); > my @loop_data = (); > # builds value list >+ my $dbh = C4::Context->dbh; >+ $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM authorised_values_branches AS avb, branches AS b WHERE avb.branchcode = b.branchcode AND avb.av_id = ?"); > for (my $i=0; $i < $count; $i++){ >+ $sth->execute( $results->[$i]{id} ); >+ my @selected_branches; >+ while ( my $branch = $sth->fetchrow_hashref ) { >+ push @selected_branches, $branch; >+ } > my %row_data; # get a fresh hash for the row data > $row_data{category} = $results->[$i]{'category'}; > $row_data{authorised_value} = $results->[$i]{'authorised_value'}; >@@ -277,6 +284,7 @@ sub default_form { > $row_data{imageurl} = getitemtypeimagelocation( 'intranet', $results->[$i]{'imageurl'} ); > $row_data{edit} = "$script_name?op=add_form&id=".$results->[$i]{'id'}."&offset=$offset"; > $row_data{delete} = "$script_name?op=delete_confirm&searchfield=$searchfield&id=".$results->[$i]{'id'}."&offset=$offset"; >+ $row_data{branches} = \@selected_branches; > push(@loop_data, \%row_data); > } > >diff --git a/admin/categorie.pl b/admin/categorie.pl >index b2076d0..fed14ce 100755 >--- a/admin/categorie.pl >+++ b/admin/categorie.pl >@@ -233,7 +233,14 @@ if ($op eq 'add_form') { > $template->param(else => 1); > my @loop; > my ($count,$results)=StringSearch($searchfield,'web'); >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?"); > for (my $i=0; $i < $count; $i++){ >+ $sth->execute( $results->[$i]{'categorycode'} ); >+ my @selected_branches; >+ while ( my $branch = $sth->fetchrow_hashref ) { >+ push @selected_branches, $branch; >+ } > my %row = ( > categorycode => $results->[$i]{'categorycode'}, > description => $results->[$i]{'description'}, >@@ -247,7 +254,9 @@ if ($op eq 'add_form') { > reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), > hidelostitems => $results->[$i]{'hidelostitems'}, > category_type => $results->[$i]{'category_type'}, >- "type_".$results->[$i]{'category_type'} => 1); >+ "type_".$results->[$i]{'category_type'} => 1, >+ branches => \@selected_branches, >+ ); > if (C4::Context->preference('EnhancedMessagingPreferences')) { > my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'}); > $row{messaging_prefs} = $brief_prefs if @$brief_prefs; >diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl >index 3fa7612..3935f40 100755 >--- a/admin/patron-attr-types.pl >+++ b/admin/patron-attr-types.pl >@@ -293,15 +293,19 @@ sub patron_attribute_type_list { > > my @attributes_loop; > for my $class (@classes) { >- my @items; >+ my ( @items, $branches ); > for my $attr (@attr_types) { >- push @items, $attr if $attr->{class} eq $class >+ next if $attr->{class} ne $class; >+ my $attr_type = C4::Members::AttributeTypes->fetch($attr->{code}); >+ $attr->{branches} = $attr_type->branches; >+ push @items, $attr; > } > my $lib = GetAuthorisedValueByCode( 'PA_CLASS', $class ) || $class; > push @attributes_loop, { > class => $class, > items => \@items, > lib => $lib, >+ branches => $branches, > }; > } > $template->param(available_attribute_types => \@attributes_loop); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >index 03cb478..2b56f21 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >@@ -249,6 +249,7 @@ > <th>Description</th> > <th>Description (OPAC)</th> > <th>Icon</th> >+ <th>Branches limitations</th> > <th>Edit</th> > <th>Delete</th> > </tr> >@@ -263,6 +264,17 @@ > <td>[% loo.lib %]</td> > <td>[% loo.lib_opac %]</td> > <td>[% IF ( loo.imageurl ) %]<img src="[% loo.imageurl %]" alt=""/>[% ELSE %] [% END %]</td> >+ <td> >+ [% IF loo.branches.size > 0 %] >+ [% branches_str = "" %] >+ [% FOREACH branch IN loo.branches %] >+ [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %] >+ [% END %] >+ <a href="#" title="[% branches_str %]">[% loo.branches.size %] branches limitations</a> >+ [% ELSE %] >+ No limitation >+ [% END %] >+ </td> > <td><a href="[% loo.edit %]">Edit</a></td> > <td><a href="[% loo.delete %]">Delete</a></td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >index f9c1880..da1d41a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >@@ -303,6 +303,7 @@ Confirm deletion of category [% categorycode |html %][% END %]</legend> > [% IF ( EnhancedMessagingPreferences ) %] > <th scope="col">Messaging</th> > [% END %] >+ <th scope="col">Branches limitations</th> > <th scope="col" colspan="2"> </th> > </thead> > [% FOREACH loo IN loop %] >@@ -356,6 +357,17 @@ Confirm deletion of category [% categorycode |html %][% END %]</legend> > [% END %] > </td> > [% END %] >+ <td> >+ [% IF loo.branches.size > 0 %] >+ [% branches_str = "" %] >+ [% FOREACH branch IN loo.branches %] >+ [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %] >+ [% END %] >+ <a href="#" title="[% branches_str %]">[% loo.branches.size %] branches limitations</a> >+ [% ELSE %] >+ No limitation >+ [% END %] >+ </td> > <td><a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |url %]">Edit</a></td> > <td><a href="[% loo.script_name %]?op=delete_confirm&categorycode=[% loo.categorycode |url %]">Delete</a></td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >index 3804f93..5f63618 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >@@ -306,6 +306,7 @@ function CheckAttributeTypeForm(f) { > <th>Code</th> > <th>Description</th> > <th>Actions</th> >+ <th>Branches limitation</th> > </tr> > </thead> > <tbody> >@@ -314,6 +315,17 @@ function CheckAttributeTypeForm(f) { > <td>[% item.code |html %]</td> > <td>[% item.description %]</td> > <td> >+ [% IF item.branches > 0 %] >+ [% branches_str = "" %] >+ [% FOREACH branch IN item.branches %] >+ [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %] >+ [% END %] >+ <a href="#" title="[% branches_str %]">[% item.branches.size %] branches limitations</a> >+ [% ELSE %] >+ No limitation >+ [% END %] >+ </td> >+ <td> > <a href="[% item.script_name %]?op=edit_attribute_type&code=[% item.code |html %]">Edit</a> > <a href="[% item.script_name %]?op=delete_attribute_type&code=[% item.code |html %]">Delete</a> > </td> >-- >1.7.7.3
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 7919
:
8939
|
9170
|
9973
|
9984
|
10424
|
11163
|
11168
|
11373
|
11751
|
13736
|
13862
|
13867
|
13868
|
13891
|
13901
|
13952
|
13953
|
14162
|
14163
|
14184
|
14287
|
14350
|
14372
|
14377