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

(-)a/C4/Circulation.pm (-1 / +5 lines)
Lines 3068-3073 sub AddRenewal { Link Here
3068
    my $issue  = $item_object->checkout;
3068
    my $issue  = $item_object->checkout;
3069
    my $item_unblessed = $item_object->unblessed;
3069
    my $item_unblessed = $item_object->unblessed;
3070
3070
3071
    my ($package, $filename, $line) = caller;
3072
    my $renewal_type = $filename =~ m/automatic_renewals.pl/ ? "Automatic" : "Manual";
3073
3071
    my $dbh = C4::Context->dbh;
3074
    my $dbh = C4::Context->dbh;
3072
3075
3073
    return unless $issue;
3076
    return unless $issue;
Lines 3206-3212 sub AddRenewal { Link Here
3206
                checkout_id => $issue->issue_id,
3209
                checkout_id => $issue->issue_id,
3207
                renewer_id  => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
3210
                renewer_id  => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
3208
                seen        => $seen,
3211
                seen        => $seen,
3209
                interface   => C4::Context->interface
3212
                interface   => C4::Context->interface,
3213
                renewal_type => $renewal_type
3210
            }
3214
            }
3211
        )->store();
3215
        )->store();
3212
3216
(-)a/Koha/Schema/Result/CheckoutRenewal.pm (-2 / +12 lines)
Lines 69-74 the interface this renewal took place on Link Here
69
69
70
the date and time the renewal took place
70
the date and time the renewal took place
71
71
72
=head2 renewal_type
73
74
  data_type: 'varchar'
75
  is_nullable: 0
76
  size: 9
77
78
whether the renewal was an automatic or manual renewal
79
72
=cut
80
=cut
73
81
74
__PACKAGE__->add_columns(
82
__PACKAGE__->add_columns(
Lines 89-94 __PACKAGE__->add_columns( Link Here
89
    default_value => \"current_timestamp",
97
    default_value => \"current_timestamp",
90
    is_nullable => 0,
98
    is_nullable => 0,
91
  },
99
  },
100
  "renewal_type",
101
  { data_type => "varchar", is_nullable => 0, size => 9 },
92
);
102
);
93
103
94
=head1 PRIMARY KEY
104
=head1 PRIMARY KEY
Lines 126-133 __PACKAGE__->belongs_to( Link Here
126
);
136
);
127
137
128
138
129
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-04-27 19:43:17
139
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-12-06 16:44:53
130
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7mjiEx634L5FZyjroACUkg
140
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BcbN0Iceh09H2DWEA6CDwA
131
141
132
=head2 checkout
142
=head2 checkout
133
143
(-)a/api/v1/swagger/definitions/renewal.yaml (+4 lines)
Lines 28-33 properties: Link Here
28
  timestamp:
28
  timestamp:
29
    type: string
29
    type: string
30
    description: Last update time
30
    description: Last update time
31
  renewal_type:
32
    type:
33
      - string
34
      - "null"
31
  renewer:
35
  renewer:
32
    type:
36
    type:
33
      - object
37
      - object
(-)a/installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "BUG_30642",
5
    description => "Record whether a renewal has been done manually or automatically.",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        if( !column_exists( 'checkout_renewals', 'renewal_type' ) ) {
11
          $dbh->do(q{
12
              ALTER TABLE checkout_renewals ADD COLUMN `renewal_type` varchar(9) NOT NULL AFTER `timestamp`
13
          });
14
15
          say $out "Added column 'checkout_renewals.column_name'";
16
        }
17
    },
18
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1714-1719 CREATE TABLE `checkout_renewals` ( Link Here
1714
  `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1714
  `seen` tinyint(1) DEFAULT 0 COMMENT 'boolean denoting whether the item was present or not',
1715
  `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1715
  `interface` varchar(16) NOT NULL COMMENT 'the interface this renewal took place on',
1716
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1716
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'the date and time the renewal took place',
1717
  `renewal_type` varchar(9) NOT NULL COMMENT 'whether the renewal was an automatic or manual renewal',
1717
  PRIMARY KEY (`renewal_id`),
1718
  PRIMARY KEY (`renewal_id`),
1718
  KEY `renewer_id` (`renewer_id`),
1719
  KEY `renewer_id` (`renewer_id`),
1719
  CONSTRAINT `renewals_renewer_id` FOREIGN KEY (`renewer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
1720
  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 (+1 lines)
Lines 2-5 Link Here
2
<script>
2
<script>
3
    var renewed_prop = _("Note: %s out of %s renewals have been logged");
3
    var renewed_prop = _("Note: %s out of %s renewals have been logged");
4
    var renewed = _("Renewed by");
4
    var renewed = _("Renewed by");
5
    var renewed_type = _(" Renewal type:");
5
</script>
6
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkout_renewals_modal.js (-2 / +1 lines)
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></li>';
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>';
24
    }
24
    }
25
});
25
});
26
- 

Return to bug 30642