Page 1 of 1

Problem with invoices and customer infos...

Posted: 25 Aug 2010, 12:40
by Mister Paul
Hi,
there is a problem with invoices if customer changes his infos after the order: the PDF is created with his new infos (jos_vm_user_info) instead of those when he created the order (jos_vm_order_user_info)
So the invoice could become completely incoherent (regarding VAT, ...)

I made slight modifications in administrator/components/com_virtuemart/pdf/phoca.tcpdf.php
1°BILL TO
- I inserted a request before: // begin bill to

Code: Select all

		$dbstc = new ps_DB;
		$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='BT'";
		$dbstc->query($qt);
		$dbstc->next_record();
- I mage a global find/replace : $hD['dbbt'] by $dbbtc
- changed this line for country :
$this->Cell(0,0,$hD['vmBTCountry'],0,0,'L'); replaced by: $this->Cell(0,0,$dbbtc->f("country"),0,0,'L');

2°SHIP TO
- a request before: // begin ship to

Code: Select all

		$dbstc = new ps_DB;
		$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='ST'";
		$dbstc->query($qt);
		$dbstc->next_record();
- global find/replace : $hD['dbst'] by $dbstc
- this line for country :
$this->Cell(0,0,$hD['vmSTCountry'],0,0,'L'); replaced by: $this->Cell(0,0,$dbstc->f("country"),0,0,'L');

Re: Problem with invoices and customer infos...

Posted: 28 Aug 2010, 13:09
by Jan
Hi, thank you for this info.

Jan

Re: Problem with invoices and customer infos...

Posted: 30 Aug 2010, 16:45
by Mister Paul
Oops I made an update because I didn't checked if there was no shipping to address!

Code: Select all

$dbstc = new ps_DB;
		$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='ST'";
		$dbstc->query($qt);
		$dbstc->next_record();
		
		// If there is no shipping address specified, we take the biil to address:
		if (is_null($dbstc->loadResult())) {
			$qt = "SELECT * FROM #__{vm}_order_user_info WHERE order_id=".$hD['dbo']->f("order_id")." AND address_type='BT'";
			$dbstc->query($qt);
		}
:wink: