From db8b6539c1e6db022e16a8f00988dc7f734715d1 Mon Sep 17 00:00:00 2001 From: Eudald Cardona Date: Mon, 27 Nov 2023 13:20:59 +0100 Subject: [PATCH] Remove extra "-" when there's no clone prefix --- src/Admin/Models/Instances.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Admin/Models/Instances.php b/src/Admin/Models/Instances.php index 94c4873..d1c0f76 100755 --- a/src/Admin/Models/Instances.php +++ b/src/Admin/Models/Instances.php @@ -976,7 +976,10 @@ function cloneInstance($inst_id, $session = '', $prefix = null) if (empty($resultNI)) { return 'Nom intern empty.'; } else { - $nomclonat = $this->cloneName($prefix.'-'.str_replace("'", "\'", $resultNI['text_val'])); + if ($prefix) { + $prefix = $prefix . '-'; + } + $nomclonat = $this->cloneName($prefix.str_replace("'", "\'", $resultNI['text_val'])); } ////////////////////////// @@ -985,13 +988,13 @@ function cloneInstance($inst_id, $session = '', $prefix = null) $origen_1 = "'" . $dolly_id . "', atri_id, '" . $nomclonat . "', date_val, num_val, img_info"; $sql = "insert into omp_values (" . $desti . ") (select " . $origen . " from omp_values where inst_id='$inst_id' and atri_id<>'1')"; - $result = parent::insert_one($sql); + parent::insert_one($sql); $sql = "insert into omp_values (" . $desti . ") (select " . $origen_1 . " from omp_values where inst_id='$inst_id' and atri_id='1')"; - $result = parent::insert_one($sql); + parent::insert_one($sql); ////////////////////////// - ///UPDATE NOM-INTER/////// + ///UPDATE NOM-INTERN/////// $sql = "update omp_instances set key_fields='$nomclonat' where id='$dolly_id'"; parent::update_one($sql); ////////////////////////////