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 32-37 Link Here
32
		[% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
32
		[% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
33
[% END %]
33
[% END %]
34
34
35
[% IF ( delete ) %]
36
    <div class="dialog alert">
37
        <h3>You are about to delete [% serialnumber %] serial(s). Do you want to continue?</h3>
38
        <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
39
            [% IF countitems > 0 %]
40
                <h5>Number of items available: [% countitems %]</h5>
41
                <p>
42
                  <label>Delete associated items? <input type="checkbox" name="delitems" value="Yes" />Yes</label>
43
                </p>
44
            [% END %]
45
            <input type="hidden" name="op" value="delete_confirmed" />
46
            <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
47
            <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
48
            [% FOREACH serialid IN serialsid %]
49
                <input type="hidden" name="serialid" value="[% serialid %]" />
50
            [% END %]
51
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
52
        </form>
53
        <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
54
            <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
55
            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
56
        </form>
57
    </div>
58
[% END %]
59
35
[% IF ( subscriptions ) %]
60
[% IF ( subscriptions ) %]
36
<table>
61
<table>
37
[% IF ( subscriptions.size == 1 ) %]
62
[% IF ( subscriptions.size == 1 ) %]
Lines 121-126 Link Here
121
                    <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
146
                    <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
122
                [% END %]
147
                [% END %]
123
            [% END %]
148
            [% END %]
149
            <input type="button" value="Delete selected issues" class="delete-issues btn btn-default btn-sm" data-subscriptionids="[% subscriptionidlist %]" />
124
        </p>
150
        </p>
125
    [% END %]
151
    [% END %]
126
      <span class="checkall">
152
      <span class="checkall">
Lines 164-171 Link Here
164
                    [% IF ( serial.subscriptionexpired ) %]
190
                    [% IF ( serial.subscriptionexpired ) %]
165
                    <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
191
                    <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
166
                    [% ELSE %]
192
                    [% ELSE %]
167
                      [% IF ( serial.checked ) %]
193
                      [% IF ( delete ) %]
168
                    <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid | html %]" />
194
                        [% IF serialsid.grep("${serial.serialid}").size %]
195
                          <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled checked />
196
                        [% ELSE %]
197
                          <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled />
198
                        [% END %]
169
                      [% ELSE %]
199
                      [% ELSE %]
170
                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
200
                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
171
                      [% END %]
201
                      [% END %]
Lines 280-285 Link Here
280
310
281
    <script type="text/javascript">
311
    <script type="text/javascript">
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 %]");
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 106-111 if($op eq 'gennext' && @subscriptionid){ Link Here
106
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
107
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
107
}
108
}
108
109
110
my $countitems = 0;
111
my @serialsid = $query->multi_param('serialid');
112
my $subscriptionid = $subscriptionid[0];
113
114
if($op eq 'delete_confirm'){
115
    foreach my $serialid (@serialsid){
116
        $countitems += Koha::Serial::Items->search({serialid => $serialid})->count();
117
    }
118
}elsif($op eq 'delete_confirmed'){
119
    if($query->param('delitems') eq "Yes"){
120
        foreach my $serialid (@serialsid){
121
            my @itemnumbers = Koha::Serial::Items->search({serialid => $serialid})->get_column('itemnumber');
122
            foreach my $itemnumber (@itemnumbers){
123
                C4::Items::DelItem({'biblionumber' => $biblionumber, 'itemnumber' => $itemnumber});
124
            }
125
        }
126
    }
127
    for my $serialid (@serialsid){
128
        ModSerialStatus($serialid,"","","","",6);
129
    }
130
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
131
}
132
109
my $subscriptioncount;
133
my $subscriptioncount;
110
my ($location, $callnumber);
134
my ($location, $callnumber);
111
if (@subscriptionid){
135
if (@subscriptionid){
Lines 177-182 $template->param( Link Here
177
          callnumber	       => $callnumber,
201
          callnumber	       => $callnumber,
178
          uc(C4::Context->preference("marcflavour")) => 1,
202
          uc(C4::Context->preference("marcflavour")) => 1,
179
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
203
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
204
          delete => ($op eq 'delete_confirm'),
205
          subscriptionid => $subscriptionid,
206
          countitems => $countitems,
207
          serialnumber => scalar @serialsid,
208
          serialsid => \@serialsid,
180
          );
209
          );
181
210
182
output_html_with_http_headers $query, $cookie, $template->output;
211
output_html_with_http_headers $query, $cookie, $template->output;
183
- 

Return to bug 17674