<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Item is not getting update in via sales invoice api]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=9504</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=9504&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Item is not getting update in via sales invoice api.]]></description>
		<lastBuildDate>Thu, 14 Oct 2021 10:27:38 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Item is not getting update in via sales invoice api]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=40100#p40100</link>
			<description><![CDATA[<p>Hi . </p><p>I have followed the code from Sales_Test.php&nbsp; as below.<br /></p><div class="codebox"><pre><code>     // Write back
        $response = $client-&gt;put(&#039;/modules/api/sales/&#039; . $id . &#039;/&#039; . ST_SALESINVOICE, array(
            &#039;headers&#039; =&gt; TestEnvironment::headers(),
            &#039;form_params&#039; =&gt; array(
                &#039;trans_type&#039; =&gt; ST_SALESINVOICE,
                &#039;ref&#039; =&gt; $ref, // TODO Ideally the api would default this and return.
                &#039;comments&#039; =&gt; &#039;new comments&#039;,
                &#039;order_date&#039; =&gt; &#039;02/03/2013&#039;,

                &#039;delivery_date&#039; =&gt; &#039;04/05/2013&#039;,
                &#039;cust_ref&#039; =&gt; &#039;cust_ref&#039;,
                &#039;deliver_to&#039; =&gt; &#039;new deliver_to&#039;,
                &#039;delivery_address&#039; =&gt; &#039;new delivery_address&#039;,
                &#039;phone&#039; =&gt; &#039;new phone&#039;,
                &#039;ship_via&#039; =&gt; &#039;new ship_via&#039;,
                &#039;location&#039; =&gt; &#039;DEF&#039;,
                &#039;freight_cost&#039; =&gt; &#039;0&#039;,
                &#039;customer_id&#039; =&gt; &#039;2&#039;,
                &#039;branch_id&#039; =&gt; &#039;2&#039;,
                &#039;sales_type&#039; =&gt; &#039;1&#039;,
                &#039;dimension_id&#039; =&gt; &#039;0&#039;,
                &#039;dimension2_id&#039; =&gt; &#039;0&#039;,

//                 &#039;items&#039; =&gt; array(
//                     0 =&gt; array(
//                         &#039;stock_id&#039; =&gt; &#039;TEST_ITEM&#039;,
//                         &#039;qty&#039; =&gt; &#039;2&#039;,
//                         &#039;price&#039; =&gt; &#039;3&#039;,
//                         &#039;discount&#039; =&gt; &#039;0&#039;,
//                         &#039;description&#039; =&gt; &#039;new description&#039;
//                     )
//                 ),
            )
        ));

        $this-&gt;assertEquals(&#039;200&#039;, $response-&gt;getStatusCode());
        $result = $response-&gt;getBody();
        $result = json_decode($result);</code></pre></div><p>But if you can see&nbsp; ITEM CODE is disabled in the sample code.<br />I&#039;ve tried to enable this code and update invoice. <br />But its now working as it should be . The error is ( THIS ITEM IS ALREADY ATTACHED TO THE INVOICE ) which is correct. All i need to update this product&#039;s price or details. Which it should basically just let it update. </p><p>I did further study . I found out it it always use add_to_order() function <br /></p><div class="codebox"><pre><code>    if (isset($info[&quot;items&quot;])) {
        foreach($info[&#039;items&#039;] as $item) {
            add_to_order($cart, $item[&#039;stock_id&#039;], $item[&#039;qty&#039;], $item[&#039;price&#039;], $item[&#039;discount&#039;], $item[&#039;description&#039;]);
        }
    }</code></pre></div><p>So.. basically its not working . And i guess that is why item editing part was disabled in sample code. </p><p>Is there any new update for this ?</p>]]></description>
			<author><![CDATA[null@example.com (DrCard)]]></author>
			<pubDate>Thu, 14 Oct 2021 10:27:38 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=40100#p40100</guid>
		</item>
	</channel>
</rss>
