[GNC] Export file lacks document links

Brook Milligan brook at nmsu.edu
Mon Oct 21 16:03:55 EDT 2024


OK, I found what appears to be the way to access document links in the code (see libgnucash/engine/Transaction.cpp).  It seems that the attached patch (untested) will add the transaction link to exported files. 

However, I’m much less certain how to make the import code handle the extra field.  All the callbacks make that code unclear to me.

If anyone has a better sense of how importing works, please let me know how an extra field (doc links) can be added to the process.

Thanks a lot.

Cheers,
Brook



--- gnucash/import-export/csv-exp/csv-transactions-export.cpp.orig	2024-10-21 13:06:24
+++ gnucash/import-export/csv-exp/csv-transactions-export.cpp	2024-10-21 13:15:05
@@ -198,6 +198,14 @@
                                GNC_HOW_DENOM_SIGFIGS(6) | GNC_HOW_RND_ROUND_HALF_UP)
             : xaccSplitGetSharePrice (split)};
     return xaccPrintAmount (cf, gnc_default_price_print_info (curr));
+}
+
+// Document link
+static std::string
+get_document_link (Transaction *trans)
+{
+    auto link{xaccTransGetDocLink (trans)};
+    return (link ? link : "");
 }
 
 /******************************************************************************/
@@ -243,7 +251,8 @@
         get_value (split, t_void, false),
         get_reconcile (split),
         get_reconcile_date (split),
-        get_price (split, t_void)
+        get_price (split, t_void),
+        get_document_link (trans)
     };
 }
 
@@ -389,6 +398,7 @@
             _("Reconcile"),
             _("Reconcile Date"),
             _("Rate/Price"),
+            _("Document link"),
         };
 
     /* Write header line */



More information about the gnucash-user mailing list