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

(-)a/C4/Serials.pm (+18 lines)
Lines 87-92 BEGIN { Link Here
87
      HasItems
87
      HasItems
88
      &GetSubscriptionsFromBorrower
88
      &GetSubscriptionsFromBorrower
89
      &subscriptionCurrentlyOnOrder
89
      &subscriptionCurrentlyOnOrder
90
      &GetSerialItemsInformations
90
91
91
    );
92
    );
92
}
93
}
Lines 2716-2722 sub _can_do_on_subscription { Link Here
2716
    }
2717
    }
2717
    return 0;
2718
    return 0;
2718
}
2719
}
2720
=head1 GetSerialItemsInformations
2721
=cut
2722
sub GetSerialItemsInformations{
2723
my (@serialid)=@_;
2724
my $i=0;
2725
my @serialitemsinformation;
2726
my $dbh = C4::Context->dbh;
2727
foreach my $sid(@serialid){
2728
        my $sth = $dbh->prepare("select count(i.itemnumber) as countitems,s.itemnumber as itemnumber  from items i  natural join  serialitems s where s.serialid=?");
2729
        $sth->execute($sid);
2730
        my $line   = $sth->fetchrow_hashref;
2731
        if($line->{'countitems'}){
2732
            push @serialitemsinformation,$line;
2733
        }
2734
}
2735
    return @serialitemsinformation;
2719
2736
2737
}
2720
=head2 findSerialsByStatus
2738
=head2 findSerialsByStatus
2721
2739
2722
    @serials = findSerialsByStatus($status, $subscriptionid);
2740
    @serials = findSerialsByStatus($status, $subscriptionid);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (-3 / +54 lines)
Lines 15-20 function generateReceive(subscriptionid) { Link Here
15
        document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues;
15
        document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues;
16
    }
16
    }
