Fix License Import. (#4121)

The license name is not unique, so keying by license alone was causing issues.  Match using name + serial instead.
This commit is contained in:
Daniel Meltzer 2017-10-03 11:46:06 -04:00 committed by snipe
parent d303cbd7cb
commit d119372ff0

View file

@ -33,10 +33,12 @@ class LicenseImporter extends ItemImporter
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;
}