mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Merge pull request #13169 from akemidx/license_sn_check1
Making Serial Number the logic checked against for new imports
This commit is contained in:
commit
2faa73f983
|
@ -27,15 +27,24 @@ class LicenseImporter extends ItemImporter
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
* @param array $row
|
* @param array $row
|
||||||
* @return License|mixed|null
|
* @return License|mixed|null
|
||||||
|
* updated @author Jes Vinsmoke
|
||||||
|
* @since 6.1
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function createLicenseIfNotExists(array $row)
|
public function createLicenseIfNotExists(array $row)
|
||||||
{
|
{
|
||||||
$editingLicense = false;
|
$editingLicense = false;
|
||||||
$license = License::where('name', $this->item['name'])
|
$license = License::where('serial', $this->item['serial'])->where('name', $this->item['name'])
|
||||||
->first();
|
->first();
|
||||||
if ($license) {
|
if ($license) {
|
||||||
if (! $this->updating) {
|
if (! $this->updating) {
|
||||||
|
|
||||||
|
if($this->item['serial'] != "") {
|
||||||
$this->log('A matching License ' . $this->item['name'] . ' with serial ' . $this->item['serial'] . ' already exists');
|
$this->log('A matching License ' . $this->item['name'] . ' with serial ' . $this->item['serial'] . ' already exists');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->log('A matching License ' . $this->item['name'] . ' with no serial number already exists');
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +66,10 @@ class LicenseImporter extends ItemImporter
|
||||||
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
|
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
|
||||||
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
|
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
|
||||||
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
|
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
|
||||||
|
if($this->item['reassignable'] == "")
|
||||||
|
{
|
||||||
|
$this->item['reassignable'] = 1;
|
||||||
|
}
|
||||||
$this->item['seats'] = $this->findCsvMatch($row, 'seats');
|
$this->item['seats'] = $this->findCsvMatch($row, 'seats');
|
||||||
|
|
||||||
$this->item["termination_date"] = null;
|
$this->item["termination_date"] = null;
|
||||||
|
|
Loading…
Reference in a new issue