+// if we want to save old or derivative document first decode html entities
+// from text fields. For new documents this is not needed.
+ if ($this->trans_no || $this->trans_type != 30) {
+ $this->reference = @html_entity_decode($this->reference);
+ $this->Comments = @html_entity_decode($this->Comments);
+ foreach($this->line_items as $lineno => $line) {
+ $this->line_items[$lineno]->stock_id = @html_entity_decode($line->stock_id);
+ $this->line_items[$lineno]->description = @html_entity_decode($line->description);
+ }
+ }