Merge branch '13.0' into 13b5

This commit is contained in:
Alexandre SPANGARO 2021-01-01 06:17:33 +01:00
commit bf8b1cec3b
6 changed files with 15 additions and 116 deletions

102
build.xml
View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Script build for hudson CI -->
<project name="dolibarr" default="hudson" basedir=".">
<!-- Exclude/ignore paths -->
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />
<target name="clean">
<!-- Clean up -->
<delete dir="${basedir}/hudson"/>
<delete dir="${basedir}/generatedJUnitFiles"/>
<!-- Create build directories -->
<mkdir dir="${basedir}/hudson/doxygen"/>
<mkdir dir="${basedir}/hudson/logs"/>
<mkdir dir="${basedir}/hudson/coverage"/>
</target>
<!-- Run phpmd, phpcpd, phpcs, doxygen and phploc in parallel -->
<target name="parallelTasks">
<parallel>
<!-- <antcall target="phpmd"/> -->
<antcall target="phpcpd"/>
<!-- <antcall target="phpcs"/> -->
<antcall target="doxygen"/>
<antcall target="phploc"/>
</parallel>
</target>
<!-- Generate pmd.xml -->
<!--
<target name="phpmd">
<exec executable="phpmd">
<arg line="htdocs xml codesize,unusedcode
-\-reportfile '${basedir}/hudson/logs/pmd.xml'
-\-ignore=${ignorepaths}
" />
</exec>
</target>
-->
<!-- Generate pmd-cpd.xml -->
<target name="phpcpd">
<exec executable="phpcpd">
<arg line=" --log-pmd '${basedir}/hudson/logs/pmd-cpd.xml'
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
--min-tokens 70
--min-lines 20
htdocs
" />
</exec>
</target>
<!-- Generate phploc.csv -->
<target name="phploc">
<exec executable="phploc">
<arg line=" --log-csv '${basedir}/hudson/logs/phploc.csv'
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
htdocs
" />
</exec>
</target>
<!-- Generate checkstyle.xml -->
<target name="phpcs">
<exec executable="phpcs" dir="${basedir}">
<arg line=" --standard=${basedir}/dev/codesniffer/jenkins_ruleset.xml
--report=checkstyle
--report-file=${basedir}/hudson/logs/checkstyle.xml
--ignore=${ignorepaths},${ignoreregexp}
htdocs
"/>
</exec>
</target>
<!-- Run unit tests and generate junit.xml and clover.xml -->
<target name="phpunit">
<exec executable="phpunit" dir="${basedir}" failonerror="true">
<arg line=" --configuration ${basedir}/test/phpunit/phpunittest.xml
--log-junit ${basedir}/hudson/logs/junit.xml
--coverage-clover ${basedir}/hudson/coverage/clover.xml
--coverage-html ${basedir}/hudson/coverage/
test/phpunit/AllTests.php
"/>
</exec>
</target>
<!-- Generate Doxygen documentation -->
<target name="doxygen" description="Dolibarr documentation" >
<exec executable="doxygen" dir="${basedir}" failonerror="false">
<arg value="${basedir}/build/doxygen/jenkins_doxygen.doxyfile"/>
</exec>
</target>
<target name="hudson" depends="clean,phpunit,phpcs,parallelTasks"/>
</project>

View File

@ -2652,14 +2652,14 @@ class Form
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)))
{
if (!empty($user->rights->stock->lire)) {
$opt .= ' - '.$langs->trans("Stock").':'.$objp->stock;
$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
if ($objp->stock > 0) {
$outval .= ' - <span class="product_line_stock_ok">';
} elseif ($objp->stock <= 0) {
$outval .= ' - <span class="product_line_stock_too_low">';
}
$outval .= $langs->transnoentities("Stock").':'.$objp->stock;
$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'));
$outval .= '</span>';
if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
{
@ -2989,14 +2989,14 @@ class Form
$novirtualstock = ($showstockinlist == 2);
if (!empty($user->rights->stock->lire)) {
$outvallabel .= ' - '.$langs->trans("Stock").':'.$objp->stock;
$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
if ($objp->stock > 0) {
$optlabel .= ' - <span class="product_line_stock_ok">';
} elseif ($objp->stock <= 0) {
$optlabel .= ' - <span class="product_line_stock_too_low">';
}
$optlabel .= $langs->transnoentities("Stock").':'.$objp->stock;
$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
$optlabel .= '</span>';
if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
{

View File

@ -386,10 +386,10 @@ if ($nolinesbefore) {
<td class="nobottom margininfos linecolmargin right">
<!-- For predef product -->
<?php if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp" style="display: none;"></select>
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp maxwidth150" style="display: none;"></select>
<?php } ?>
<!-- For free product -->
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 right" value="<?php echo (GETPOSTISSET("buying_price") ? GETPOST("buying_price", 'alpha', 2) : ''); ?>">
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 maxwidth150 right" value="<?php echo (GETPOSTISSET("buying_price") ? GETPOST("buying_price", 'alpha', 2) : ''); ?>">
</td>
<?php
if (!empty($conf->global->DISPLAY_MARGIN_RATES))

View File

@ -490,9 +490,9 @@ if ($id > 0 || $ref)
if ($rowid)
{
print '<input type="hidden" name="ref_fourn_old" value="'.$object->ref_supplier.'">';
print '<input class="flat" name="ref_fourn" size="12" value="'.$object->ref_supplier.'">';
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.$object->ref_supplier.'">';
} else {
print '<input class="flat" name="ref_fourn" size="12" value="'.(GETPOST("ref_fourn") ?GETPOST("ref_fourn") : '').'">';
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.(GETPOST("ref_fourn") ? GETPOST("ref_fourn") : '').'">';
}
print '</td>';
print '</tr>';

View File

@ -364,6 +364,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
$objectresp = array();
$errorcode = ''; $errorlabel = '';
$error = 0;
$socid = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
@ -387,7 +388,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
if ($result > 0)
{
// Security for external user
if ($socid && (empty($order->socid) || $socid != $order->socid))
if ($socid && $socid != $order->socid)
{
$error++;
$errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request';

View File

@ -468,12 +468,12 @@ function createThirdParty($authentication, $thirdparty)
$newobject->capital = $thirdparty['capital'];
$newobject->barcode = $thirdparty['barcode'];
$newobject->tva_assuj = $thirdparty['vat_used'];
$newobject->tva_intra = $thirdparty['vat_number'];
$newobject->barcode = empty($thirdparty['barcode']) ? '' : $thirdparty['barcode'];
$newobject->tva_assuj = empty($thirdparty['vat_used']) ? 0 : $thirdparty['vat_used'];
$newobject->tva_intra = empty($thirdparty['vat_number']) ? '' : $thirdparty['vat_number'];
$newobject->canvas = $thirdparty['canvas'];
$newobject->particulier = $thirdparty['individual'];
$newobject->canvas = empty($thirdparty['canvas']) ? '' : $thirdparty['canvas'];
$newobject->particulier = empty($thirdparty['individual']) ? 0 : $thirdparty['individual'];
$elementtype = 'societe';