<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — PayPal import issues]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5712&amp;type=atom" />
	<updated>2015-04-28T18:10:20Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=5712</id>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23382#p23382" />
			<content type="html"><![CDATA[<p>Try to slice the list of paypal import entries and verify failure on specific transaction - any extra characters, quotes, double quotes, etc....</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-28T18:10:20Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23382#p23382</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23379#p23379" />
			<content type="html"><![CDATA[<p>There is a option in the import paypal setup to create customers and invoices, I have that checked.<br />And when I run it it actually created some of the customers that were not in the system.<br />The problem is that at some point it fails and I can&#039;t figure out why.<br />If you don&#039;t have that option checked, it will only write a bank transaction even if you have the customer and the invoice.<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-28T14:44:35Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23379#p23379</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23376#p23376" />
			<content type="html"><![CDATA[<p>Actually Paypal Import Transactions is more of a payment transaction basically and not an invoice generation / customer creation transaction although the code sports it. The Customer and their Invoice should generally pre-exist for a PayPal transaction to effect payment allocation to it. It is therefore no wonder that no transactions are related to existing customers and is&nbsp; either not imported at all or is imported as an orphan record. You can try to create the customer and invoice manually if they do not exist and then manually allocate / edit allocation of the payment.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-28T03:04:52Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23376#p23376</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23371#p23371" />
			<content type="html"><![CDATA[<p>I am not 100% sure what the code tries to do.<br />Here is my understanding of what the intent is:<br />- Create customer if it does not exist.<br />- Create invoice for the customer.<br />- Add customer payment.</p><p>Let me know if this is not right.<br />Will try based on these assumptions and report back.<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-27T21:24:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23371#p23371</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23362#p23362" />
			<content type="html"><![CDATA[<p>If you have a backup prior to the paypal imoprt, then revert to it.<br />Then manually do the transactions necessary for 1 paypal transaction.<br />Take a backup.<br />Now revert back to previous db state.<br />Now import the same transaction using the import_paypal extension<br />Take a backup again.<br />Now compare the last 2 backups using a diff tool like <a href="http://www.winmerge.org">WinMerge</a> and see what is different.</p><p>The fact that the SQL executed without error incicates that the absence of transactions is a functional application error. Need to also contact the module author.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-25T15:59:50Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23362#p23362</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23360#p23360" />
			<content type="html"><![CDATA[<p>I did not use a table prefix.<br />Running the sql returns 0 rows.<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-25T15:18:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23360#p23360</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23357#p23357" />
			<content type="html"><![CDATA[<p>If the TB_PREF = &quot;1_&quot;, then execute :<br /></p><div class="codebox"><pre><code>SELECT 
   trans.*
  ,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total
  ,cust.name AS DebtorName
  , cust.address
  , cust.curr_code
  , cust.tax_id
  , com.memo_
  , shippers.shipper_name
  , sales_types.sales_type
  , sales_types.tax_included
  , branch.*
  , cust.discount
  , tax_groups.name AS tax_group_name
  , tax_groups.id AS tax_group_id  
FROM 1_debtor_trans trans
  LEFT JOIN 1_comments com ON trans.type=com.type AND trans.trans_no=com.id
  LEFT JOIN 1_shippers shippers ON shippers.shipper_id=trans.ship_via
  , 1_debtors_master cust
  , 1_sales_types sales_types
  , 1_cust_branch branch
  , 1_tax_groups tax_groups
WHERE trans.trans_no=&#039;&#039;
  AND trans.type=&#039;10&#039;
  AND trans.debtor_no=cust.debtor_no 
  AND sales_types.id = trans.tpe
  AND branch.branch_code = trans.branch_code
  AND branch.tax_group_id = tax_groups.id;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-25T08:23:27Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23357#p23357</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23356#p23356" />
			<content type="html"><![CDATA[<p>Try to execute the sql on your database in some MySQL client like SQLyog or phpMyAdmin:<br /></p><div class="codebox"><pre><code>SELECT 
   trans.*
  ,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total
  ,cust.name AS DebtorName
  , cust.address
  , cust.curr_code
  , cust.tax_id
  , com.memo_
  , shippers.shipper_name
  , sales_types.sales_type
  , sales_types.tax_included
  , branch.*
  , cust.discount
  , tax_groups.name AS tax_group_name
  , tax_groups.id AS tax_group_id  
FROM debtor_trans trans
  LEFT JOIN comments com ON trans.type=com.type AND trans.trans_no=com.id
  LEFT JOIN shippers ON shippers.shipper_id=trans.ship_via
  , debtors_master cust
  , sales_types
  , cust_branch branch
  , tax_groups  
WHERE trans.trans_no=&#039;&#039;
  AND trans.type=&#039;10&#039;
  AND trans.debtor_no=cust.debtor_no 
  AND sales_types.id = trans.tpe
  AND branch.branch_code = trans.branch_code
  AND branch.tax_group_id = tax_groups.id;</code></pre></div><p>and see what results you get.</p><p>Unless you used no Table Prefix, it seems to be missing here.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-25T08:09:32Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23356#p23356</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23353#p23353" />
			<content type="html"><![CDATA[<p>I am still getting the database error:<br /></p><div class="quotebox"><blockquote><p>[25-Apr-2015 01:34:17 America/Toronto] &lt;b&gt;DATABASE ERROR :&lt;/b&gt; no debtor trans found for given params&lt;br&gt;sql that failed was : SELECT trans.*,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,cust.name AS DebtorName, cust.address, cust.curr_code, cust.tax_id, com.memo_, shippers.shipper_name, sales_types.sales_type, sales_types.tax_included, branch.*, cust.discount, tax_groups.name AS tax_group_name, tax_groups.id AS tax_group_id&nbsp; FROM debtor_trans trans<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN comments com ON trans.type=com.type AND trans.trans_no=com.id<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN shippers ON shippers.shipper_id=trans.ship_via, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debtors_master cust, sales_types, cust_branch branch, tax_groups&nbsp; WHERE trans.trans_no=&#039;&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.type=&#039;10&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.debtor_no=cust.debtor_no AND sales_types.id = trans.tpe<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND branch.branch_code = trans.branch_code<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND branch.tax_group_id = tax_groups.id &lt;br&gt;&lt;br&gt;&lt;br&gt;</p></blockquote></div><p>Any suggestions?<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-25T05:39:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23353#p23353</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23352#p23352" />
			<content type="html"><![CDATA[<p>I have checked the files, they seem to be the same.<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-25T05:12:53Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23352#p23352</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23351#p23351" />
			<content type="html"><![CDATA[<p>The <strong>write_bank_transaction()</strong> having less arguments in a call than defined in the function is okay here as the rest have default values defined in the function as well in <strong>gl/includes/db/gl_db_banking.inc</strong>.</p><p>You might want to check out any file differences between those in your import_paypal module install and those in my unofficial Github repo.</p><p>The function <strong>write_customer_payment()</strong> is defined in <strong>sales/includes/db/payment_db.inc</strong> with 12 arguments with the last 3 being optional with defaults provided. Furthermore, if there are less than 12 arguments, the rest are filled with zeroes in line 29 in it:<br /></p><div class="codebox"><pre><code>$args = func_get_args(); while (count($args) &lt; 12) $args[] = 0;</code></pre></div><p>The said function is called with 13 arguments in <strong>modules/import_paypal/import_paypal_update.php</strong> Lines 117 to 119 are:<br /></p><div class="codebox"><pre><code>      $payment_no = write_customer_payment(0, $customer_id, $branch_id,
          $paypal_bank_id, $recpt_date, $ref,
          $gross, 0, $company, 1, 0 - $fee, $gross, $paypal_fee_act);</code></pre></div><p>The <strong>$gross</strong> appears twice.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-25T04:59:40Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23351#p23351</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23350#p23350" />
			<content type="html"><![CDATA[<p>I do not understand the function <strong>write_bank_receipt</strong> in <strong>modules/import_paypal/import_paypal_update.php</strong>.<br />Line 132 reads:<br /></p><div class="quotebox"><blockquote><p>function write_bank_receipt($date, $ref, $name, $shipping, $insurance, $tax, $gross, $fee, $net) {</p></blockquote></div><p>In my case the function is called with:<br />tax = 0<br />gross = 134<br />fee = -7.54<br />net = 126.46</p><p>By the end of the function call, the only entry that get&#039;s created is for the fee.<br />The gross and net are not handled.<br />I think it&#039;s missing the handling for the net amount.<br />Any thoughts?<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-25T04:59:13Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23350#p23350</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23349#p23349" />
			<content type="html"><![CDATA[<p>Hi Ap.Muthu,</p><p>I am running Import Paypal transactions version 2.3.10-3. FA is version 2.3.24.<br />I made the change you suggested but it did not make a difference. I think the code in <strong>sales/includes/db/payment_db.inc</strong> is correct.</p><p>I found one of the issues: in <strong>modules/import_paypal/import_paypal_update.php</strong> at line 117, the call to <strong>write_customer_payment</strong> does not match with the definition in <strong>sales/includes/db/payment_db.inc</strong>. There are 13 arguments in the call, the function definition has only 12:<br /></p><div class="quotebox"><blockquote><p>$payment_no = write_customer_payment(0, $customer_id, $branch_id,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $paypal_bank_id, $recpt_date, $ref,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $gross, 0, $company, 1, 0 - $fee, $gross, $paypal_fee_act);</p></blockquote></div><p>I replaced the line with the following:<br /></p><div class="quotebox"><blockquote><p>$payment_no = write_customer_payment(0, $customer_id, $branch_id,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $paypal_bank_id, $recpt_date, $ref,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $gross, 0, $company, 1, 0 - $fee, $paypal_fee_act);</p></blockquote></div><p>Seems to be working, I don&#039;t get the <strong>Both parameters should have an equal number of elements</strong> error any more but I still get the database error.<br />Similarly, the calls to <strong>write_bank_transaction</strong> in <strong>modules/import_paypal/import_paypal_update.php</strong> have fewer arguments than defined in the definition.</p><p>I will investigate further and report back.<br />Ion</p>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-25T04:07:14Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23349#p23349</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23340#p23340" />
			<content type="html"><![CDATA[<p>Which version of the paypal extension are you using?<br />There was some feature reduction in a later version.</p><p>There could be some error in the file <strong>sales/includes/db/payment_db.inc</strong> since only 11 arguments are initialised in the code fragment from line 29-31:<br /></p><div class="codebox"><pre><code>    $args = func_get_args(); while (count($args) &lt; 12) $args[] = 0;
    $args = (object)array_combine(array(&#039;trans_no&#039;, &#039;customer_id&#039;, &#039;branch_id&#039;, &#039;bank_account&#039;, 
        &#039;date_&#039;, &#039;ref&#039;, &#039;amount&#039;, &#039;discount&#039;, &#039;memo_&#039;,&#039;rate&#039;,&#039;charge&#039;, &#039;bank_amount&#039;), $args);</code></pre></div><p>Try changing the first line above:<br /></p><div class="codebox"><pre><code>    $args = func_get_args(); while (count($args) &lt; 12) $args[] = 0;</code></pre></div><p>to<br /></p><div class="codebox"><pre><code>    $args = func_get_args(); while (count($args) &lt;= 12) $args[] = 0;</code></pre></div><p>and report the results.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2015-04-24T01:55:16Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23340#p23340</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PayPal import issues]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=23326#p23326" />
			<content type="html"><![CDATA[<p>I also noticed some errors in the error.log:<br /></p><div class="quotebox"><blockquote><p>[22-Apr-2015 23:59:50 America/Toronto] 0:admin:payment_db.inc:31: array_combine(): Both parameters should have an equal number of elements<br />[22-Apr-2015 23:59:50 America/Toronto] 0:admin:payment_db.inc:31: array_combine(): Both parameters should have an equal number of elements<br />[22-Apr-2015 23:59:50 America/Toronto] &lt;b&gt;DATABASE ERROR :&lt;/b&gt; no debtor trans found for given params&lt;br&gt;sql that failed was : SELECT trans.*,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total,cust.name AS DebtorName, cust.address, cust.curr_code, cust.tax_id, com.memo_, shippers.shipper_name, sales_types.sales_type, sales_types.tax_included, branch.*, cust.discount, tax_groups.name AS tax_group_name, tax_groups.id AS tax_group_id&nbsp; FROM debtor_trans trans<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN comments com ON trans.type=com.type AND trans.trans_no=com.id<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEFT JOIN shippers ON shippers.shipper_id=trans.ship_via, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debtors_master cust, sales_types, cust_branch branch, tax_groups&nbsp; WHERE trans.trans_no=&#039;&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.type=&#039;10&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; AND trans.debtor_no=cust.debtor_no AND sales_types.id = trans.tpe<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND branch.branch_code = trans.branch_code<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AND branch.tax_group_id = tax_groups.id &lt;br&gt;&lt;br&gt;&lt;br&gt;</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[ion]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=18154</uri>
			</author>
			<updated>2015-04-23T13:16:09Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=23326#p23326</id>
		</entry>
</feed>
