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

(-)a/C4/Reserves.pm (-23 / +16 lines)
Lines 1282-1293 sub ModReserveStatus { Link Here
1282
1282
1283
=head2 ModReserveAffect
1283
=head2 ModReserveAffect
1284
1284
1285
  &ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend);
1285
  &ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend,$reserve_id);
1286
1286
1287
This function affect an item and a status for a given reserve
1287
This function affect an item and a status for a given reserve, either fetched directly
1288
The itemnumber parameter is used to find the biblionumber.
1288
by record_id, or by borrowernumber and itemnumber or biblionumber. If only biblionumber
1289
with the biblionumber & the borrowernumber, we can affect the itemnumber
1289
is given, only first reserve returned is affected, which is ok for anything but
1290
to the correct reserve.
1290
multi-item holds.
1291
1291
1292
if $transferToDo is not set, then the status is set to "Waiting" as well.
1292
if $transferToDo is not set, then the status is set to "Waiting" as well.
1293
otherwise, a transfer is on the way, and the end of the transfer will
1293
otherwise, a transfer is on the way, and the end of the transfer will
Lines 1346-1352 sub ModReserveAffect { Link Here
1346
    }
1346
    }
1347
    $hold->store();
1347
    $hold->store();
1348
1348
1349
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber )
1349
    _koha_notify_reserve( $hold->reserve_id )
1350
      if ( !$transferToDo && !$already_on_shelf );
1350
      if ( !$transferToDo && !$already_on_shelf );
1351
1351
1352
    _FixPriority( { biblionumber => $biblionumber } );
1352
    _FixPriority( { biblionumber => $biblionumber } );
Lines 1952-1958 sub _Findgroupreserve { Link Here
1952
1952
1953
=head2 _koha_notify_reserve
1953
=head2 _koha_notify_reserve
1954
1954
1955
  _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber );
1955
  _koha_notify_reserve( $hold->reserve_id );
1956
1956
1957
Sends a notification to the patron that their hold has been filled (through
1957
Sends a notification to the patron that their hold has been filled (through
1958
ModReserveAffect, _not_ ModReserveFill)
1958
ModReserveAffect, _not_ ModReserveFill)
Lines 1979-1987 The following tables are availalbe witin the notice: Link Here
1979
=cut
1979
=cut
1980
1980
1981
sub _koha_notify_reserve {
1981
sub _koha_notify_reserve {
1982
    my ($itemnumber, $borrowernumber, $biblionumber) = @_;
1982
    my $reserve_id = shift;
1983
    my $hold = Koha::Holds->find($reserve_id);
1984
    my $borrowernumber = $hold->borrowernumber;
1983
1985
1984
    my $dbh = C4::Context->dbh;
1985
    my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
1986
    my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
1986
1987
1987
    # Try to get the borrower's email address
1988
    # Try to get the borrower's email address
Lines 1992-2019 sub _koha_notify_reserve { Link Here
1992
            message_name => 'Hold_Filled'
1993
            message_name => 'Hold_Filled'
1993
    } );
1994
    } );
1994
1995
1995
    my $sth = $dbh->prepare("
1996
    my $library = Koha::Libraries->find( $hold->branchcode )->unblessed;
1996
        SELECT *
1997
        FROM   reserves
1998
        WHERE  borrowernumber = ?
1999
            AND biblionumber = ?
2000
    ");
2001
    $sth->execute( $borrowernumber, $biblionumber );
2002
    my $reserve = $sth->fetchrow_hashref;
2003
    my $library = Koha::Libraries->find( $reserve->{branchcode} )->unblessed;
2004
1997
2005
    my $admin_email_address = $library->{branchemail} || C4::Context->preference('KohaAdminEmailAddress');
1998
    my $admin_email_address = $library->{branchemail} || C4::Context->preference('KohaAdminEmailAddress');
2006
1999
2007
    my %letter_params = (
2000
    my %letter_params = (
2008
        module => 'reserves',
2001
        module => 'reserves',
2009
        branchcode => $reserve->{branchcode},
2002
        branchcode => $hold->branchcode,
2010
        tables => {
2003
        tables => {
2011
            'branches'       => $library,
2004
            'branches'       => $library,
2012
            'borrowers'      => $borrower,
2005
            'borrowers'      => $borrower,
2013
            'biblio'         => $biblionumber,
2006
            'biblio'         => $hold->biblionumber,
2014
            'biblioitems'    => $biblionumber,
2007
            'biblioitems'    => $hold->biblionumber,
2015
            'reserves'       => $reserve,
2008
            'reserves'       => $hold->unblessed,
2016
            'items'          => $reserve->{'itemnumber'},
2009
            'items'          => $hold->itemnumber,
2017
        },
2010
        },
2018
        substitute => { today => output_pref( { dt => dt_from_string, dateonly => 1 } ) },
2011
        substitute => { today => output_pref( { dt => dt_from_string, dateonly => 1 } ) },
2019
    );
2012
    );
(-)a/t/db_dependent/Reserves/MultiplePerRecord.t (-1 / +3 lines)
Lines 80-85 my $item1 = $builder->build( Link Here
80
            itype         => $itemtype1->{itemtype},
80
            itype         => $itemtype1->{itemtype},
81
            homebranch    => $library->{branchcode},
81
            homebranch    => $library->{branchcode},
82
            holdingbranch => $library->{branchcode},
82
            holdingbranch => $library->{branchcode},
83
            damaged       => 0,
83
        },
84
        },
84
    }
85
    }
85
);
86
);
Lines 91-96 my $item2 = $builder->build( Link Here
91
            itype         => $itemtype2->{itemtype},
92
            itype         => $itemtype2->{itemtype},
92
            homebranch    => $library->{branchcode},
93
            homebranch    => $library->{branchcode},
93
            holdingbranch => $library->{branchcode},
94
            holdingbranch => $library->{branchcode},
95
            damaged       => 0,
94
        },
96
        },
95
    }
97
    }
96
);
98
);
Lines 102-107 my $item3 = $builder->build( Link Here
102
            itype         => $itemtype2->{itemtype},
104
            itype         => $itemtype2->{itemtype},
103
            homebranch    => $library->{branchcode},
105
            homebranch    => $library->{branchcode},
104
            holdingbranch => $library->{branchcode},
106
            holdingbranch => $library->{branchcode},
107
            damaged       => 0,
105
        },
108
        },
106
    }
109
    }
107
);
110
);
108
- 

Return to bug 17766