úprava pro sponge

This commit is contained in:
daaric 2026-02-08 20:51:07 +01:00
parent 872ca92934
commit 32801ca4a6

View file

@ -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;
}