is_nullable: 1
size: 200
-=head2 can_be_added_manually
+=head2 can_be_invoiced
data_type: 'tinyint'
default_value: 1
is_nullable: 0
+=head2 can_be_sold
+
+ data_type: 'tinyint'
+ default_value: 0
+ is_nullable: 0
+
=head2 default_amount
data_type: 'decimal'
{ data_type => "varchar", is_nullable => 0, size => 80 },
"description",
{ data_type => "varchar", is_nullable => 1, size => 200 },
- "can_be_added_manually",
+ "can_be_invoiced",
{ data_type => "tinyint", default_value => 1, is_nullable => 0 },
+ "can_be_sold",
+ { data_type => "tinyint", default_value => 0, is_nullable => 0 },
"default_amount",
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"is_system",
);
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-23 13:48:17
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uDKsz1QUF6zY+haOVVQZNw
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-17 12:22:04
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8FIMJZ+JAmqa+Dx7oymBjw
__PACKAGE__->add_columns(
'+is_system' => { is_boolean => 1 }
}
elsif ( $op eq 'add_validate' ) {
my $description = $input->param('description');
- my $can_be_added_manually = $input->param('can_be_added_manually') || 0;
+ my $can_be_invoiced = $input->param('can_be_invoiced') || 0;
+ my $can_be_sold = $input->param('can_be_sold') || 0;
my $default_amount = $input->param('default_amount') || undef;
my @branches = grep { $_ ne q{} } $input->multi_param('branches');
$debit_type = Koha::Account::DebitType->new( { code => $code } );
}
$debit_type->description($description);
- $debit_type->can_be_added_manually($can_be_added_manually);
+ $debit_type->can_be_invoiced($can_be_invoiced);
+ $debit_type->can_be_sold($can_be_sold);
$debit_type->default_amount($default_amount);
try {
-INSERT INTO account_debit_types ( code, description, can_be_added_manually, default_amount, is_system ) VALUES
-('ACCOUNT', 'Account creation fee', 0, NULL, 1),
-('ACCOUNT_RENEW', 'Account renewal fee', 0, NULL, 1),
-('LOST', 'Lost item', 1, NULL, 1),
-('MANUAL', 'Manual fee', 1, NULL, 0),
-('NEW_CARD', 'New card fee', 1, NULL, 1),
-('OVERDUE', 'Overdue fine', 0, NULL, 1),
-('PROCESSING', 'Lost item processing fee', 0, NULL, 1),
-('PAYOUT', 'Payment from library to patron', 0, NULL, 1),
-('RENT', 'Rental fee', 0, NULL, 1),
-('RENT_DAILY', 'Daily rental fee', 0, NULL, 1),
-('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1),
-('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, NULL, 1),
-('RESERVE', 'Hold fee', 0, NULL, 1),
-('RESERVE_EXPIRED', 'Hold waiting too long', 0, NULL, 1);
+INSERT INTO account_debit_types ( code, description, can_be_invoiced, can_be_sold, default_amount, is_system ) VALUES
+('ACCOUNT', 'Account creation fee', 0, 0, NULL, 1),
+('ACCOUNT_RENEW', 'Account renewal fee', 0, 0, NULL, 1),
+('LOST', 'Lost item', 1, 0, NULL, 1),
+('MANUAL', 'Manual fee', 1, 0, NULL, 0),
+('NEW_CARD', 'New card fee', 1, 0, NULL, 1),
+('OVERDUE', 'Overdue fine', 0, 0, NULL, 1),
+('PROCESSING', 'Lost item processing fee', 0, 0, NULL, 1),
+('PAYOUT', 'Payment from library to patron', 0, 0, NULL, 1),
+('RENT', 'Rental fee', 0, 0, NULL, 1),
+('RENT_DAILY', 'Daily rental fee', 0, 0, NULL, 1),
+('RENT_RENEW', 'Renewal of rental item', 0, 0, NULL, 1),
+('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, 0, NULL, 1),
+('RESERVE', 'Hold fee', 0, 0, NULL, 1),
+('RESERVE_EXPIRED', 'Hold waiting too long', 0, 0, NULL, 1);
INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Purchase' );
});
+ # Updating field in account_debit_types
+ unless ( column_exists('account_debit_types', 'can_be_invoiced') ) {
+ $dbh->do(
+ qq{
+ ALTER TABLE account_debit_types
+ CHANGE COLUMN
+ can_be_added_manually can_be_invoiced tinyint(1) NOT NULL DEFAULT 1
+ }
+ );
+ }
+ unless ( column_exists('account_debit_types', 'can_be_sold') ) {
+ $dbh->do(
+ qq{
+ ALTER IGNORE TABLE account_debit_types
+ ADD
+ can_be_sold tinyint(1) DEFAULT 0
+ AFTER
+ can_be_invoiced
+ }
+ );
+ }
+
$dbh->do(q{
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '<table>
CREATE TABLE `account_debit_types` (
`code` varchar(80) NOT NULL,
`description` varchar(200) DEFAULT NULL,
- `can_be_added_manually` tinyint(4) NOT NULL DEFAULT 1,
+ `can_be_invoiced` tinyint(1) NOT NULL DEFAULT 1, -- boolean flag to denote if this debit type is available for manual invoicing
+ `can_be_sold` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this debit type is available at point of sale
`default_amount` decimal(28,6) DEFAULT NULL,
`is_system` tinyint(1) NOT NULL DEFAULT 0,
`archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not
<input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
</li>
<li>
- <label for="can_be_added_manually">Can be added manually? </label>
- [% IF debit_type.can_be_added_manually %]
- <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
+ <label for="can_be_invoiced">Can be manually invoiced? </label>
+ [% IF debit_type.can_be_invoiced %]
+ <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" checked="checked" value="1" />
[% ELSE %]
- <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
+ <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" value="1" />
+ [% END %]
+ </li>
+ <li>
+ <label for="can_be_sold">Can be sold? </label>
+ [% IF debit_type.can_be_sold %]
+ <input type="checkbox" name="can_be_sold" id="can_be_sold" checked="checked" value="1" />
+ [% ELSE %]
+ <input type="checkbox" name="can_be_sold" id="can_be_sold" value="1" />
[% END %]
</li>
<li>
<th>Code</th>
<th>Description</th>
<th>Default amount</th>
- <th>Can be added manually</th>
+ <th>Available for</th>
<th>Library limitations</th>
<th>Actions</th>
</thead>
<td>[% debit_type.code | html %]</td>
<td>[% debit_type.description | html %]</td>
<td>[% debit_type.default_amount | $Price %]</td>
- <td>[% IF debit_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]</td>
+ <td>[% IF debit_type.can_be_invoiced && debit_type.can_be_sold %]
+ <i class="fa fa-id-card-o"></i> Invoicing, <i class="fa fa-shopping-cart"></i> Sale
+ [% ELSIF debit_type.can_be_invoiced %]
+ <i class="fa fa-id-card-o"></i> Invoicing
+ [% ELSIF debit_type.can_be_sold %]
+ <i class="fa fa-shopping-cart"></i> Sale
+ [% END %]
+ </td>
<td>
[% IF debit_type.library_limits.count > 0 %]
[% library_limits_str = "" %]
);
my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
- { can_be_added_manually => 1, archived => 0 },
+ { can_be_invoiced => 1, archived => 0 },
{}, $library_id );
$template->param( debit_types => \@debit_types );
$template->param(
my $invoice_types =
Koha::Account::DebitTypes->search_with_library_limits(
- { can_be_added_manually => 1 },
+ { can_be_sold => 1 },
{}, $library_id );
$template->param( invoice_types => $invoice_types );