Kaydet (Commit) c2bc2c46 authored tarafından Julien Nabet's avatar Julien Nabet

tdf#113923: don't use twice a new column in table copy

In the case where:
1: we enabled the creation of a primary key
2: we come back here from the "Back" button of the next page,
we want to avoid to list the new column generated in the next page

So we must check added columns in right panel must exist in the table

Change-Id: I467007941b03811381a216c1ab3de8fe729f9b9b
Reviewed-on: https://gerrit.libreoffice.org/47684Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarLionel Elie Mamane <lionel@mamane.lu>
üst d03a7547
...@@ -148,13 +148,23 @@ void OWizColumnSelect::ActivatePage( ) ...@@ -148,13 +148,23 @@ void OWizColumnSelect::ActivatePage( )
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector(); const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
// tdf#113923, the added columns must exist in the table
// in the case where:
// 1: we enabled the creation of a primary key
// 2: we come back here from the "Back" button of the next page,
// we want to avoid to list the new column generated in the next page
const ODatabaseExport::TColumns& rSrcColumns = m_pParent->getSourceColumns();
ODatabaseExport::TColumnVector::const_iterator aIter = rDestColumns.begin(); ODatabaseExport::TColumnVector::const_iterator aIter = rDestColumns.begin();
ODatabaseExport::TColumnVector::const_iterator aEnd = rDestColumns.end(); ODatabaseExport::TColumnVector::const_iterator aEnd = rDestColumns.end();
for(;aIter != aEnd;++aIter) for(;aIter != aEnd;++aIter)
{ {
const sal_Int32 nPos = m_pNewColumnNames->InsertEntry((*aIter)->first); if (rSrcColumns.find((*aIter)->first) != rSrcColumns.end())
m_pNewColumnNames->SetEntryData(nPos,new OFieldDescription(*((*aIter)->second))); {
m_pOrgColumnNames->RemoveEntry((*aIter)->first); const sal_Int32 nPos = m_pNewColumnNames->InsertEntry((*aIter)->first);
m_pNewColumnNames->SetEntryData(nPos,new OFieldDescription(*((*aIter)->second)));
m_pOrgColumnNames->RemoveEntry((*aIter)->first);
}
} }
m_pParent->GetOKButton().Enable(m_pNewColumnNames->GetEntryCount() != 0); m_pParent->GetOKButton().Enable(m_pNewColumnNames->GetEntryCount() != 0);
m_pParent->EnableNextButton(m_pNewColumnNames->GetEntryCount() && m_pParent->getOperation() != CopyTableOperation::AppendData); m_pParent->EnableNextButton(m_pNewColumnNames->GetEntryCount() && m_pParent->getOperation() != CopyTableOperation::AppendData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment