File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,8 +123,9 @@ function invoice_recMod10($in): int
123123 * Returns a QR code for invoice payments.
124124 *
125125 * @param number invoice-id
126+ * @param number width
126127 */
127- function invoice_qrcode ($ invoice_id ): string
128+ function invoice_qrcode ($ invoice_id, $ width = 64 ): string
128129{
129130 $ CI = &get_instance ();
130131
@@ -139,7 +140,13 @@ function invoice_qrcode($invoice_id): string
139140 $ CI ->load ->library ('QrCode ' , ['invoice ' => $ invoice ]);
140141 $ qrcode_data_uri = $ CI ->qrcode ->generate ();
141142
142- return '<img src=" ' . $ qrcode_data_uri . '" alt="QR Code" id="invoice-qr-code"> ' ;
143+ $ numeric_width = intval ($ width );
144+ $ width = '' ;
145+ if ($ numeric_width > 0 ) {
146+ $ width = ' width=" ' . strval ($ numeric_width ) . '" ' ;
147+ }
148+
149+ return '<img src=" ' . $ qrcode_data_uri . '" ' . $ width . ' alt="QR Code" id="invoice-qr-code"> ' ;
143150 }
144151 }
145152
You can’t perform that action at this time.
0 commit comments