Bugzilla – Attachment 146472 Details for
Bug 30642
We should record the renewal type (automatic/manual)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30642: (follow-up) Change sql and adapt for translations
Bug-30642-follow-up-Change-sql-and-adapt-for-trans.patch (text/plain), 8.26 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-02-10 12:43:29 UTC
(
hide
)
Description:
Bug 30642: (follow-up) Change sql and adapt for translations
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-02-10 12:43:29 UTC
Size:
8.26 KB
patch
obsolete
>From c9fe1438a6ae1ce6b8be954ccf2acb41faf3f60a Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Thu, 8 Dec 2022 14:28:49 +0000 >Subject: [PATCH] Bug 30642: (follow-up) Change sql and adapt for translations > >New column has now been changed to an enum in line with comments and the strings have been amended to be picked up for translation. The file koha-tmpl/intranet-tmpl/prog/en/includes/str/checkout_renewals.inc has been removed as the variables can be included within the javascript file. > >Test plan: >1) In the database shell run "show columns from checkout_renewals;" and observe that there is currently no column for recording the type of renewal >2) Apply patch >3) In the shell run "dbic" and "perl installer/data/mysql/updatedatabase.pl" to update the database schema with the new column. >4) Create some checkouts >5) Renew some checkouts manually and observe in the database that there is now a column called "renewal_type" that will have recorded these as "Manual" >6) Create some checkouts that can be automatically renewed >7) Run the cron script in automatic_renewals.pl and observe that there are now also entries with a renewal_type of "Automatic" >8) Send a GET request to http://localhost:8081/api/v1/checkouts/1/renewals and observe that the renewal_type is now returned in the response >9) In the Item Details tab for a record, there is the "Current renewals" option which has a button to view renewals. Click on this and observe that the modal now displays the new information. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Schema/Result/CheckoutRenewal.pm | 16 +++++++++++----- > .../atomicupdate/bug_30642-add_renewal_type.pl | 4 ++-- > installer/data/mysql/kohastructure.sql | 2 +- > .../prog/en/includes/str/checkout_renewals.inc | 6 ------ > .../prog/en/modules/catalogue/moredetail.tt | 1 - > .../prog/js/checkout_renewals_modal.js | 8 ++++++-- > 6 files changed, 20 insertions(+), 17 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/str/checkout_renewals.inc > >diff --git a/Koha/Schema/Result/CheckoutRenewal.pm b/Koha/Schema/Result/CheckoutRenewal.pm >index 9efbd93630a..569fcfc0494 100644 >--- a/Koha/Schema/Result/CheckoutRenewal.pm >+++ b/Koha/Schema/Result/CheckoutRenewal.pm >@@ -71,9 +71,10 @@ the date and time the renewal took place > > =head2 renewal_type > >- data_type: 'varchar' >+ data_type: 'enum' >+ default_value: 'Manual' >+ extra: {list => ["Automatic","Manual"]} > is_nullable: 0 >- size: 9 > > whether the renewal was an automatic or manual renewal > >@@ -98,7 +99,12 @@ __PACKAGE__->add_columns( > is_nullable => 0, > }, > "renewal_type", >- { data_type => "varchar", is_nullable => 0, size => 9 }, >+ { >+ data_type => "enum", >+ default_value => "Manual", >+ extra => { list => ["Automatic", "Manual"] }, >+ is_nullable => 0, >+ }, > ); > > =head1 PRIMARY KEY >@@ -136,8 +142,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-12-06 16:44:53 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BcbN0Iceh09H2DWEA6CDwA >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-12-08 10:49:16 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Si1gkXWqpvt98YN0dO7vgw > > =head2 checkout > >diff --git a/installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl b/installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl >index cc86ed11b77..36290b3bcee 100644 >--- a/installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl >+++ b/installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl >@@ -1,7 +1,7 @@ > use Modern::Perl; > > return { >- bug_number => "BUG_30642", >+ bug_number => "30642", > description => "Record whether a renewal has been done manually or automatically.", > up => sub { > my ($args) = @_; >@@ -9,7 +9,7 @@ return { > > if( !column_exists( 'checkout_renewals', 'renewal_type' ) ) { > $dbh->do(q{ >- ALTER TABLE checkout_renewals ADD COLUMN `renewal_type` varchar(9) NOT NULL AFTER `timestamp` >+ ALTER TABLE checkout_renewals ADD COLUMN `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' AFTER `timestamp` > }); > > say $out "Added column 'checkout_renewals.column_name'"; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index fbd653963b4..03d6cbebc90 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1714,7 +1714,7 @@ CREATE TABLE `checkout_renewals` ( > `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not', > `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on', > `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place', >- `renewal_type` varchar(9) NOT NULL COMMENT 'whether the renewal was an automatic or manual renewal', >+ `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal', > PRIMARY KEY (`renewal_id`), > KEY `renewer_id` (`renewer_id`), > CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/str/checkout_renewals.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/str/checkout_renewals.inc >deleted file mode 100644 >index 3dc71383556..00000000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/str/checkout_renewals.inc >+++ /dev/null >@@ -1,6 +0,0 @@ >-<!-- str/checkout_renewals.inc --> >-<script> >- var renewed_prop = _("Note: %s out of %s renewals have been logged"); >- var renewed = _("Renewed by"); >- var renewed_type = _(" Renewal type:"); >-</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index 5ba3e48b08c..945a1b0e20d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -475,7 +475,6 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'catalog-strings.inc' %] > [% INCLUDE 'modals/checkout_renewals.inc' %] >- [% INCLUDE 'str/checkout_renewals.inc' %] > [% INCLUDE 'js-date-format.inc' %] > [% INCLUDE 'js-patron-format.inc' %] > [% Asset.js("js/catalog.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkout_renewals_modal.js b/koha-tmpl/intranet-tmpl/prog/js/checkout_renewals_modal.js >index 4ca4c6cf732..f4f57c5a784 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkout_renewals_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkout_renewals_modal.js >@@ -10,7 +10,7 @@ $(document).ready(function(){ > $('#checkoutRenewals #retrieving').show(); > $.get({ 'url': '/api/v1/checkouts/'+checkoutID+'/renewals', 'headers': { 'x-koha-embed': 'renewer' } }, function(data) { > if (data.length < renewals) { >- $('#checkoutRenewals #incomplete').append(renewed_prop.format(data.length, renewals)).show(); >+ $('#checkoutRenewals #incomplete').append(__("Note: %s out of %s renewals have been logged").format(data.length, renewals)).show(); > } > var items = data.map(function(item) { > return createLi(item); >@@ -20,6 +20,10 @@ $(document).ready(function(){ > }); > }); > function createLi(renewal) { >- return '<li><span style="font-weight:bold">' + $datetime(renewal.timestamp) + '</span> ' + renewed + ' <span style="font-weight:bold">' + $patron_to_html(renewal.renewer) + '</span>' + renewed_type + ' <span style="font-weight:bold">' + renewal.renewal_type + '</span></li>'; >+ if(renewal.renewal_type === "Manual"){ >+ return '<li><span style="font-weight:bold">' + $datetime(renewal.timestamp) + '</span> ' + __("Renewed by") + ' <span style="font-weight:bold">' + $patron_to_html(renewal.renewer) + " " + __("manually") + '</span></li>'; >+ } else { >+ return '<li><span style="font-weight:bold">' + $datetime(renewal.timestamp) + '</span> ' + __("Renewal type:") + ' <span style="font-weight:bold">' + __("Automatic") + '</span></li>'; >+ } > } > }); >-- >2.34.1
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 30642
:
144451
|
144457
|
144463
|
144499
|
144504
|
144505
|
145518
|
145519
|
145520
|
146471
| 146472 |
146473
|
146474
|
146476
|
146614