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

(-)a/Koha/Schema/Result/Issuingrule.pm (-2 / +9 lines)
Lines 160-165 __PACKAGE__->table("issuingrules"); Link Here
160
  default_value: 0
160
  default_value: 0
161
  is_nullable: 0
161
  is_nullable: 0
162
162
163
=head2 holdspickupwait
164
165
  data_type: 'integer'
166
  is_nullable: 1
167
163
=head2 holds_per_record
168
=head2 holds_per_record
164
169
165
  data_type: 'smallint'
170
  data_type: 'smallint'
Lines 272-277 __PACKAGE__->add_columns( Link Here
272
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
277
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
273
  "reservesallowed",
278
  "reservesallowed",
274
  { data_type => "smallint", default_value => 0, is_nullable => 0 },
279
  { data_type => "smallint", default_value => 0, is_nullable => 0 },
280
  "holdspickupwait",
281
  { data_type => "integer", is_nullable => 1 },
275
  "holds_per_record",
282
  "holds_per_record",
276
  { data_type => "smallint", default_value => 1, is_nullable => 0 },
283
  { data_type => "smallint", default_value => 1, is_nullable => 0 },
277
  "holds_per_day",
284
  "holds_per_day",
Lines 314-321 __PACKAGE__->add_columns( Link Here
314
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
321
__PACKAGE__->set_primary_key("branchcode", "categorycode", "itemtype");
315
322
316
323
317
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-05 20:49:11
324
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-20 02:39:10
318
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6bPX0BRWWQZrWFun3GP86Q
325
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nVZzow7RuzPASVF3rdxeZg
319
326
320
sub koha_object_class {
327
sub koha_object_class {
321
    'Koha::IssuingRule';
328
    'Koha::IssuingRule';
(-)a/Koha/Schema/Result/OldReserve.pm (-2 / +10 lines)
Lines 130-135 __PACKAGE__->table("old_reserves"); Link Here
130
  datetime_undef_if_invalid: 1
130
  datetime_undef_if_invalid: 1
131
  is_nullable: 1
131
  is_nullable: 1
132
132
133
=head2 lastpickupdate
134
135
  data_type: 'date'
136
  datetime_undef_if_invalid: 1
137
  is_nullable: 1
138
133
=head2 itemtype
139
=head2 itemtype
134
140
135
  data_type: 'varchar'
141
  data_type: 'varchar'
Lines 196-201 __PACKAGE__->add_columns( Link Here
196
    datetime_undef_if_invalid => 1,
202
    datetime_undef_if_invalid => 1,
197
    is_nullable => 1,
203
    is_nullable => 1,
198
  },
204
  },
205
  "lastpickupdate",
206
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
199
  "itemtype",
207
  "itemtype",
200
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
208
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
201
  "item_level_hold",
209
  "item_level_hold",
Lines 297-304 __PACKAGE__->belongs_to( Link Here
297
);
305
);
298
306
299
307
300
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 07:24:39
308
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-20 02:39:10
301
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZgGAW7ODBby3hGNJ41eeMA
309
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CTozZnDtmr5SAU10tRbNUw
302
310
303
sub koha_object_class {
311
sub koha_object_class {
304
    'Koha::Old::Hold';
312
    'Koha::Old::Hold';
(-)a/Koha/Schema/Result/Reserve.pm (-2 / +10 lines)
Lines 134-139 __PACKAGE__->table("reserves"); Link Here
134
  datetime_undef_if_invalid: 1
134
  datetime_undef_if_invalid: 1
135
  is_nullable: 1
135
  is_nullable: 1
136
136
137
=head2 lastpickupdate
138
139
  data_type: 'date'
140
  datetime_undef_if_invalid: 1
141
  is_nullable: 1
142
137
=head2 itemtype
143
=head2 itemtype
138
144
139
  data_type: 'varchar'
145
  data_type: 'varchar'
Lines 210-215 __PACKAGE__->add_columns( Link Here
210
    datetime_undef_if_invalid => 1,
216
    datetime_undef_if_invalid => 1,
211
    is_nullable => 1,
217
    is_nullable => 1,
212
  },
218
  },
219
  "lastpickupdate",
220
  { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
213
  "itemtype",
221
  "itemtype",
214
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
222
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
215
  "item_level_hold",
223
  "item_level_hold",
Lines 321-328 __PACKAGE__->belongs_to( Link Here
321
);
329
);
322
330
323
331
324
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 07:24:39
332
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-20 02:39:10
325
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OMFqEWyKqFTcYj7vAFXy/g
333
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B9A9RCfZpr/rGs362rQ9RA
326
334
327
__PACKAGE__->belongs_to(
335
__PACKAGE__->belongs_to(
328
  "item",
336
  "item",
(-)a/installer/data/mysql/atomicupdate/bug_8367.perl (-21 / +30 lines)
Lines 1-21 Link Here
1
my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0; #MaxPickupDelay
1
$DBversion = 'XXX'; #Replaced by RM
2
$dbh->do(q{ DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay'; });
2
if( CheckVersion( $DBversion ) ) {
3
$dbh->do(q{ DELETE FROM systempreferences WHERE variable='ExpireReservesOnHolidays'; });
3
    my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0; #MaxPickupDelay
4
#        //DELETE FROM systempreferences WHERE variable='ExpireReservesMaxPickUpDelay'; #This syspref is not needed and would be better suited to be calculated from the holdspickupwait
4
    $dbh->do(q{ DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay'; });
5
#        //ExpireReservesMaxPickUpDelayCharge #This could be added as a column to the issuing rules.
5
    $dbh->do(q{ DELETE FROM systempreferences WHERE variable='ExpireReservesOnHolidays'; });
6
$dbh->do(q{ ALTER TABLE issuingrules ADD COLUMN holdspickupwait INT(11) NULL default NULL AFTER reservesallowed; });
6
    #        //DELETE FROM systempreferences WHERE variable='ExpireReservesMaxPickUpDelay'; #This syspref is not needed and would be better suited to be calculated from the holdspickupwait
7
$dbh->do(q{ ALTER TABLE reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; });
7
    #        //ExpireReservesMaxPickUpDelayCharge #This could be added as a column to the issuing rules.
8
$dbh->do(q{ ALTER TABLE old_reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; });
8
    unless( column_exists( 'issuingrules', 'holdspickupwait' ) ) {
9
my $sth = $dbh->prepare(q{
9
        $dbh->do(q{ ALTER TABLE issuingrules ADD COLUMN holdspickupwait INT(11) NULL default NULL AFTER reservesallowed; });
10
    UPDATE issuingrules SET holdspickupwait = ?
10
    }
11
});
11
    unless( column_exists( 'reserves', 'lastpickupdate' ) ) {
12
$sth->execute( $maxpickupdelay ) if $maxpickupdelay; #Don't want to accidentally nullify all!
12
        $dbh->do(q{ ALTER TABLE reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; });
13
##Populate the lastpickupdate-column from existing 'ReservesMaxPickUpDelay'
13
    }
14
print "Populating the new lastpickupdate-column for all waiting holds. This might take a while.\n";
14
    unless( column_exists( 'old_reserves', 'lastpickupdate' ) ) {
15
$sth = $dbh->prepare(q{ SELECT * FROM reserves WHERE found = 'W'; });
15
        $dbh->do(q{ ALTER TABLE old_reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; });
16
$sth->execute( );
16
    }
17
my $dtdur = DateTime::Duration->new( days => 0 );
17
18
while ( my $res = $sth->fetchrow_hashref ) {
18
    my $sth = $dbh->prepare(q{
19
     C4::Reserves::MoveWaitingdate( $res, $dtdur ); #We call MoveWaitingdate with a 0 duration to simply recalculate the lastpickupdate and store the new values to DB.
19
        UPDATE issuingrules SET holdspickupwait = ?
20
    });
21
    $sth->execute( $maxpickupdelay ) if $maxpickupdelay; #Don't want to accidentally nullify all!
22
    ##Populate the lastpickupdate-column from existing 'ReservesMaxPickUpDelay'
23
    print "Populating the new lastpickupdate-column for all waiting holds. This might take a while.\n";
24
    $sth = $dbh->prepare(q{ SELECT * FROM reserves WHERE found = 'W'; });
25
    $sth->execute( );
26
    my $dtdur = DateTime::Duration->new( days => 0 );
27
    while ( my $res = $sth->fetchrow_hashref ) {
28
        C4::Reserves::MoveWaitingdate( $res, $dtdur ); #We call MoveWaitingdate with a 0 duration to simply recalculate the lastpickupdate and store the new values to DB.
29
    }
30
    print "Upgrade to $DBversion done (Bug 8367: Add colum issuingrules.holdspickupwait and reserves.lastpickupdate. Populates introduced columns from the expiring ReservesMaxPickUpDelay. Deletes the ReservesMaxPickUpDelay and ExpireReservesOnHolidays -sysprefs)\n";
20
}
31
}
21
print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupwait and reserves.lastpickupdate. Populates introduced columns from the expiring ReservesMaxPickUpDelay. Deletes the ReservesMaxPickUpDelay and ExpireReservesOnHolidays -sysprefs)\n";>>>>>>> Bug 8367: Template fixes + fixes to C4/Reserves.pm and Koha/Hold.pm
22
- 

Return to bug 8367