Skip to content

Commit

Permalink
Fix License Import. (snipe#4121)
Browse files Browse the repository at this point in the history
The license name is not unique, so keying by license alone was causing issues.  Match using name + serial instead.
  • Loading branch information
dmeltzer authored and snipe committed Oct 3, 2017
1 parent d303cbd commit d119372
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Importer/LicenseImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ protected function handle($row)
public function createLicenseIfNotExists(array $row)
{
$editingLicense = false;
$license = License::where('name', $this->item['name'])->first();
$license = License::where('name', $this->item['name'])
->where('serial', $this->item['serial'])
->first();
if ($license) {
if (!$this->updating) {
$this->log('A matching License ' . $this->item['name'] . ' already exists');
$this->log('A matching License ' . $this->item['name'] . 'with serial ' . $this->item['serial'] . ' already exists');
return;
}

Expand Down

0 comments on commit d119372

Please sign in to comment.