Billing module - SOAP-ENV:ServerCall to a member function fault() on a non-object

Discussion in 'Installation/Configuration' started by arek_bednarczyk, Feb 15, 2013.

  1. arek_bednarczyk

    arek_bednarczyk New Member

    Hi,
    I'm trying use a remote billing_invoice_get_pdf function, if invoice number is like 0001 pdf is created. But if number is like 2013/AB/0001 then this not work, and I see this one error message:

    SOAP-ENV:ServerCall to a member function fault() on a non-object
    SOAP Error: Call to a member function fault() on a non-object

    Is this bug in billing remote module? With normal work in ispconfig everything work properly.

    Br.
    Arek
     
  2. till

    till Super Moderator

    Which billing module version and ispconfig version do you use?
     
  3. arek_bednarczyk

    arek_bednarczyk New Member

    Sorry,

    ISPConfig Version: 3.0.4.6
    Billing module: REV-3
     
  4. till

    till Super Moderator

    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.
     
  5. arek_bednarczyk

    arek_bednarczyk New Member

    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());
    	}
    }
     
  6. till

    till Super Moderator

    The problem is not your remote function here. As ispconfig billing module does not support slashes in invoice numbers in the rev3 release, the pdf invoice can not be saved to disk when you call the finalize function of the remote api or click on finalize in the interface. The function billing_invoice_get_pdf(...) is just trying to read the pdf file from disk that was created before and then hands it over to your script. So when the pdf can not be saved to disk in the first step, then you can not retrieve it with the billing_invoice_get_pdf later.

    It might be possible to replace the internal get_invoice_filename(...) function of the interface/lib/classes/billing_functions.inc.php with the one from the rev 4 release. If you want to try that, send me an email to the address were you received the billing module from and I will send you the rev4 version RC.
     
  7. arek_bednarczyk

    arek_bednarczyk New Member

    Thanks!
    As I remember this was arek[at]linux.pl address.
     

Share This Page