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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (-2 / +50 lines)
Lines 30-35 Link Here
30
		[% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
30
		[% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
31
[% END %]
31
[% END %]
32
32
33
[% IF ( delete ) %]
34
    <div class="dialog alert">
35
        <h3>You are about to delete [% serialnumber | html %] serial(s). Do you want to continue?</h3>
36
        <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
37
            [% IF countitems > 0 %]
38
                <h5>Number of items available: [% countitems | html %]</h5>
39
                <p>
40
                  <label>Delete associated items? <input type="checkbox" name="delitems" value="Yes" />Yes</label>
41
                </p>
42
            [% END %]
43
            <input type="hidden" name="op" value="delete_confirmed" />
44
            <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
45
            <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
46
            [% FOREACH serialid IN serialsid %]
47
                <input type="hidden" name="serialid" value="[% serialid | html %]" />
48
            [% END %]
49
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
50
        </form>
51
        <form action="/cgi-bin/koha/serials/serials-collection.pl">
52
            <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" />
53
            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
54
        </form>
55
    </div>
56
[% END %]
57
33
[% IF ( subscriptions ) %]
58
[% IF ( subscriptions ) %]
34
<table>
59
<table>
35
[% IF ( subscriptions.size == 1 ) %]
60
[% IF ( subscriptions.size == 1 ) %]
Lines 119-124 Link Here
119
                    <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
144
                    <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
120
                [% END %]
145
                [% END %]
121
            [% END %]
146
            [% END %]
147
            <input type="button" value="Delete selected issues" class="delete-issues btn btn-default btn-sm" data-subscriptionids="[% subscriptionidlist | html %]" />
122
        </p>
148
        </p>
123
    [% END %]
149
    [% END %]
124
      <span class="checkall">
150
      <span class="checkall">
Lines 162-169 Link Here
162
                    [% IF ( serial.subscriptionexpired ) %]
188
                    [% IF ( serial.subscriptionexpired ) %]
163
                    <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
189
                    <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
164
                    [% ELSE %]
190
                    [% ELSE %]
165
                      [% IF ( serial.checked ) %]
191
                      [% IF ( delete ) %]
166
                    <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid | html %]" />
192
                        [% IF serialsid.grep("${serial.serialid}").size %]
193
                          <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled checked />
194
                        [% ELSE %]
195
                          <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled />
196
                        [% END %]
167
                      [% ELSE %]
197
                      [% ELSE %]
168
                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
198
                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
169
                      [% END %]
199
                      [% END %]
Lines 280-285 Link Here
280
310
281
    <script>
311
    <script>
282
312
313
        function deleteIssues(subscriptionid) {
314
            var serialschecked = $("form[name='edition'] input[name='serialid']:checked");
315
            if (serialschecked.length > 0) {
316
                var location = 'serials-collection.pl?subscriptionid='+subscriptionid+'&op=delete_confirm';
317
                for (i=0; i < serialschecked.length; i++) {
318
                    location += '&serialid=' + serialschecked[i].value;
319
                }
320
                document.location = location;
321
            } else {
322
                alert(_("No serials selected"));
323
            }
324
        }
325
283
        function print_slip(subscriptionid,issue){
326
        function print_slip(subscriptionid,issue){
284
            var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
327
            var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
285
            window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
328
            window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
Lines 330-335 Link Here
330
                }
373
                }
331
                return 1;
374
                return 1;
332
            });
375
            });
376
377
            $(".delete-issues").on("click", function(e){
378
                e.preventDefault();
379
                deleteIssues("[% subscriptionidlist | html %]");
380
            });
333
        });
381
        });
334
382
335
    </script>
383
    </script>
(-)a/serials/serials-collection.pl (-1 / +29 lines)
Lines 27-32 use C4::Serials; Link Here
27
use C4::Letters;
27
use C4::Letters;
28
use C4::Output;
28
use C4::Output;
29
use C4::Context;
29
use C4::Context;
30
use Koha::Serial::Items;
30
31
31
use Koha::DateUtils qw( dt_from_string );
32
use Koha::DateUtils qw( dt_from_string );
32
33
Lines 110-115 if($op eq 'gennext' && @subscriptionid){ Link Here
110
    exit;
111
    exit;
111
}
112
}
112
113
114
my $countitems = 0;
115
my @serialsid = $query->multi_param('serialid');
116
my $subscriptionid = $subscriptionid[0];
117
118
if($op eq 'delete_confirm'){
119
    foreach my $serialid (@serialsid){
120
        $countitems += Koha::Serial::Items->search({serialid => $serialid})->count();
121
    }
122
}elsif($op eq 'delete_confirmed'){
123
    if($query->param('delitems') eq "Yes"){
124
        foreach my $serialid (@serialsid){
125
            my @itemnumbers = Koha::Serial::Items->search({serialid => $serialid})->get_column('itemnumber');
126
            foreach my $itemnumber (@itemnumbers){
127
                C4::Items::DelItem({'biblionumber' => $biblionumber, 'itemnumber' => $itemnumber});
128
            }
129
        }
130
    }
131
    for my $serialid (@serialsid){
132
        ModSerialStatus($serialid,"","","","",6);
133
    }
134
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
135
}
136
113
my $subscriptioncount;
137
my $subscriptioncount;
114
my ($location, $callnumber);
138
my ($location, $callnumber);
115
if (@subscriptionid){
139
if (@subscriptionid){
Lines 181-186 $template->param( Link Here
181
          callnumber	       => $callnumber,
205
          callnumber	       => $callnumber,
182
          uc(C4::Context->preference("marcflavour")) => 1,
206
          uc(C4::Context->preference("marcflavour")) => 1,
183
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
207
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
208
          delete => ($op eq 'delete_confirm'),
209
          subscriptionid => $subscriptionid,
210
          countitems => $countitems,
211
          serialnumber => scalar @serialsid,
212
          serialsid => \@serialsid,
184
          );
213
          );
185
214
186
output_html_with_http_headers $query, $cookie, $template->output;
215
output_html_with_http_headers $query, $cookie, $template->output;
187
- 

Return to bug 17674