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

(-)a/C4/Serials.pm (+18 lines)
Lines 85-90 BEGIN { Link Here
85
      &CountIssues
85
      &CountIssues
86
      HasItems
86
      HasItems
87
      &subscriptionCurrentlyOnOrder
87
      &subscriptionCurrentlyOnOrder
88
      &GetSerialItemsInformations
88
89
89
    );
90
    );
90
}
91
}
Lines 2594-2600 sub _can_do_on_subscription { Link Here
2594
    }
2595
    }
2595
    return 0;
2596
    return 0;
2596
}
2597
}
2598
=head1 GetSerialItemsInformations
2599
=cut
2600
sub GetSerialItemsInformations{
2601
my (@serialid)=@_;
2602
my $i=0;
2603
my @serialitemsinformation;
2604
my $dbh = C4::Context->dbh;
2605
foreach my $sid(@serialid){
2606
        my $sth = $dbh->prepare("select count(i.itemnumber) as countitems,s.itemnumber as itemnumber  from items i  natural join  serialitems s where s.serialid=?");
2607
        $sth->execute($sid);
2608
        my $line   = $sth->fetchrow_hashref;
2609
        if($line->{'countitems'}){
2610
            push @serialitemsinformation,$line;
2611
        }
2612
}
2613
    return @serialitemsinformation;
2597
2614
2615
}
2598
=head2 findSerialsByStatus
2616
=head2 findSerialsByStatus
2599
2617
2600
    @serials = findSerialsByStatus($status, $subscriptionid);
2618
    @serials = findSerialsByStatus($status, $subscriptionid);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (-3 / +80 lines)
Lines 15-20 Link Here
15
15
16
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Serial collection information for  <i>[% bibliotitle %]</i></div>
16
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Serial collection information for  <i>[% bibliotitle %]</i></div>
17
17
18
[% IF ( delete ) %]
19
 <div class="yui-g">
20
 <div id="circ_needsconfirmation" class="dialog alert">
21
   <h3>Are you sure delete <b> [% serialnumber %] </b> selected serials</h3>
22
   <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
23
           <h5>Delete associated items <input type="radio" name="delitems" value="Yes">Yes
24
           <input type="radio" name="delitems" value="No" checked>No</h5>
25
           <h5>Number of items available <b>: [% countitems %] </b> </h5>
26
           <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
27
           <input type="hidden" name="serialsid" value="[% serialsid %]" />
28
           <input type="hidden" name="confdelete" value="1" />
29
           <input type="submit" class="approve" value="Yes, delete"/>
30
       </form>
31
       <form action=""/cgi-bin/koha/serials/serials-collection.pl/#">
32
           <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
33
           <input type="submit" class="deny" value="No, don't delete"/>
34
       </form>
35
   </div>
36
 </div>
37
 [% END %]
18
<div id="doc3" class="yui-t2">
38
<div id="doc3" class="yui-t2">
19
   
39
   
20
   <div id="bd">
40
   <div id="bd">
Lines 120-125 Link Here
120
                    <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
140
                    <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
121
                [% END %]
141
                [% END %]
122
            [% END %]
142
            [% END %]
143
            <input type="button" value="Delete selected issues" onclick="javascript:deleteIssues([% subscriptionidlist %])"/>
123
        </p>
144
        </p>
124
    [% END %]
145
    [% END %]
125
      <span class="checkall">
146
      <span class="checkall">
Lines 161-172 Link Here
161
                    disabled
182
                    disabled
162
                  [% ELSE %]
183
                  [% ELSE %]
163
                    [% IF ( serial.subscriptionexpired ) %]
184
                    [% IF ( serial.subscriptionexpired ) %]
164
                    <input type="checkbox" name="serialid" value="[% serial.serialid %]" disabled="disabled" />
185
                       <input type="checkbox" name="serialid" value="[% serial.serialid %]" disabled="disabled" />
165
                    [% ELSE %]
186
                    [% ELSE %]
166
                      [% IF ( serial.checked ) %]
187
                      [% IF ( serial.checked ) %]
167
                    <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid %]" />
188
                         [% IF ( delete ) %]
189
                            <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" [% IF ( delete ) %] readonly [% END %] [% IF serialsid.grep("${serial.serialid}").size %] checked [% END %] />
190
                         [% ELSE %]
191
                            <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid %]" />
192
                         [% END %]
168
                      [% ELSE %]
193
                      [% ELSE %]
169
                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" />
194
                         [% IF ( delete ) %]
195
                            <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" [% IF ( delete ) %] readonly [% END %] [% IF serialsid.grep("${serial.serialid}").size %] checked [% END %] />
196
                         [% ELSE %]
197
                            <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" />
198
                         [% END %]
170
                      [% END %]
199
                      [% END %]
171
                    [% END %]
200
                    [% END %]
172
                  [% END %]
201
                  [% END %]
Lines 278-283 Link Here
278
    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
307
    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
279
308
280
    <script type="text/javascript">
309
    <script type="text/javascript">
310
        function generateReceive(subscriptionid) {
311
            if(nbissues=prompt(_("How many issues do you want to receive ?"))){
312
                document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues;
313
            }
314
        }
