<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — function customer_list_low]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=10650</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10650&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in function customer_list_low.]]></description>
		<lastBuildDate>Thu, 17 Apr 2025 15:46:13 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43607#p43607</link>
			<description><![CDATA[<p>Yes, db_fetch() function used in list helper functions returns data array indexed both associative and numerically. So it can lead to some problems depending on code processing the result. As far as I know this is not the case with FA base code.</p><p>Regarding blank string (&quot; &quot;) used as fourth argument in customer_list_row(), it is intentional in some places, just to have unnamed special option, which could be read just as &#039;not applicable&#039;. E.g. in recurrent invoices it is special case of recurrent invoice defined for whole sales group, not individual customer.</p><p>J.</p>]]></description>
			<author><![CDATA[null@example.com (janusz)]]></author>
			<pubDate>Thu, 17 Apr 2025 15:46:13 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43607#p43607</guid>
		</item>
		<item>
			<title><![CDATA[Re: function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43603#p43603</link>
			<description><![CDATA[<p>I guess I will ask janusz to look into this. He wrote these routines, i.e. customer_list_row. Combined with search functions.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 17 Apr 2025 10:14:22 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43603#p43603</guid>
		</item>
		<item>
			<title><![CDATA[Re: function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43597#p43597</link>
			<description><![CDATA[<p>Very good troubleshooting.<br />Kudos @trafficpest.</p><p>@joe: are there any other scripts that will benefit from this?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 15 Apr 2025 18:56:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43597#p43597</guid>
		</item>
		<item>
			<title><![CDATA[Re: function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43596#p43596</link>
			<description><![CDATA[<p><strong>SOLVED: Customer Dropdown Showing Two Selected Options on Edit</strong></p><p><strong>Problem:</strong> When editing a record, the customer dropdown (`debtor_no`) was incorrectly showing two selected customers. The correct customer ID for the record was present in the `$_POST` data, but the dropdown also selected the record&#039;s primary key ID.</p><p><strong>Cause:</strong> The issue stemmed from how the `$_POST` array was populated during the edit operation. Instead of explicitly setting each form field value from the fetched database row (`$myrow`) to its corresponding associative key in `$_POST`, the entire `$myrow` array was directly assigned to `$_POST`. This resulted in `$_POST` containing both associative keys (column names) and numerical indexes (based on the order of columns fetched).</p><p>The `combo_input` function, used to generate the dropdown, was likely accessing the `$_POST` array and inadvertently picking up the value at index `0` (which was the record&#039;s primary key `id`) in addition to the correct `debtor_no`. This led to both IDs being included in the `$selected_id` array processed by `combo_input`, causing both options to be marked as `selected` in the HTML.</p><p><strong>Fix:</strong> To resolve this, ensure that you explicitly set each relevant form field value in the `$_POST` array using the associative keys from your fetched database row.</p><p><strong>Incorrect (Causing the Issue):</strong><br /></p><div class="codebox"><pre><code>$_POST = $myrow;</code></pre></div><p>ie. Don&#039;t be lazy like me</p><p><strong>Correct (Explicitly Setting Values):</strong><br /></p><div class="codebox"><pre><code>$_POST[&#039;debtor_no&#039;] = $myrow[&#039;debtor_no&#039;];
$_POST[&#039;other_field&#039;] = $myrow[&#039;other_field&#039;];
// ... and so on for all your form fields</code></pre></div><p>By explicitly assigning the values, you prevent the numerical indexes from being present in the `$_POST` array and thus avoid the `combo_input` function mistakenly selecting the record&#039;s primary key ID.</p>]]></description>
			<author><![CDATA[null@example.com (trafficpest)]]></author>
			<pubDate>Tue, 15 Apr 2025 17:22:27 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43596#p43596</guid>
		</item>
		<item>
			<title><![CDATA[Re: function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43592#p43592</link>
			<description><![CDATA[<p>Yeah I was looking over and noticed the 3rd example</p><p>Line 195 in sales/manage/recurrent_invoices.php</p><p>customer_list_row(_(&quot;Customer:&quot;), &#039;debtor_no&#039;, null, &quot; &quot;, true);</p><p>I was wondering why the space for 3rd arg. It should become true since it has a space but strange.</p><p>I&#039;m going to look it over tomorrow there has to be something I&#039;m missing, maybe I&#039;ll try another browser. So strange that the generated source has the correct id as selected. Maybe it&#039;s a time / buffer issue.</p>]]></description>
			<author><![CDATA[null@example.com (trafficpest)]]></author>
			<pubDate>Tue, 15 Apr 2025 08:20:49 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43592#p43592</guid>
		</item>
		<item>
			<title><![CDATA[Re: function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43588#p43588</link>
			<description><![CDATA[<p>Here is how it is called elsewhere:<br />Line 64 in <strong>gl/includes/ui/gl_bank_ui.inc</strong><br /></p><div class="codebox"><pre><code>customer_list_row(_(&quot;Customer:&quot;), &#039;person_id&#039;, null, false, true, false, true);</code></pre></div><p>Line 29 in <strong>sales/includes/ui/sales_credit_ui.inc</strong> and Line 267 in <strong>sales/includes/ui/sales_order_ui.inc</strong><br /></p><div class="codebox"><pre><code>customer_list_row(_(&quot;Customer:&quot;), &#039;customer_id&#039;, null, false, true, false, true);</code></pre></div><p>Line 195 in <strong>sales/manage/recurrent_invoices.php</strong><br /></p><div class="codebox"><pre><code>customer_list_row(_(&quot;Customer:&quot;), &#039;debtor_no&#039;, null, &quot; &quot;, true);</code></pre></div><p>Check the 2nd and 3rd arguments in your construct. You can try to use an intermediary variable for the <strong>isset()</strong> argument.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 15 Apr 2025 06:39:23 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43588#p43588</guid>
		</item>
		<item>
			<title><![CDATA[function customer_list_low]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43586#p43586</link>
			<description><![CDATA[<p>I have an issue with customer list row that is strange I don&#039;t think there is an issue in the function. I don&#039;t know what is going on.</p><p>This is how I&#039;m calling it:<br /></p><div class="codebox"><pre><code>customer_list_row(_(&quot;Customer:&quot;), &#039;debtor_no&#039;, isset($_POST[&#039;debtor_no&#039;]) ? $_POST[&#039;debtor_no&#039;] : null, false, true);</code></pre></div><p>I&#039;m having an issue with selected_id for editing a form. I have tried manually entering a client as int 3 and string &#039;3&#039; also null since I&#039;m passing update. But, it is not showing selected in the browser. It is giving me a random one. the strangest thing is it shows selected in the source and chrome inspector. have you seen anything like this before? my branch_list is working correctly below it. I have the form wrapped in a div for ajax for a few buttons and everything is working fine there.</p>]]></description>
			<author><![CDATA[null@example.com (trafficpest)]]></author>
			<pubDate>Mon, 14 Apr 2025 21:27:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43586#p43586</guid>
		</item>
	</channel>
</rss>
