Skip to content

Commit

Permalink
[fix] refs EC-CUBE#100
Browse files Browse the repository at this point in the history
  • Loading branch information
seasoftjapan committed Apr 18, 2020
1 parent 6d191a0 commit 9fd3b69
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ public function lfSaveUploadFiles(&$objUpFile, &$objDownFile, $product_id)
$objImage->moveTempImage($temp_file, $objUpFile->save_dir);
$arrImageKey[] = $arrKeyName[$key];
if (!empty($arrSaveFile[$key])
&& !$this->lfHasSameProductImage($product_id, $arrImageKey, $arrSaveFile[$key])
&& !$this->lfHasSameProductImage($product_id, $arrImageKey, $arrSaveFile[$key], $objUpFile)
&& !in_array($temp_file, $arrSaveFile)
) {
$objImage->deleteImage($arrSaveFile[$key], $objUpFile->save_dir);
Expand All @@ -808,9 +808,10 @@ public function lfSaveUploadFiles(&$objUpFile, &$objDownFile, $product_id)
* @param string $product_id 商品ID
* @param string $arrImageKey 対象としない画像カラム名
* @param string $image_file_name 画像ファイル名
* @param SC_UploadFile_Ex $objUpFile SC_UploadFileインスタンス
* @return boolean
*/
public function lfHasSameProductImage($product_id, $arrImageKey, $image_file_name)
public function lfHasSameProductImage($product_id, $arrImageKey, $image_file_name, &$objUpFile)
{
if (!SC_Utils_Ex::sfIsInt($product_id)) return false;
if (!$arrImageKey) return false;
Expand All @@ -825,7 +826,7 @@ public function lfHasSameProductImage($product_id, $arrImageKey, $image_file_nam
$where = implode(' OR ', $arrWhere);
$where = "del_flg = ? AND ((product_id <> ? AND ({$where}))";

$arrKeyName = $this->objUpFile->keyname;
$arrKeyName = $objUpFile->keyname;
foreach ($arrKeyName as $key => $keyname) {
if (in_array($keyname, $arrImageKey)) continue;
$where .= " OR {$keyname} = ?";
Expand Down Expand Up @@ -1104,7 +1105,7 @@ public function lfRegistProduct(&$objUpFile, &$objDownFile, $arrList)
foreach ($arrKeyName as $key => $keyname) {
if ($arrRet[$keyname] && !$arrSaveFile[$key]) {
$arrImageKey[] = $keyname;
$has_same_image = $this->lfHasSameProductImage($arrList['product_id'], $arrImageKey, $arrRet[$keyname]);
$has_same_image = $this->lfHasSameProductImage($arrList['product_id'], $arrImageKey, $arrRet[$keyname], $objUpFile);
if (!$has_same_image) {
$objImage->deleteImage($arrRet[$keyname], $objUpFile->save_dir);
}
Expand Down

0 comments on commit 9fd3b69

Please sign in to comment.