close #2292 Fixed: Unable to change the customer of a duplicated invoice

This commit is contained in:
Cüneyt Şentürk 2021-11-08 10:46:26 +03:00
parent d9d0e09e3a
commit 9ddbeddd2b
2 changed files with 6 additions and 2 deletions

View File

@ -456,8 +456,8 @@ abstract class DocumentForm extends Base
$contacts = Contact::enabled()->orderBy('name')->take(setting('default.select_limit'))->get();
}
if (!empty($document) && ($document->contact && !$contacts->has($document->contact_id))) {
$contacts->put($document->contact->id, $document->contact->name);
if (!empty($document) && ($document->contact && !$contacts->contains('id', $document->contact_id))) {
$contacts->push($document->contact);
}
return $contacts;

View File

@ -71,6 +71,10 @@ class SelectContactCard extends Component
{
if (empty($this->contacts)) {
$this->contacts = Contact::{$this->type}()->enabled()->orderBy('name')->take(setting('default.select_limit'))->get();
if (!empty($this->contact) && (!$this->contacts->contains('id', $contact->id))) {
$this->contacts->push($this->contact);
}
}
if (empty($this->searchRoute)) {