View Single Post
  #5  
Old 15th February 2013, 16:07
arek_bednarczyk arek_bednarczyk is offline
Junior Member
 
Join Date: Jun 2009
Location: Poland
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
Slashes in invoice numbers are not supported in that version of the billing module as the invoice number is used as filename for the pdf invoices, so only chars that are allowed as filename on Linux can be used inside a invoice number. The billingmodule prerelease for ISPConfig 3.0.5 supports slashes as the invoice naming has been changed.
I know this, but I want save invoices as invoice[$invoice_id].pdf
Here is function for saving invoices:


Code:
function remote_billing_invoice_get_pdf($invoice_id) {
	require('lib/config.inc.php');
	
	$client = new SoapClient(null, array(	'location' => $soap_location,
                                     		'uri'      => $soap_uri,
									 												'trace' => 1,
									 												'exceptions' => 1));

	try {
		$session_id = $client->login($username,$password);
		
		//* Save the PDF file in the following path
		$file_path = 'invoices/invoice'.$invoice_id.'.pdf';
		
		//* Get the PDF file content (base64 encoded)
		$content = $client->billing_invoice_get_pdf($session_id, $invoice_id);
		
		//* Decode the content
		$content_decoded = base64_decode($content);
		
		//* Save the pdf file to disk
		file_put_contents($file_path,$content_decoded);

		// Logout remote user
		$client->logout($session_id);
	} catch (SoapFault $e) {
		echo $client->__getLastResponse();
		die('SOAP Error: '.$e->getMessage());
	}
}
Reply With Quote