blesta_tester Posted July 10, 2013 Report Posted July 10, 2013 I think it would be nice to hide the word "Terms" on invoices if "Terms" textfield is empty in "Invoice customization". Bit Bayou and iAlex 2
Bit Bayou Posted July 12, 2013 Report Posted July 12, 2013 I like this idea. I understand the point of the Terms box, but if it's empty, it looks kind of funny with the word there by itself
Bit Bayou Posted July 13, 2013 Report Posted July 13, 2013 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?
Bit Bayou Posted July 13, 2013 Report Posted July 13, 2013 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(); }
Paul Posted July 13, 2013 Report Posted July 13, 2013 This is probably a good idea. And you know what I like about the source being available? You guys can make changes, test them, and share. EDIT: CORE-580 Bit Bayou 1
MemoryX2 Posted July 13, 2013 Report Posted July 13, 2013 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!
Bit Bayou Posted July 13, 2013 Report Posted July 13, 2013 (edited) 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 July 13, 2013 by serverbin.net MemoryX2 1
Tyson Posted July 19, 2013 Report Posted July 19, 2013 It's only a one-line fix to both invoice pdf templates. Added in CORE-580 for v3.0.0.b6. Bit Bayou 1
Recommended Posts