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

(-)a/C4/Accounts.pm (-5 / +8 lines)
Lines 159-169 sub chargelostitem{ Link Here
159
    unless ($existing_charges) {
159
    unless ($existing_charges) {
160
        #add processing fee
160
        #add processing fee
161
        if ($processfee && $processfee > 0){
161
        if ($processfee && $processfee > 0){
162
            manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1);
162
            manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1, 1);
163
        }
163
        }
164
        #add replace cost
164
        #add replace cost
165
        if ($replacementprice > 0){
165
        if ($replacementprice > 0){
166
            manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice, undef, 1);
166
            manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice, undef, 1, 1);
167
        }
167
        }
168
    }
168
    }
169
}
169
}
Lines 171-177 sub chargelostitem{ Link Here
171
=head2 manualinvoice
171
=head2 manualinvoice
172
172
173
  &manualinvoice($borrowernumber, $itemnumber, $description, $type,
173
  &manualinvoice($borrowernumber, $itemnumber, $description, $type,
174
                 $amount, $note);
174
                 $amount, $note, $skip_notify, $is_automatic);
175
175
176
C<$borrowernumber> is the patron's borrower number.
176
C<$borrowernumber> is the patron's borrower number.
177
C<$description> is a description of the transaction.
177
C<$description> is a description of the transaction.
Lines 179-184 C<$type> may be one of C<CS>, C<CB>, C<CW>, C<CF>, C<CL>, C<N>, C<L>, Link Here
179
or C<REF>.
179
or C<REF>.
180
C<$itemnumber> is the item involved, if pertinent; otherwise, it
180
C<$itemnumber> is the item involved, if pertinent; otherwise, it
181
should be the empty string.
181
should be the empty string.
182
C<$is_automatic> should be true if manual invoice isn't really being used
183
to create a manual invoice ( e.g. it's use in chargelostitem is automatic )
182
184
183
=cut
185
=cut
184
186
Lines 195-201 should be the empty string. Link Here
195
#
197
#
196
198
197
sub manualinvoice {
199
sub manualinvoice {
198
    my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note, $skip_notify ) = @_;
200
    my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note, $skip_notify, $automatic ) = @_;
199
    my $manager_id = 0;
201
    my $manager_id = 0;
200
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
202
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
201
    my $dbh      = C4::Context->dbh;
203
    my $dbh      = C4::Context->dbh;
Lines 231-237 sub manualinvoice { Link Here
231
    )->store();
233
    )->store();
232
234
233
    my $offset_type =
235
    my $offset_type =
234
        $type eq 'L'  ? 'Lost Item'
236
       !$automatic    ? 'Manual Debit'
237
      : $type eq 'L'  ? 'Lost Item'
235
      : $type eq 'PF' ? 'Processing Fee'
238
      : $type eq 'PF' ? 'Processing Fee'
236
      :                 'Manual Debit';
239
      :                 'Manual Debit';
237
240
(-)a/Koha/Schema/Result/Accountoffset.pm (-41 / +95 lines)
Lines 1-12 Link Here
1
use utf8;
1
use utf8;
2
package Koha::Schema::Result::Accountoffset;
2
package Koha::Schema::Result::AccountOffset;
3
3
4
# Created by DBIx::Class::Schema::Loader
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
6
7
=head1 NAME
7
=head1 NAME
8
8
9
Koha::Schema::Result::Accountoffset
9
Koha::Schema::Result::AccountOffset
10
10
11
=cut
11
=cut
12
12
Lines 15-54 use warnings; Link Here
15
15
16
use base 'DBIx::Class::Core';
16
use base 'DBIx::Class::Core';
17
17
18
=head1 TABLE: C<accountoffsets>
18
=head1 TABLE: C<account_offsets>
19
19
20
=cut
20
=cut
21
21
22
__PACKAGE__->table("accountoffsets");
22
__PACKAGE__->table("account_offsets");
23
23
24
=head1 ACCESSORS
24
=head1 ACCESSORS
25
25
26
=head2 borrowernumber
26
=head2 id
27
27
28
  data_type: 'integer'
28
  data_type: 'integer'
29
  default_value: 0
29
  is_auto_increment: 1
30
  is_foreign_key: 1
31
  is_nullable: 0
30
  is_nullable: 0
32
31
33
=head2 accountno
32
=head2 credit_id
34
33
35
  data_type: 'smallint'
34
  data_type: 'integer'
36
  default_value: 0
35
  is_foreign_key: 1
37
  is_nullable: 0
36
  is_nullable: 1
38
37
39
=head2 offsetaccount
38
=head2 debit_id
40
39
41
  data_type: 'smallint'
40
  data_type: 'integer'
42
  default_value: 0
41
  is_foreign_key: 1
42
  is_nullable: 1
43
44
=head2 type
45
46
  data_type: 'varchar'
47
  is_foreign_key: 1
43
  is_nullable: 0
48
  is_nullable: 0
49
  size: 16
44
50
45
=head2 offsetamount
51
=head2 amount
46
52
47
  data_type: 'decimal'
53
  data_type: 'decimal'
48
  is_nullable: 1
54
  is_nullable: 0
49
  size: [28,6]
55
  size: [26,6]
50
56
51
=head2 timestamp
57
=head2 created_on
52
58
53
  data_type: 'timestamp'
59
  data_type: 'timestamp'
54
  datetime_undef_if_invalid: 1
60
  datetime_undef_if_invalid: 1
Lines 58-77 __PACKAGE__->table("accountoffsets"); Link Here
58
=cut
64
=cut
59
65
60
__PACKAGE__->add_columns(
66
__PACKAGE__->add_columns(
61
  "borrowernumber",
67
  "id",
62
  {
68
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
63
    data_type      => "integer",
69
  "credit_id",
64
    default_value  => 0,
70
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
65
    is_foreign_key => 1,
71
  "debit_id",
66
    is_nullable    => 0,
72
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
67
  },
73
  "type",
68
  "accountno",
74
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 16 },
69
  { data_type => "smallint", default_value => 0, is_nullable => 0 },
75
  "amount",
70
  "offsetaccount",
76
  { data_type => "decimal", is_nullable => 0, size => [26, 6] },
71
  { data_type => "smallint", default_value => 0, is_nullable => 0 },
77
  "created_on",
72
  "offsetamount",
73
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
74
  "timestamp",
75
  {
78
  {
76
    data_type => "timestamp",
79
    data_type => "timestamp",
77
    datetime_undef_if_invalid => 1,
80
    datetime_undef_if_invalid => 1,
Lines 80-106 __PACKAGE__->add_columns( Link Here
80
  },
83
  },
81
);
84
);
82
85
86
=head1 PRIMARY KEY
87
88
=over 4
89
90
=item * L</id>
91
92
=back
93
94
=cut
95
96
__PACKAGE__->set_primary_key("id");
97
83
=head1 RELATIONS
98
=head1 RELATIONS
84
99
85
=head2 borrowernumber
100
=head2 credit
101
102
Type: belongs_to
103
104
Related object: L<Koha::Schema::Result::Accountline>
105
106
=cut
107
108
__PACKAGE__->belongs_to(
109
  "credit",
110
  "Koha::Schema::Result::Accountline",
111
  { accountlines_id => "credit_id" },
112
  {
113
    is_deferrable => 1,
114
    join_type     => "LEFT",
115
    on_delete     => "CASCADE",
116
    on_update     => "CASCADE",
117
  },
118
);
119
120
=head2 debit
121
122
Type: belongs_to
123
124
Related object: L<Koha::Schema::Result::Accountline>
125
126
=cut
127
128
__PACKAGE__->belongs_to(
129
  "debit",
130
  "Koha::Schema::Result::Accountline",
131
  { accountlines_id => "debit_id" },
132
  {
133
    is_deferrable => 1,
134
    join_type     => "LEFT",
135
    on_delete     => "CASCADE",
136
    on_update     => "CASCADE",
137
  },
138
);
139
140
=head2 type
86
141
87
Type: belongs_to
142
Type: belongs_to
88
143
89
Related object: L<Koha::Schema::Result::Borrower>
144
Related object: L<Koha::Schema::Result::AccountOffsetType>
90
145
91
=cut
146
=cut
92
147
93
__PACKAGE__->belongs_to(
148
__PACKAGE__->belongs_to(
94
  "borrowernumber",
149
  "type",
95
  "Koha::Schema::Result::Borrower",
150
  "Koha::Schema::Result::AccountOffsetType",
96
  { borrowernumber => "borrowernumber" },
151
  { type => "type" },
97
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
152
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
98
);
153
);
99
154
100
155
101
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
156
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-20 16:27:04
102
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OTfcUiJCPb5aU/gjqAb/bA
157
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tPPrIug2c7PbDO7LCxCJAA
103
158
104
159
105
# You can replace this text with custom content, and it will be preserved on regeneration
160
# You can replace this text with custom code or comments, and it will be preserved on regeneration
106
1;
161
1;
107
- 

Return to bug 12768