Bug 27595: Place holds when ordering from a suggestion

This patch updates the ordering code to place a hold when adding to a basket from a
suggestion if the new preference PlaceHoldsOnOrdersFromSuggestions is enabled.

To test:
1 - Apply all patches
2 - updatedatabase
3 - See new system preference PlaceHoldsOnOrdersFromSuggestions
4 - Create a new purchase suggestion, mark it accepted
5 - Go to acquisitions, find a vendor, find a basket, 'Add to basket' -> 'From a suggestion'
6 - Complete order, confirm no hold was placed
7 - Enable the new system preference
8 - Repeast 4-6
9 - Confirm a hold was placed

Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Nick Clemens 2023-12-04 14:05:43 +00:00 committed by Katrin Fischer
parent e4caa84e86
commit bb2dcfdced
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -343,6 +343,12 @@ if ( $op eq 'cud-order' ) {
STATUS => 'ORDERED',
}
);
if ( C4::Context->preference('PlaceHoldsOnOrdersFromSuggestions') ) {
my $suggestion = Koha::Suggestions->find($suggestionid);
if ($suggestion) {
$suggestion->place_hold();
}
}
}
$orderinfo->{unitprice} = $orderinfo->{ecost}