Created attachment 179988 [details] carte de visite dans Writer Dans le module carte de visite les champs de base de données n'apparaissent pas
This is English only forum, so I retitle to "Business Cards in Writer don't show database". File - New - Business Cards don't, while File - New - Labels show it. Seems repro since redesign, in 6.2 and still in 7.4+. Hard to grasp that nobody noticed this before. Note: Another issue is that Help for Business Cards goes to Labels. https://help.libreoffice.org/7.4/en-US/text/shared/01/01010201.html
With this patch: diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 6d34ea2132de..a3b62c3d4e81 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -81,11 +81,17 @@ void SwLabDlg::PageCreated(const OString &rId, SfxTabPage &rPage) static_cast<SwLabPage*>(&rPage)->SetDBManager(pDBManager); static_cast<SwLabPage*>(&rPage)->InitDatabaseBox(); } - else + else // TODO: if we are in "labels", can we go in !m_bLabel static_cast<SwLabPage*>(&rPage)->SetToBusinessCard(); } else if (rId == "options") m_pPrtPage = static_cast<SwLabPrtPage*>(&rPage); + else if (rId == "medium") + { + static_cast<SwLabPage*>(&rPage)->SetDBManager(pDBManager); + static_cast<SwLabPage*>(&rPage)->InitDatabaseBox(); + static_cast<SwLabPage*>(&rPage)->SetToBusinessCard(); + } } SwLabDlg::SwLabDlg(weld::Window* pParent, const SfxItemSet& rSet, @@ -275,7 +281,6 @@ void SwLabPage::SetToBusinessCard() m_xSheetButton->set_help_id(HID_BUSINESS_FMT_PAGE_SHEET); m_xMakeBox->set_help_id(HID_BUSINESS_FMT_PAGE_BRAND); m_xTypeBox->set_help_id(HID_BUSINESS_FMT_PAGE_TYPE); - m_xAddressFrame->hide(); }; IMPL_LINK_NOARG(SwLabPage, AddrHdl, weld::Toggleable&, void) - first tab "Medium" displays - the Database part (and shows the databases in list) - the label text and address checkbox - help goes to Medium part but it doesn't talk about label text and address checkbox AND doesn't talk about database part. So I think we need first to know what is expected here. For example why to call this tab "Medium" for "Business Card" and "Labels" for "Labels" if they must display the same thing? Of course whatever the decision, help should be modified. Heiko/Xisco: thought you might be interested in this one.
Looking to whom the blame goes these lines around SwLabDlg::PageCreated() date back to the "initial import" patch 22 years ago. But I don't see where two labels are assigned. Neither there would be a good reason, I guess.
(In reply to Heiko Tietze from comment #3) > Looking to whom the blame goes these lines around SwLabDlg::PageCreated() > date back to the "initial import" patch 22 years ago. But I don't see where > two labels are assigned. Neither there would be a good reason, I guess. Ok for the initial import part but sorry, I don't understand what you mean in "I don't see where two labels are assigned". What 2 labels?
I don't get 2 things. Julien, if you have a patch that would resolve this bug albeit leaving different labels, why didn't you apply it? Heiko, I understand that you agree on same labels/names for simalar tabs (Labels, Medium) and that you didn't comment why code is not shared for Labels and BC db? Please clarify.
(In reply to Julien Nabet from comment #2) > ...why to call this tab "Medium" for "Business Card" and "Labels".. That's what I mean with "two labels"- and I don't see where it is assigned per code. And my comment was a general agreement, having more consistency is good.
(In reply to Timur from comment #5) > I don't get 2 things. > Julien, if you have a patch that would resolve this bug albeit leaving > different labels, why didn't you apply it? > ... Because I prefer knowing first what we want for UI. It's not as if it was a critical bug which needs to hurry a lot :-)
I gave a try with https://gerrit.libreoffice.org/c/core/+/135566 I quote the description of the patch (in addition to make database part work): ' + Remove "medium" tab since its goal is exactly what "label" tab does. So now "label" tab is common for "File - New - Business Cards" and "File - New - Labels '
Julien Nabet committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7a7afd3ae5d44677791924a1450d42b7fcf9b82b tdf#148978: Business Cards in Writer dont show database It will be available in 7.5.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/7ab4918280eb0f06025f23530878de6a67bbdea7 tdf#148978: Business Cards in Writer dont show database It will be available in 7.4.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Is this the first fix for BC ever? Julien, now that you are fresh here, please see https://bugs.documentfoundation.org/show_bug.cgi?id=112330#c6. This wasn't good before and test will not be straightforward.
(In reply to Timur from comment #11) > Is this the first fix for BC ever? > Julien, now that you are fresh here, please see > https://bugs.documentfoundation.org/show_bug.cgi?id=112330#c6. > This wasn't good before and test will not be straightforward. I don't know how it works and it's unclear for me what's expected from UI. I gave a try to this one because it was quite clear and straightforward. I did just a bit more because it seemed to me there was no reason to have 2 different panels for the same thing at the end. Also, I suppose documentation should be updated after having fixed this one (I'm not a volunteer for it).
Database is shown now. But I don't see it working, if I use some fields, I still get an empty cards.
(In reply to Timur from comment #13) > Database is shown now. > But I don't see it working, if I use some fields, I still get an empty cards. Indeed, I had tested: - Database entries appeared - Table entries appeared - Database field entries appeared - click on left arrow make the field appeared at left I hadn't tried "New Document", depressing... I don't know at all how is managed the field. Feel free to revert the patch and/or reopen the tracker, unassign myself.
Taking a look at sw/source/uibase/app/applab.cxx, there are 2 functions: - lcl_InsertLabText for Labels https://opengrok.libreoffice.org/xref/core/sw/source/uibase/app/applab.cxx?r=6b147d33&mo=1968&fi=102 102 static const SwFrameFormat *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem, 103 SwFrameFormat &rFormat, SwFieldMgr& rFieldMgr, 104 sal_uInt16 nCol, sal_uInt16 nRow, bool bLast ) It uses the field to display it when clicking on "New Document" 124 OUString sDBName; 125 if( (!rItem.m_bSynchron || !(nCol|nRow)) && !(sDBName = InsertLabEnvText( rSh, rFieldMgr, rItem.m_aWriting )).isEmpty() && !bLast ) 126 { 127 sDBName = comphelper::string::setToken(sDBName, 3, DB_DELIM, u"True"); 128 SwInsertField_Data aData(SwFieldTypesEnum::DatabaseNextSet, 0, sDBName, OUString(), 0, &rSh); 129 rFieldMgr.InsertField( aData ); 130 } - lcl_InsertBCText for Business cards https://opengrok.libreoffice.org/xref/core/sw/source/uibase/app/applab.cxx?r=6b147d33&mo=1968&fi=67#67 67 static const SwFrameFormat *lcl_InsertBCText( SwWrtShell& rSh, const SwLabItem& rItem, 68 SwFrameFormat &rFormat, 69 sal_uInt16 nCol, sal_uInt16 nRow ) it doesn't use any field from database but does: 88 if(!rItem.m_bSynchron || !(nCol|nRow)) 89 { 90 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 91 ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc(); 92 if ( fnSetActGroup ) 93 (*fnSetActGroup)( rItem.m_sGlossaryGroup ); 94 SwGlossaryHdl* pGlosHdl = rSh.GetView().GetGlosHdl(); 95 pGlosHdl->SetCurGroup(rItem.m_sGlossaryGroup, true); 96 pGlosHdl->InsertGlossary( rItem.m_sGlossaryBlockName ); 97 } m_sGlossaryBlockName and other infos are loaded with: 259 SwLabCfgItem::SwLabCfgItem(bool bLabel) : 260 ConfigItem(bLabel ? OUString("Office.Writer/Label") : OUString("Office.Writer/BusinessCard")), 261 m_bIsLabel(bLabel) https://opengrok.libreoffice.org/xref/core/sw/source/uibase/envelp/labimg.cxx?r=0a501634#259 by using: 4732 <group oor:name="BusinessCard"> 4733 <info> 4734 <desc>Contains settings for business cards.</desc> 4735 </info> 4736 <group oor:name="Medium"> ... 4873 <group oor:name="AutoText"> 4874 <info> 4875 <desc>Contains settings for the AutoText used.</desc> 4876 </info> 4877 <prop oor:name="Group" oor:type="xs:string"> 4878 <!-- UIHints: File New BusinessCards BusinessCards --> 4879 <info> 4880 <desc>Specifies the AutoText section name.</desc> 4881 <label>AutoText section</label> 4882 </info> 4883 </prop> 4884 <prop oor:name="Block" oor:type="xs:string"> 4885 <!-- UIHints: File New BusinessCards BusinessCards --> 4886 <info> 4887 <desc>Specifies the AutoText module name.</desc> 4888 </info> 4889 </prop> 4890 </group> See https://opengrok.libreoffice.org/xref/core/officecfg/registry/schema/org/openoffice/Office/Writer.xcs#4732 (notice that there's no value for Group and Block). => - where can we find these values in UI? (without using Expert Configuration) - above all, it seems it wasn't planned at all in Business Card to use Database field so I wonder if this bug is valid (and if we shouldn't revert the commit). Finally, I think we should find what was the purpose of Business cards wizard and how to use it correctly? Let's reopen this one meanwhile.
(In reply to Julien Nabet from comment #14) > Feel free to revert the patch and/or reopen the tracker, unassign myself. I don't support the revert. It's not worse. This was wrong from the implementation. Now it's at least more clear.
(In reply to Julien Nabet from comment #15) > Finally, I think we should find what was the purpose of Business cards > wizard and how to use it correctly? Really good question. I hope Heiko can give some input. I assume that database was for large scale use, like printing BC/tags/badges for many persons. But Labels also can do it, without Synchronize. BC has additional Private and Business tabs. Not sure if that was the reason of separate BC. So we need to know the purpose of BC as separate to Labels. I guess there should be.
Perhaps it could be a subject of ESC? (some devs may have infos)
(In reply to Timur from comment #17) > I hope Heiko can give some input. Asked on IRC but no answer. We have to look into the code, apparently.