<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5857&amp;type=atom" />
	<updated>2015-09-20T15:22:55Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=5857</id>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=24324#p24324" />
			<content type="html"><![CDATA[<p>It is possible to make all Reference fields in new element forms to be readonly. The attached screenshots are for making just one form (Direct Invoice) or all forms to have their Reference field as non-editable.</p><p>Apart from being defined in <strong>includes/ui/ui_input.inc</strong>, there are 17 files that use the function <strong>ref_row</strong> - once each. The said function is currently not used in any standard extension.</p><p>Placed on <a href="https://frontaccounting.com/fawiki/index.php?n=Devel.ReferenceFieldNonEditableMod">Wiki</a>.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-09-20T15:22:55Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=24324#p24324</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=24323#p24323" />
			<content type="html"><![CDATA[<p>The before and after depiction of the code changes suggested for pass 1 of the function synch is attached herein.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-09-20T14:06:56Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=24323#p24323</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=24318#p24318" />
			<content type="html"><![CDATA[<p>The same could have been achieved easily with a flag based readonly attribute in the input tag.</p><p>I have re-factored the <strong>includes/ui/ui_input.inc</strong> &#039;s <span class="bbu">text_cells</span> and <span class="bbu">text_cells_ex</span> functions to have the same argument names and bunching similar code for ease of understanding before the inclusion of the <strong>$inparams</strong> in the latter function where the <strong>readonly</strong> can be inserted. This will also server to clarify the code.</p><p>The real solution will be to have a flag in the <strong>sys_prefs</strong> table that removes the field altogether and in the processing script acquires the next reference and then populates the tables, showing the end result in the browser.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-09-20T05:27:29Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=24318#p24318</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=24314#p24314" />
			<content type="html"><![CDATA[<p>Hi AP Muthu,</p><p>Sorry for the late reply.... and sure I&#039;m happy to provide the change I made.</p><p>Actually it is just a small change to this file:&nbsp; sales/customer_invoice.php:</p><p>At around line 400,&nbsp; I commented this line: </p><p>ref_cells(_(&quot;Reference&quot;), &#039;ref&#039;, &#039;&#039;, null, &quot;class=&#039;tableheader2&#039;&quot;);</p><p>and replaced it with these 2 lines:</p><p>label_cells(_(&quot;Inv No:&quot;), $_SESSION[&#039;Items&#039;]-&gt;reference, &quot;class=&#039;tableheader2&#039;&quot;);<br />hidden(&#039;ref&#039;, $_SESSION[&#039;Items&#039;]-&gt;reference);</p><p>That&#039;s all I did and now the Invoice number cannot be changed by user.</p><p>I&#039;m not sure this is the best way to do but it achieved what I need.</p>]]></content>
			<author>
				<name><![CDATA[mark0300]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20216</uri>
			</author>
			<updated>2015-09-18T09:13:54Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=24314#p24314</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23983#p23983" />
			<content type="html"><![CDATA[<p>Would you like to provide a diff or changed fileset to the project?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-08-03T14:19:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23983#p23983</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23979#p23979" />
			<content type="html"><![CDATA[<p>Thanks very much.<br />It works for me!</p>]]></content>
			<author>
				<name><![CDATA[mark0300]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20216</uri>
			</author>
			<updated>2015-07-31T10:16:48Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23979#p23979</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23965#p23965" />
			<content type="html"><![CDATA[<p>Try a blank (or value: auto) hidden field for it.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-07-29T17:53:13Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23965#p23965</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23954#p23954" />
			<content type="html"><![CDATA[<p>Thanks APmuthu.&nbsp; &nbsp;I need some help in getting the variable of the field.&nbsp; </p><p>Based on this line:</p><p>ref_cells(_(&quot;Reference&quot;), &#039;ref&#039;, &#039;&#039;, null, &quot;class=&#039;tableheader2&#039;&quot;); //Invoice Number assigned but editable</p><p>I thought the value is $_SESSION[&#039;Items&#039;]-&gt;reference.&nbsp; But I struggled to figure out what should be the correct variable/value to assign to the field but I failed to make it work.&nbsp; (I can&#039;t put $ref = $_SESSION[&#039;Items&#039;]-&gt;reference;)</p><p>I would appreciate it if you could advise how to assign that and it will help if you could give me some examples.</p><p>Thank you.</p>]]></content>
			<author>
				<name><![CDATA[mark0300]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20216</uri>
			</author>
			<updated>2015-07-28T08:24:24Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23954#p23954</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23926#p23926" />
			<content type="html"><![CDATA[<p>You will need to make a hidden field with assigned value.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-07-26T09:20:41Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23926#p23926</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[INVOICE NUMBER - PREVENT CHANGE BY USER]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23908#p23908" />
			<content type="html"><![CDATA[<p>I have posted this under another post but there is no reply so I transferred the topic to here....</p><p>There is a need to implement a control of the invoice number and we have to make the invoice number non-editable by the user when they enter a Direct Invoice or Invoice against a delivery.&nbsp; We used the Form Setup to assign the first number and let the Invoice number incremental run automatically.</p><p>Currently, the Invoice screen will show the Invoice Number assigned by the Form Setup and the field allows user to edit.&nbsp; &nbsp;This is because of the lines below in sales\customer_invoice.php:</p><p>if ($_SESSION[&#039;Items&#039;]-&gt;trans_no == 0) {<br />&nbsp; &nbsp; ref_cells(_(&quot;Reference&quot;), &#039;ref&#039;, &#039;&#039;, null, &quot;class=&#039;tableheader2&#039;&quot;); //Invoice Number assigned but editable<br />} else {<br />&nbsp; &nbsp; label_cells(_(&quot;Reference&quot;), $_SESSION[&#039;Items&#039;]-&gt;reference, &quot;class=&#039;tableheader2&#039;&quot;);<br />}</p><br /><br /><p>To make it non-editable, I have replaced the line ref_cells to label_cells as follows:</p><p>if ($_SESSION[&#039;Items&#039;]-&gt;trans_no == 0) {<br />&nbsp; &nbsp; label_cells(_(&quot;Reference&quot;), $_SESSION[&#039;Items&#039;]-&gt;reference, &quot;class=&#039;tableheader2&#039;&quot;);&nbsp; //Invoice Number assigned and now not editable<br />} else {<br />&nbsp; &nbsp; label_cells(_(&quot;Reference&quot;), $_SESSION[&#039;Items&#039;]-&gt;reference, &quot;class=&#039;tableheader2&#039;&quot;);<br />}</p><p>With this change, now the Invoice number is assigned (by Form Setups) and not editable.&nbsp; However, when I process the Invoice, the error &quot;You must enter a reference.&quot; shows.&nbsp; I know I missed out something but I don&#039;t know what else to change.&nbsp; The Invoice Number showed is not assigned to the variable which in turn update the reference in the database tables.&nbsp; This variable is empty. </p><p>Would you please advise what other codes I have to change so that the assigned Invoice number is picked up and update the reference in the Tables?</p><p>Thank you.</p><p>Mark</p>]]></content>
			<author>
				<name><![CDATA[mark0300]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20216</uri>
			</author>
			<updated>2015-07-22T09:25:32Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23908#p23908</id>
		</entry>
</feed>
