Skip to content

Commit

Permalink
close #2292 Fixed: Unable to change the customer of a duplicated invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 8, 2021
1 parent d9d0e09 commit 9ddbedd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Abstracts/View/Components/DocumentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ protected function getContacts($type, $document, $contacts)
$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;
Expand Down
4 changes: 4 additions & 0 deletions app/View/Components/SelectContactCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function render()
{
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)) {
Expand Down

0 comments on commit 9ddbedd

Please sign in to comment.