- $cart->reference = $Refs->get_next(ST_COSTUPDATE, null, $cart->tran_date, $date_);
-
- $cart->memo_ = sprintf(_("Cost was %s changed to %s x quantity on hand of %s"),
- number_format2($last_cost, 2), number_format2($new_cost), $qoh);
+ $cart->reference = $Refs->get_next(ST_COSTUPDATE, $refline, $cart->tran_date, $date_);
+
+ if (empty($memo_))
+ $cart->memo_ = sprintf(_("Cost was %s changed to %s x quantity on hand of %s"),
+ number_format2($last_cost, 2), number_format2($new_cost), $qoh);
+ else
+ $cart->memo_ = $memo_;