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

(-)a/serials/routing-preview.pl (-20 / +26 lines)
Lines 66-106 if($ok){ Link Here
66
    my $biblio = Koha::Biblios->find( $biblionumber );
66
    my $biblio = Koha::Biblios->find( $biblionumber );
67
    my $branchcode = $subs->{branchcode};
67
    my $branchcode = $subs->{branchcode};
68
    my $serialitem = Koha::Serial::Items->search( { serialid => $serialid } )->next;
68
    my $serialitem = Koha::Serial::Items->search( { serialid => $serialid } )->next;
69
    if ( $serialitem ) {
69
70
    if ( C4::Context->preference('RoutingListAddReserves') && $serialitem ) {
70
        my $item = Koha::Items->find($serialitem->itemnumber);
71
        my $item = Koha::Items->find($serialitem->itemnumber);
71
        $branchcode = $item->holdingbranch || $branchcode;
72
        $branchcode = $item->holdingbranch || $branchcode;
72
    }
73
        $library = Koha::Libraries->find($branchcode);
73
    $library = Koha::Libraries->find($branchcode);
74
74
75
        my $notes;
75
	if (C4::Context->preference('RoutingListAddReserves')){
76
        my $title = $subs->{'bibliotitle'};
76
		my $notes;
77
        for my $routing (@routinglist) {
77
		my $title = $subs->{'bibliotitle'};
78
            my $sth = $dbh->prepare(
78
        for my $routing ( @routinglist ) {
79
                'SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? LIMIT 1'
79
            my $sth = $dbh->prepare('SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? LIMIT 1');
80
            );
80
            $sth->execute($biblionumber,$routing->{borrowernumber});
81
            $sth->execute( $biblionumber, $routing->{borrowernumber} );
81
            my $reserve = $sth->fetchrow_hashref;
82
            my $reserve = $sth->fetchrow_hashref;
82
83
83
            if($routing->{borrowernumber} == $reserve->{borrowernumber}){
84
            if ( $routing->{borrowernumber} == $reserve->{borrowernumber} )
84
                ModReserve({
85
            {
85
                    rank           => $routing->{ranking},
86
                ModReserve(
86
                    biblionumber   => $biblionumber,
87
                    {
87
                    borrowernumber => $routing->{borrowernumber},
88
                        rank           => $routing->{ranking},
88
                    branchcode     => $branchcode,
89
                        biblionumber   => $biblionumber,
89
                });
90
                        itemnumber     => $serialitem->itemnumber,
90
            } else {
91
                        borrowernumber => $routing->{borrowernumber},
92
                        branchcode     => $branchcode,
93
                    }
94
                );
95
            }
96
            else {
91
                AddReserve(
97
                AddReserve(
92
                    {
98
                    {
93
                        branchcode     => $branchcode,
99
                        branchcode     => $branchcode,
94
                        borrowernumber => $routing->{borrowernumber},
100
                        borrowernumber => $routing->{borrowernumber},
95
                        biblionumber   => $biblionumber,
101
                        biblionumber   => $biblionumber,
102
                        itemnumber     => $serialitem->itemnumber,
96
                        priority       => $routing->{ranking},
103
                        priority       => $routing->{ranking},
97
                        notes          => $notes,
104
                        notes          => $notes,
98
                        title          => $title,
105
                        title          => $title,
99
                    }
106
                    }
100
                );
107
                );
108
            }
101
        }
109
        }
102
    }
110
    }
103
	}
104
111
105
    ($template, $loggedinuser, $cookie)
112
    ($template, $loggedinuser, $cookie)
106
= get_template_and_user({template_name => "serials/routing-preview-slip.tt",
113
= get_template_and_user({template_name => "serials/routing-preview-slip.tt",
107
- 

Return to bug 2894