From a29b6716791a410d387661965f5ddf50454a2a8c Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Mon, 31 Jul 2023 15:16:45 -0700 Subject: [PATCH 1/2] Don't count null values a duplicates --- ProcessMaker/ImportExport/Exporters/ExporterBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProcessMaker/ImportExport/Exporters/ExporterBase.php b/ProcessMaker/ImportExport/Exporters/ExporterBase.php index 128ee2b5bf..9ce322e142 100644 --- a/ProcessMaker/ImportExport/Exporters/ExporterBase.php +++ b/ProcessMaker/ImportExport/Exporters/ExporterBase.php @@ -382,7 +382,7 @@ public function updateDuplicateAttributes() foreach ($this->handleDuplicateAttributes() as $attribute => $handler) { $value = $this->model->$attribute; $i = 0; - while ($this->duplicateExists($attribute, $value)) { + while ($value !== null && $this->duplicateExists($attribute, $value)) { if ($i > 100) { throw new \Exception('Can not fix duplicate attribute after 100 iterations'); } From 7b8ed4745ab09b3be3a174938bc25faf298470a8 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Mon, 31 Jul 2023 15:52:58 -0700 Subject: [PATCH 2/2] Move null value check inside loop --- ProcessMaker/ImportExport/Exporters/ExporterBase.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ProcessMaker/ImportExport/Exporters/ExporterBase.php b/ProcessMaker/ImportExport/Exporters/ExporterBase.php index 9ce322e142..bc6cfe5b3c 100644 --- a/ProcessMaker/ImportExport/Exporters/ExporterBase.php +++ b/ProcessMaker/ImportExport/Exporters/ExporterBase.php @@ -382,12 +382,15 @@ public function updateDuplicateAttributes() foreach ($this->handleDuplicateAttributes() as $attribute => $handler) { $value = $this->model->$attribute; $i = 0; - while ($value !== null && $this->duplicateExists($attribute, $value)) { + while ($this->duplicateExists($attribute, $value)) { if ($i > 100) { throw new \Exception('Can not fix duplicate attribute after 100 iterations'); } $i++; $value = $handler($value); + if ($value === null) { + break; + } } $this->model->$attribute = $value; }