17
}
17
}
18
19
function deleteIssues(subscriptionid){
20
    var serialnumber=0;
21
    var serials="";
22
    var serialids = document.edition.serialid;
23
    for(i=0;i<serialids.length;i++){
24
        if (serialids[i].checked==true){
25
            if (serials.length==0){
26
                serials+=serialids[i].value;
27
            }else{
28
                serials+="!"+serialids[i].value;
29
            }
30
            serialnumber ++;
31
        }
32
    }
33
    if(serialnumber==0){
34
        alert("No serials selected");
35
    }else{
36
        document.location = 'serials-collection.pl?subscriptionid='+subscriptionid+                 '&op=delete&serialsid='+serials+'&serialnumber='+serialnumber;
37
    }
38
}
39
18
function print_slip(subscriptionid,issue){
40
function print_slip(subscriptionid,issue){
19
    var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
41
    var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
20
    window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
42
    window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
Lines 84-89 $(document).ready(function() { Link Here
84
106
85
<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>
107
<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>
86
108
109
[% IF ( delete ) %]
110
 <div class="yui-g">
111
 <div id="circ_needsconfirmation" class="dialog alert">
112
   <h3>Are you sure delete <b> [% serialnumber %] </b> selected serials</h3>
113
   <form action="/cgi-bin/koha/serials/serials-collection.pl/#">
114
           <h5>Delete associated items <input type="radio" name="delitems" value="Yes">Yes
115
           <input type="radio" name="delitems" value="No" checked>No</h5>
116
           <h5>Number of items available <b>: [% countitems %] </b> </h5>
117
           <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
118
           <input type="hidden" name="serialsid" value="[% serialsid %]" />
119
           <input type="hidden" name="confdelete" value="1" />
120
           <input type="submit" class="approve" value="Yes, delete"/>
121
       </form>
122
       <form action=""/cgi-bin/koha/serials/serials-collection.pl/#">
123
           <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
124
           <input type="submit" class="deny" value="No, don't delete"/>
125
       </form>
126
   </div>
127
 </div>
128
 [% END %]
87
<div id="doc3" class="yui-t2">
129
<div id="doc3" class="yui-t2">
88
   
130
   
89
   <div id="bd">
131
   <div id="bd">
Lines 186-191 $(document).ready(function() { Link Here
186
                <input type="button" value="Generate next" onclick="javascript:generateNext([% subscriptionidlist %])" />
228
                <input type="button" value="Generate next" onclick="javascript:generateNext([% subscriptionidlist %])" />
187
                [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;<input type="button" value="Multi receiving" onclick="javascript:generateReceive([% subscriptionidlist %])" />[% END %]
229
                [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;<input type="button" value="Multi receiving" onclick="javascript:generateReceive([% subscriptionidlist %])" />[% END %]
188
            [% END %]
230
            [% END %]
231
            <input type="button" value="Delete selected issues" onclick="javascript:deleteIssues([% subscriptionidlist %])"/>
189
        </p>
232
        </p>
190
    [% END %]
233
    [% END %]
191
      <span class="checkall">
234
      <span class="checkall">
Lines 227-238 $(document).ready(function() { Link Here
227
                    disabled
270
                    disabled
228
                  [% ELSE %]
271
                  [% ELSE %]
229
                    [% IF ( serial.subscriptionexpired ) %]
272
                    [% IF ( serial.subscriptionexpired ) %]
230
                    <input type="checkbox" name="serialid" value="[% serial.serialid %]" disabled="disabled" />
273
                       <input type="checkbox" name="serialid" value="[% serial.serialid %]" disabled="disabled" />
231
                    [% ELSE %]
274
                    [% ELSE %]
232
                      [% IF ( serial.checked ) %]
275
                      [% IF ( serial.checked ) %]
233
                    <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid %]" />
276
                         [% IF ( delete ) %]
277
                            <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" [% IF ( delete ) %] readonly [% END %] [% IF serialsid.grep("${serial.serialid}").size %] checked [% END %] />
278
                         [% ELSE %]
279
                            <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid %]" />
280
                         [% END %]
234
                      [% ELSE %]
281
                      [% ELSE %]
235
                    <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" />
282
                         [% IF ( delete ) %]
283
                            <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" [% IF ( delete ) %] readonly [% END %] [% IF serialsid.grep("${serial.serialid}").size %] checked [% END %] />
284
                         [% ELSE %]
285
                            <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid %]" />
286
                         [% END %]
236
                      [% END %]
287
                      [% END %]
237
                    [% END %]
288
                    [% END %]
238
                  [% END %]
289
                  [% END %]
(-)a/serials/serials-collection.pl (-3 / +33 lines)
Lines 25-30 use CGI qw ( -utf8 ); Link Here
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Serials;
27
use C4::Serials;
28
use C4::Items;
28
use C4::Letters;
29
use C4::Letters;
29
use C4::Output;
30
use C4::Output;
30
use C4::Context;
31
use C4::Context;
Lines 48-58 my ($template, $loggedinuser, $cookie) Link Here
48
my $biblionumber = $query->param('biblionumber');
49
my $biblionumber = $query->param('biblionumber');
49
my @subscriptionid = $query->multi_param('subscriptionid');
50
my @subscriptionid = $query->multi_param('subscriptionid');
50
51
52
my $serialsid=$query->param('serialsid');
53
my $serialnumber=$query->param('serialnumber');
54
my $confdelete=$query->param('confdelete');
55
my $delitems=$query->param('delitems');
51
@subscriptionid= uniq @subscriptionid;
56
@subscriptionid= uniq @subscriptionid;
52
@subscriptionid= sort @subscriptionid;
57
@subscriptionid= sort @subscriptionid;
53
my $subscriptiondescs;
58
my $subscriptiondescs;
54
my $subscriptions;
59
my $subscriptions;
55
60
my $delete;
61
my $countitems=0;
62
my @ids=split("!",$serialsid);
63
my @serialitemsinformation=GetSerialItemsInformations(@ids);
64
my $subscriptionid = $subscriptionid[0];
56
if($op eq 'gennext' && @subscriptionid){
65
if($op eq 'gennext' && @subscriptionid){
57
    my $subscriptionid = $subscriptionid[0];
66
    my $subscriptionid = $subscriptionid[0];
58
    my $sth = $dbh->prepare("
67
    my $sth = $dbh->prepare("
Lines 102-107 if($op eq 'gennext' && @subscriptionid){ Link Here
102
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
111
    print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
103
}
112
}
104
113
114
if($op eq 'delete'){
115
    $delete=1;
116
    foreach my $line (@serialitemsinformation){
117
        $countitems+=$line->{'countitems'};
118
    }
119
}
120
if($confdelete){
121
    for my $id(@ids){
122
        ModSerialStatus($id,"","","","",6);
123
    }
124
    if($delitems eq "Yes"){
125
        foreach my $line (@serialitemsinformation){
126
            DelItem($line);
127
        }
128
    }
129
print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
130
}
105
my $subscriptioncount;
131
my $subscriptioncount;
106
my ($location, $callnumber);
132
my ($location, $callnumber);
107
if (@subscriptionid){
133
if (@subscriptionid){
Lines 166-171 $template->param( Link Here
166
          callnumber	       => $callnumber,
192
          callnumber	       => $callnumber,
167
          uc(C4::Context->preference("marcflavour")) => 1,
193
          uc(C4::Context->preference("marcflavour")) => 1,
168
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
194
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
169
          );
195
          subscriptionid =>$subscriptionid,
196
          delete =>$delete,
197
          serialsid =>$serialsid,
198
          serialnumber =>$serialnumber,
199
          countitems =>$countitems,
200
      );
170
201
171
output_html_with_http_headers $query, $cookie, $template->output;
202
output_html_with_http_headers $query, $cookie, $template->output;
172
- 

Return to bug 17674