Topic: Suggestion: Make Payment Link Prettier

This is just a suggestion, but I think it would make invoices look nicer...

Currently, if you have Payment Link enabled when printing invoices you get this at the bottom:

"You can pay through PayPal:
https://www.paypal.com/xclick/business=chris%40crazychris.ca&item_name=INVOICE+135&amount=50.00&currency_code=CAD"

While this works, it's somewhat ugly.  It would look much nicer if it looked like this:

"You can pay using a credit card or PayPal."

This puts everything on one line (saves space) and hides the URL from the customer which looks better on the printout.  It also explicitly tells the customer they can pay with a credit card (some folks don't have a  PayPal account and don't know that PayPal also does regular credit card processing).

I'm not sure if this is a trivial change or monumental.  It's no big deal, really, but if someone is bored and looking for something to do someday it would pretty things up.  smile wink  I'd do it myself but I'm not a programmer so I'd probably crash the application.  lol

Regards,

Chris

2 (edited by apmuthu 01/12/2013 02:13:26 pm)

Re: Suggestion: Make Payment Link Prettier

Lines 1350-1355 in includes/ui/ui_view.inc:

if (!isset($payment_services))
{
    $payment_services = array(
        'PayPal' => "https://www.paypal.com/xclick/business=<company_email>&item_name=<comment>&amount=<amount>&currency_code=<currency>",
    );
}

What do you mean by that "it appears at the bottom" ? - a screenshot would be nice.

Re: Suggestion: Make Payment Link Prettier

I don't see a way of adding an attachment to this message (maybe I don't have privileges?), so here's a link for you:

https://www.crazychris.ca/screenshot-1.png

Hope that helps...

Regards,

Chris

4 (edited by apmuthu 01/12/2013 02:12:27 pm)

Re: Suggestion: Make Payment Link Prettier

If the only usage is a pdf that will be emailed or seen in a browser, then the shortened text with the hyperlink beneath it would have been okay.

The reason that is expanded in full is that in a printout the URL is not clickable!

Please try replacing Lines 1350-1355 in includes/ui/ui_view.inc for your requirement (inspite of reason listed) with:

if (!isset($payment_services))
{
    $payment_services = array(
        'PayPal' => "<a href='https://www.paypal.com/xclick/business=<company_email>&item_name=<comment>&amount=<amount>&currency_code=<currency>'>Payment Link</a>",
    );
}

Line 259 in file reporting/includes/doctext.inc:

$Footer[_("You can pay through"). " $service: "] = "$url";

and Line 1014 in file reporting/includes/pdf_report.inc:

$msg.= _("You can pay through"). " $service: $url\n\n";

are used to display the assembled $url string.

BTW: your screenshot was http and not https and yes, upload rights are controlled by the board admin.

Post's attachments

screenshot-1.png 44.1 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

5 (edited by chrison 01/13/2013 04:47:16 am)

Re: Suggestion: Make Payment Link Prettier

Hi, apmuthu!

Your point about the link in a printed report not being click-able is well taken.  However, with such a long URL it's a bit doubtful someone is going to type it all in manually, especially since it contains special characters (e.g. "&" for field parameters and "%40" instead of "@").  So, getting rid of all that, even though it means someone who prints the report can't type it, probably isn't that big a deal.

Anyway, I tried making the changes you suggested above and now neither the word "PayPal" nor the long URL are click-able, although the URL is blue instead of black.  If you PM me your e-mail address, I can e-mail you a PDF'ed invoice to look at (I don't want to post one online.)

***
EDIT:  Actually, the payment link now looks like this (and is unclickable):

<a href='https://www.paypal.com/xclick/business=chris%40crazychris.ca&item_name=INVOICE+146&amount=24.30&currency_code=CAD'>Payment Link</a>

In other words, it's printing out the whole URL, not just "Payment Link".
***

Thanks, again, for your help!

Regards,

Chris

P.S.  I sent you a PM about accessing my system.  I hope you got it?

6 (edited by apmuthu 01/14/2013 08:14:29 am)

