Skip to content

Commit

Permalink
Fix composer file to allow to install sparin/swiss-qr-bill
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 19, 2023
1 parent 5bdb59b commit 1283c22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ doc/install.lock
.idea/modules.xml
.idea/workspace.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/jsLinters/jshint.xml
.idea/jsLinters/jshint.xml
/composer.json
/composer.lock
6 changes: 3 additions & 3 deletions composer.json.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
"ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "3.0",
"mobiledetect/mobiledetectlib" : "2.8.41",
"phpoffice/phpspreadsheet" : "1.12",
"phpoffice/phpspreadsheet" : ">=1.12",
"restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^3.7.1",
"stripe/stripe-php" : "10.7.0",
"maximebf/debugbar" : "1.18.2",
"symfony/var-dumper" : "3.2"
"symfony/var-dumper" : ">=3.2"
},
"require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0",
"php-parallel-lint/php-console-highlighter" : "^0",
"phpunit/phpunit" : "^4",
"squizlabs/php_codesniffer" : "^2",
"phpunit/phpunit-selenium" : "^2"
"phpunit/phpunit-selenium" : "^2",
"rector/rector" : "^0.16.0"
},
"suggest" : {
Expand Down
8 changes: 7 additions & 1 deletion htdocs/core/modules/facture/modules_facture.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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

// For the experimental feature using swiss QR invoice generated by composer lib sparin/swiss-qr-bill
use Sprain\SwissQrBill;

/**
Expand Down Expand Up @@ -105,7 +106,12 @@ private function getSwissQrBill(Facture $object, Translate $langs)
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
$qrBill = SwissQrBill\QrBill::create();
Expand Down

0 comments on commit 1283c22

Please sign in to comment.