massiveart-webservices / ZOOLU

2 stars 1 forks source link

Duplicated Media Titles in One Languages #309

Closed alexander-schranz closed 9 years ago

alexander-schranz commented 10 years ago

When you double click on Media Edit 'Save'. The media title will be saved twice and this will show the Problem that the Media is multiple in the Content Template.

To fix this clean the duplicated fileTitles:

/* DE */
SELECT * FROM fileTitles
WHERE
  idFiles
  IN (
   SELECT ft.idFiles
   FROM  `fileTitles` as ft 
      WHERE ft.idLanguages =1
      GROUP BY ft.idFiles, ft.idLanguages
      HAVING COUNT( * ) > 1
  )
  AND isDisplayTitle = 0
  AND idLanguages = 1
/* EN */
SELECT * FROM fileTitles
WHERE
  idFiles
  IN (
   SELECT ft.idFiles
   FROM  `fileTitles` as ft 
      WHERE ft.idLanguages =2
      GROUP BY ft.idFiles, ft.idLanguages
      HAVING COUNT( * ) > 1
  )
  AND isDisplayTitle = 0
  AND idLanguages = 2

Change file.class.php:updateFileData()

// FROM
$intNumOfEffectedRows = $this->objModelFile->getFileTitleTable()->update($arrData, $strWhere);

if ($intNumOfEffectedRows == 0) {
//....
// TO
$elements = $this->objModelFile->getFileTitleTable()->fetchAll($strWhere);
$intNumOfEffectedRows = count($elements);
$this->objModelFile->getFileTitleTable()->update($arrData, $strWhere);

if ($intNumOfEffectedRows == 0) {
//....