Fix composer file to allow to install sparin/swiss-qr-bill

This commit is contained in:
Laurent Destailleur
2023-07-19 23:52:19 +02:00
parent 5bdb59bbe1
commit 1283c22f26
3 changed files with 13 additions and 5 deletions

2
.gitignore vendored
View File

@@ -65,3 +65,5 @@ doc/install.lock
.idea/workspace.xml .idea/workspace.xml
.idea/inspectionProfiles/Project_Default.xml .idea/inspectionProfiles/Project_Default.xml
.idea/jsLinters/jshint.xml .idea/jsLinters/jshint.xml
/composer.json
/composer.lock

View File

@@ -28,20 +28,20 @@
"ckeditor/ckeditor" : "4.12.1", "ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "3.0", "mike42/escpos-php" : "3.0",
"mobiledetect/mobiledetectlib" : "2.8.41", "mobiledetect/mobiledetectlib" : "2.8.41",
"phpoffice/phpspreadsheet" : "1.12", "phpoffice/phpspreadsheet" : ">=1.12",
"restler/framework" : "3.0.0-RC6", "restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "6.3.2", "tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^3.7.1", "nnnick/chartjs" : "^3.7.1",
"stripe/stripe-php" : "10.7.0", "stripe/stripe-php" : "10.7.0",
"maximebf/debugbar" : "1.18.2", "maximebf/debugbar" : "1.18.2",
"symfony/var-dumper" : "3.2" "symfony/var-dumper" : ">=3.2"
}, },
"require-dev" : { "require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0", "php-parallel-lint/php-parallel-lint" : "^0",
"php-parallel-lint/php-console-highlighter" : "^0", "php-parallel-lint/php-console-highlighter" : "^0",
"phpunit/phpunit" : "^4", "phpunit/phpunit" : "^4",
"squizlabs/php_codesniffer" : "^2", "squizlabs/php_codesniffer" : "^2",
"phpunit/phpunit-selenium" : "^2" "phpunit/phpunit-selenium" : "^2",
"rector/rector" : "^0.16.0" "rector/rector" : "^0.16.0"
}, },
"suggest" : { "suggest" : {

View File

@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit
// For the experimental feature using swiss QR invoice generated by composer lib sparin/swiss-qr-bill
use Sprain\SwissQrBill; use Sprain\SwissQrBill;
/** /**
@@ -105,7 +106,12 @@ abstract class ModelePDFFactures extends CommonDocGenerator
return false; return false;
} }
require_once DOL_DOCUMENT_ROOT.'/includes/sprain/swiss-qr-bill/autoload.php'; // Load the autoload file generated by composer
if (file_exists(DOL_DOCUMENT_ROOT.'/includes/sprain/swiss-qr-bill/autoload.php')) {
require_once DOL_DOCUMENT_ROOT.'/includes/sprain/swiss-qr-bill/autoload.php';
} elseif (file_exists(DOL_DOCUMENT_ROOT.'/includes/autoload.php')) {
require_once DOL_DOCUMENT_ROOT.'/includes/autoload.php';
}
// Create a new instance of SwissQrBill, containing default headers with fixed values // Create a new instance of SwissQrBill, containing default headers with fixed values
$qrBill = SwissQrBill\QrBill::create(); $qrBill = SwissQrBill\QrBill::create();