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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview-slip.tt (-1 / +2 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE raw %]
2
[% USE raw %]
3
[% USE KohaDates %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Routing slip preview &rsaquo; Serials &rsaquo; Koha</title>
6
<title>Routing slip preview &rsaquo; Serials &rsaquo; Koha</title>
Lines 17-23 Link Here
17
        <td colspan="2"><h3>[% libraryname | html %]</h3></td>
18
        <td colspan="2"><h3>[% libraryname | html %]</h3></td>
18
    </tr>
19
    </tr>
19
    <tr>
20
    <tr>
20
        <td colspan="2"><strong>Title:</strong> [% title | html %]<br />[% issue | html %]</td>
21
        <td colspan="2"><strong>Title:</strong> [% title | html %]<br />[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</td>
21
    </tr>
22
    </tr>
22
    <tr>
23
    <tr>
23
        <td><strong>Name</strong></td>
24
        <td><strong>Name</strong></td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing-preview.tt (-5 / +6 lines)
Lines 1-4 Link Here
1
[% SET footerjs = 1 %]
1
[% SET footerjs = 1 %]
2
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Preview routing list &rsaquo; Serials &rsaquo; Koha</title>
4
<title>Preview routing list &rsaquo; Serials &rsaquo; Koha</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
Lines 36-45 Link Here
36
37
37
<form method="post" action="routing-preview.pl">
38
<form method="post" action="routing-preview.pl">
38
<input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
39
<input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
39
    <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" />
40
<input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" />
40
<fieldset class="rows">
41
<fieldset class="rows">
41
	<ol>
42
	<ol>
42
		<li><span class="label">Issue:</span>[% issue | html %]</li>
43
		<li><span class="label">Issue:</span>[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</li>
43
		<li><span class="label">List member:</span><table style="clear:none;margin:0;">
44
		<li><span class="label">List member:</span><table style="clear:none;margin:0;">
44
        <tr><th>Name</th></tr>
45
        <tr><th>Name</th></tr>
45
[% FOREACH memberloo IN memberloop %]
46
[% FOREACH memberloo IN memberloop %]
Lines 71-81 Link Here
71
        $(document).ready(function(){
72
        $(document).ready(function(){
72
            $("#save_and_preview").on("click",function(e){
73
            $("#save_and_preview").on("click",function(e){
73
                e.preventDefault();
74
                e.preventDefault();
74
                print_slip( $("#subscriptionid").val(), $("#issue_escaped").val() );
75
                print_slip( $("#subscriptionid").val(), $("#serialid").val() );
75
            });
76
            });
76
        });
77
        });
77
        function print_slip(subscriptionid,issue){
78
        function print_slip(subscriptionid,serialid){
78
            var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
79
            var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&serialid='+serialid;
79
            window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
80
            window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
80
            window.location.href='subscription-detail.pl?subscriptionid=' + subscriptionid;
81
            window.location.href='subscription-detail.pl?subscriptionid=' + subscriptionid;
81
        }
82
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt (-5 / +5 lines)
Lines 59-70 Link Here
59
<fieldset class="rows">
59
<fieldset class="rows">
60
	<ol>
60
	<ol>
61
		<li><label for="date_selected">Issue: </label>
61
		<li><label for="date_selected">Issue: </label>
62
<select name="date_selected" id="date_selected">
62
<select name="serialid" id="serialid">
63
    [% FOREACH date IN dates %]
63
    [% FOREACH serial IN serials %]
64
        [% IF ( date.selected ) %]
64
        [% IF ( serial.serialid == serialid ) %]
65
            <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])" selected="selected">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option>
65
            <option value="[% serial.serialid | html %]" selected="selected">[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</option>
66
        [% ELSE %]
66
        [% ELSE %]
67
            <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option>
67
            <option value="[% serial.serialid | html %]">[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</option>
68
        [% END %]
68
        [% END %]
69
[% END %]
69
[% END %]
70
</select> [% issue | html %]</li>
70
</select> [% issue | html %]</li>
(-)a/serials/routing-preview.pl (-12 / +13 lines)
Lines 26-40 use C4::Output qw( output_html_with_http_headers ); Link Here
26
use C4::Reserves qw( AddReserve ModReserve );
26
use C4::Reserves qw( AddReserve ModReserve );
27
use C4::Context;
27
use C4::Context;
28
use C4::Serials qw( delroutingmember getroutinglist GetSubscription GetSerials check_routing );
28
use C4::Serials qw( delroutingmember getroutinglist GetSubscription GetSerials check_routing );
29
use URI::Escape;
30
29
31
use Koha::Biblios;
30
use Koha::Biblios;
32
use Koha::Libraries;
31
use Koha::Libraries;
33
use Koha::Patrons;
32
use Koha::Patrons;
33
use Koha::Serial::Items;
34
34
35
my $query = CGI->new;
35
my $query = CGI->new;
36
my $subscriptionid = $query->param('subscriptionid');
36
my $subscriptionid = $query->param('subscriptionid');
37
my $issue = $query->param('issue');
37
my $serialid = $query->param('serialid');
38
my $routingid;
38
my $routingid;
39
my $ok = $query->param('ok');
39
my $ok = $query->param('ok');
40
my $edit = $query->param('edit');
40
my $edit = $query->param('edit');
Lines 52-57 if($edit){ Link Here
52
    print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
52
    print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
53
}
53
}
54
54
55
my $serial = Koha::Serials->find($serialid);
55
my @routinglist = getroutinglist($subscriptionid);
56
my @routinglist = getroutinglist($subscriptionid);
56
my $subs = GetSubscription($subscriptionid);
57
my $subs = GetSubscription($subscriptionid);
57
my ($tmp ,@serials) = GetSerials($subscriptionid);
58
my ($tmp ,@serials) = GetSerials($subscriptionid);
Lines 63-74 if($ok){ Link Here
63
    my $biblionumber = $subs->{'bibnum'};
64
    my $biblionumber = $subs->{'bibnum'};
64
65
65
    my $biblio = Koha::Biblios->find( $biblionumber );
66
    my $biblio = Koha::Biblios->find( $biblionumber );
66
    my $items = $biblio->items->search_ordered;
67
    my $branchcode = $subs->{branchcode};
67
    my $branch =
68
    my $serialitem = Koha::Serial::Items->search( { serialid => $serialid } )->next;
68
        $items->count
69
    if ( $serialitem ) {
69
      ? $items->next->holding_branch->branchcode
70
        my $item = Koha::Items->find($serialitem->itemnumber);
70
      : $subs->{branchcode};
71
        $branchcode = $item->holdingbranch || $branchcode;
71
    $library = Koha::Libraries->find($branch);
72
    }
73
    $library = Koha::Libraries->find($branchcode);
72
74
73
	if (C4::Context->preference('RoutingListAddReserves')){
75
	if (C4::Context->preference('RoutingListAddReserves')){
74
		# get existing reserves .....
76
		# get existing reserves .....
Lines 90-101 if($ok){ Link Here
90
                    rank           => $routing->{ranking},
92
                    rank           => $routing->{ranking},
91
                    biblionumber   => $biblionumber,
93
                    biblionumber   => $biblionumber,
92
                    borrowernumber => $routing->{borrowernumber},
94
                    borrowernumber => $routing->{borrowernumber},
93
                    branchcode     => $branch
95
                    branchcode     => $branchcode,
94
                });
96
                });
95
            } else {
97
            } else {
96
                AddReserve(
98
                AddReserve(
97
                    {
99
                    {
98
                        branchcode     => $branch,
100
                        branchcode     => $branchcode,
99
                        borrowernumber => $routing->{borrowernumber},
101
                        borrowernumber => $routing->{borrowernumber},
100
                        biblionumber   => $biblionumber,
102
                        biblionumber   => $biblionumber,
101
                        priority       => $routing->{ranking},
103
                        priority       => $routing->{ranking},
Lines 136-143 $routingnotes =~ s/\n/\<br \/\>/g; Link Here
136
138
137
$template->param(
139
$template->param(
138
    title => $subs->{'bibliotitle'},
140
    title => $subs->{'bibliotitle'},
139
    issue => $issue,
141
    serial => $serial,
140
    issue_escaped => URI::Escape::uri_escape_utf8($issue),
141
    subscriptionid => $subscriptionid,
142
    subscriptionid => $subscriptionid,
142
    memberloop => $memberloop,
143
    memberloop => $memberloop,
143
    routingnotes => $routingnotes,
144
    routingnotes => $routingnotes,
(-)a/serials/routing.pl (-23 / +5 lines)
Lines 35-42 use C4::Context; Link Here
35
use C4::Serials qw( GetSubscription delroutingmember addroutingmember getroutinglist GetSerials GetLatestSerials check_routing );
35
use C4::Serials qw( GetSubscription delroutingmember addroutingmember getroutinglist GetSerials GetLatestSerials check_routing );
36
use Koha::Patrons;
36
use Koha::Patrons;
37
37
38
use URI::Escape;
39
40
my $query = CGI->new;
38
my $query = CGI->new;
41
my $subscriptionid = $query->param('subscriptionid');
39
my $subscriptionid = $query->param('subscriptionid');
42
my $serialseq = $query->param('serialseq');
40
my $serialseq = $query->param('serialseq');
Lines 44-51 my $routingid = $query->param('routingid'); Link Here
44
my $borrowernumber = $query->param('borrowernumber');
42
my $borrowernumber = $query->param('borrowernumber');
45
my $notes = $query->param('notes');
43
my $notes = $query->param('notes');
46
my $op = $query->param('op') || q{};
44
my $op = $query->param('op') || q{};
47
my $date_selected = $query->param('date_selected');
45
my $serialid = $query->param('serialid');
48
$date_selected ||= q{};
49
my $dbh = C4::Context->dbh;
46
my $dbh = C4::Context->dbh;
50
47
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
48
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 72-99 if($op eq 'add'){ Link Here
72
if($op eq 'save'){
69
if($op eq 'save'){
73
    my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?');
70
    my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?');
74
    $sth->execute($notes,$subscriptionid);
71
    $sth->execute($notes,$subscriptionid);
75
    my $urldate = URI::Escape::uri_escape_utf8($date_selected);
72
    print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&serialid=$serialid");
76
    print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate");
77
}
73
}
78
74
79
my @routinglist = getroutinglist($subscriptionid);
75
my @routinglist = getroutinglist($subscriptionid);
80
76
81
my ($count,@serials) = GetSerials($subscriptionid);
77
my ($count,@serials) = GetSerials($subscriptionid);
82
my $serialdates = GetLatestSerials($subscriptionid,$count);
78
my $serials = GetLatestSerials($subscriptionid,$count);
83
84
my $dates = [];
85
foreach my $dateseq (@{$serialdates}) {
86
    my $d = {};
87
    $d->{publisheddate} = $dateseq->{publisheddate};
88
    $d->{serialseq} = $dateseq->{serialseq};
89
    $d->{serialid} = $dateseq->{serialid};
90
    if($date_selected eq $dateseq->{serialid}){
91
        $d->{selected} = ' selected';
92
    } else {
93
        $d->{selected} = q{};
94
    }
95
    push @{$dates}, $d;
96
}
97
79
98
my $member_loop = [];
80
my $member_loop = [];
99
for my $routing ( @routinglist ) {
81
for my $routing ( @routinglist ) {
Lines 116-125 for my $routing ( @routinglist ) { Link Here
116
98
117
$template->param(
99
$template->param(
118
    title => $subs->{bibliotitle},
100
    title => $subs->{bibliotitle},
101
    serialid => $serialid,
119
    subscriptionid => $subscriptionid,
102
    subscriptionid => $subscriptionid,
120
    memberloop => $member_loop,
103
    memberloop => $member_loop,
121
    op => $op eq 'new',
104
    op => $op eq 'new',
122
    dates => $dates,
105
    serials => $serials,
123
    routingnotes => $serials[0]->{'routingnotes'},
106
    routingnotes => $serials[0]->{'routingnotes'},
124
    hasRouting => check_routing($subscriptionid),
107
    hasRouting => check_routing($subscriptionid),
125
    (uc(C4::Context->preference("marcflavour"))) => 1
108
    (uc(C4::Context->preference("marcflavour"))) => 1
126
- 

Return to bug 31330