diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 19ecb6b51f..c091f898a0 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -1410,7 +1410,7 @@ q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketn
my $sth = $dbh->prepare($query);
$sth->execute(
- ( $order->{quantity} < $quantrec ? 0 : ( $order->{quantity} - $quantrec ) ),
+ ( $order->{is_standing} ? 1 : ( $order->{quantity} - $quantrec ) ),
( defined $order_internalnote ? $order_internalnote : () ),
( defined $order_vendornote ? $order_vendornote : () ),
$ordernumber
diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm
index de0c49d904..ede8ddf415 100644
--- a/Koha/Acquisition/Order.pm
+++ b/Koha/Acquisition/Order.pm
@@ -26,17 +26,16 @@ sub fetch {
sub insert {
my ($self) = @_;
+ my $schema = Koha::Database->new->schema;
+ # Override quantity for standing orders
+ $self->{quantity} = 1 if ( $self->{basketno} && $schema->resultset('Aqbasket')->find( $self->{basketno} )->is_standing );
+
# if these parameters are missing, we can't continue
- for my $key (qw( basketno biblionumber budget_id )) {
+ for my $key (qw( basketno quantity biblionumber budget_id )) {
croak "Cannot insert order: Mandatory parameter $key is missing"
unless $self->{$key};
}
- my $schema = Koha::Database->new->schema;
- if ( !$self->{quantity} && !$schema->resultset('Aqbasket')->find( $self->{basketno} )->is_standing ) {
- croak "Cannot insert order: Quantity is mandatory for non-standing orders";
- }
-
$self->{quantityreceived} ||= 0;
$self->{entrydate} ||=
output_pref( { dt => dt_from_string, dateformat => 'iso' } );
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
index 12de1ed1f9..d33de40900 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
@@ -522,7 +522,7 @@
[% books_loo.ecostgste | $Price%]
[% books_loo.rrpgsti | $Price %]
[% books_loo.ecostgsti | $Price %]
-
[% IF is_standing and books_loo.quantity == 0 %]N/A[% ELSE %][% books_loo.quantity or 'N/A' %][% END %]
+
[% books_loo.quantity %]
[% books_loo.totalgste | $Price %]
[% books_loo.totalgsti | $Price %]
[% books_loo.gstrate * 100 | $Price %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
index 67791096bc..c01641d3c7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -43,12 +43,10 @@ function Check(ff) {
_alertString += "\n- "+ _("You must select a fund");
}
-[% UNLESS basket.is_standing %]
if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
ok=1;
_alertString += "\n- " + _("Quantity must be greater than '0'");
}
-[% END %]
if (!(isNum(ff.listprice,0))){
ok=1;
@@ -415,7 +413,7 @@ $(document).ready(function()
[% END %]
- [% UNLESS subscriptionid %][% # it is a suggestion, we have not items %]
+ [% UNLESS subscriptionid || basket.is_standing %][% # it is a suggestion, we have not items %]
[% IF (AcqCreateItemOrdering) %]