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

This commit is contained in:
Laurent Destailleur 2024-02-12 03:35:51 +01:00
commit f6dd2f808e
21 changed files with 150 additions and 74 deletions

View file

@ -160,7 +160,8 @@ if ($action == 'create') {
//Add js for AutoFill
print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
print ' $(".AutoFillAmount").on(\'click touchstart\', function() {
console.log("Click on .AutoFillAmount");
var amount = $(this).data("value");
document.getElementById($(this).data(\'rowid\')).value = amount ;
});';

View file

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals', 'suppliers'));
$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals', 'salaries', 'suppliers'));
// Get supervariables
$id = GETPOST('id', 'int');

View file

@ -247,6 +247,9 @@ if ($id > 0) {
$balance = 0;
foreach ($TData as &$data1) {
$balance += $data1['amount'];
if (!isset($data1['balance'])) {
$data1['balance'] = 0;
}
$data1['balance'] += $balance;
}

View file

@ -170,7 +170,7 @@ function check_events() {
body: body,
lang: '<?php print dol_escape_js($langs->getDefaultLang(1)); ?>',
tag: value.id_agenda,
requireInteraction: true
requireInteraction: true /* wait that the user click or close the notification */
/* only supported for persistent notification shown using ServiceWorkerRegistration.showNotification() so disabled */
/* actions: [{ action: 'action1', title: 'New Button Label' }, { action: 'action2', title: 'Another Button' }] */
};
@ -185,7 +185,7 @@ function check_events() {
if (noti[index]) {
noti[index].onclick = function (event) {
/* If the use has clicked on button Activate */
/* If the user has clicked on button Activate */
console.log("A click on notification on browser has been done for url="+url);
event.preventDefault(); // prevent the browser from focusing the Notification's tab
window.focus();
@ -212,7 +212,7 @@ function check_events() {
result = 1;
} else {
console.log("Cancel check_events() with dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page+". Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https).");
console.log("Cancel check_events() with dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page+". Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https or browser is in Private mode).");
result = 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check)
}

View file

@ -2560,13 +2560,13 @@ function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(
* Security check when accessing to a document (used by document.php, viewimage.php and webservices to get documents).
* TODO Replace code that set $accessallowed by a call to restrictedArea()
*
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp'). Exemple: 'medias', 'invoice', 'logs', 'tax-vat', ...
* @param string $original_file Relative path with filename, relative to modulepart.
* @param string $entity Restrict onto entity (0=no restriction)
* @param User $fuser User object (forced)
* @param string $refname Ref of object to check permission for external users (autodetect if not provided) or for hierarchy
* @param string $mode Check permission for 'read' or 'write'
* @return mixed Array with access information : 'accessallowed' & 'sqlprotectagainstexternals' & 'original_file' (as a full path name)
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp'). Exemple: 'medias', 'invoice', 'logs', 'tax-vat', ...
* @param string $original_file Relative path with filename, relative to modulepart.
* @param string $entity Restrict onto entity (0=no restriction)
* @param User|null $fuser User object (forced)
* @param string $refname Ref of object to check permission for external users (autodetect if not provided) or for hierarchy
* @param string $mode Check permission for 'read' or 'write'
* @return mixed Array with access information : 'accessallowed' & 'sqlprotectagainstexternals' & 'original_file' (as a full path name)
* @see restrictedArea()
*/
function dol_check_secure_access_document($modulepart, $original_file, $entity, $fuser = '', $refname = '', $mode = 'read')

View file

@ -163,7 +163,7 @@ if (!GETPOST('code')) {
// Save more data into session
// Not required. All data are saved into $_SESSION['datafromloginform'] when form is posted with a click on Login with
// Google with param actionlogin=login and beforeoauthloginredirect=1, by the functions_googleoauth.php.
// Google with param actionlogin=login and beforeoauthloginredirect=google, by the functions_googleoauth.php.
/*
if (!empty($_POST["tz"])) {
$_SESSION["tz"] = $_POST["tz"];

View file

@ -375,7 +375,7 @@ if (isset($conf->file->main_authentication) && preg_match('/google/', $conf->fil
*/
print '<input type="hidden" name="beforeoauthloginredirect" id="beforeoauthloginredirect" value="">';
print '<a class="alogin" href="#" onclick="jQuery(\'#beforeoauthloginredirect\').val(1); $(this).closest(\'form\').submit();">';
print '<a class="alogin" href="#" onclick="jQuery(\'#beforeoauthloginredirect\').val(\'google\'); $(this).closest(\'form\').submit();">';
print '<div class="loginbuttonexternal">';
print img_picto('', 'google', 'class="pictofixedwidth"');
print $langs->trans("LoginWith", "Google");

View file

@ -225,7 +225,7 @@ if ($rss) {
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name

View file

@ -225,7 +225,7 @@ if ($rss) {
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name

View file

@ -225,7 +225,7 @@ if ($rss) {
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name

View file

@ -225,7 +225,7 @@ if ($rss) {
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name

View file

@ -225,7 +225,7 @@ if ($rss) {
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name

View file

@ -193,10 +193,10 @@ elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name
if ($hashp) {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$sqlprotectagainstexternals = '';

View file

@ -558,3 +558,9 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana');
-- Cuba Regions (id_country=77)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 77, 7700, '', 0, 'Cuba');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 77, 7701, '', 0, 'Occidente');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 77, 7702, '', 0, 'Centro');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 77, 7703, '', 0, 'Occidente');

View file

@ -2041,3 +2041,21 @@ INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-78
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-79',22105,'Kilis');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-80',22104,'Osmaniye');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-81',22106,'Düzce');
-- Provinces Cuba (id country=77)
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-PRI', 7701, 'Pinar del Rio');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-ART', 7701, 'Artemisa');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-HAB', 7701, 'La Habana');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-MYB', 7701, 'Mayabeque');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-MTZ', 7701, 'Matanzas');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-IJV', 7701, 'Isla de la Juventud');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-VLC', 7702, 'Villa Calra');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-CFG', 7702, 'Cienfuegos');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-SSP', 7702, 'Sancti Spiritus');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-CAV', 7702, 'Ciego de Avila');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-CMG', 7702, 'Camagüey');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-LTU', 7703, 'Las Tunas');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-GRM', 7703, 'Granma');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-SCU', 7703, 'Santiago de Cuba');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-GTM', 7703, 'Guantanamo');
INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('CU-HLG', 7703, 'Holguin');

