// error_log('Moving approved suggestion'); // $objApprovedSuggestion->ValidSuggestionId = $objSuggestion->SuggestionId; // $objApprovedSuggestion->Save(); // } // // error_log(sprintf('Deleting suggestion %d %d "%s"', $objDuplicateSuggestion->SuggestionId, $objDuplicateSuggestion->LanguageId, $objDuplicateSuggestion->SuggestionValue)); // $objDuplicateSuggestion->Delete(); // $intDuplicateSuggestionsDeleted++; // } // } // // $objSuggestion->Save(); // } // } $intDuplicateTextsDeleted = 0; foreach (NarroText::LoadAll() as $intVal => $objText) { if ($objText->TextValueMd5 == md5($objText->TextValue)) { continue; } try { $objText->Save(); } catch (Exception $objEx) { if (strstr($objEx->getMessage(), 'Duplicate')) { $arrDuplicateTexts = NarroText::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroText()->TextValue, $objText->TextValue), QQ::NotEqual(QQN::NarroText()->TextId, $objText->TextId))); error_log(sprintf('Found duplicates for "%s": %d', $objText->TextValue, count($arrDuplicateTexts))); foreach ($arrDuplicateTexts as $objDuplicateText) { if ($objText->TextValue !== $objDuplicateText->TextValue) { continue; } foreach (NarroTextComment::LoadArrayByTextId($objDuplicateText->TextId) as $objTextComment) { error_log('Moving text comment');
/** * Refresh this MetaControl with Data from the local NarroSuggestion object. * @param boolean $blnReload reload NarroSuggestion from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objNarroSuggestion->Reload(); } if ($this->lblSuggestionId) { if ($this->blnEditMode) { $this->lblSuggestionId->Text = $this->objNarroSuggestion->SuggestionId; } } if ($this->lstUser) { $this->lstUser->RemoveAllItems(); $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null); $objUserArray = NarroUser::LoadAll(); if ($objUserArray) { foreach ($objUserArray as $objUser) { $objListItem = new QListItem($objUser->__toString(), $objUser->UserId); if ($this->objNarroSuggestion->User && $this->objNarroSuggestion->User->UserId == $objUser->UserId) { $objListItem->Selected = true; } $this->lstUser->AddItem($objListItem); } } } if ($this->lblUserId) { $this->lblUserId->Text = $this->objNarroSuggestion->User ? $this->objNarroSuggestion->User->__toString() : null; } if ($this->lstText) { $this->lstText->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstText->AddItem(QApplication::Translate('- Select One -'), null); } $objTextArray = NarroText::LoadAll(); if ($objTextArray) { foreach ($objTextArray as $objText) { $objListItem = new QListItem($objText->__toString(), $objText->TextId); if ($this->objNarroSuggestion->Text && $this->objNarroSuggestion->Text->TextId == $objText->TextId) { $objListItem->Selected = true; } $this->lstText->AddItem($objListItem); } } } if ($this->lblTextId) { $this->lblTextId->Text = $this->objNarroSuggestion->Text ? $this->objNarroSuggestion->Text->__toString() : null; } if ($this->lstLanguage) { $this->lstLanguage->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null); } $objLanguageArray = NarroLanguage::LoadAll(); if ($objLanguageArray) { foreach ($objLanguageArray as $objLanguage) { $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId); if ($this->objNarroSuggestion->Language && $this->objNarroSuggestion->Language->LanguageId == $objLanguage->LanguageId) { $objListItem->Selected = true; } $this->lstLanguage->AddItem($objListItem); } } } if ($this->lblLanguageId) { $this->lblLanguageId->Text = $this->objNarroSuggestion->Language ? $this->objNarroSuggestion->Language->__toString() : null; } if ($this->txtSuggestionValue) { $this->txtSuggestionValue->Text = $this->objNarroSuggestion->SuggestionValue; } if ($this->lblSuggestionValue) { $this->lblSuggestionValue->Text = $this->objNarroSuggestion->SuggestionValue; } if ($this->txtSuggestionValueMd5) { $this->txtSuggestionValueMd5->Text = $this->objNarroSuggestion->SuggestionValueMd5; } if ($this->lblSuggestionValueMd5) { $this->lblSuggestionValueMd5->Text = $this->objNarroSuggestion->SuggestionValueMd5; } if ($this->txtSuggestionCharCount) { $this->txtSuggestionCharCount->Text = $this->objNarroSuggestion->SuggestionCharCount; } if ($this->lblSuggestionCharCount) { $this->lblSuggestionCharCount->Text = $this->objNarroSuggestion->SuggestionCharCount; } if ($this->txtSuggestionWordCount) { $this->txtSuggestionWordCount->Text = $this->objNarroSuggestion->SuggestionWordCount; } if ($this->lblSuggestionWordCount) { $this->lblSuggestionWordCount->Text = $this->objNarroSuggestion->SuggestionWordCount; } if ($this->chkHasComments) { $this->chkHasComments->Checked = $this->objNarroSuggestion->HasComments; } if ($this->lblHasComments) { $this->lblHasComments->Text = $this->objNarroSuggestion->HasComments ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkIsImported) { $this->chkIsImported->Checked = $this->objNarroSuggestion->IsImported; } if ($this->lblIsImported) { $this->lblIsImported->Text = $this->objNarroSuggestion->IsImported ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->calCreated) { $this->calCreated->DateTime = $this->objNarroSuggestion->Created; } if ($this->lblCreated) { $this->lblCreated->Text = sprintf($this->objNarroSuggestion->Created) ? $this->objNarroSuggestion->Created->qFormat($this->strCreatedDateTimeFormat) : null; } if ($this->calModified) { $this->calModified->DateTime = $this->objNarroSuggestion->Modified; } if ($this->lblModified) { $this->lblModified->Text = sprintf($this->objNarroSuggestion->Modified) ? $this->objNarroSuggestion->Modified->qFormat($this->strModifiedDateTimeFormat) : null; } }
/** * Refresh this MetaControl with Data from the local NarroContext object. * @param boolean $blnReload reload NarroContext from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objNarroContext->Reload(); } if ($this->lblContextId) { if ($this->blnEditMode) { $this->lblContextId->Text = $this->objNarroContext->ContextId; } } if ($this->lstText) { $this->lstText->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstText->AddItem(QApplication::Translate('- Select One -'), null); } $objTextArray = NarroText::LoadAll(); if ($objTextArray) { foreach ($objTextArray as $objText) { $objListItem = new QListItem($objText->__toString(), $objText->TextId); if ($this->objNarroContext->Text && $this->objNarroContext->Text->TextId == $objText->TextId) { $objListItem->Selected = true; } $this->lstText->AddItem($objListItem); } } } if ($this->lblTextId) { $this->lblTextId->Text = $this->objNarroContext->Text ? $this->objNarroContext->Text->__toString() : null; } if ($this->txtTextAccessKey) { $this->txtTextAccessKey->Text = $this->objNarroContext->TextAccessKey; } if ($this->lblTextAccessKey) { $this->lblTextAccessKey->Text = $this->objNarroContext->TextAccessKey; } if ($this->txtTextCommandKey) { $this->txtTextCommandKey->Text = $this->objNarroContext->TextCommandKey; } if ($this->lblTextCommandKey) { $this->lblTextCommandKey->Text = $this->objNarroContext->TextCommandKey; } if ($this->lstProject) { $this->lstProject->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstProject->AddItem(QApplication::Translate('- Select One -'), null); } $objProjectArray = NarroProject::LoadAll(); if ($objProjectArray) { foreach ($objProjectArray as $objProject) { $objListItem = new QListItem($objProject->__toString(), $objProject->ProjectId); if ($this->objNarroContext->Project && $this->objNarroContext->Project->ProjectId == $objProject->ProjectId) { $objListItem->Selected = true; } $this->lstProject->AddItem($objListItem); } } } if ($this->lblProjectId) { $this->lblProjectId->Text = $this->objNarroContext->Project ? $this->objNarroContext->Project->__toString() : null; } if ($this->txtContext) { $this->txtContext->Text = $this->objNarroContext->Context; } if ($this->lblContext) { $this->lblContext->Text = $this->objNarroContext->Context; } if ($this->txtContextMd5) { $this->txtContextMd5->Text = $this->objNarroContext->ContextMd5; } if ($this->lblContextMd5) { $this->lblContextMd5->Text = $this->objNarroContext->ContextMd5; } if ($this->txtComment) { $this->txtComment->Text = $this->objNarroContext->Comment; } if ($this->lblComment) { $this->lblComment->Text = $this->objNarroContext->Comment; } if ($this->txtCommentMd5) { $this->txtCommentMd5->Text = $this->objNarroContext->CommentMd5; } if ($this->lblCommentMd5) { $this->lblCommentMd5->Text = $this->objNarroContext->CommentMd5; } if ($this->lstFile) { $this->lstFile->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstFile->AddItem(QApplication::Translate('- Select One -'), null); } $objFileArray = NarroFile::LoadAll(); if ($objFileArray) { foreach ($objFileArray as $objFile) { $objListItem = new QListItem($objFile->__toString(), $objFile->FileId); if ($this->objNarroContext->File && $this->objNarroContext->File->FileId == $objFile->FileId) { $objListItem->Selected = true; } $this->lstFile->AddItem($objListItem); } } } if ($this->lblFileId) { $this->lblFileId->Text = $this->objNarroContext->File ? $this->objNarroContext->File->__toString() : null; } if ($this->calCreated) { $this->calCreated->DateTime = $this->objNarroContext->Created; } if ($this->lblCreated) { $this->lblCreated->Text = sprintf($this->objNarroContext->Created) ? $this->objNarroContext->Created->qFormat($this->strCreatedDateTimeFormat) : null; } if ($this->calModified) { $this->calModified->DateTime = $this->objNarroContext->Modified; } if ($this->lblModified) { $this->lblModified->Text = sprintf($this->objNarroContext->Modified) ? $this->objNarroContext->Modified->qFormat($this->strModifiedDateTimeFormat) : null; } if ($this->chkActive) { $this->chkActive->Checked = $this->objNarroContext->Active; } if ($this->lblActive) { $this->lblActive->Text = $this->objNarroContext->Active ? QApplication::Translate('Yes') : QApplication::Translate('No'); } }
/** * Refresh this MetaControl with Data from the local NarroTextComment object. * @param boolean $blnReload reload NarroTextComment from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objNarroTextComment->Reload(); } if ($this->lblTextCommentId) { if ($this->blnEditMode) { $this->lblTextCommentId->Text = $this->objNarroTextComment->TextCommentId; } } if ($this->lstText) { $this->lstText->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstText->AddItem(QApplication::Translate('- Select One -'), null); } $objTextArray = NarroText::LoadAll(); if ($objTextArray) { foreach ($objTextArray as $objText) { $objListItem = new QListItem($objText->__toString(), $objText->TextId); if ($this->objNarroTextComment->Text && $this->objNarroTextComment->Text->TextId == $objText->TextId) { $objListItem->Selected = true; } $this->lstText->AddItem($objListItem); } } } if ($this->lblTextId) { $this->lblTextId->Text = $this->objNarroTextComment->Text ? $this->objNarroTextComment->Text->__toString() : null; } if ($this->lstUser) { $this->lstUser->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null); } $objUserArray = NarroUser::LoadAll(); if ($objUserArray) { foreach ($objUserArray as $objUser) { $objListItem = new QListItem($objUser->__toString(), $objUser->UserId); if ($this->objNarroTextComment->User && $this->objNarroTextComment->User->UserId == $objUser->UserId) { $objListItem->Selected = true; } $this->lstUser->AddItem($objListItem); } } } if ($this->lblUserId) { $this->lblUserId->Text = $this->objNarroTextComment->User ? $this->objNarroTextComment->User->__toString() : null; } if ($this->lstLanguage) { $this->lstLanguage->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null); } $objLanguageArray = NarroLanguage::LoadAll(); if ($objLanguageArray) { foreach ($objLanguageArray as $objLanguage) { $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId); if ($this->objNarroTextComment->Language && $this->objNarroTextComment->Language->LanguageId == $objLanguage->LanguageId) { $objListItem->Selected = true; } $this->lstLanguage->AddItem($objListItem); } } } if ($this->lblLanguageId) { $this->lblLanguageId->Text = $this->objNarroTextComment->Language ? $this->objNarroTextComment->Language->__toString() : null; } if ($this->calCreated) { $this->calCreated->DateTime = $this->objNarroTextComment->Created; } if ($this->lblCreated) { $this->lblCreated->Text = sprintf($this->objNarroTextComment->Created) ? $this->objNarroTextComment->Created->qFormat($this->strCreatedDateTimeFormat) : null; } if ($this->calModified) { $this->calModified->DateTime = $this->objNarroTextComment->Modified; } if ($this->lblModified) { $this->lblModified->Text = sprintf($this->objNarroTextComment->Modified) ? $this->objNarroTextComment->Modified->qFormat($this->strModifiedDateTimeFormat) : null; } if ($this->txtCommentText) { $this->txtCommentText->Text = $this->objNarroTextComment->CommentText; } if ($this->lblCommentText) { $this->lblCommentText->Text = $this->objNarroTextComment->CommentText; } if ($this->txtCommentTextMd5) { $this->txtCommentTextMd5->Text = $this->objNarroTextComment->CommentTextMd5; } if ($this->lblCommentTextMd5) { $this->lblCommentTextMd5->Text = $this->objNarroTextComment->CommentTextMd5; } }