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 (-4 / +5 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% SET footerjs = 1 %]
2
[% SET footerjs = 1 %]
3
[% USE KohaDates %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Preview routing list &rsaquo; Serials &rsaquo; Koha</title>
5
<title>Preview routing list &rsaquo; Serials &rsaquo; Koha</title>
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
Lines 34-40 Link Here
34
35
35
<fieldset class="rows">
36
<fieldset class="rows">
36
	<ol>
37
	<ol>
37
		<li><span class="label">Issue:</span>[% issue | html %]</li>
38
		<li><span class="label">Issue:</span>[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</li>
38
		<li><span class="label">List member:</span><table style="clear:none;margin:0;">
39
		<li><span class="label">List member:</span><table style="clear:none;margin:0;">
39
        <tr><th>Name</th></tr>
40
        <tr><th>Name</th></tr>
40
[% FOREACH memberloo IN memberloop %]
41
[% FOREACH memberloo IN memberloop %]
Lines 49-55 Link Here
49
    <form method="post" action="routing-preview.pl">
50
    <form method="post" action="routing-preview.pl">
50
        [% INCLUDE 'csrf-token.inc' %]
51
        [% INCLUDE 'csrf-token.inc' %]
51
        <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
52
        <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
52
        <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" />
53
        <input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" />
53
        <input type="hidden" name="op" value="cud-save_and_preview" />
54
        <input type="hidden" name="op" value="cud-save_and_preview" />
54
        <input id="save_and_preview" type="submit" class="btn btn-primary" value="Save and preview routing slip" />
55
        <input id="save_and_preview" type="submit" class="btn btn-primary" value="Save and preview routing slip" />
55
    </form>
56
    </form>
Lines 57-63 Link Here
57
    <form method="post" action="routing-preview.pl">
58
    <form method="post" action="routing-preview.pl">
58
        [% INCLUDE 'csrf-token.inc' %]
59
        [% INCLUDE 'csrf-token.inc' %]
59
        <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
60
        <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
60
        <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" />
61
        <input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" />
61
        <input type="hidden" name="op" value="cud-edit" />
62
        <input type="hidden" name="op" value="cud-edit" />
62
        <input type="submit" class="btn btn-primary" value="Edit" />
63
        <input type="submit" class="btn btn-primary" value="Edit" />
63
    </form>
64
    </form>
Lines 65-71 Link Here
65
    <form method="post" action="routing-preview.pl">
66
    <form method="post" action="routing-preview.pl">
66
        [% INCLUDE 'csrf-token.inc' %]
67
        [% INCLUDE 'csrf-token.inc' %]
67
        <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
68
        <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]" />
68
        <input type="hidden" id="issue_escaped" name="issue_escaped" value="[% issue_escaped | html %]" />
69
        <input type="hidden" id="serialid" name="serialid" value="[% serial.serialid | html %]" />
69
        <input type="hidden" name="op" value="cud-delete" />
70
        <input type="hidden" name="op" value="cud-delete" />
70
        <input type="submit" class="btn btn-primary" value="Delete" />
71
        <input type="submit" class="btn btn-primary" value="Delete" />
71
    </form>
72
    </form>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt (-5 / +5 lines)
Lines 51-62 Link Here
51
<fieldset class="rows">
51
<fieldset class="rows">
52
	<ol>
52
	<ol>
53
		<li><label for="date_selected">Issue: </label>
53
		<li><label for="date_selected">Issue: </label>
54
<select name="date_selected" id="date_selected">
54
<select name="serialid" id="serialid">
55
    [% FOREACH date IN dates %]
55
    [% FOREACH serial IN serials %]
56
        [% IF ( date.selected ) %]
56
        [% IF ( serial.serialid == serialid ) %]
57
            <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])" selected="selected">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option>
