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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt (-14 / +21 lines)
Lines 51-61 Link Here
51
                [% END %]
51
                [% END %]
52
            </tbody>
52
            </tbody>
53
        </table>
53
        </table>
54
        [% UNLESS ( too_many_items_display ) %]
55
            [% IF ( item_loop ) %]
56
                    <h4>The following barcodes were found: </h4>
57
            [% END %]
58
        [% END %]
59
    [% END %] <!-- /notfoundbarcodes -->
54
    [% END %] <!-- /notfoundbarcodes -->
60
    [% IF ( notfounditemnumbers.size ) %]
55
    [% IF ( notfounditemnumbers.size ) %]
61
        <div class="dialog alert">
56
        <div class="dialog alert">
Lines 71-84 Link Here
71
                [% END %]
66
                [% END %]
72
            </tbody>
67
            </tbody>
73
        </table>
68
        </table>
74
        [% UNLESS ( too_many_items_display ) %]
75
            [% IF ( item_loop ) %]
76
                    <h4>The following itemnumbers were found: </h4>
77
            [% END %]
78
        [% END %]
79
    [% END %] <!-- /notfounditemnumbers -->
69
    [% END %] <!-- /notfounditemnumbers -->
80
70
71
    [% IF cannot_be_deleted.size %]
72
        <div class="dialog alert">
73
            <p>Warning, the following items cannot be deleted: </p>
74
        </div>
75
        <table style="margin:auto;">
76
            <thead>
77
                <tr><th>Cannot be deleted</th></tr>
78
            </thead>
79
            <tbody>
80
                [% FOREACH barcode IN cannot_be_deleted %]
81
                    <tr><td>[% barcode | html %]</td></td>
82
                [% END %]
83
            </tbody>
84
        </table>
85
    [% END %]
81
86
87
    [% IF ( notfoundbarcodes.size || notfounditemnumbers.size || cannot_be_deleted.size ) && !too_many_items_display && item_loop %]
88
        <h4>The following barcodes were found: </h4>
89
    [% END %]
82
90
83
91
84
<form name="f" action="batchMod.pl" method="post">
92
<form name="f" action="batchMod.pl" method="post">
Lines 120-136 Link Here
120
                  [% IF item_loo.nomod %]
128
                  [% IF item_loo.nomod %]
121
                    <td class="error">Cannot delete</td>
129
                    <td class="error">Cannot delete</td>
122
                [% ELSE %]
130
                [% ELSE %]
123
                    [% SET can_be_deleted = item_loo.item.safe_to_delete %]
131
                    [% IF item_loo.safe_to_delete == 1 %]
124
                    [% IF can_be_deleted == 1 %]
125
                        <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" /></td>
132
                        <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" checked="checked" /></td>
126
                    [% ELSE %]
133
                    [% ELSE %]
127
                        [% SWITCH can_be_deleted %]
134
                        [% SWITCH item_loo.safe_to_delete%]
128
                        [% CASE "book_on_loan" %][% SET cannot_delete_reason = t("Item is checked out") %]
135
                        [% CASE "book_on_loan" %][% SET cannot_delete_reason = t("Item is checked out") %]
129
                        [% CASE "not_same_branch" %][% SET cannot_delete_reason = t("Item does not belong to your library") %]
136
                        [% CASE "not_same_branch" %][% SET cannot_delete_reason = t("Item does not belong to your library") %]
130
                        [% CASE "book_reserved" %][% SET cannot_delete_reason = t("Item has a waiting hold") %]
137
                        [% CASE "book_reserved" %][% SET cannot_delete_reason = t("Item has a waiting hold") %]
131
                        [% CASE "linked_analytics" %][% SET cannot_delete_reason = t("Item has linked analytics") %]
138
                        [% CASE "linked_analytics" %][% SET cannot_delete_reason = t("Item has linked analytics") %]
132
                        [% CASE "last_item_for_hold" %][% SET cannot_delete_reason = t("Last item for bibliographic record with biblio-level hold on it") %]
139
                        [% CASE "last_item_for_hold" %][% SET cannot_delete_reason = t("Last item for bibliographic record with biblio-level hold on it") %]
133
                        [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ can_be_deleted _ ')' %]
140
                        [% CASE %][% SET cannot_delete_reason = t("Unknown reason") _ '(' _ item_loo.safe_to_delete _ ')' %]
134
                        [% END %]
141
                        [% END %]
135
142
136
                        <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" disabled="disabled" title="[% cannot_delete_reason | html %]"/></td>
143
                        <td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber | html %]" id="row[% item_loo.itemnumber | html %]" disabled="disabled" title="[% cannot_delete_reason | html %]"/></td>
(-)a/tools/batchMod.pl (-2 / +9 lines)
Lines 711-723 sub BuildItemsData{ Link Here
711
      $row_data{holds}        = $row->{holds};
711
      $row_data{holds}        = $row->{holds};
712
      $row_data{item_holds}   = $row->{item_holds};
712
      $row_data{item_holds}   = $row->{item_holds};
713
      $row_data{item}         = $row->{item};
713
      $row_data{item}         = $row->{item};
714
      $row_data{safe_to_delete} = $row->{item}->safe_to_delete;
714
      my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} );
715
      my $is_on_loan = C4::Circulation::IsItemIssued( $row->{itemnumber} );
715
      $row_data{onloan} = $is_on_loan ? 1 : 0;
716
      $row_data{onloan} = $is_on_loan ? 1 : 0;
716
			push(@item_value_loop,\%row_data);
717
			push(@item_value_loop,\%row_data);
717
		}
718
		}
718
		my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted;
719
		my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted;
719
720
720
	return { item_loop        => \@item_value_loop, item_header_loop => \@header_loop };
721
    my @cannot_be_deleted = map {
722
        $_->{safe_to_delete} == 1 ? () : $_->{item}->barcode
723
    } @item_value_loop;
724
    return {
725
        item_loop        => \@item_value_loop,
726
        cannot_be_deleted => \@cannot_be_deleted,
727
        item_header_loop => \@header_loop
728
    };
721
}
729
}
722
730
723
#BE WARN : it is not the general case 
731
#BE WARN : it is not the general case 
724
- 

Return to bug 28353