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

(-)a/C4/HoldsQueue.pm (-2 / +2 lines)
Lines 409-416 sub MapItemsToHoldRequests { Link Here
409
                next
409
                next
410
                  if ( !$item->{holdallowed} )
410
                  if ( !$item->{holdallowed} )
411
                  || ( $item->{holdallowed} == 1
411
                  || ( $item->{holdallowed} == 1
412
                    && $item->{homebranch} ne $request->{borrowerbranch}
412
                    && $item->{homebranch} ne $request->{borrowerbranch} )
413
                  || $item->{_object}->exclude_from_local_holds_priority );
413
                  || $item->{_object}->exclude_from_local_holds_priority;
414
414
415
                next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber};
415
                next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber};
416
416
(-)a/catalogue/moredetail.pl (-1 / +1 lines)
Lines 51-57 my ($template, $loggedinuser, $cookie) = get_template_and_user( Link Here
51
);
51
);
52
52
53
$template->param(
53
$template->param(
54
    updated_exclude_from_local_holds_priority => $query->param('updated_exclude_from_local_holds_priority')
54
    updated_exclude_from_local_holds_priority => scalar($query->param('updated_exclude_from_local_holds_priority'))
55
);
55
);
56
56
57
if($query->cookie("holdfor")){ 
57
if($query->cookie("holdfor")){ 
(-)a/catalogue/updateitem.pl (-3 / +3 lines)
Lines 56-62 for ($damaged,$itemlost,$withdrawn) { Link Here
56
    }
56
    }
57
}
57
}
58
58
59
my $alerts = q{};
59
my $messages = q{};
60
60
61
# modify MARC item if input differs from items table.
61
# modify MARC item if input differs from items table.
62
if ( $op eq "set_non_public_note" ) {
62
if ( $op eq "set_non_public_note" ) {
Lines 76-82 elsif ( $op eq "set_public_note" ) { # i.e., itemnotes parameter passed from for Link Here
76
    $item->withdrawn($withdrawn);
76
    $item->withdrawn($withdrawn);
77
} elsif ( $op eq "set_exclude_priority" && $exclude_from_local_holds_priority ne $item_data_hashref->{'exclude_from_local_holds_priority'}) {
77
} elsif ( $op eq "set_exclude_priority" && $exclude_from_local_holds_priority ne $item_data_hashref->{'exclude_from_local_holds_priority'}) {
78
    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
78
    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
79
    $alerts = "updated_exclude_from_local_holds_priority=$exclude_from_local_holds_priority&";
79
    $messages = "updated_exclude_from_local_holds_priority=$exclude_from_local_holds_priority&";
80
} elsif ( $op eq "set_damaged" && $damaged ne $item_data_hashref->{'damaged'}) {
80
} elsif ( $op eq "set_damaged" && $damaged ne $item_data_hashref->{'damaged'}) {
81
    $item->damaged($damaged);
81
    $item->damaged($damaged);
82
} else {
82
} else {
Lines 89-92 $item->store; Link Here
89
89
90
LostItem($itemnumber, 'moredetail') if $op eq "set_lost";
90
LostItem($itemnumber, 'moredetail') if $op eq "set_lost";
91
91
92
print $cgi->redirect("moredetail.pl?" . $alerts . "biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");
92
print $cgi->redirect("moredetail.pl?" . $messages . "biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+8 lines)
Lines 436-441 Link Here
436
                    <th scope="col">Check previous checkout?</th>
436
                    <th scope="col">Check previous checkout?</th>
437
                    [% END %]
437
                    [% END %]
438
                    <th scope="col">Default privacy</th>
438
                    <th scope="col">Default privacy</th>
439
                    <th scope="col">Exclude from local holds priority</th>
439
                    <th scope="col">Actions</th>
440
                    <th scope="col">Actions</th>
440
                </tr>
441
                </tr>
441
            </thead>
442
            </thead>
Lines 549-554 Link Here
549
                                Forever
550
                                Forever
550
                            [% END %]
551
                            [% END %]
551
                        </td>
552
                        </td>
553
                        <td>
554
                            [% IF category.exclude_from_local_holds_priority %]
555
                                Yes
556
                            [% ELSE %]
557
                                No
558
                            [% END %]
559
                        </td>
552
                        <td class="actions">
560
                        <td class="actions">
553
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
561
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=add_form&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-pencil"></i> Edit</a>
554
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-trash"></i> Delete</a>
562
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/categories.pl?op=delete_confirm&amp;categorycode=[% category.categorycode |uri %]"><i class="fa fa-trash"></i> Delete</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (-1 / +5 lines)
Lines 61-67 Link Here
61
    [% IF updated_exclude_from_local_holds_priority.defined %]
61
    [% IF updated_exclude_from_local_holds_priority.defined %]
62
    <div class="dialog message">
62
    <div class="dialog message">
63
        <i>Exclude from local holds priority</i> updated to
63
        <i>Exclude from local holds priority</i> updated to
64
        [% IF updated_exclude_from_local_holds_priority %]<i>Yes</i>[% ELSE %]<i>No</i>[% END %]
64
        [% IF updated_exclude_from_local_holds_priority %]
65
            <i>Yes</i>
66
        [% ELSE %]
67
            <i>No</i>
68
        [% END %]
65
    </div>
69
    </div>
66
    [% END %]
70
    [% END %]
67
71
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt (-1 / +1 lines)
Lines 341-347 $(document).ready(function(){ Link Here
341
    </ol>
341
    </ol>
342
    </fieldset>
342
    </fieldset>
343
    <fieldset class="rows">
343
    <fieldset class="rows">
344
      <legend>Priority</legend>
344
      <legend>Other attributes</legend>
345
      <ol>
345
      <ol>
346
        <li>
346
        <li>
347
          <div class="subfield_line">
347
          <div class="subfield_line">
(-)a/tools/batchMod.pl (-39 / +61 lines)
Lines 127-160 if ($op eq "action") { Link Here
127
127
128
    # Once the job is done
128
    # Once the job is done
129
    if ($completedJobID) {
129
    if ($completedJobID) {
130
	# If we have a reasonable amount of items, we display them
130
        # If we have a reasonable amount of items, we display them
131
    my $max_items = $del ? C4::Context->preference("MaxItemsToDisplayForBatchDel") : C4::Context->preference("MaxItemsToDisplayForBatchMod");
131
        my $max_items = $del ? C4::Context->preference("MaxItemsToDisplayForBatchDel") : C4::Context->preference("MaxItemsToDisplayForBatchMod");
132
    if (scalar(@itemnumbers) <= $max_items ){
132
        if (scalar(@itemnumbers) <= $max_items ){
133
        if (scalar(@itemnumbers) <= 1000 ) {
133
            if (scalar(@itemnumbers) <= 1000 ) {
134
            $items_display_hashref=BuildItemsData(@itemnumbers);
134
                $items_display_hashref=BuildItemsData(@itemnumbers);
135
            } else {
136
                # Else, we only display the barcode
137
                my @simple_items_display = map {
138
                    my $itemnumber = $_;
139
                    my $item = Koha::Items->find($itemnumber);
140
                    {
141
                        itemnumber   => $itemnumber,
142
                        barcode      => $item ? ( $item->barcode // q{} ) : q{},
143
                        biblionumber => $item ? $item->biblio->biblionumber : q{},
144
                    };
145
                } @itemnumbers;
146
                $template->param("simple_items_display" => \@simple_items_display);
147
            }
135
        } else {
148
        } else {
136
            # Else, we only display the barcode
149
            $template->param( "too_many_items_display" => scalar(@itemnumbers) );
137
            my @simple_items_display = map {
150
            $template->param( "job_completed" => 1 );
138
                my $itemnumber = $_;
139
                my $item = Koha::Items->find($itemnumber);
140
                {
141
                    itemnumber   => $itemnumber,
142
                    barcode      => $item ? ( $item->barcode // q{} ) : q{},
143
                    biblionumber => $item ? $item->biblio->biblionumber : q{},
144
                };
145
            } @itemnumbers;
146
            $template->param("simple_items_display" => \@simple_items_display);
147
        }
151
        }
148
    } else {
149
        $template->param( "too_many_items_display" => scalar(@itemnumbers) );
150
        $template->param( "job_completed" => 1 );
151
    }
152
152
153
	# Setting the job as done
153
        # Setting the job as done
154
	my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
154
        my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
155
155
156
	# Calling the template
156
        # Calling the template
157
        add_saved_job_results_to_template($template, $completedJobID);
157
        add_saved_job_results_to_template($template, $completedJobID, $items_display_hashref);
158
158
159
    } else {
159
    } else {
160
    # While the job is getting done
160
    # While the job is getting done
Lines 186-197 if ($op eq "action") { Link Here
186
	    }
186
	    }
187
        }
187
        }
188
188
189
        my $yesno = Koha::AuthorisedValues->search({category => 'YES_NO'});
190
        my $ynhash = {};
191
192
        while(my $yn = $yesno->next) {
193
            $ynhash->{'av'.$yn->authorised_value} = $yn->lib;
194
        }
195
189
        try {
196
        try {
190
            my $schema = Koha::Database->new->schema;
197
            my $schema = Koha::Database->new->schema;
191
            $schema->txn_do(
198
            $schema->txn_do(
192
                sub {
199
                sub {
193
                    # For each item
200
                    # For each item
194
                    my $i = 1;
201
                    my $i = 1;
202
                    my $extra_headers = {};
195
                    foreach my $itemnumber (@itemnumbers) {
203
                    foreach my $itemnumber (@itemnumbers) {
196
                        $job->progress($i) if $runinbackground;
204
                        $job->progress($i) if $runinbackground;
197
                        my $item = Koha::Items->find($itemnumber);
205
                        my $item = Koha::Items->find($itemnumber);
Lines 233-241 if ($op eq "action") { Link Here
233
                        }
241
                        }
234
                        else {
242
                        else {
235
                            my $modified_holds_priority = 0;
243
                            my $modified_holds_priority = 0;
236
                            if (defined $exclude_from_local_holds_priority && $item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) {
244
                            if (defined $exclude_from_local_holds_priority) {
237
                                $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store;
245
                                if($item->exclude_from_local_holds_priority != $exclude_from_local_holds_priority) {
238
                                $modified_holds_priority = 1;
246
                                    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority)->store;
247
                                    $modified_holds_priority = 1;
248
                                }
249
                                $extra_headers->{exclude_from_local_holds_priority} = {name => 'Exclude from local holds priority', items => {}} unless defined $extra_headers->{exclude_from_local_holds_priority};
250
                                $extra_headers->{exclude_from_local_holds_priority}->{items}->{$item->itemnumber} = $ynhash->{'av'.$item->exclude_from_local_holds_priority};
239
                            }
251
                            }
240
                            my $modified = 0;
252
                            my $modified = 0;
241
                            if ( $values_to_modify || $values_to_blank ) {
253
                            if ( $values_to_modify || $values_to_blank ) {
Lines 305-310 if ($op eq "action") { Link Here
305
                                    {
317
                                    {
306
                                        modified_items  => $modified_items,
318
                                        modified_items  => $modified_items,
307
                                        modified_fields => $modified_fields,
319
                                        modified_fields => $modified_fields,
320
                                        extra_headers => $extra_headers,
308
                                    }
321
                                    }
309
                                );
322
                                );
310
                            }
323
                            }
Lines 625-631 exit; Link Here
625
638
626
# ---------------- Functions
639
# ---------------- Functions
627
640
628
sub BuildItemsData{
641
sub BuildItemsData {
629
	my @itemnumbers=@_;
642
	my @itemnumbers=@_;
630
		# now, build existiing item list
643
		# now, build existiing item list
631
		my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
644
		my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
Lines 695-710 sub BuildItemsData{ Link Here
695
			$row_data{itemnumber} = $row->{itemnumber};
708
			$row_data{itemnumber} = $row->{itemnumber};
696
			#reporting this_row values
709
			#reporting this_row values
697
			$row_data{'nomod'} = $row->{'nomod'};
710
			$row_data{'nomod'} = $row->{'nomod'};
698
      $row_data{bibinfo} = $row->{bibinfo};
711
            $row_data{bibinfo} = $row->{bibinfo};
699
      $row_data{author} = $row->{author};
712
            $row_data{author} = $row->{author};
700
      $row_data{title} = $row->{title};
713
            $row_data{title} = $row->{title};
701
      $row_data{isbn} = $row->{isbn};
714
            $row_data{isbn} = $row->{isbn};
702
      $row_data{biblionumber} = $row->{biblionumber};
715
            $row_data{biblionumber} = $row->{biblionumber};
703
      $row_data{holds}        = $row->{holds};
716
            $row_data{holds}        = $row->{holds};
704
      $row_data{item_holds}   = $row->{item_holds};
717
            $row_data{item_holds}   = $row->{item_holds};
705
      $row_data{item}         = $row->{item};
718
            $row_data{item}         = $row->{item};
706
      my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} );
719
            my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} );
707
      $row_data{onloan} = $is_on_loan ? 1 : 0;
720
            $row_data{onloan} = $is_on_loan ? 1 : 0;
708
			push(@item_value_loop,\%row_data);
721
			push(@item_value_loop,\%row_data);
709
		}
722
		}
710
		my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted;
723
		my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted;
Lines 772-783 sub add_results_to_template { Link Here
772
sub add_saved_job_results_to_template {
785
sub add_saved_job_results_to_template {
773
    my $template = shift;
786
    my $template = shift;
774
    my $completedJobID = shift;
787
    my $completedJobID = shift;
788
    my $items_display_hashref= shift;
775
    my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
789
    my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID);
776
    my $results = $job->results();
790
    my $results = $job->results();
777
    add_results_to_template($template, $results);
791
    add_results_to_template($template, $results);
778
792
779
    my $fields = $job->get("modified_fields");
793
    my $fields = $job->get("modified_fields");
780
    my $items = $job->get("modified_items");
794
    my $items = $job->get("modified_items");
795
    my $extra_headers = $job->get("extra_headers");
796
797
    foreach my $header (keys %{$extra_headers}) {
798
        push @{$items_display_hashref->{item_header_loop}}, {header_value => $extra_headers->{$header}->{name}};
799
        foreach my $row (@{$items_display_hashref->{item_loop}}) {
800
            push @{$row->{item_value}}, {field => $extra_headers->{$header}->{items}->{$row->{itemnumber}}};
801
        }
802
    }
803
781
    $template->param(
804
    $template->param(
782
        modified_items => $items,
805
        modified_items => $items,
783
        modified_fields => $fields,
806
        modified_fields => $fields,
784
- 

Return to bug 19889