Skip to content

Commit

Permalink
Remove extra "-" when there's no clone prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
eudaldca committed Nov 27, 2023
1 parent 5bb3718 commit db8b653
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Admin/Models/Instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
}

//////////////////////////
Expand All @@ -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);
////////////////////////////
Expand Down

0 comments on commit db8b653

Please sign in to comment.