57
            <option value="[% serial.serialid | html %]" selected="selected">[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</option>
58
        [% ELSE %]
58
        [% ELSE %]
59
            <option value="[% date.serialseq | html %] ([% date.publisheddate | html %])">[% date.serialseq | html %] ([% date.publisheddate | $KohaDates %])</option>
59
            <option value="[% serial.serialid | html %]">[% serial.serialseq | html %] ([% serial.publisheddate | $KohaDates %])</option>
60
        [% END %]
60
        [% END %]
61
[% END %]
61
[% END %]
62
</select> [% issue | html %]</li>
62
</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 $op = $query->param('op') || q{};
39
my $op = $query->param('op') || q{};
40
my $dbh = C4::Context->dbh;
40
my $dbh = C4::Context->dbh;
Lines 50-55 if($op eq 'cud-edit'){ Link Here
50
    print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
50
    print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
51
}
51
}
52
52
53
my $serial = Koha::Serials->find($serialid);
53
my @routinglist = getroutinglist($subscriptionid);
54
my @routinglist = getroutinglist($subscriptionid);
54
my $subs = GetSubscription($subscriptionid);
55
my $subs = GetSubscription($subscriptionid);
55
my ($tmp ,@serials) = GetSerials($subscriptionid);
56
my ($tmp ,@serials) = GetSerials($subscriptionid);
Lines 61-72 if($op eq 'cud-save_and_preview'){ Link Here
61
    my $biblionumber = $subs->{'bibnum'};
62
    my $biblionumber = $subs->{'bibnum'};
62
63
63
    my $biblio = Koha::Biblios->find( $biblionumber );
64
    my $biblio = Koha::Biblios->find( $biblionumber );
64
    my $items = $biblio->items->search_ordered;
65
    my $branchcode = $subs->{branchcode};
65
    my $branch =
66
    my $serialitem = Koha::Serial::Items->search( { serialid => $serialid } )->next;
66
        $items->count
67
    if ( $serialitem ) {
67
      ? $items->next->holding_branch->branchcode
68
        my $item = Koha::Items->find($serialitem->itemnumber);
68
      : $subs->{branchcode};
69
        $branchcode = $item->holdingbranch || $branchcode;
69
    $library = Koha::Libraries->find($branch);
70
    }
71
    $library = Koha::Libraries->find($branchcode);
70
72
71
	if (C4::Context->preference('RoutingListAddReserves')){
73
	if (C4::Context->preference('RoutingListAddReserves')){
72
74
Lines 82-93 if($op eq 'cud-save_and_preview'){ Link Here
82
                    rank           => $routing->{ranking},
84
                    rank           => $routing->{ranking},
83
                    biblionumber   => $biblionumber,
85
                    biblionumber   => $biblionumber,
84
                    borrowernumber => $routing->{borrowernumber},
86
                    borrowernumber => $routing->{borrowernumber},
85
                    branchcode     => $branch
87
                    branchcode     => $branchcode,
86
                });
88
                });
