Bugzilla – Attachment 23983 Details for
Bug 6254
Set default for privacy by patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6254 [QA Followup 1] - can't set patron privacy by default
Bug-6254-QA-Followup-1---cant-set-patron-privacy-b.patch (text/plain), 15.62 KB, created by
Kyle M Hall (khall)
on 2014-01-07 13:35:19 UTC
(
hide
)
Description:
Bug 6254 [QA Followup 1] - can't set patron privacy by default
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-01-07 13:35:19 UTC
Size:
15.62 KB
patch
obsolete
>From 49c4777f5c8111ab2e6091869d86843eb8fde3c3 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 7 Jan 2014 07:50:43 -0500 >Subject: [PATCH] Bug 6254 [QA Followup 1] - can't set patron privacy by default > >--- > admin/categorie.pl | 66 +++++---------- > installer/data/mysql/updatedatabase.pl | 2 +- > .../prog/en/modules/admin/categorie.tt | 87 ++++++++++++-------- > .../prog/en/modules/admin/patron-attr-types.tt | 2 +- > 4 files changed, 76 insertions(+), 81 deletions(-) > >diff --git a/admin/categorie.pl b/admin/categorie.pl >index abd73f8..5a7e5fd 100755 >--- a/admin/categorie.pl >+++ b/admin/categorie.pl >@@ -45,6 +45,7 @@ use C4::Branch; > use C4::Output; > use C4::Dates; > use C4::Form::MessagingPreferences; >+use Koha::Database; > > sub StringSearch { > my ($searchstring,$type)=@_; >@@ -188,36 +189,14 @@ if ($op eq 'add_form') { > ################## DELETE_CONFIRM ################################## > # called by default form, used to confirm deletion of data in DB > } elsif ($op eq 'delete_confirm') { >+ my $schema = Koha::Database->new()->schema(); > $template->param(delete_confirm => 1); > >- my $dbh = C4::Context->dbh; >- my $sth=$dbh->prepare("select count(*) as total from borrowers where categorycode=?"); >- $sth->execute($categorycode); >- my $total = $sth->fetchrow_hashref; >- $sth->finish; >- $template->param(total => $total->{'total'}); >- >- my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?"); >- $sth2->execute($categorycode); >- my $data=$sth2->fetchrow_hashref; >- $sth2->finish; >- if ($total->{'total'} >0) { >- $template->param(totalgtzero => 1); >- } >- >- $template->param( description => $data->{'description'}, >- enrolmentperiod => $data->{'enrolmentperiod'}, >- enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), >- upperagelimit => $data->{'upperagelimit'}, >- dateofbirthrequired => $data->{'dateofbirthrequired'}, >- enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), >- overduenoticerequired => $data->{'overduenoticerequired'}, >- issuelimit => $data->{'issuelimit'}, >- reservefee => sprintf("%.2f",$data->{'reservefee'}), >- hidelostitems => $data->{'hidelostitems'}, >- category_type => $data->{'category_type'}, >- ); >- # END $OP eq DELETE_CONFIRM >+ my $count = $schema->resultset('Borrower')->search( { categorycode => $categorycode } )->count(); >+ my $category = $schema->resultset('Category')->find($categorycode); >+ $category->enrolmentperioddate( C4::Dates::format_date( $category->enrolmentperioddate() ) ); >+ $template->param( category => $category, patrons_in_category => $count ); >+# END $OP eq DELETE_CONFIRM > ################## DELETE_CONFIRMED ################################## > # called by delete_confirm, used to effectively confirm deletion of data in DB > } elsif ($op eq 'delete_confirmed') { >@@ -243,21 +222,22 @@ if ($op eq 'add_form') { > while ( my $branch = $sth->fetchrow_hashref ) { > push @selected_branches, $branch; > } >- my %row = ( >- categorycode => $results->[$i]{'categorycode'}, >- description => $results->[$i]{'description'}, >- enrolmentperiod => $results->[$i]{'enrolmentperiod'}, >- enrolmentperioddate => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}), >- upperagelimit => $results->[$i]{'upperagelimit'}, >- dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, >- enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), >- overduenoticerequired => $results->[$i]{'overduenoticerequired'}, >- issuelimit => $results->[$i]{'issuelimit'}, >- reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), >- hidelostitems => $results->[$i]{'hidelostitems'}, >- category_type => $results->[$i]{'category_type'}, >- "type_".$results->[$i]{'category_type'} => 1, >- branches => \@selected_branches, >+ my %row = ( >+ branches => \@selected_branches, >+ categorycode => $results->[$i]{'categorycode'}, >+ description => $results->[$i]{'description'}, >+ enrolmentperiod => $results->[$i]{'enrolmentperiod'}, >+ upperagelimit => $results->[$i]{'upperagelimit'}, >+ dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, >+ overduenoticerequired => $results->[$i]{'overduenoticerequired'}, >+ issuelimit => $results->[$i]{'issuelimit'}, >+ hidelostitems => $results->[$i]{'hidelostitems'}, >+ category_type => $results->[$i]{'category_type'}, >+ default_privacy => $results->[$i]{'default_privacy'}, >+ enrolmentfee => sprintf( "%.2f", $results->[$i]{'enrolmentfee'} ), >+ reservefee => sprintf( "%.2f", $results->[$i]{'reservefee'} ), >+ enrolmentperioddate => C4::Dates::format_date( $results->[$i]{'enrolmentperioddate'} ), >+ "type_" . $results->[$i]{'category_type'} => 1, > ); > if (C4::Context->preference('EnhancedMessagingPreferences')) { > my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'}); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 3854752..4065a46 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7914,7 +7914,7 @@ if ( CheckVersion($DBversion) ) { > > $DBversion = "3.15.00.XXX"; > if(CheckVersion($DBversion)) { >- $dbh->do("ALTER TABLE categories ADD default_privacy ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default'"); >+ $dbh->do("ALTER TABLE categories ADD default_privacy ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default' AFTER categorycode"); > print "Upgrade to $DBversion done (Bug 6254 - can't set patron privacy by default)\n"; > SetVersion($DBversion); > } >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 56b667a..1a6e6e3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt >@@ -1,7 +1,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › Patron categories › [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %] > [% IF ( add_validate ) %]Data recorded[% END %] >-[% IF ( delete_confirm ) %][% IF ( totalgtzero ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %] >+[% IF ( delete_confirm ) %][% IF ( patrons_in_category > 0 ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %] > [% IF ( delete_confirmed ) %]Category deleted[% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >@@ -113,7 +113,7 @@ > > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %] > [% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › Data recorded[% END %] >-[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › [% IF ( totalgtzero ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %] >+[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › [% IF ( patrons_in_category > 0 ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %] > [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> › Category deleted[% END %] > [% IF ( else ) %]Patron categories[% END %]</div> > >@@ -200,7 +200,7 @@ > [% END %] > [% END %] > </select> >- <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value. >+ <span>Select All if this category type must to be displayed all the time. Otherwise select libraries you want to associate with this value. > </span> > </li> > <li> >@@ -242,43 +242,54 @@ > <form action="[% script_name %]" method="post"> > <input type="submit" value="OK" /> > </form> >- > [% END %] > > [% IF ( delete_confirm ) %] >- >- <form action="[% script_name %]" method="post"> >- <fieldset><legend> >- [% IF ( totalgtzero ) %] >- Category [% categorycode |html %] is in use. Deletion not possible![% ELSE %] >-Confirm deletion of category [% categorycode |html %][% END %]</legend> >+ <form action="[% script_name %]" method="post"> >+ <fieldset> >+ <legend> >+ [% IF ( patrons_in_category > 0 ) %] >+ Category [% categorycode |html %] is in use. Deletion not possible! >+ [% ELSE %] >+ Confirm deletion of category [% categorycode |html %] >+ [% END %] >+ </legend> > >-[% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %] >- <table> >- <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr> >- <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr> >- <tr><th scope="row">Enrollment period: </th> >- <td> >- [% IF ( enrolmentperiod ) %] >- [% enrolmentperiod %] months >- [% ELSE %] >- until [% enrolmentperioddate %] >- [% END %] >- </td> >- </tr> >- <tr><th scope="row">Age required: </th><td>[% dateofbirthrequired %] years</td></tr> >- <tr><th scope="row">Upperage limit: </th><td>[% upperagelimit %] years</td></tr> >- <tr><th scope="row">Enrollment fee: </th><td>[% enrolmentfee %]</td></tr> >- <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr> >- <tr><th scope="row">Lost items in staff client</th><td>[% IF ( hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr> >- <tr><th scope="row">Hold fee: </th><td>[% reservefee %]</td></tr> >-</table> >- <fieldset class="action">[% IF ( totalgtzero ) %] >-<input type="submit" value="OK" /></form> >- [% ELSE %] >- <input type="hidden" name="op" value="delete_confirmed" /> >- <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a> >- [% END %]</fieldset></fieldset></form> >+ [% IF ( patrons_in_category > 0 ) %] >+ <div class="dialog alert"><strong>This category is used [% patrons_in_category %] times</strong>. Deletion not possible</div> >+ [% END %] >+ >+ <table> >+ <tr><th scope="row">Category code: </th><td>[% categorycode |html %]</td></tr> >+ <tr><th scope="row">Description: </th><td>[% description |html %]</td></tr> >+ <tr><th scope="row">Enrollment period: </th> >+ <td> >+ [% IF ( enrolmentperiod ) %] >+ [% enrolmentperiod %] months >+ [% ELSE %] >+ until [% enrolmentperioddate %] >+ [% END %] >+ </td> >+ </tr> >+ <tr><th scope="row">Age required: </th><td>[% category.dateofbirthrequired %] years</td></tr> >+ <tr><th scope="row">Upperage limit: </th><td>[% category.upperagelimit %] years</td></tr> >+ <tr><th scope="row">Enrollment fee: </th><td>[% category.enrolmentfee | format('%.02f') %]</td></tr> >+ <tr><th scope="row">Receives overdue notices: </th><td>[% IF ( category.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td></tr> >+ <tr><th scope="row">Lost items in staff client</th><td>[% IF ( category.hidelostitems ) %]Hidden by default[% ELSE %]Shown[% END %]</td></tr> >+ <tr><th scope="row">Hold fee: </th><td>[% category.reservefee | format('%.02f') %]</td></tr> >+ <tr><th scope="row">Default privacy: </th><td>[% category.default_privacy %]</td></tr> >+ </table> >+ >+ <fieldset class="action"> >+ [% IF ( patrons_in_category > 0 ) %] >+ <input type="submit" value="OK" /></form> >+ [% ELSE %] >+ <input type="hidden" name="op" value="delete_confirmed" /> >+ <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a> >+ [% END %] >+ </fieldset> >+ </fieldset> >+</form> > [% END %] > > [% IF ( delete_confirmed ) %] >@@ -319,6 +330,7 @@ Confirm deletion of category [% categorycode |html %][% END %]</legend> > <th scope="col">Messaging</th> > [% END %] > <th scope="col">Branches limitations</th> >+ <th scope="col">Default privacy</th> > <th scope="col"> </th> > <th scope="col"> </th> > </tr> >@@ -392,6 +404,9 @@ Confirm deletion of category [% categorycode |html %][% END %]</legend> > No limitation > [% END %] > </td> >+ <td> >+ [% loo.default_privacy %] >+ </td> > <td><a href="[% loo.script_name %]?op=add_form&categorycode=[% loo.categorycode |uri %]">Edit</a></td> > <td><a href="[% loo.script_name %]?op=delete_confirm&categorycode=[% loo.categorycode |uri %]">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 e561ae5..2fb8a68 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 >@@ -202,7 +202,7 @@ function CheckAttributeTypeForm(f) { > [% END %] > [% END %] > </select> >- <span>Select All if this attribute type must to be displayed all the time. Otherwise select librairies you want to associate with this value. >+ <span>Select All if this attribute type must to be displayed all the time. Otherwise select libraries you want to associate with this value. > </span> > </li> > <li> >-- >1.7.2.5
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 6254
:
19131
|
19132
|
19133
|
19272
|
19631
|
23309
|
23310
|
23317
|
23516
|
23520
|
23983
|
23985
|
23986
|
23987
|
24606
|
24696
|
24697
|
24698
|
24699
|
28033
|
28034
|
28035
|
28036