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

(-)a/C4/Serials.pm (+25 lines)
Lines 50-55 BEGIN { Link Here
50
      &GetDistributedTo   &SetDistributedTo
50
      &GetDistributedTo   &SetDistributedTo
51
      &getroutinglist     &delroutingmember   &addroutingmember
51
      &getroutinglist     &delroutingmember   &addroutingmember
52
      &reorder_members
52
      &reorder_members
53
      &reorder_member_ranking
53
      &check_routing &updateClaim &removeMissingIssue
54
      &check_routing &updateClaim &removeMissingIssue
54
      &CountIssues
55
      &CountIssues
55
      HasItems
56
      HasItems
Lines 2000-2005 sub reorder_members { Link Here
2000
    return;
2001
    return;
2001
}
2002
}
2002
2003
2004
=head2 reorder_member_ranking
2005
2006
reorder_member_ranking($subscriptionid)
2007
2008
this function is used to reorder the routing list without adding or deleting any members, which is necessary when the ranking goes out of sync due to the cascading delete of a borrower
2009
2010
=cut
2011
2012
sub reorder_member_ranking {
2013
    my ( $subscriptionid, $routingid, $rank ) = @_;
2014
    my $dbh = C4::Context->dbh;
2015
    my $sth = $dbh->prepare( "SELECT * FROM subscriptionroutinglist WHERE subscriptionid = ? ORDER BY ranking ASC" );
2016
    $sth->execute($subscriptionid);
2017
    my @result;
2018
    while ( my $line = $sth->fetchrow_hashref ) {
2019
        push( @result, $line->{'routingid'} );
2020
    }
2021
2022
    for ( my $j = 0 ; $j < @result ; $j++ ) {
2023
        my $sth = $dbh->prepare( "UPDATE subscriptionroutinglist SET ranking = '" . ( $j + 1 ) . "' WHERE routingid = '" . $result[$j] . "'" );
2024
        $sth->execute;
2025
    }
2026
}
2027
2003
=head2 delroutingmember
2028
=head2 delroutingmember
2004
2029
2005
delroutingmember($routingid,$subscriptionid)
2030
delroutingmember($routingid,$subscriptionid)
(-)a/serials/routing.pl (-1 / +2 lines)
Lines 66-71 if($op eq 'save'){ Link Here
66
    print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate");
66
    print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate");
67
}
67
}
68
68
69
reorder_member_ranking($subscriptionid);
70
69
my @routinglist = getroutinglist($subscriptionid);
71
my @routinglist = getroutinglist($subscriptionid);
70
my $subs = GetSubscription($subscriptionid);
72
my $subs = GetSubscription($subscriptionid);
71
my ($count,@serials) = GetSerials($subscriptionid);
73
my ($count,@serials) = GetSerials($subscriptionid);
72
- 

Return to bug 8260