87
            } else {
89
            } else {
88
                AddReserve(
90
                AddReserve(
89
                    {
91
                    {
90
                        branchcode     => $branch,
92
                        branchcode     => $branchcode,
91
                        borrowernumber => $routing->{borrowernumber},
93
                        borrowernumber => $routing->{borrowernumber},
92
                        biblionumber   => $biblionumber,
94
                        biblionumber   => $biblionumber,
93
                        priority       => $routing->{ranking},
95
                        priority       => $routing->{ranking},
Lines 134-141 $routingnotes =~ s/\n/\<br \/\>/g; Link Here
134
136
135
$template->param(
137
$template->param(
136
    title => $subs->{'bibliotitle'},
138
    title => $subs->{'bibliotitle'},
137
    issue => $issue,
139
    serial => $serial,
138
    issue_escaped => URI::Escape::uri_escape_utf8($issue),
139
    subscriptionid => $subscriptionid,
140
    subscriptionid => $subscriptionid,
140
    memberloop => $memberloop,
141
    memberloop => $memberloop,
141
    routingnotes => $routingnotes,
142
    routingnotes => $routingnotes,
(-)a/serials/routing.pl (-23 / +5 lines)
Lines 36-43 use C4::Context; Link Here
36
use C4::Serials qw( GetSubscription delroutingmember addroutingmember getroutinglist GetSerials GetLatestSerials check_routing );
36
use C4::Serials qw( GetSubscription delroutingmember addroutingmember getroutinglist GetSerials GetLatestSerials check_routing );
37
use Koha::Patrons;
37
use Koha::Patrons;
38
38
39
use URI::Escape;
40
41
my $query = CGI->new;
39
my $query = CGI->new;
42
my $subscriptionid = $query->param('subscriptionid');
40
my $subscriptionid = $query->param('subscriptionid');
43
my $serialseq = $query->param('serialseq');
41
my $serialseq = $query->param('serialseq');
Lines 45-52 my $routingid = $query->param('routingid'); Link Here
45
my $borrowernumbers = $query->param('borrowernumbers');
43
my $borrowernumbers = $query->param('borrowernumbers');
46
my $notes = $query->param('notes');
44
my $notes = $query->param('notes');
47
my $op = $query->param('op') || q{};
45
my $op = $query->param('op') || q{};
48
my $date_selected = $query->param('date_selected');
46
my $serialid = $query->param('serialid');
49
$date_selected ||= q{};
50
my $dbh = C4::Context->dbh;
47
my $dbh = C4::Context->dbh;
51
48
52
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
49
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 81-108 if ( $op eq 'cud-add_new_recipients' ) { Link Here
81
if($op eq 'cud-save'){
78
if($op eq 'cud-save'){
82
    my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?');
79
    my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?');
83
    $sth->execute($notes,$subscriptionid);
80
    $sth->execute($notes,$subscriptionid);
84
    my $urldate = URI::Escape::uri_escape_utf8($date_selected);
81
    print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&serialid=$serialid");
85
    print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate");
86
}
82
}
87
83
88
my @routinglist = getroutinglist($subscriptionid);
84
my @routinglist = getroutinglist($subscriptionid);
89
85
90
my ($count,@serials) = GetSerials($subscriptionid);
86
my ($count,@serials) = GetSerials($subscriptionid);
91
my $serialdates = GetLatestSerials($subscriptionid,$count);
87
my $serials = GetLatestSerials($subscriptionid,$count);
92
93
my $dates = [];
94
foreach my $dateseq (@{$serialdates}) {
95
    my $d = {};
96
    $d->{publisheddate} = $dateseq->{publisheddate};
97
    $d->{serialseq} = $dateseq->{serialseq};
98
    $d->{serialid} = $dateseq->{serialid};
99
    if($date_selected eq $dateseq->{serialid}){
100
        $d->{selected} = ' selected';
101
    } else {
102
        $d->{selected} = q{};
103
    }
104
    push @{$dates}, $d;
105
}
106
88
107
my $member_loop = [];
89
my $member_loop = [];
108
for my $routing ( @routinglist ) {
90
for my $routing ( @routinglist ) {
Lines 125-134 for my $routing ( @routinglist ) { Link Here
125
107
126
$template->param(
108
$template->param(
127
    title => $subs->{bibliotitle},
109
    title => $subs->{bibliotitle},
110
    serialid => $serialid,
128
    subscriptionid => $subscriptionid,
111
    subscriptionid => $subscriptionid,
129
    memberloop => $member_loop,
112
    memberloop => $member_loop,
130
    op => $op eq 'new',
113
    op => $op eq 'new',
131
    dates => $dates,
114
    serials => $serials,
132
    routingnotes => $serials[0]->{'routingnotes'},
115
    routingnotes => $serials[0]->{'routingnotes'},
133
    hasRouting => check_routing($subscriptionid),
116
    hasRouting => check_routing($subscriptionid),
134
    (uc(C4::Context->preference("marcflavour"))) => 1
117
    (uc(C4::Context->preference("marcflavour"))) => 1
135
- 

Return to bug 31330