Duplicate customer name on tax invoice

Mike Evans mikee at saxicola.idps.co.uk
Wed Mar 23 05:37:35 EDT 2011


On Wednesday 23 Mar 2011 02:06:34 David Muir wrote:
> On 23/03/11 01:16, Mike Evans wrote:
> > I think I may be resposible for this. :) In order to fix a bug in the
> > std. invoice where the name wasn't displayed at all I 'fixed'
> > busines-core.scm and invoice.scm.  Unfortunately this makes the tax
> > invoice display the recipient name twice.  Fixing it for the tax invoice
> > breaks it again for invoice.scm. If you want fix your install comment
> > line 58 (with a semi-colon) in busines- core.scm.  Restart GnuCash afer
> > editing.
> > 
> > It will have to be re-fixed for ordinary invoices.
> 
> I had a further play with it, and was able to modify the eguile part
> instead, so it should keep working after an update.
> 
> For anyone who's interested, I added the following lines to a copy of
> 
> taxinvoice.eguile.scm:
> |(ownercomp  (gnc:owner-get-name-dep owner))
> 
> (owneraddr1 (gncAddressGetAddr1 (gnc:owner-get-address owner)))
> (owneraddr2 (gncAddressGetAddr2 (gnc:owner-get-address owner)))
> (owneraddr3 (gncAddressGetAddr3 (gnc:owner-get-address owner)))
> (owneraddr4 (gncAddressGetAddr4 (gnc:owner-get-address owner)))|
> 
> And then in the html:
> |<!-- customer info -->
> 
>   <td align="left" class="customer">
>     <?scm (if (not (string=? billcontact "")) (begin ?>
>       <span class="contact-name">Attn: <?scm:d billcontact ?></span><br />
>     <?scm )) ?>
>     <?scm (if (not (string=? ownercomp "")) (begin ?>
>       <span class="company-name"><?scm:d ownercomp ?></span><br />
>     <?scm )) ?>
>     <?scm (if (not (string=? owneraddr1 "")) (begin ?>
>       <span class="company-addr1"><?scm:d owneraddr1 ?></span><br />
>     <?scm )) ?>
>     <?scm (if (not (string=? owneraddr2 "")) (begin ?>
>       <span class="company-addr2"><?scm:d owneraddr2 ?></span><br />
>     <?scm )) ?>
>     <?scm (if (not (string=? owneraddr3 "")) (begin ?>
>       <span class="company-addr3"><?scm:d owneraddr3 ?></span><br />
>     <?scm )) ?>
>     <?scm (if (not (string=? owneraddr4 "")) (begin ?>
>       <span class="company-addr4"><?scm:d owneraddr4 ?></span><br />
>     <?scm )) ?>
>   </td>|
> 
> It's probably a bit more verbose than it needs to be, but works :-)
> 
> Cheers,
> David

Hi David
I think I'd like to fix the problem at source, so to speak, rather than 
intoduce  work-arounds in the invoice.  This way future upgrades won't break 
peoples invoices and the simple invoice as well as the guile invoices will all 
work as they should.  Dereks' suggestion is the correct change to make in 
taxinvoice.eguile.scm (line 56) along with two minor changes in busines-
core.scm.  This should make all the reports work as they should and updates 
will not affect anybody adversely.

I've put a partial diff below for busines-core.scm.  The changes can be made 
manually by taking out the lines marked - and adding the lines markes +.  If 
you're happy to do that (after making a backup!) and it works OK for you then 
I'll make sure the changes get into the source.


@@ -35,12 +35,14 @@
   (define (just-name name)
     (if name name ""))
 
-  (let ((type (gncOwnerGetType owner)))
+  (let ((type (gncOwnerGetType owner))
+               (addr (gnc:owner-get-address owner))
+       )
     (cond
       ((eqv? type GNC-OWNER-JOB)
        (gnc:owner-get-name-dep (gncJobGetOwner
                                (gncOwnerGetJob owner))))
-      (else (just-name (gncOwnerGetName owner))))))
+      (else (just-name (gncAddressGetName addr))))))
 
 (define (gnc:owner-get-address-dep owner)
   (define (add-if-exists lst new)
@@ -54,8 +56,6 @@
      (else (string-append (build-string (cdr lst)) "\n" (car lst)))))
   (let ((lst '())
        (addr (gnc:owner-get-address owner)))
-; Added gncAddressGetName  <mikee at saxicola.co.uk>
-    (set! lst (add-if-exists lst (gncAddressGetName  addr)))
     (set! lst (add-if-exists lst (gncAddressGetAddr1 addr)))
     (set! lst (add-if-exists lst (gncAddressGetAddr2 addr)))
     (set! lst (add-if-exists lst (gncAddressGetAddr3 addr)))


Regards Mike E


More information about the gnucash-user mailing list