Re: Suggestion: Make Payment Link Prettier

Obtained the backup sql of your system and am testing it out in an OpenVZ VPS - a sort of test ride  troubleshooting using it.

The changes from the stock FA v2.3.13 to the Mercurial Build now as far as the database is concerned is only the following statements (You are using company 0 with a table prefix of "f1_"):

# Default value is not '1' but blank
ALTER TABLE `f1_users` 
    CHANGE `print_profile` `print_profile` varchar(30)  COLLATE latin1_swedish_ci NOT NULL DEFAULT '' after `pos`;

# InnoDB needed for Foreign Keys - not mere unique key
ALTER TABLE `f1_tag_associations` 
    ADD PRIMARY KEY(`record_id`,`tag_id`), 
    DROP KEY `record_id`, ENGINE=InnoDB; 

ALTER TABLE `f1_tags` ENGINE=InnoDB; 

# New feature in Mercurial build needs it
INSERT INTO `f1_sys_prefs` VALUES ('bcc_email', 'setup.company', 'varchar', '100', NULL);

Typo in Company Name - Extraordinaire.

The config.php must be matched with the config.default.php to make up for the missing/changed entries. Stick to default themes for now till the other themes are updated to accommodate the changed function locations that affect the renderer.php in the older themes.

The choice of white background in your logo blends well with stock white paper invoice!
COA has Retained Earnings, Owner's Drawings and Owner's Equity in Owner's Capital type(7).

Working on the prettier link without having to change the code much.....

7 (edited by apmuthu 01/14/2013 11:00:31 am)

Re: Suggestion: Make Payment Link Prettier

Your Pretty Link is done!
Replace file reporting/includes/header2.inc with the one attached.

Post's attachments

header2_inc.zip 14.2 kb, 7 downloads since 2013-01-14 

You don't have the permssions to download the attachments of this post.

Re: Suggestion: Make Payment Link Prettier

Lines 205 and 209 in the file reporting/includes/header2.inc attached in the previous post are both:

$this->row -= $this->lineHeight;

If the said lines are commented out, the blank line in the middle of the footer disappears.

Attached herein is the before and after picture set of an invoice.

Post's attachments

FooterPix.zip 23.9 kb, 6 downloads since 2013-01-14 

You don't have the permssions to download the attachments of this post.

Re: Suggestion: Make Payment Link Prettier

Hold your horses a bit. This new link does not work in certain PDF-readers.

The old, ugly one, did work. And for printed copies, you could just enter the URL in your browser and pay it this way too.

/Joe

10 (edited by apmuthu 01/14/2013 01:50:52 pm)

Re: Suggestion: Make Payment Link Prettier

Works in Adobe Acrobat Reader X
Works in the Browser plugin in MS IE 8 and FF 18.0
Works from Sumatra PDF Reader v2.2.1 - 2.5 MB

Please let me know which PDF Reader it did not work.

If the PayPal Link is necessary to be shown in full, maybe we can add a config variable (all companies) for it or a setup preference (sys_prefs) variable for it (per company basis). The patch contains the native way to populate a link in TCPDF with no dependency of FPDF parsers. The latest TCPDF also has ShotCodes, Extended barcodes / QCodes as well.

Post's attachments

FA_Inv_in_SumatraPDFReader.png 42.6 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Suggestion: Make Payment Link Prettier

We are not planning to update the TCPDF  in a while. They used to have upgrades every week a while ago.

As told, this doesn't work in Foxit reader and we should not change something that does not work in all pdf viewers.

/Joe

Re: Suggestion: Make Payment Link Prettier

See this thread - It works in Foxit Reader as well.

In Foxit Reader:
Edit -> Preferences -> Trust Manager -> Enable Safe Reading Mode -> Uncheck

Re: Suggestion: Make Payment Link Prettier

Yes, I know this is possible, but this is another unneeded support issue.

The other argument against it is that a good typist could easily enter the URL in a browser from a printed copy. This is not possible at all with this new implementation.

Joe

Re: Suggestion: Make Payment Link Prettier

