35 lines
835 B
PHP
35 lines
835 B
PHP
<?php
|
|
require_once DOL_DOCUMENT_ROOT.'/custom/czqrpay/lib/czqrpay.lib.php';
|
|
|
|
class ActionsCzQrPay
|
|
{
|
|
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);
|
|
|
|
// pozice QR (Sponge layout)
|
|
$x = 150;
|
|
$y = 240;
|
|
$size = 40;
|
|
|
|
$pdf->write2DBarcode($spd, 'QRCODE,M', $x, $y, $size, $size);
|
|
|
|
return 1;
|
|
}
|
|
}
|