315
316
        function deleteIssues(subscriptionid) {
317
            var serialnumber=0;
318
            var serials="";
319
            var serialids = document.edition.serialid;
320
            for(i=0;i<serialids.length;i++){
321
                if (serialids[i].checked==true){
322
                    if (serials.length==0){
323
                        serials+=serialids[i].value;
324
                    }else{
325
                        serials+="!"+serialids[i].value;
326
                    }
327
                    serialnumber ++;
328
                }
329
            }
330
            if(serialnumber==0){
331
                alert("No serials selected");
332
            }else{
333
                document.location = 'serials-collection.pl?subscriptionid='+subscriptionid+'&op=delete&serialsid='+serials+'&serialnumber='+serialnumber;
334
            }
335
        }
336
337
        function addsubscriptionid() {
338
            var tab=new Array();
339
            var serialids = document.edition.serialid;
340
            for (i=0; i<serialids.length; i++){
341
              if (serialids[i].checked == true){
342
                var found=false;
343
                for (var val in tab){
344
                  if (tab[val] == document.getElementsByName("subs")[i].getAttribute('val')){found = true;}
345
                }
346
                if (found == false){
347
                  tab=tab.concat((document.getElementsByName("subs")[i].getAttribute('val')));
348
                }
349
              }
350
            }
351
            var string="";
352
            for (var val in tab){
353
              string = string + tab[val] + ",";
354
            }
355
            string=string.substring(0,string.length -1);
356
            document.edition.subscriptionid.value=string;
357
        }
281
358
282
        function print_slip(subscriptionid,issue){
359
        function print_slip(subscriptionid,issue){
283
            var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
360
            var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
(-)a/serials/serials-collection.pl (-3 / +33 lines)
Lines 24-29 use CGI qw ( -utf8 ); Link Here
24
use C4::Auth;
24
use C4::Auth;
25
use C4::Koha;
25
use C4::Koha;
26
use C4::Serials;
26
use C4::Serials;
27
use C4::Items;
27
use C4::Letters;
28
use C4::Letters;
28
use C4::Output;
29
use C4::Output;
29
use C4::Context;
30
use C4::Context;
Lines 50-60 my ($template, $loggedinuser, $cookie) Link Here
50
my $biblionumber = $query->param('biblionumber');
51
my $biblionumber = $query->param('biblionumber');
51
my @subscriptionid = $query->multi_param('subscriptionid');
52
my @subscriptionid = $query->multi_param('subscriptionid');
52
53
54
my $serialsid=$query->param('serialsid');
55
my $serialnumber=$query->param('serialnumber');
56
my $confdelete=$query->param('confdelete');
57
my $delitems=$query->param('delitems');
53
@subscriptionid= uniq @subscriptionid;
58
@subscriptionid= uniq @subscriptionid;
54
@subscriptionid= sort @subscriptionid;
59
@subscriptionid= sort @subscriptionid;
55
my $subscriptiondescs;
60
my $subscriptiondescs;
56
my $subscriptions;
61
my $subscriptions;
57
62
my $delete;
63
my $countitems=0;
64
my @ids=split("!",$serialsid);
65
my @serialitemsinformation=GetSerialItemsInformations(@ids);
66
my $subscriptionid = $subscriptionid[0];
58
if($op eq 'gennext' && @subscriptionid){
67
if($op eq 'gennext' && @subscriptionid){
59
    my $subscriptionid = $subscriptionid[0];
68
    my $subscriptionid = $subscriptionid[0];
60
    my $sth = $dbh->prepare("
69
    my $sth = $dbh->prepare("
Lines 106-111 if($op eq 'gennext' && @subscriptionid){ Link Here
106
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
115
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
107
}
116
}
108
117
118
if($op eq 'delete'){
119
    $delete=1;
120
    foreach my $line (@serialitemsinformation){
121
        $countitems+=$line->{'countitems'};
122
    }
123
}
124
if($confdelete){
125
    for my $id(@ids){
126
        ModSerialStatus($id,"","","","",6);
127
    }
128
    if($delitems eq "Yes"){
129
        foreach my $line (@serialitemsinformation){
130
            DelItem($line);
131
        }
132
    }
133
print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
134
}
109
my $subscriptioncount;
135
my $subscriptioncount;
110
my ($location, $callnumber);
136
my ($location, $callnumber);
111
if (@subscriptionid){
137
if (@subscriptionid){
Lines 177-182 $template->param( Link Here
177
          callnumber	       => $callnumber,
203
          callnumber	       => $callnumber,
178
          uc(C4::Context->preference("marcflavour")) => 1,
204
          uc(C4::Context->preference("marcflavour")) => 1,
179
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
205
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
180
          );
206
          subscriptionid =>$subscriptionid,
207
          delete =>$delete,
208
          serialsid =>$serialsid,
209
          serialnumber =>$serialnumber,
210
          countitems =>$countitems,
211
      );
181
212
182
output_html_with_http_headers $query, $cookie, $template->output;
213
output_html_with_http_headers $query, $cookie, $template->output;
183
- 

Return to bug 17674