diff --git a/class/actions_czqrpay.class.php b/class/actions_czqrpay.class.php index 74bdf04..458543e 100644 --- a/class/actions_czqrpay.class.php +++ b/class/actions_czqrpay.class.php @@ -3,25 +3,32 @@ require_once DOL_DOCUMENT_ROOT.'/custom/czqrpay/lib/czqrpay.lib.php'; class ActionsCzQrPay { - function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) - { - return 0; - } - - function beforePDFCreation($parameters, &$object, &$action, $hookmanager) + function afterPDFCreation($parameters, &$object, &$action, $hookmanager) { global $db, $pdf; + // Jen vydané faktury if ($object->element != 'facture') return 0; + // účet $account = czqrpay_get_bank_account($db); if (!$account) return 0; + // VS = jen čísla z ref $vs = preg_replace('/\D/', '', $object->ref); + + // zpráva $msg = "Faktura ".$object->ref; + + // SPD string $spd = czqrpay_build_spd($account, $object->total_ttc, $vs, $msg); - $pdf->write2DBarcode($spd, 'QRCODE,M', 160, 230, 35, 35); + // pozice QR (Sponge layout) + $x = 150; + $y = 240; + $size = 40; + + $pdf->write2DBarcode($spd, 'QRCODE,M', $x, $y, $size, $size); return 1; }