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

(-)a/Koha/Template/Plugin/Biblio.pm (-1 / +5 lines)
Lines 73-79 sub CanBook { Link Here
73
73
74
    my $biblio = Koha::Biblios->find($biblionumber);
74
    my $biblio = Koha::Biblios->find($biblionumber);
75
    return 0 unless $biblio;
75
    return 0 unless $biblio;
76
    return $biblio->bookable_items->count ? 1 : 0;
76
    my $biblio_itemtype = Koha::ItemTypes->find($biblio->itemtype);
77
    my $bookable_itemtype = $biblio_itemtype->bookable;
78
79
    return 1 if $bookable_itemtype || $biblio->bookable_items->count;
80
    return 0;
77
}
81
}
78
82
79
sub BookingsCount {
83
sub BookingsCount {
(-)a/admin/itemtypes.pl (+3 lines)
Lines 98-103 if ( $op eq 'add_form' ) { Link Here
98
    my $rentalcharge_daily_calendar  = $input->param('rentalcharge_daily_calendar') // 0;
98
    my $rentalcharge_daily_calendar  = $input->param('rentalcharge_daily_calendar') // 0;
99
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
99
    my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
100
    my $automatic_checkin = $input->param('automatic_checkin') // 0;
100
    my $automatic_checkin = $input->param('automatic_checkin') // 0;
101
    my $bookable = $input->param('bookable')// 0;
101
102
102
    if ( $itemtype and $is_a_modif ) {    # it's a modification
103
    if ( $itemtype and $is_a_modif ) {    # it's a modification
103
        $itemtype->description($description);
104
        $itemtype->description($description);
Lines 118-123 if ( $op eq 'add_form' ) { Link Here
118
        $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
119
        $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
119
        $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar);
120
        $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar);
120
        $itemtype->automatic_checkin($automatic_checkin);
121
        $itemtype->automatic_checkin($automatic_checkin);
122
        $itemtype->bookable($bookable);
121
123
122
        eval {
124
        eval {
123
          $itemtype->store;
125
          $itemtype->store;
Lines 151-156 if ( $op eq 'add_form' ) { Link Here
151
                rentalcharge_daily_calendar  => $rentalcharge_daily_calendar,
153
                rentalcharge_daily_calendar  => $rentalcharge_daily_calendar,
152
                rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar,
154
                rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar,
153
                automatic_checkin   => $automatic_checkin,
155
                automatic_checkin   => $automatic_checkin,
156
                bookable   => $bookable,
154
            }
157
            }
155
        );
158
        );
156
        eval {
159
        eval {
(-)a/installer/data/mysql/atomicupdate/Bug_35906_add-column-bookable-itemtype.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "35906",
5
    description => "Add bookable column on itemtypes table",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do('ALTER TABLE itemtypes ADD IF NOT EXISTS bookable INT(1) DEFAULT 0');
11
12
        say $out "Added column 'itemtypes.bookable'";
13
    },
14
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 4123-4128 CREATE TABLE `itemtypes` ( Link Here
4123
  `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
4123
  `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC',
4124
  `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
4124
  `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options',
4125
  `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
4125
  `automatic_checkin` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'If automatic checkin is enabled for items of this type',
4126
  `bookable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Activate bookable feature for items related to this item type',
4126
  PRIMARY KEY (`itemtype`),
4127
  PRIMARY KEY (`itemtype`),
4127
  UNIQUE KEY `itemtype` (`itemtype`),
4128
  UNIQUE KEY `itemtype` (`itemtype`),
4128
  KEY `itemtypes_ibfk_1` (`parent_type`),
4129
  KEY `itemtypes_ibfk_1` (`parent_type`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (+9 lines)
Lines 256-261 Link Here
256
                        [% END %]
256
                        [% END %]
257
                        <span class="hint">If checked, items will be automatically checked in once they've reached their due date. This feature requires the <code>misc/cronjobs/automatic_checkin.pl</code> cronjob. Ask your system administrator to schedule it.</span>
257
                        <span class="hint">If checked, items will be automatically checked in once they've reached their due date. This feature requires the <code>misc/cronjobs/automatic_checkin.pl</code> cronjob. Ask your system administrator to schedule it.</span>
258
                </li>
258
                </li>
259
                <li>
260
                    <label for="bookable">Bookable: </label>
261
                        [% IF itemtype.bookable %]
262
                            <input type="checkbox" id="bookable" name="bookable" checked="checked" value="1" />
263
                        [% ELSE %]
264
                            <input type="checkbox" id="bookable" name="bookable" value="1" />
265
                        [% END %]
266
                        <span class="hint">If checked, items related to this item type will benefit from the "booking" feature.</span>
267
                </li>
259
                <li>
268
                <li>
260
                    <label for="rentalcharge">Rental charge: </label>
269
                    <label for="rentalcharge">Rental charge: </label>
261
                    <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% itemtype.rentalcharge | $Price on_editing => 1 %]" min="0" />
270
                    <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% itemtype.rentalcharge | $Price on_editing => 1 %]" min="0" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (-3 / +6 lines)
Lines 346-352 Link Here
346
                                            </form>
346
                                            </form>
347
                                        </li>
347
                                        </li>
348
                                        <li>
348
                                        <li>
349
                                            <span class="label">Bookable:</span>
349
                                            [% SET itemtype_bookable_status = ITEM_DAT.effective_itemtype.bookable == 1 ? "bookable" : "not bookable" %]
350
                                            <span class="label">
351
                                                Bookable:
352
                                                [% IF ITEM_DAT.bookable != ITEM_DAT.effective_itemtype.bookable %]<i class="fa fa-warning warn" Title="Itemtype is actually [% itemtype_bookable_status | html %]"></i>[% END %]
353
                                            </span>
350
                                            [% IF ( CAN_user_circulate ) %]
354
                                            [% IF ( CAN_user_circulate ) %]
351
                                                <form action="updateitem.pl" method="post">
355
                                                <form action="updateitem.pl" method="post">
352
                                                    <input type="hidden" name="biblionumber" value="[% ITEM_DAT.biblionumber | html %]" />
356
                                                    <input type="hidden" name="biblionumber" value="[% ITEM_DAT.biblionumber | html %]" />
Lines 365-371 Link Here
365
                                                    <input type="submit" name="submit" class="btn btn-primary btn-xs" value="Update" />
369
                                                    <input type="submit" name="submit" class="btn btn-primary btn-xs" value="Update" />
366
                                                </form>
370
                                                </form>
367
                                            [% ELSE %]
371
                                            [% ELSE %]
368
                                                [% IF ITEM_DAT.bookable == 1 %] Yes [% ELSE %] No [% END %]
372
                                                [% IF ITEM_DAT.bookable == 1 || ITEM_DAT.effective_itemtype.bookable == 1 %] Yes [% ELSE %] No [% END %]
369
                                            [% END %]
373
                                            [% END %]
370
                                        </li>
374
                                        </li>
371
375
372
- 

Return to bug 35906