Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	ChangeLog
	htdocs/admin/tools/export_files.php
	htdocs/compta/paiement_charge.php
	htdocs/compta/sociales/card.php
	htdocs/core/lib/functions.lib.php
	htdocs/cron/list.php
	htdocs/filefunc.inc.php
	test/phpunit/FilesLibTest.php
This commit is contained in:
Laurent Destailleur 2021-03-16 14:57:04 +01:00
commit e366d2c379
12 changed files with 87 additions and 20 deletions

View File

@ -25,6 +25,54 @@ Following changes may create regressions for some external modules, but were nec
* If your database is MySql or MariaDB, you need at least version 5.1
***** ChangeLog for 13.0.2 compared to 13.0.1 *****
FIX: 11.0 - $this->socid injected in query without checking for empty value
FIX: #16096 #16085 Any call of ajax pages must provide the token
FIX: #16296
FIX: #16325
FIX: #16341 : Fetch the Product ExtraFields in Shippment lines
FIX: #16366
FIX: #16393 Do not sanitize <!DOCTYPE html>
FIX: #16420 #16423 #16488 #16477
FIX: #16431
FIX: #16465
FIX: #16480
FIX: #16485
FIX: #16487
FIX: #16503
FIX: #16530
FIX: #16533
FIX: #16629
FIX: #16671 Can not generate zip file of documents in backup tool
FIX: Add "Now" link on social charges creation card
FIX: avoid undefined url and missing token
FIX: Bad project filter in ticket list
FIX: Buttons to disable bindings not working
FIX: class not found when creating recuring invoice from invoice+discount
FIX: File attachment on lots
FIX: handling $heightforinfotot when he's superior to a page height on Supplier Invoice
FIX: hourglass and hide button to pay
FIX: massaction validate invoice do not regenerate pdf
FIX: missing mp4 video mime
FIX: picto on shipment to reset qty to 0. Some quantities were not reset.
FIX: Protection to avoid #16504
FIX: rounding amount on card updating
FIX: Rounding amount on social charges card updating
FIX: select list dependencies now work for ModuleBuilder sellist field
FIX: Status in popup of member in widget
FIX: status on tooltip on widgets
FIX: Timezone management for datetime on list of events
FIX: Timezone management for datetime with modulebuilder and extrafields
FIX: Total_ht not show in contract link element
FIX: use post instead get
FIX: use var "saved_url" instead global var "$url"
FIX: Various payment - Missing fields for check transmitter & bank name
FIX: warning if setup of chart of account is not yet done.
FIX: wrong extension
***** ChangeLog for 13.0.1 compared to 13.0.0 *****
FIX: 10.0 before crediting a withdrawal receipt, check whether it has been credited already.

View File

@ -7,6 +7,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -383,11 +384,11 @@ foreach ($list_binding as $key) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disablebindingonsales&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disablebindingonsales&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -396,11 +397,11 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disablebindingonpurchases&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disablebindingonpurchases&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -409,11 +410,11 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disablebindingonexpensereports&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disablebindingonexpensereports&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}

View File

