Browse Source
Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>20.05.x
31 changed files with 1350 additions and 1339 deletions
@ -1,68 +0,0 @@ |
|||
package Koha::IssuingRule; |
|||
|
|||
# Copyright Vaara-kirjastot 2015 |
|||
# |
|||
# This file is part of Koha. |
|||
# |
|||
# Koha is free software; you can redistribute it and/or modify it under the |
|||
# terms of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 3 of the License, or (at your option) any later |
|||
# version. |
|||
# |
|||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
|||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
|||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU General Public License along |
|||
# with Koha; if not, write to the Free Software Foundation, Inc., |
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
|
|||
use Modern::Perl; |
|||
use Koha::Database; |
|||
use base qw(Koha::Object); |
|||
|
|||
=head1 NAME |
|||
|
|||
Koha::Hold - Koha Hold object class |
|||
|
|||
=head1 API |
|||
|
|||
=head2 Class Methods |
|||
|
|||
=cut |
|||
|
|||
=head3 delete |
|||
|
|||
=cut |
|||
|
|||
sub delete { |
|||
my ($self) = @_; |
|||
|
|||
my $branchcode = $self->branchcode eq '*' ? undef : $self->branchcode; |
|||
my $categorycode = $self->categorycode eq '*' ? undef : $self->categorycode; |
|||
my $itemtype = $self->itemtype eq '*' ? undef : $self->itemtype; |
|||
|
|||
Koha::CirculationRules->search({ |
|||
branchcode => $branchcode, |
|||
itemtype => $itemtype, |
|||
categorycode => $categorycode, |
|||
rule_name => [qw( |
|||
maxissueqty |
|||
maxonsiteissueqty |
|||
max_holds |
|||
)], |
|||
})->delete; |
|||
|
|||
$self->SUPER::delete; |
|||
|
|||
} |
|||
|
|||
=head3 type |
|||
|
|||
=cut |
|||
|
|||
sub _type { |
|||
return 'Issuingrule'; |
|||
} |
|||
|
|||
1; |
@ -1,327 +0,0 @@ |
|||
use utf8; |
|||
package Koha::Schema::Result::Issuingrule; |
|||
|
|||
# Created by DBIx::Class::Schema::Loader |
|||
# DO NOT MODIFY THE FIRST PART OF THIS FILE |
|||
|
|||
=head1 NAME |
|||
|
|||
Koha::Schema::Result::Issuingrule |
|||
|
|||
=cut |
|||
|
|||
use strict; |
|||
use warnings; |
|||
|
|||
use base 'DBIx::Class::Core'; |
|||
|
|||
=head1 TABLE: C<issuingrules> |
|||
|
|||
=cut |
|||
|
|||
__PACKAGE__->table("issuingrules"); |
|||
|
|||
=head1 ACCESSORS |
|||
|
|||
=head2 categorycode |
|||
|
|||
data_type: 'varchar' |
|||
default_value: (empty string) |
|||
is_nullable: 0 |
|||
size: 10 |
|||
|
|||
=head2 itemtype |
|||
|
|||
data_type: 'varchar' |
|||
default_value: (empty string) |
|||
is_nullable: 0 |
|||
size: 10 |
|||
|
|||
=head2 restrictedtype |
|||
|
|||
data_type: 'tinyint' |
|||
is_nullable: 1 |
|||
|
|||
=head2 rentaldiscount |
|||
|
|||
data_type: 'decimal' |
|||
is_nullable: 1 |
|||
size: [28,6] |
|||
|
|||
=head2 reservecharge |
|||
|
|||
data_type: 'decimal' |
|||
is_nullable: 1 |
|||
size: [28,6] |
|||
|
|||
=head2 fine |
|||
|
|||
data_type: 'decimal' |
|||
is_nullable: 1 |
|||
size: [28,6] |
|||
|
|||
=head2 finedays |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 maxsuspensiondays |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 suspension_chargeperiod |
|||
|
|||
data_type: 'integer' |
|||
default_value: 1 |
|||
is_nullable: 1 |
|||
|
|||
=head2 firstremind |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 chargeperiod |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 chargeperiod_charge_at |
|||
|
|||
data_type: 'tinyint' |
|||
default_value: 0 |
|||
is_nullable: 0 |
|||
|
|||
=head2 accountsent |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 issuelength |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 lengthunit |
|||
|
|||
data_type: 'varchar' |
|||
default_value: 'days' |
|||
is_nullable: 1 |
|||
size: 10 |
|||
|
|||
=head2 hardduedate |
|||
|
|||
data_type: 'date' |
|||
datetime_undef_if_invalid: 1 |
|||
is_nullable: 1 |
|||
|
|||
=head2 hardduedatecompare |
|||
|
|||
data_type: 'tinyint' |
|||
default_value: 0 |
|||
is_nullable: 0 |
|||
|
|||
=head2 renewalsallowed |
|||
|
|||
data_type: 'smallint' |
|||
default_value: 0 |
|||
is_nullable: 0 |
|||
|
|||
=head2 renewalperiod |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 norenewalbefore |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 auto_renew |
|||
|
|||
data_type: 'tinyint' |
|||
default_value: 0 |
|||
is_nullable: 1 |
|||
|
|||
=head2 no_auto_renewal_after |
|||
|
|||
data_type: 'integer' |
|||
is_nullable: 1 |
|||
|
|||
=head2 no_auto_renewal_after_hard_limit |
|||
|
|||
data_type: 'date' |
|||
datetime_undef_if_invalid: 1 |
|||
is_nullable: 1 |
|||
|
|||
=head2 reservesallowed |
|||
|
|||
data_type: 'smallint' |
|||
default_value: 0 |
|||
is_nullable: 0 |
|||
|
|||
=head2 holds_per_record |
|||
|
|||
data_type: 'smallint' |
|||
default_value: 1 |
|||
is_nullable: 0 |
|||
|
|||
=head2 holds_per_day |
|||
|
|||
data_type: 'smallint' |
|||
is_nullable: 1 |
|||
|
|||
=head2 branchcode |
|||
|
|||
data_type: 'varchar' |
|||
default_value: (empty string) |
|||
is_nullable: 0 |
|||
size: 10 |
|||
|
|||
=head2 overduefinescap |
|||
|
|||
data_type: 'decimal' |
|||
is_nullable: 1 |
|||
size: [28,6] |
|||
|
|||
=head2 cap_fine_to_replacement_price |
|||
|
|||
data_type: 'tinyint' |
|||
default_value: 0 |
|||
is_nullable: 0 |
|||
|
|||
=head2 onshelfholds |
|||
|
|||
data_type: 'tinyint' |
|||
default_value: 0 |
|||
is_nullable: 0 |
|||
|
|||
=head2 opacitemholds |
|||
|
|||
data_type: 'char' |
|||
default_value: 'N' |
|||
is_nullable: 0 |
|||
size: 1 |
|||
|
|||
=head2 article_requests |
|||
|
|||
data_type: 'enum' |
|||
default_value: 'no' |
|||
extra: {list => ["no","yes","bib_only","item_only"]} |
|||
is_nullable: 0 |
|||
|
|||
=head2 note |
|||
|
|||
data_type: 'varchar' |
|||
is_nullable: 1 |
|||
size: 100 |
|||
|
|||
=cut |
|||
|
|||
__PACKAGE__->add_columns( |
|||
"categorycode", |
|||
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, |
|||
"itemtype", |
|||
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, |
|||
"restrictedtype", |
|||
{ data_type => "tinyint", is_nullable => 1 }, |
|||
"rentaldiscount", |
|||
{ data_type => "decimal", is_nullable => 1, size => [28, 6] }, |
|||
"reservecharge", |
|||
{ data_type => "decimal", is_nullable => 1, size => [28, 6] }, |
|||
"fine", |
|||
{ data_type => "decimal", is_nullable => 1, size => [28, 6] }, |
|||
"finedays", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"maxsuspensiondays", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"suspension_chargeperiod", |
|||
{ data_type => "integer", default_value => 1, is_nullable => 1 }, |
|||
"firstremind", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"chargeperiod", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"chargeperiod_charge_at", |
|||
{ data_type => "tinyint", default_value => 0, is_nullable => 0 }, |
|||
"accountsent", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"issuelength", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"lengthunit", |
|||
{ |
|||
data_type => "varchar", |
|||
default_value => "days", |
|||
is_nullable => 1, |
|||
size => 10, |
|||
}, |
|||
"hardduedate", |
|||
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, |
|||
"hardduedatecompare", |
|||
{ data_type => "tinyint", default_value => 0, is_nullable => 0 }, |
|||
"renewalsallowed", |
|||
{ data_type => "smallint", default_value => 0, is_nullable => 0 }, |
|||
"renewalperiod", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"norenewalbefore", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"auto_renew", |
|||
{ data_type => "tinyint", default_value => 0, is_nullable => 1 }, |
|||
"no_auto_renewal_after", |
|||
{ data_type => "integer", is_nullable => 1 }, |
|||
"no_auto_renewal_after_hard_limit", |
|||
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, |
|||
"reservesallowed", |
|||
{ data_type => "smallint", default_value => 0, is_nullable => 0 }, |
|||
"holds_per_record", |
|||
{ data_type => "smallint", default_value => 1, is_nullable => 0 }, |
|||
"holds_per_day", |
|||
{ data_type => "smallint", is_nullable => 1 }, |
|||
"branchcode", |
|||
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, |
|||
"overduefinescap", |
|||
{ data_type => "decimal", is_nullable => 1, size => [28, 6] }, |
|||
"cap_fine_to_replacement_price", |
|||
{ data_type => "tinyint", default_value => 0, is_nullable => 0 }, |
|||
"onshelfholds", |
|||
{ data_type => "tinyint", default_value => 0, is_nullable => 0 }, |
|||
"opacitemholds", |
|||
{ data_type => "char", default_value => "N", is_nullable => 0, size => 1 }, |
|||
"article_requests", |
|||
{ |
|||
data_type => "enum", |
|||
default_value => "no", |
|||
extra => { list => ["no", "yes", "bib_only", "item_only"] }, |
|||
is_nullable => 0, |
|||
}, |
|||
"note", |
|||
{ data_type => "varchar", is_nullable => 1, size => 100 }, |
|||
); |
|||
|
|||
=head1 PRIMARY KEY |
|||
|
|||
=over 4 |
|||
|
|||
=item * L</branchcode> |
|||
|
|||
=item * L</categorycode> |
|||
|
|||
=item * L</itemtype> |
|||
|
|||
=back |
|||
|
|||
=cut |
|||
|
|||
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype"); |
|||
|
|||
|
|||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:49:11 |
|||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6bPX0BRWWQZrWFun3GP86Q |
|||
|
|||
sub koha_object_class { |
|||
'Koha::IssuingRule'; |
|||
} |
|||
sub koha_objects_class { |
|||
'Koha::IssuingRules'; |
|||
} |
|||
|
|||
1; |
@ -0,0 +1,45 @@ |
|||
$DBversion = 'XXX'; # will be replaced by the RM |
|||
if( CheckVersion( $DBversion ) ) { |
|||
my @columns = qw( |
|||
restrictedtype |
|||
rentaldiscount |
|||
fine |
|||
finedays |
|||
maxsuspensiondays |
|||
firstremind |
|||
chargeperiod |
|||
chargeperiod_charge_at |
|||
accountsent |
|||
issuelength |
|||
lengthunit |
|||
hardduedate |
|||
hardduedatecompare |
|||
renewalsallowed |
|||
renewalperiod |
|||
norenewalbefore |
|||
auto_renew |
|||
no_auto_renewal_after |
|||
no_auto_renewal_after_hard_limit |
|||
reservesallowed |
|||
holds_per_record |
|||
overduefinescap |
|||
cap_fine_to_replacement_price |
|||
onshelfholds |
|||
opacitemholds |
|||
article_requests |
|||
); |
|||
|
|||
if ( column_exists( 'issuingrules', 'categorycode' ) ) { |
|||
foreach my $column ( @columns ) { |
|||
$dbh->do(" |
|||
INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) |
|||
SELECT categorycode, branchcode, itemtype, 'column', $column |
|||
FROM issuingrules |
|||
"); |
|||
} |
|||
$dbh->do("DROP TABLE issuingrules"); |
|||
} |
|||
|
|||
SetVersion( $DBversion ); |
|||
print "Upgrade to $DBversion done (Bug 18930 - Move lost item refund rules to circulation_rules table)\n"; |
|||
} |
Loading…
Reference in new issue