Sounds to me like my suggestion has "fixed" one problem, long and ugly URL's at the end of the invoice, but has created several others. including possible support issues with PDF readers.  Although personally I would prefer not having the long and ugly URL, I now realize there are logical reasons for having it (so that customers who print the report can manually type it in).

Perhaps it's best to leave things be?  I'm sure I'll get used to the URL's.  Sorry if my suggestion caused anyone to waste time/effort that could have been better spent on other matters.

Regards,

Chris

Re: Suggestion: Make Payment Link Prettier

Just to finish up a previous side conversation...

apmuthu wrote:

Obtained the backup sql of your system and am testing it out in an OpenVZ VPS - a sort of test ride  troubleshooting using it.

The changes from the stock FA v2.3.13 to the Mercurial Build now as far as the database is concerned is only the following statements (You are using company 0 with a table prefix of "f1_"):

(SQL Statements removed)

Thanks for that info.  If I decide to do a backup of my production data and restore it into Mercurial I'll remember to run those SQL statements so the the db is correct.

apmuthu wrote:

Typo in Company Name - Extraordinaire.

Thanks for pointing that out!  lol  I type that word so often I often don't look at it closely any more!

apmuthu wrote:

The config.php must be matched with the config.default.php to make up for the missing/changed entries. Stick to default themes for now till the other themes are updated to accommodate the changed function locations that affect the renderer.php in the older themes.

I'll keep that in mind, too, if I decide to do the export/import thing into Mercurial.

apmuthu wrote:

The choice of white background in your logo blends well with stock white paper invoice!

Yes, it does.  I tried a logo with a transparent background but the transparency converted to black in the PDF reader.  I never use colored paper for business purposes, so the white background works just fine.

apmuthu wrote:

COA has Retained Earnings, Owner's Drawings and Owner's Equity in Owner's Capital type(7).

That's right.  Owner's Equity is my capital investment in the company (i.e. shares).  Owner's Draw is used for occasionally putting some operating funds into the company or drawing-out funds for personal use.    Although I could record draws to Owner's Equity, I prefer to keep those two types of transactions separate.

apmuthu wrote:


Working on the prettier link without having to change the code much.....

See my comment above.

Thanks, again, apmuthu for your help!

Regards,

Chris

Re: Suggestion: Make Payment Link Prettier

You could also insert the URL as a QR code. There are libraries available to generate and insert them into TCPDF's output, but it might require changing the layout a bit. (I don't use FA's invoices, but I've done something quite similar elsewhere with FPDF.)

A more keyboard-friendly approach would be building a simple URL shortening and redirection service, but that would involve interfacing with a publicly accessible web server.

Re: Suggestion: Make Payment Link Prettier

I agree with tm its what I did so you get the URL printed and the QR on the invoice

copy the library from here https://sourceforge.net/projects/phpqrc … t/download
to --> /reporting/includes/

in the file
/reporting/includes/doctext.inc

in the top

// add QR Support mod
    $path_to_root="..";
    include_once($path_to_root . "/reporting/includes/phpqrcode/qrlib.php");

    $tempDir = $path_to_root ."/company/1/pdf_files/"; // <--NOTE must be your temp location
// end

the if statement around line 270 should look like this

    if (@$this->formData['payment_service'])    //payment link
    {
        $amt = number_format($this->formData["ov_freight"] + $this->formData["ov_gst"] + $this->formData["ov_amount"], user_price_dec());
        $service = $this->formData['payment_service'];
        $url = payment_link($service, array(
            'company_email' => $this->company['email'],
            'amount' => $amt,
            'currency' => $this->formData['curr_code'],
            'comment' => $this->title . " " . $this->formData['reference'],
            'invoice' => $this->formData['document_number']
            ));
        $Footer[_("You can pay through"). " $service: "] = "$url";
// QR Mod
        $tempname = tempnam($tempDir,'QRcode');
        QRcode::png($url, $tempname.'.png', QR_ECLEVEL_L, 3);
        $this->Image($tempname.'.png',486,670,100,100);
// End
    }