PHP
Laragon & XDebug- Debug PHP with VSCode on Windows
A configuration that finally works ! A free alternative to PHPStorm.
Prerequisite :
- Visual Studio Code
- PHP Extension Pack VSCode Extension
- Laragon
- PHP v7.4.33-Win32-vc15-x64
- XDebug v3.1.6-7.4-vc15-x86_64
- XDebug helper chrome extension
Chrome Extension : XDebug helper
Install XDebug helper Chrome extension and enable the Debug mode.
XDebug
Download and copy the xdebug-3.1.6-7.4-vc15-x86_64.dll in the PHP ext
folder.
C:\laragon\bin\php\php-7.4.33-Win32-vc15-x64\ext\
Verify XDebug is properly installed by follow the instructions at : https://xdebug.org/wizard
Laragon
This line is added automatically by Laragon when activating the extension by clicking it :
Laragon > Menu > PHP > Extensions > xdebug-3.1.6-7.4-vc15-x86_64
zend_extension=xdebug-3.1.6-7.4-vc15-x86_64
; Manually added
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host=localhost
xdebug.idekey = VSCODE
xdebug.port=9003
xdebug.mode=debug
VSCode
VSCode > Run and Debug > Modify/Add the “Listen for Xdebug” configuration.
{
// ...
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
//...
]
}
Dolibarr – Ne pas autoriser de valeur décimale dans le champ quantité stock
Par défaut il est possible d’entrer un nombre décimal dans la valeur de quantité de stock dans Dolibarr > Produits > (Onglet) Stock > (Section) Corriger le stock > (Formulaire Input) Nombre de pièces .
Solution
Il semblerait que l’ajout d’un attribut type="number"
HTML sur le tag input permet d’empêcher d’entrer une valeur décimale.
Implémentation
Ajouter la constante STOCK_QUANTITY_ALLOW_DECIMAL_VALUE
dans la table llx_const
. Depuis le backoffice Accueil > Configuration > Divers .
- Nom de la constante : STOCK_QUANTITY_ALLOW_DECIMAL_VALUE
- Commentaire : Autoriser un nombre décimal dans le champ quantité stock.
- Valeurs possibles : 0 => ne pas autoriser | 1 => autoriser
Modification du fichier : htdocs\product\stock\tpl\stockcorrection.tpl.php
L115
// BEFORE
print '<input name="nbpiece" id="nbpiece" class="center valignmiddle maxwidth75" value="'.GETPOST("nbpiece").'">';
// AFTER
print '<input name="nbpiece" id="nbpiece" class="center valignmiddle maxwidth75" '.($conf->global->STOCK_QUANTITY_ALLOW_DECIMAL_VALUE === '0' ? 'type="number"' : '').' value="'.GETPOST("nbpiece").'">';
