<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Edit Journal -> orphaned attachments.]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=10489</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10489&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Edit Journal -> orphaned attachments..]]></description>
		<lastBuildDate>Sat, 16 Mar 2024 18:46:29 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Edit Journal -> orphaned attachments.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42946#p42946</link>
			<description><![CDATA[<p>Yes, of course you are right. Sorry for the typo. Thanks for the correction.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Sat, 16 Mar 2024 18:46:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42946#p42946</guid>
		</item>
		<item>
			<title><![CDATA[Re: Edit Journal -> orphaned attachments.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42944#p42944</link>
			<description><![CDATA[<p>@joe you mean to say function write_journal_entries (instead of write_journal_transaction)</p>]]></description>
			<author><![CDATA[null@example.com (dz)]]></author>
			<pubDate>Sat, 16 Mar 2024 08:45:45 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42944#p42944</guid>
		</item>
		<item>
			<title><![CDATA[Re: Edit Journal -> orphaned attachments.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42943#p42943</link>
			<description><![CDATA[<p>This has now been fixed, but not in file /gl/gl_journal.php. It was better to fix it in /gl/includes/db/gl_journal.inc in function write_journal_transaction.</p><p>You can download the fixed file here and replace it <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/gl/includes/db/gl_journal.inc">/gl/includes/db/gl_journal.inc</a>.</p><p>Thank you for pointing this our. There were no errors in the bank payment/deposit routines.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Fri, 15 Mar 2024 11:27:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42943#p42943</guid>
		</item>
		<item>
			<title><![CDATA[Re: Edit Journal -> orphaned attachments.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42941#p42941</link>
			<description><![CDATA[<p>I will check this asap.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 14 Mar 2024 14:24:40 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42941#p42941</guid>
		</item>
		<item>
			<title><![CDATA[Edit Journal -> orphaned attachments.]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=42939#p42939</link>
			<description><![CDATA[<p>FA 2.4.1 - If you create a journal entry, attach a document, and then later edit the journal entry (e.g. journal enquiry - edit), the old journal number is voided, and a new journal number created.&nbsp; However, the attachment data is NOT updated, so the document is orphaned, and the journal no longer is associated to the document, so doesn&#039;t list it for viewing.</p><p>The FIX:&nbsp; (in gl/gl_journal.php)<br />Line 298:<br />if (isset($_POST[&#039;Process&#039;]))<br />{<br />&nbsp; &nbsp; &nbsp; &nbsp; $cart = &amp;$_SESSION[&#039;journal_items&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; $new = $cart-&gt;order_id == 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /***************<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * Start of fix for orphaned attachments<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ***************/<br />&nbsp; &nbsp; &nbsp; &nbsp; $old_trans_type = $cart-&gt;trans_type;<br />&nbsp; &nbsp; &nbsp; &nbsp; $old_trans_no = $cart-&gt;order_id;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /***************/</p><p>new line 342:<br />&nbsp; &nbsp; &nbsp; &nbsp; unset($_SESSION[&#039;journal_items&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*********************************************<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * original code does not update attachments.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * The old trans no is zero&#039;d/marked voided and a new trans created<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * This leads to an orphaned transaction.&nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * Update attachment info<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ***********************************************/<br />&nbsp; &nbsp; &nbsp; &nbsp; if( isset( $old_trans_no ) )<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sql = &quot;UPDATE &quot; . TB_PREF . &quot;attachments SET `trans_no` = &#039;&quot; . $trans_no . &quot;&#039; WHERE trans_no = &#039;&quot; . $old_trans_no . &quot;&#039; and type_no = &#039;&quot; . $old_trans_type . &quot;&#039;&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db_query( $sql, &quot;Couldn&#039;t update attachments&quot; );<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /***************/</p><p>I have not checked the other functions (i.e. bank payments/deposits, etc) but expect they are similar.&nbsp; I did see void_transaction function then calls different void_XXX_trans functions so didn&#039;t chase down the rabbit hole.&nbsp; If they all call the db HOOKs calls this could be made into a module but I didn&#039;t chase that neither.</p>]]></description>
			<author><![CDATA[null@example.com (fraserks)]]></author>
			<pubDate>Wed, 13 Mar 2024 20:29:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=42939#p42939</guid>
		</item>
	</channel>
</rss>
