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

(-)a/Koha/Hold.pm (+18 lines)
Lines 271-276 sub cleanup_hold_group { Link Here
271
    }
271
    }
272
}
272
}
273
273
274
=head3 is_hold_group_target
275
276
$self->is_hold_group_target;
277
278
Returns whether this hold is its hold group target
279
280
=cut
281
282
sub is_hold_group_target {
283
    my ($self) = @_;
284
285
    return 1
286
        if $self->hold_group
287
        && $self->hold_group->target_hold_id
288
        && $self->hold_group->target_hold_id eq $self->reserve_id;
289
    return 0;
290
}
291
274
=head3 set_transfer
292
=head3 set_transfer
275
293
276
=cut
294
=cut
(-)a/Koha/HoldGroup.pm (+16 lines)
Lines 78-83 sub holds { Link Here
78
    return Koha::Holds->_new_from_dbic($holds_rs);
78
    return Koha::Holds->_new_from_dbic($holds_rs);
79
}
79
}
80
80
81
=head3 target_hold_id
82
83
    $holds = $hold_group->target_hold_id
84
85
Return the target_hold_id
86
87
=cut
88
89
sub target_hold_id {
90
    my ($self) = @_;
91
92
    return unless $self->_result->hold_group_target_hold;
93
94
    return $self->_result->hold_group_target_hold->reserve_id;
95
}
96
81
=head3 _type
97
=head3 _type
82
98
83
=cut
99
=cut
(-)a/api/v1/swagger/definitions/hold_group.yaml (+3 lines)
Lines 10-15 properties: Link Here
10
  visual_hold_group_id:
10
  visual_hold_group_id:
11
    type: integer
11
    type: integer
12
    description: Visual ID for this hold group, in the context of the related patron
12
    description: Visual ID for this hold group, in the context of the related patron
13
  target_hold_id:
14
    type: integer
15
    description: Target hold ID of this hold group
13
  holds:
16
  holds:
14
    type:
17
    type:
15
      - array
18
      - array
(-)a/installer/data/mysql/atomicupdate/bug_40529_-_hold_group_table_target.pl (+25 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "40529",
6
    description => "Add 'hold_groups_target_hold_id' column to hold_groups",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        unless ( TableExists('hold_group_target_holds') ) {
12
            $dbh->do(
13
                q{
14
                    CREATE TABLE hold_group_target_holds (
15
                        `hold_group_id` int unsigned NOT NULL UNIQUE COMMENT 'foreign key, linking this to the hold_groups table',
16
                        `reserve_id` int(11) DEFAULT NULL UNIQUE COMMENT 'foreign key, linking this to the reserves table',
17
                        CONSTRAINT `hold_group_target_holds_ibfk_1` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE CASCADE,
18
                        CONSTRAINT `hold_group_target_holds_ibfk_2` FOREIGN KEY (`reserve_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE
19
                    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
20
                }
21
            );
22
            say_success( $out, "Added table 'hold_group_target_holds'" );
23
        }
24
    },
25
};
(-)a/installer/data/mysql/kohastructure.sql (+14 lines)
Lines 5113-5118 CREATE TABLE `old_issues` ( Link Here
5113
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5113
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5114
/*!40101 SET character_set_client = @saved_cs_client */;
5114
/*!40101 SET character_set_client = @saved_cs_client */;
5115
5115
5116
--
5117
-- Table structure for table `hold_group_target_holds`
5118
--
5119
DROP TABLE IF EXISTS `hold_group_target_holds`;
5120
/*!40101 SET @saved_cs_client     = @@character_set_client */;
5121
/*!40101 SET character_set_client = utf8 */;
5122
CREATE TABLE hold_group_target_holds (
5123
    `hold_group_id` int unsigned NOT NULL UNIQUE COMMENT 'foreign key, linking this to the hold_groups table',
5124
    `reserve_id` int(11) DEFAULT NULL UNIQUE COMMENT 'foreign key, linking this to the reserves table',
5125
    CONSTRAINT `hold_group_target_holds_ibfk_1` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_groups` (`hold_group_id`) ON DELETE CASCADE,
5126
    CONSTRAINT `hold_group_target_holds_ibfk_2` FOREIGN KEY (`reserve_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE
5127
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5128
/*!40101 SET character_set_client = @saved_cs_client */;
5129
5116
--
5130
--
5117
-- Table structure for table `old_reserves`
5131
-- Table structure for table `old_reserves`
5118
--
5132
--
(-)a/koha-tmpl/intranet-tmpl/prog/js/holds.js (+8 lines)
Lines 259-264 $(document).ready(function () { Link Here
259
                                        "</span>";
259
                                        "</span>";
260
                                }
260
                                }
261
261
262
                                if (oObj.is_hold_group_target) {
263
                                    var link = __("target of hold group");
264
                                    title +=
265
                                        '<br><span class="fw-bold fst-italic">(' +
266
                                        link +
267
                                        ")</span>";
268
                                }
269
262
                                return title;
270
                                return title;
263
                            },
271
                            },
264
                        },
272
                        },
(-)a/svc/holds (-1 / +1 lines)
Lines 115-120 while ( my $h = $holds_rs->next() ) { Link Here
115
        itemtype_limit        => $itemtype_limit,
115
        itemtype_limit        => $itemtype_limit,
116
        hold_group_id         => $h->hold_group_id,
116
        hold_group_id         => $h->hold_group_id,
117
        visual_hold_group_id  => $h->hold_group ? $h->hold_group->visual_hold_group_id : q{},
117
        visual_hold_group_id  => $h->hold_group ? $h->hold_group->visual_hold_group_id : q{},
118
        is_hold_group_target  => $h->is_hold_group_target,
118
        reservedate_formatted => $h->reservedate()
119
        reservedate_formatted => $h->reservedate()
119
        ? output_pref( { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } )
120
        ? output_pref( { dt => dt_from_string( $h->reservedate() ), dateonly => 1 } )
120
        : q{},
121
        : q{},
121
- 

Return to bug 40529