diff --git a/classes/Device.class.php b/classes/Device.class.php index 7fea0de1b..9fdf03e71 100644 --- a/classes/Device.class.php +++ b/classes/Device.class.php @@ -610,7 +610,9 @@ function CopyDeviceCustomValues($new) { global $dbh; if($this->GetDevice() && $new->GetDevice()) { $sql="INSERT INTO fac_DeviceCustomValue(DeviceID, AttributeID, Value) - SELECT $new->DeviceID, dcv.AttributeID, dcv.Value FROM fac_DeviceCustomValue dcv WHERE dcv.DeviceID=$this->DeviceID;"; + SELECT $new->DeviceID, dcv.AttributeID, dcv.Value + FROM fac_DeviceCustomValue, dcv WHERE dcv.DeviceID=$this->DeviceID + ON DUPLICATE KEY UPDATE Value=dcv.Value;"; if(!$dbh->query($sql)){ $info=$dbh->errorInfo();