<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Sales Orders view DESC mode]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=3984&amp;type=atom" />
	<updated>2013-07-06T06:04:17Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=3984</id>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16994#p16994" />
			<content type="html"><![CDATA[<p>The simple solution is this<br />_(&quot;Order Date&quot;) =&gt; array(&#039;name&#039;=&gt;&#039;ord_date&#039;, &#039;type&#039;=&gt;&#039;date&#039;, &#039;ord&#039;=&gt;&#039;desc&#039;),</p>]]></content>
			<author>
				<name><![CDATA[cristiart]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17592</uri>
			</author>
			<updated>2013-07-06T06:04:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16994#p16994</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16226#p16226" />
			<content type="html"><![CDATA[<p>Lines 127 to 138 of <strong>includes/db_pager.inc</strong>:<br /></p><div class="codebox"><pre><code>    //    Change sort column direction 
    //    in order asc-&gt;desc-&gt;none-&gt;asc
    //
    function sort_table($col) 
    {
        $ord = $this-&gt;columns[$col][&#039;ord&#039;];
        $ord = ($ord == &#039;&#039;) ? &#039;asc&#039; : (($ord == &#039;asc&#039;) ? &#039;desc&#039; : &#039;&#039;);
        $this-&gt;columns[$col][&#039;ord&#039;] = $ord;
        $this-&gt;set_page(1);
        $this-&gt;query();
        return true;
    }</code></pre></div><p>This clearly shows a <strong>$ord</strong> check for <strong>empty</strong> being retained as empty becoming ASC, a check for <strong>asc</strong> being set to DESC&nbsp; but if <strong>desc</strong>, no enforcement is done unless invoked by a click to be ASC. Hence Line 133:<br /></p><div class="codebox"><pre><code>        $ord = ($ord == &#039;&#039;) ? &#039;asc&#039; : (($ord == &#039;asc&#039;) ? &#039;desc&#039; : &#039;&#039;);</code></pre></div><p>should possibly be explicit in all it&#039;s redundant splendour&nbsp; (default being to capture any invalid declaration degrading gracefully) like:<br /></p><div class="codebox"><pre><code>        switch ($ord) {
            case &#039;asc&#039;:
                $ord = &#039;desc&#039;;
                break;
            case &#039;desc&#039;:
            case &#039;&#039;:
                $ord = &#039;asc&#039;;
                break;
            default:
                $ord = &#039;asc&#039;;
        }</code></pre></div><p>Hence a setting of &#039;asc&#039; in the code would result in a default display of DESC in this case as in the earlier one as well. This code fragment does not change any logic and is unnecessary and is placed for an understanding of how activation occurs on clicking only.</p><p>If there is a check for an initial value placed in the php page we should use that value to be the default when the $ord is empty thru&#039; clicking route - thereafter, the clicked value of $ord will be available as asc or desc.</p><p>Lines 50-62 of <strong>includes/ui/db_pager_view.php</strong>:<br /></p><div class="codebox"><pre><code>    foreach($pager-&gt;columns as $num_col=&gt;$col) {
        // record status control column is displayed only when control checkbox is on
        if (isset($col[&#039;head&#039;]) &amp;&amp; ($col[&#039;type&#039;]!=&#039;inactive&#039; || get_post(&#039;show_inactive&#039;))) {
            if (!isset($col[&#039;ord&#039;]))
                $headers[] = $col[&#039;head&#039;];
            else {
                  $icon = (($col[&#039;ord&#039;] == &#039;desc&#039;) ? &#039;sort_desc.gif&#039; : 
                    ($col[&#039;ord&#039;] == &#039;asc&#039; ? &#039;sort_asc.gif&#039; : &#039;sort_none.gif&#039;));
                $headers[] = navi_button($pager-&gt;name.&#039;_sort_&#039;.$num_col, 
                    $col[&#039;head&#039;], true, $icon);
            }
         }
    }</code></pre></div><p>sets the sort image on the header correctly and checks used here can be used in the earlier code fragment to synch a similar behaviour.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2013-03-27T03:40:43Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16226#p16226</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16224#p16224" />
			<content type="html"><![CDATA[<p>i thought so to, but it will not for some reason...</p>]]></content>
			<author>
				<name><![CDATA[cristiart]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17592</uri>
			</author>
			<updated>2013-03-26T19:24:46Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16224#p16224</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16223#p16223" />
			<content type="html"><![CDATA[<p>Then the following should sort by descending order by default:<br /></p><div class="codebox"><pre><code>_(&quot;Order #&quot;) =&gt; array(&#039;fun&#039;=&gt;&#039;view_link&#039;, &#039;ord&#039;=&gt;&#039;desc&#039;),</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2013-03-26T19:04:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16223#p16223</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16222#p16222" />
			<content type="html"><![CDATA[<p>That did not worked but i change line 270 in to this</p><p>&nbsp; &nbsp; &nbsp; &nbsp; _(&quot;Order #&quot;) =&gt; array(&#039;fun&#039;=&gt;&#039;view_link&#039;, &#039;ord&#039;=&gt;&#039;asc&#039;),</p><p>This will allow me to short by asc/desc but not by default. Once you navigate back from page, and come back you&#039;ll have to press &quot;order#&quot; again to rearrange the order...</p>]]></content>
			<author>
				<name><![CDATA[cristiart]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17592</uri>
			</author>
			<updated>2013-03-26T18:48:07Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16222#p16222</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16209#p16209" />
			<content type="html"><![CDATA[<p>Try line 268 in sales/inquiry/sales_orders_view.php :<br /></p><div class="codebox"><pre><code>        _(&quot;Required By&quot;) =&gt;array(&#039;type&#039;=&gt;&#039;date&#039;, &#039;ord&#039;=&gt;&#039;&#039;),</code></pre></div><p>to be:<br /></p><div class="codebox"><pre><code>        _(&quot;Required By&quot;) =&gt;array(&#039;type&#039;=&gt;&#039;date&#039;, &#039;ord&#039;=&gt;&#039;desc&#039;),</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2013-03-26T11:07:49Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16209#p16209</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16205#p16205" />
			<content type="html"><![CDATA[<p>Then just look into the sales_orders_view.php code. You have sortable &#039;Required by&#039; column here.<br />Janusz</p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2013-03-26T07:34:31Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16205#p16205</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Sales Orders view DESC mode]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=16200#p16200" />
			<content type="html"><![CDATA[<p>is there a way to view all sales order in DESC mode/order by default?<br />i&#039;m trying to figure this out to see if I can use FA for my company. We have hundreds of orders/invoices per month and it&#039;s very hard to keep track with invoices + overdue invoices if they are on the back of the list. </p><p>I can hack the php code to do this if i can get some pointers since i&#039;m new here <img src="https://frontaccounting.com/punbb/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />thanks</p>]]></content>
			<author>
				<name><![CDATA[cristiart]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=17592</uri>
			</author>
			<updated>2013-03-26T04:20:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=16200#p16200</id>
		</entry>
</feed>
