Jump to content

"terms" In Invoice


blesta_tester

Recommended Posts

The file default_invoice_pdf.php in "components\invoice_templates\default_invoice" has a drawTerms() function.

 

Original:

	private function drawTerms() {
		$data = array(
			array(Language::_("DefaultInvoice.terms_heading", true)),
			array($this->meta['terms'])
		);
		$options = array(
			'font_size'=>self::$font_size_alt,
			'border'=>0,
			'x_pos'=>48,
			'y_pos'=>-119,
			'col'=>array(array('height'=>12)),
			'row'=>array(array('font'=>array(self::$font_bold)))
		);
		$this->drawTable($data, $options);
	}

 

Could it not be replaced with something like this:

	private function drawTerms() {
		if( $this->meta['terms'] != '' )
		{
			$data = array(
				array(Language::_("DefaultInvoice.terms_heading", true)),
				array($this->meta['terms'])
			);
			$options = array(
				'font_size'=>self::$font_size_alt,
				'border'=>0,
				'x_pos'=>48,
				'y_pos'=>-119,
				'col'=>array(array('height'=>12)),
				'row'=>array(array('font'=>array(self::$font_bold)))
			);
			$this->drawTable($data, $options);
		}
	}

 

That way it only does anything at all if $this->meta['terms'] is not empty?

Link to comment
Share on other sites

OR, check out the Footer() function.

 

Original:

	public function Footer() {

		// Set the terms of the document
		$this->drawTerms();
		
		// Set the page number of the document
		$this->drawPageNumber();
	}

 

Replace with this:

	public function Footer() {

		// Set the terms of the document, if available
		if( $this->meta['terms'] != '' )
		{
			$this->drawTerms();
		}
		
		// Set the page number of the document
		$this->drawPageNumber();
	}

 

Link to comment
Share on other sites

OR, check out the Footer() function.

 

Original:

	public function Footer() {

		// Set the terms of the document
		$this->drawTerms();
		
		// Set the page number of the document
		$this->drawPageNumber();
	}

 

Replace with this:

	public function Footer() {

		// Set the terms of the document, if available
		if( $this->meta['terms'] != '' )
		{
			$this->drawTerms();
		}
		
		// Set the page number of the document
		$this->drawPageNumber();
	}

 

Have you tested this yet to see if it works? I like the idea a lot! 

Link to comment
Share on other sites

Have you tested this yet to see if it works? I like the idea a lot! 

 

Yeah, they both work just fine for me. It's a simple IF statement.

 

-- Edit --

 

I just recommend one or the other. Both can work together, but it's just redundant at that point.

Edited by serverbin.net
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...