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

(-)a/C4/Circulation.pm (-1 / +5 lines)
Lines 3048-3053 sub AddRenewal { Link Here
3048
    my $issue  = $item_object->checkout;
3048
    my $issue  = $item_object->checkout;
3049
    my $item_unblessed = $item_object->unblessed;
3049
    my $item_unblessed = $item_object->unblessed;
3050
3050
3051
    my ($package, $filename, $line) = caller;
3052
    my $renewal_type = $filename eq "automatic_renewals.pl" ? "Automatic" : "Manual";
3053
3051
    my $dbh = C4::Context->dbh;
3054
    my $dbh = C4::Context->dbh;
3052
3055
3053
    return unless $issue;
3056
    return unless $issue;
Lines 3185-3191 sub AddRenewal { Link Here
3185
                checkout_id => $issue->issue_id,
3188
                checkout_id => $issue->issue_id,
3186
                renewer_id  => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
3189
                renewer_id  => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
3187
                seen        => $seen,
3190
                seen        => $seen,
3188
                interface   => C4::Context->interface
3191
                interface   => C4::Context->interface,
3192
                renewal_type => $renewal_type
3189
            }
3193
            }
3190
        )->store();
3194
        )->store();
3191
3195
(-)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 1711-1716 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
  PRIMARY KEY (`renewal_id`),
1715
  PRIMARY KEY (`renewal_id`),
1715
  KEY `renewer_id` (`renewer_id`),
1716
  KEY `renewer_id` (`renewer_id`),
1716
  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 (+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