@ -122,7 +122,8 @@ $utils = new Utils($db);
if ($compression == 'zip') {
$file .= '.zip';
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.back|\.old|\.log|[\\\/]temp[\\\/]|documents[\\\/]admin[\\\/]documents[\\\/])/i');
$excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, $excludefiles);
if ($ret < 0) {
if ($ret == -2) {
$langs->load("errors");

View File

@ -227,7 +227,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'"></textarea></td>';
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'">'.GETPOST('note', 'alphanohtml').'</textarea></td>';
print '</tr>';
print '</table>';
@ -279,7 +279,7 @@ if ($action == 'create') {
}
$remaintopay = $objp->amount - $sumpaid;
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'" value="'.GETPOST('amount_'.$objp->id, 'alpha').'">';
} else {
print '-';
}

View File

@ -48,7 +48,7 @@ $langs->loadLangs(array('compta', 'bills', 'banks', 'hrm'));
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
$fk_project = (GETPOST('fk_project') ? GETPOST('fk_project', 'int') : 0);
$dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear'));
$dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear'));
@ -93,7 +93,7 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) {
// Link to a project
if ($action == 'classin' && $user->rights->tax->charges->creer) {
$object->fetch($id);
$object->setProject(GETPOST('projectid'));
$object->setProject(GETPOST('fk_project'));
}
if ($action == 'setfk_user' && $user->rights->tax->charges->creer) {
@ -360,20 +360,20 @@ if ($action == 'create') {
print '<tr><td>'.$langs->trans("Project").'</td><td>';
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
print '</td></tr>';
}
// Payment Mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
$form->select_types_paiements(GETPOST('mode_reglement_id', 'int'), 'mode_reglement_id');
print '</td></tr>';
// Bank Account
if (!empty($conf->banque->enabled)) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 2, '', 0, '', 1);
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(GETPOST('fk_account', 'int'), 'fk_account', 0, '', 2, '', 0, '', 1);
print '</td></tr>';
}
@ -475,7 +475,7 @@ if ($id > 0) {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'fk_project', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {

View File

@ -9198,6 +9198,11 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
$famime = 'file-audio-o';
}
// Video
if (preg_match('/\.mp4$/i', $tmpfile)) {
$mime = 'video/mp4';
$imgmime = 'video.png';
$famime = 'file-video-o';
}
if (preg_match('/\.ogv$/i', $tmpfile)) {
$mime = 'video/ogg';
$imgmime = 'video.png';
@ -9229,7 +9234,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
$famime = 'file-video-o';
}
// Archive
if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i', $tmpfile)) {
if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh|zst)$/i', $tmpfile)) {
$mime = 'archive';
$imgmime = 'archive.png';
$famime = 'file-archive-o';

View File

@ -313,6 +313,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
if (is_string($result)) {
$this->error = $result;
return -6;
} else {
$is_dispo = $this->verif_dispo($db, $code, $soc, $type);
if ($is_dispo <> 0) {
$result = -3;
}
}
}

View File

@ -510,7 +510,7 @@ if ($num > 0) {
print $object->priority;
print '</td>';
print '<td>';
print '<td class="nowraponall">';
if ($obj->jobtype == 'method') {
$text = $langs->trans("CronClass");
$texttoshow = $langs->trans('CronModule').': '.$obj->module_name.'<br>';

View File

@ -399,7 +399,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fourn
$product = $supplierorderdispatch->fk_product;
$price = GETPOST('price');
$comment = $supplierorderdispatch->comment;
$eatby = $supplierorderdispatch->fk_product;
$eatby = $supplierorderdispatch->eatby;
$sellby = $supplierorderdispatch->sellby;
$batch = $supplierorderdispatch->batch;

View File

@ -212,6 +212,6 @@ class mymodulewidget1 extends ModeleBoxes
{
// You may make your own code here…
// … or use the parent's class function using the provided head and contents templates
parent::showBox($this->info_box_head, $this->info_box_contents);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -211,7 +211,7 @@ if (empty($reshook)) {
}
} else {
$db->rollback();
unset($_POST["ref"]);
$action = 'create';
}
} else {

View File

@ -424,6 +424,13 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
$result=dol_uncompress($fileout, $dirout);
print __METHOD__." result=".join(',', $result)."\n";
$this->assertEquals(0, count($result), "Pb with dol_uncompress_file of file ".$fileout);
$excludefiles = '/(\.back|\.old|\.log|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
if (preg_match($excludefiles, 'a/temp/b')) { echo '----- Regex OK -----'."\n"; }
$result=dol_compress_dir($dirout, $conf->admin->dir_temp.'/testdir.zip', 'zip', $excludefiles);
print __METHOD__." result=".$result."\n";
print join(', ', $conf->logbuffer);
$this->assertGreaterThanOrEqual(1, $result, "Pb with dol_compress_dir of ".$dirout." into ".$conf->admin->dir_temp.'/testdir.zip');
}
/**