View | Details | Raw Unified | Return to bug 30642
Collapse All | Expand All

(-)a/Koha/Schema/Result/CheckoutRenewal.pm (-5 / +11 lines)
Lines 71-79 the date and time the renewal took place Link Here
71
71
72
=head2 renewal_type
72
=head2 renewal_type
73
73
74
  data_type: 'varchar'
74
  data_type: 'enum'
75
  default_value: 'Manual'
76
  extra: {list => ["Automatic","Manual"]}
75
  is_nullable: 0
77
  is_nullable: 0
76
  size: 9
77
78
78
whether the renewal was an automatic or manual renewal
79
whether the renewal was an automatic or manual renewal
79
80
Lines 98-104 __PACKAGE__->add_columns( Link Here
98
    is_nullable => 0,
99
    is_nullable => 0,
99
  },
100
  },
100
  "renewal_type",
101
  "renewal_type",
101
  { data_type => "varchar", is_nullable => 0, size => 9 },
102
  {
103
    data_type => "enum",
104
    default_value => "Manual",
105
    extra => { list => ["Automatic", "Manual"] },
106
    is_nullable => 0,
107
  },
102
);
108
);
103
109
104
=head1 PRIMARY KEY
110
=head1 PRIMARY KEY
Lines 136-143 __PACKAGE__->belongs_to( Link Here
136
);
142
);
137
143
138
144
139
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-12-06 16:44:53
145
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-12-08 10:49:16
140
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BcbN0Iceh09H2DWEA6CDwA
146
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Si1gkXWqpvt98YN0dO7vgw
141
147
142
=head2 checkout
148
=head2 checkout
143
149
(-)a/installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl (-2 / +2 lines)
Lines 1-7 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
2
3
return {
3
return {
4
    bug_number => "BUG_30642",
4
    bug_number => "30642",
5
    description => "Record whether a renewal has been done manually or automatically.",
5
    description => "Record whether a renewal has been done manually or automatically.",
6
    up => sub {
6
    up => sub {
7
        my ($args) = @_; 
7
        my ($args) = @_; 
Lines 9-15 return { Link Here
9
9
10
        if( !column_exists( 'checkout_renewals', 'renewal_type' ) ) { 
10
        if( !column_exists( 'checkout_renewals', 'renewal_type' ) ) { 
11
          $dbh->do(q{
11
          $dbh->do(q{
12
              ALTER TABLE checkout_renewals ADD COLUMN `renewal_type` varchar(9) NOT NULL AFTER `timestamp`
12
              ALTER TABLE checkout_renewals ADD COLUMN `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' AFTER `timestamp`
13
          });
13
          });
14
14
15
          say $out "Added column 'checkout_renewals.column_name'";
15
          say $out "Added column 'checkout_renewals.column_name'";
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1711-1717 CREATE TABLE `checkout_renewals` ( Link Here
1711
  `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1711
  `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1712
  `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1712
  `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1713
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1713
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1714
  `renewal_type` varchar(9) NOT NULL COMMENT 'whether the renewal was an automatic or manual renewal',
1714
  `renewal_type` enum('Automatic', 'Manual') NOT NULL DEFAULT 'Manual' COMMENT 'whether the renewal was an automatic or manual renewal',
1715
  PRIMARY KEY (`renewal_id`),
1715
  PRIMARY KEY (`renewal_id`),
1716
  KEY `renewer_id` (`renewer_id`),
1716
  KEY `renewer_id` (`renewer_id`),
1717
  CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1717
  CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/str/checkout_renewals.inc (-6 lines)
Lines 1-6 Link Here
1
<!-- str/checkout_renewals.inc -->
2
<script>
3
    var renewed_prop = _("Note: %s out of %s renewals have been logged");
4
    var renewed = _("Renewed by");
5
    var renewed_type = _(" Renewal type:");
6
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (-1 lines)
Lines 482-488 Link Here
482
[% MACRO jsinclude BLOCK %]
482
[% MACRO jsinclude BLOCK %]
483
    [% INCLUDE 'catalog-strings.inc' %]
483
    [% INCLUDE 'catalog-strings.inc' %]
484
    [% INCLUDE 'modals/checkout_renewals.inc' %]
484
    [% INCLUDE 'modals/checkout_renewals.inc' %]
485
    [% INCLUDE 'str/checkout_renewals.inc' %]
486
    [% INCLUDE 'js-date-format.inc' %]
485
    [% INCLUDE 'js-date-format.inc' %]
487
    [% INCLUDE 'js-patron-format.inc' %]
486
    [% INCLUDE 'js-patron-format.inc' %]
488
    [% Asset.js("js/catalog.js") | $raw %]
487
    [% Asset.js("js/catalog.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkout_renewals_modal.js (-3 / +6 lines)
Lines 10-16 $(document).ready(function(){ Link Here
10
        $('#checkoutRenewals #retrieving').show();
10
        $('#checkoutRenewals #retrieving').show();
11
        $.get({ 'url': '/api/v1/checkouts/'+checkoutID+'/renewals', 'headers': { 'x-koha-embed': 'renewer' } }, function(data) {
11
        $.get({ 'url': '/api/v1/checkouts/'+checkoutID+'/renewals', 'headers': { 'x-koha-embed': 'renewer' } }, function(data) {
12
            if (data.length < renewals) {
12
            if (data.length < renewals) {
13
                $('#checkoutRenewals #incomplete').append(renewed_prop.format(data.length, renewals)).show();
13
                $('#checkoutRenewals #incomplete').append(__("Note: %s out of %s renewals have been logged").format(data.length, renewals)).show();
14
            }
14
            }
15
            var items = data.map(function(item) {
15
            var items = data.map(function(item) {
16
                return createLi(item);
16
                return createLi(item);
Lines 20-25 $(document).ready(function(){ Link Here
20
        });
20
        });
21
    });
21
    });
22
    function createLi(renewal) {
22
    function createLi(renewal) {
23
        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>';
23
        if(renewal.renewal_type === "Manual"){
24
            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>';
25
        } else {
26
            return '<li><span style="font-weight:bold">' + $datetime(renewal.timestamp) + '</span> ' + __("Renewal type:") + ' <span style="font-weight:bold">' +  __("Automatic") + '</span></li>';
27
        }
24
    }
28
    }
25
});
29
});
26
- 

Return to bug 30642