View file

@ -680,10 +680,11 @@ if (is_array($modulepart)) {
}
/*
* Phase authentication / login
*/
$login = '';
/*
* Phase authentication / login
*/
$login = '';
if (!defined('NOLOGIN')) {
// $authmode lists the different method of identification to be tested in order of preference.
// Example: 'http', 'dolibarr', 'ldap', 'http,forceuser', '...'
@ -817,7 +818,7 @@ if (!defined('NOLOGIN')) {
if (GETPOST('openid_mode', 'alpha', 1)) { // For openid_connect ?
$goontestloop = true;
}
if (GETPOST('beforeoauthloginredirect', 'int') || GETPOST('afteroauthloginreturn')) { // For oauth login
if (GETPOST('beforeoauthloginredirect') || GETPOST('afteroauthloginreturn')) { // For oauth login
$goontestloop = true;
}
if (!empty($_COOKIE['login_dolibarr'])) { // TODO For ? Remove this ?
@ -827,7 +828,7 @@ if (!defined('NOLOGIN')) {
if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
$langs = new Translate("", $conf);
$langcode = (GETPOST('lang', 'aZ09', 1) ?GETPOST('lang', 'aZ09', 1) : (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
$langcode = (GETPOST('lang', 'aZ09', 1) ?GETPOST('lang', 'aZ09', 1) : getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'));
if (defined('MAIN_LANG_DEFAULT')) {
$langcode = constant('MAIN_LANG_DEFAULT');
}
@ -837,8 +838,23 @@ if (!defined('NOLOGIN')) {
// Validation of login/pass/entity
// If ok, the variable login will be returned
// If error, we will put error message in session under the name dol_loginmesg
// Note authmode is an array for example: array('0'=>'dolibarr', '1'=>'googleoauth');
if ($test && $goontestloop && (GETPOST('actionlogin', 'aZ09') == 'login' || $dolibarr_main_authentication != 'dolibarr')) {
// Loop on each test mode defined into $authmode
// $authmode is an array for example: array('0'=>'dolibarr', '1'=>'googleoauth');
$oauthmodetotestarray = array('google');
foreach ($oauthmodetotestarray as $oauthmodetotest) {
if (in_array($oauthmodetotest.'oauth', $authmode) && GETPOST('beforeoauthloginredirect') != $oauthmodetotest) {
// If we did not click on the link to use OAuth authentication, we do not try it.
dol_syslog("User did not click on link for OAuth so we disable check using googleoauth");
foreach ($authmode as $tmpkey => $tmpval) {
if ($tmpval == $oauthmodetotest.'oauth') {
unset($authmode[$tmpkey]);
break;
}
}
}
}
$login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode);
if ($login === '--bad-login-validity--') {
$login = '';

View file

@ -85,7 +85,7 @@ if ($conf->browser->layout == 'phone') {
$maxcategbydefaultforthisdevice = 8;
$maxproductbydefaultforthisdevice = 16;
//REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT FORCED
if (!empty($_SESSION["takeposterminal"]) && getDolGlobalInt('TAKEPOS_PHONE_BASIC_LAYOUT') == 1) {
if (!empty($_SESSION["takeposterminal"]) && getDolGlobalString('TAKEPOS_BAR_RESTAURANT') && getDolGlobalInt('TAKEPOS_PHONE_BASIC_LAYOUT') == 1) {
$_SESSION["basiclayout"] = 1;
header("Location: phone.php?mobilepage=invoice");
exit;
@ -243,6 +243,7 @@ function PrintCategories(first) {
<?php } ?>
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']);
$("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
$("#catdiv"+i).attr("data-rowid",categories[parseInt(i)+parseInt(first)]['rowid']);
$("#catdiv"+i).attr('class', 'wrapper');
$("#catwatermark"+i).show();
}
@ -285,6 +286,7 @@ function MoreCategories(moreorless) {
<?php } ?>
$("#catimg"+i).attr("src","genimg/index.php?query=cat&id="+categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
$("#catdiv"+i).data("rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
$("#catdiv"+i).attr("data-rowid",categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['rowid']);
$("#catwatermark"+i).show();
}
@ -293,18 +295,25 @@ function MoreCategories(moreorless) {
// LoadProducts
function LoadProducts(position, issubcat) {
console.log("LoadProducts");
console.log("LoadProducts position="+position+" issubcat="+issubcat);
var maxproduct = <?php echo($MAXPRODUCT - 2); ?>;
if (position=="supplements") currentcat="supplements";
else
{
if (position=="supplements") {
currentcat="supplements";
} else {
$('#catimg'+position).animate({opacity: '0.5'}, 1);
$('#catimg'+position).animate({opacity: '1'}, 100);
if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
else currentcat=$('#catdiv'+position).data('rowid');
if (issubcat == true) {
currentcat=$('#prodiv'+position).data('rowid');
} else {
console.log('#catdiv'+position);
currentcat=$('#catdiv'+position).data('rowid');
console.log("currentcat="+currentcat);
}
}
if (currentcat == undefined) {
return;
}
if (currentcat == undefined) return;
pageproducts=0;
ishow=0; //product to show counter
@ -323,7 +332,9 @@ function LoadProducts(position, issubcat) {
$("#proprice"+ishow).html("");
$("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid);
$("#prodiv"+ishow).data("rowid",val.rowid);
$("#prodiv"+ishow).attr("data-rowid",val.rowid);
$("#prodiv"+ishow).data("iscat",1);
$("#prodiv"+ishow).attr("data-iscat",1);
$("#prowatermark"+ishow).show();
ishow++;
}
@ -354,6 +365,7 @@ function LoadProducts(position, issubcat) {
$("#proprice"+ishow).attr("class", "hidden");
$("#proprice"+ishow).html("");
$("#prodiv"+ishow).data("rowid","");
$("#prodiv"+ishow).attr("data-rowid","");
$("#prodiv"+ishow).attr("class","wrapper2 divempty");
} else {
<?php
@ -395,8 +407,10 @@ function LoadProducts(position, issubcat) {
console.log($("#prodiv"+ishow));
$("#prodiv"+ishow).data("rowid", data[idata]['id']);
$("#prodiv"+ishow).attr("data-rowid", data[idata]['id']);
console.log($('#prodiv4').data('rowid'));
$("#prodiv"+ishow).data("iscat", 0);
$("#prodiv"+ishow).attr("data-iscat", 0);
$("#prodiv"+ishow).attr("class","wrapper2");
<?php
@ -463,6 +477,7 @@ function MoreProducts(moreorless) {
$("#proprice"+ishow).html("");
$("#proimg"+ishow).attr("src","genimg/empty.png");
$("#prodiv"+ishow).data("rowid","");
$("#prodiv"+ishow).attr("data-rowid","");
} else {
$("#prodivdesc"+ishow).show();
<?php if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { ?>
@ -490,6 +505,7 @@ function MoreProducts(moreorless) {
}
$("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']);
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
$("#prodiv"+ishow).attr("data-rowid",data[idata]['id']);
$("#prodiv"+ishow).data("iscat",0);
}
$("#prowatermark"+ishow).hide();
@ -655,6 +671,7 @@ function Search2(keyCodeForEnter, moreorless) {
$("[id^=proprice]").html("");
$("[id^=proimg]").attr("src", "genimg/empty.png");
$("[id^=prodiv]").data("rowid", "");
$("[id^=prodiv]").attr("data-rowid", "");
return;
}
@ -686,6 +703,7 @@ function Search2(keyCodeForEnter, moreorless) {
$("#proprice" + i).html("");
$("#proimg" + i).attr("src", "genimg/empty.png");
$("#prodiv" + i).data("rowid", "");
$("#prodiv" + i).attr("data-rowid", "");
continue;
}
<?php
@ -725,7 +743,9 @@ function Search2(keyCodeForEnter, moreorless) {
$("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']);
}
$("#prodiv" + i).data("rowid", data[i]['rowid']);
$("#prodiv" + i).attr("data-rowid", data[i]['rowid']);
$("#prodiv" + i).data("iscat", 0);
$("#prodiv" + i).attr("data-iscat", 0);
<?php
// Add js from hooks

View file

@ -534,12 +534,14 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
if (isModEnabled('productbatch') && isModEnabled('stock')) {
$batch = GETPOST('batch', 'alpha');
if (!empty($batch)) {
$action="setbatch";
} else {
// Set nb of suggested with nb of batch into the warehouse of the terminal
$nbofsuggested = 0;
$prod->load_stock('warehouseopen');
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
@ -552,9 +554,8 @@ if (empty($reshook)) {
}
echo "<script>";
echo "function addbatch(batch, warehouseid){";
echo '$("#poslines").load("invoice.php?action=addline&batch="+batch+"&warehouseid="+warehouseid+"&place='.$place.'&idproduct='.$idproduct.'&token='.newToken().'", function() {
});';
echo "function addbatch(batch, warehouseid) {";
echo '$("#poslines").load("invoice.php?action=addline&batch="+batch+"&warehouseid="+warehouseid+"&place='.$place.'&idproduct='.$idproduct.'&token='.newToken().'", function() {});';
echo "}";
echo "</script>";
@ -579,7 +580,7 @@ if (empty($reshook)) {
//$detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby, "day");
}
$detail .= ' - '.$langs->trans("Qty").': '.$dbatch->qty;
$detail .= " <button onclick='addbatch(".$dbatch->batch.", ".getDolGlobalInt($constantforkey).")'>".$langs->trans("Select")."</button>";
$detail .= ' <button onclick="addbatch(\''.$dbatch->batch.'\', '.getDolGlobalInt($constantforkey).')">'.$langs->trans("Select")."</button>";
$detail .= '<br>';
print $detail;
@ -596,6 +597,7 @@ if (empty($reshook)) {
}
}
if (getDolGlobalString('TAKEPOS_SUPPLEMENTS')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$cat = new Categorie($db);

View file

@ -5,6 +5,7 @@
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
*
* 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
@ -1410,43 +1411,52 @@ class Ticket extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return status label of object
* Return status label of object
*
* @param string $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $notooltip 1=No tooltip
* @param int $progress Progression (0 to 100)
* @return string Label
* @param string $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $notooltip 1=No tooltip
* @param int $progress Progression (0 to 100)
* @return string Label
*/
public function LibStatut($status, $mode = 0, $notooltip = 0, $progress = 0)
{
// phpcs:enable
global $langs, $hookmanager;
$labelStatus = $this->labelStatus[$status];
$labelStatusShort = $this->labelStatusShort[$status];
$labelStatus = !empty($status) ? $this->labelStatus[$status] : '';
$labelStatusShort = !empty($status) ? $this->labelStatusShort[$status] : '';
if ($status == self::STATUS_NOT_READ) {
$statusType = 'status0';
} elseif ($status == self::STATUS_READ) {
$statusType = 'status1';
} elseif ($status == self::STATUS_ASSIGNED) {
$statusType = 'status2';
} elseif ($status == self::STATUS_IN_PROGRESS) {
$statusType = 'status4';
} elseif ($status == self::STATUS_WAITING) {
$statusType = 'status7';
} elseif ($status == self::STATUS_NEED_MORE_INFO) {
$statusType = 'status3';
} elseif ($status == self::STATUS_CANCELED) {
$statusType = 'status9';
} elseif ($status == self::STATUS_CLOSED) {
$statusType = 'status6';
} else {
$labelStatus = 'Unknown';
$labelStatusShort = 'Unknown';
$statusType = 'status0';
$mode = 0;
switch ($status) {
case self::STATUS_NOT_READ:
$statusType = 'status0';
break;
case self::STATUS_READ:
$statusType = 'status1';
break;
case self::STATUS_ASSIGNED:
$statusType = 'status2';
break;
case self::STATUS_IN_PROGRESS:
$statusType = 'status4';
break;
case self::STATUS_WAITING:
$statusType = 'status7';
break;
case self::STATUS_NEED_MORE_INFO:
$statusType = 'status3';
break;
case self::STATUS_CANCELED:
$statusType = 'status9';
break;
case self::STATUS_CLOSED:
$statusType = 'status6';
break;
default:
$labelStatus = 'Unknown';
$labelStatusShort = 'Unknown';
$statusType = 'status0';
$mode = 0;
}
$parameters = array(

View file

@ -1212,7 +1212,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<tr><td>'.$langs->trans($value['label']).'</td>';
print '<td>';
if (!empty($value['icon'])) {
print '<span class="fa '.$value['icon'].' pictofixedwidth"></span>';
print '<span class="fab '.$value['icon'].' pictofixedwidth"></span>';
}
if (!empty($ldap_social[$key])) {
print '<input type="hidden" name="'.$key.'" value="'.$ldap_social[$key].'">';
@ -2625,7 +2625,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<tr><td>'.$langs->trans($value['label']).'</td>';
print '<td>';
if (!empty($value['icon'])) {
print '<span class="fa '.$value['icon'].' pictofixedwidth"></span>';
print '<span class="fab '.$value['icon'].' pictofixedwidth"></span>';
}
if ($caneditfield && empty($object->ldap_sid)) {
print '<input type="text" name="'.$key.'" class="flat maxwidth200" value="'.(isset($object->socialnetworks[$key]) ? $object->socialnetworks[$key] : '').'">';

View file

@ -226,7 +226,7 @@ if ($rss) {
} else {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, null, $refname);
$accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name