Merge remote-tracking branch 'Dolibarr/13.0' into 13

This commit is contained in:
Francis Appels 2021-03-19 09:32:11 +01:00
commit 1267c1a4f9
20 changed files with 110 additions and 30 deletions

View File

@ -3,6 +3,53 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** 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

@ -113,7 +113,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) {

View File

@ -285,6 +285,7 @@ if (empty($reshook))
} elseif ($action == 'setecheance' && $usercancreate)
{
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0)
dol_print_error($db, $object->error);
} elseif ($action == 'setdate_livraison' && $usercancreate)

View File

@ -2240,6 +2240,7 @@ class Commande extends CommonOrder
$sql .= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
$sql .= ', '.MAIN_DB_PREFIX.'element_element as el';
$sql .= ' WHERE el.fk_source = '.$this->id;
$sql .= " AND el.sourcetype = 'commande'";
$sql .= " AND el.fk_target = e.rowid";
$sql .= " AND el.targettype = 'shipping'";

View File

@ -515,13 +515,17 @@ if ($search_description)
}
$sql .= natural_search("b.label", $search_description_to_use); // Warning some text are just translation keys, not translated strings
}
if ($search_bid > 0) $sql .= " AND b.rowid=l.lineid AND l.fk_categ=".$search_bid;
if (!empty($search_type)) $sql .= " AND b.fk_type = '".$db->escape($search_type)."' ";
if ($search_bid > 0) $sql .= " AND b.rowid=l.lineid AND l.fk_categ=".((int) $search_bid);
if (!empty($search_type)) $sql .= " AND b.fk_type = '".$db->escape($search_type)."'";
// Search criteria amount
$search_debit = price2num(str_replace('-', '', $search_debit));
$search_credit = price2num(str_replace('-', '', $search_credit));
if ($search_debit) $sql .= natural_search('- b.amount', $search_debit, 1);
if ($search_credit) $sql .= natural_search('b.amount', $search_credit, 1);
if ($search_debit) {
$sql .= natural_search('ABS(b.amount)', $search_debit, 1);
$sql .= ' AND b.amount <= 0';
}
if ($search_credit) {
$sql .= natural_search('b.amount', $search_credit, 1);
$sql .= ' AND b.amount >= 0';
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';

View File

@ -247,7 +247,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>';
@ -293,6 +293,7 @@ if ($action == 'create')
print '<td class="right">'.price($objp->amount - $sumpaid)."</td>";
print '<td class="center">';
if ($sumpaid < $objp->amount)
{
$namef = "amount_".$objp->id;
@ -301,7 +302,7 @@ if ($action == 'create')
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
$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

@ -45,7 +45,7 @@ $langs->loadLangs(array('compta', 'bills', 'banks'));
$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'));
@ -91,7 +91,7 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) {
if ($action == 'classin' && $user->rights->tax->charges->creer)
{
$object->fetch($id);
$object->setProject(GETPOST('projectid'));
$object->setProject(GETPOST('fk_project'));
}
if ($action == 'setlib' && $user->rights->tax->charges->creer)
@ -352,21 +352,21 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
$numproject = $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, 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">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 2);
$form->select_comptes(GETPOST('fk_account', 'int'), 'fk_account', 0, '', 2);
print '</td></tr>';
}
@ -457,7 +457,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

@ -762,9 +762,9 @@ class pdf_azur extends ModelePDFPropales
}
} else {
if (!empty($conf->product->enabled)) {
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref);
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product');
} elseif (!empty($conf->service->enabled)) {
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref);
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product');
}
}

View File

@ -907,9 +907,9 @@ class pdf_cyan extends ModelePDFPropales
}
} else {
if (!empty($conf->product->enabled)) {
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref);
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product');
} elseif (!empty($conf->service->enabled)) {
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref);
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product');
}
}

View File

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

View File

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

View File

@ -411,7 +411,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

@ -32,7 +32,9 @@ require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php";
// Security check
if (!$user->rights->opensurvey->read) accessforbidden();
if (empty($user->rights->opensurvey->read)) {
accessforbidden();
}
// Initialisation des variables
$action = GETPOST('action', 'aZ09');

View File

@ -39,6 +39,11 @@ $object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage);
// Security check
if (empty($user->rights->opensurvey->read)) {
accessforbidden();
}
/*
* Actions

View File

@ -31,7 +31,6 @@
*/
function opensurvey_prepare_head(Opensurveysondage $object)
{
global $langs, $conf;
$h = 0;

View File

@ -31,7 +31,9 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
$langs->load("opensurvey");
// Security check
if (!$user->rights->opensurvey->read) accessforbidden();
if (empty($user->rights->opensurvey->read)) {
accessforbidden();
}
$hookmanager = new HookManager($db);

View File

@ -29,10 +29,10 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php";
// Security check
if (!$user->rights->opensurvey->read) accessforbidden();
if (empty($user->rights->opensurvey->read)) {
accessforbidden();
}
// Init vars
$action = GETPOST('action', 'aZ09');
@ -596,7 +596,10 @@ if (GETPOST('ajoutsujet'))
}
if ($user->rights->opensurvey->write) {
print '<span class="opacitymedium">'.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).'</span><br>';
print '<span class="opacitymedium">';
$s = $langs->trans("PollAdminDesc", '{s1}', $langs->trans("Add"));
print str_replace('{s1}', img_picto('', 'delete'), $s);
print '</span><br>';
}
$nbcolonnes = substr_count($object->sujet, ',') + 1;

View File

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

View File

@ -307,7 +307,9 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
// Make a redirect to avoid to have ticket submitted twice if we make back
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>', '<strong>'.$object->ref.'</strong>'), null, 'warnings');
$messagetoshow = $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '{s1}', '{s2}');
$messagetoshow = str_replace(array('{s1}', '{s2}'), array('<strong>'.$object->track_id.'</strong>', '<strong>'.$object->ref.'</strong>'), $messagetoshow);
setEventMessages($messagetoshow, null, 'warnings');
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
header("Location: index.php");
exit;

View File

@ -425,6 +425,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');
}
/**