[-] BO: the attached file of downloadable products duplicated should not be the same than the original #PSCFV-7460
This commit is contained in:
+10
-2
@@ -3409,11 +3409,16 @@ class ProductCore extends ObjectModel
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
$res = true;
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
|
{
|
||||||
|
$new_filename = ProductDownload::getNewFilename();
|
||||||
|
copy(_PS_DOWNLOAD_DIR_.$row['filename'], _PS_DOWNLOAD_DIR_.$new_filename);
|
||||||
|
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'id_product' => (int)$id_product_new,
|
'id_product' => (int)$id_product_new,
|
||||||
'display_filename' => pSQL($row['display_filename']),
|
'display_filename' => pSQL($row['display_filename']),
|
||||||
'filename' => pSQL($row['filename']),
|
'filename' => pSQL($new_filename),
|
||||||
'date_expiration' => pSQL($row['date_expiration']),
|
'date_expiration' => pSQL($row['date_expiration']),
|
||||||
'nb_days_accessible' => (int)$row['nb_days_accessible'],
|
'nb_days_accessible' => (int)$row['nb_days_accessible'],
|
||||||
'nb_downloadable' => (int)$row['nb_downloadable'],
|
'nb_downloadable' => (int)$row['nb_downloadable'],
|
||||||
@@ -3421,7 +3426,10 @@ class ProductCore extends ObjectModel
|
|||||||
'is_shareable' => (int)$row['is_shareable'],
|
'is_shareable' => (int)$row['is_shareable'],
|
||||||
'date_add' => date('Y-m-d H:i:s')
|
'date_add' => date('Y-m-d H:i:s')
|
||||||
);
|
);
|
||||||
return Db::getInstance()->insert('product_download', $data);
|
$res &= Db::getInstance()->insert('product_download', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function duplicateAttachments($id_product_old, $id_product_new)
|
public static function duplicateAttachments($id_product_old, $id_product_new)
|
||||||
|
|||||||
Reference in New Issue
Block a user