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

This commit is contained in:
Laurent Destailleur 2024-02-18 15:46:07 +01:00
commit f9e075a15b
14 changed files with 121 additions and 94 deletions

View file

@ -243,7 +243,7 @@ foreach ($dirmodels as $reldir) {
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
/** @var ModelNumRefContracts $module */
$module = new $file($db);
// Show modules according to features level
@ -255,7 +255,7 @@ foreach ($dirmodels as $reldir) {
}
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info($langs);
print '</td>';
@ -376,6 +376,7 @@ foreach ($dirmodels as $reldir) {
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
/** @var ModelePDFContract $module */
$module = new $classname($db);
$modulequalified = 1;

View file

@ -22,26 +22,6 @@
* \brief List page for calendar
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
//if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -51,9 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// load module libraries
require_once __DIR__.'/class/calendar.class.php';
// for other modules
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
@ -398,21 +375,6 @@ if ($num == 1 && !getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $sea
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
// Example : Adding jquery code
// print '<script type="text/javascript">
// jQuery(document).ready(function() {
// function init_myfunc()
// {
// jQuery("#myid").removeAttr(\'disabled\');
// jQuery("#myid").attr(\'disabled\',\'disabled\');
// }
// init_myfunc();
// jQuery("#mybutton").click(function() {
// init_myfunc();
// });
// });
// </script>';
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';

View file

@ -656,7 +656,7 @@ class Calendar extends CommonObject
if (isset($this->status)) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
$datas['ref'] .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
return $datas;
}

View file

@ -1645,6 +1645,36 @@ class Categorie extends CommonObject
}
}
/**
* Return if at least one photo is available
*
* @param string $sdir Directory to scan
* @return boolean True if at least one photo is available, False if not
*/
public function isAnyPhotoAvailable($sdir)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
$sdir .= '/' . get_exdir($this->id, 2, 0, 0, $this, 'category') . $this->id . "/photos/";
$dir_osencoded = dol_osencode($sdir);
if (file_exists($dir_osencoded)) {
$handle = opendir($dir_osencoded);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (!utf8_check($file)) {
$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory
}
if (dol_is_file($sdir . $file) && image_format_supported($file) >= 0) {
return true;
}
}
}
}
return false;
}
/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
@ -1755,7 +1785,7 @@ class Categorie extends CommonObject
if (file_exists($dir)) {
if (is_array($file['name']) && count($file['name']) > 0) {
$nbfile = count($file['name']);
for ($i = 0; $i <= $nbfile; $i++) {
for ($i = 0; $i < $nbfile; $i++) {
$originImage = $dir.$file['name'][$i];
// Cree fichier en taille origine

View file

@ -2446,7 +2446,7 @@ while ($i < $imaxinloop) {
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->user_email;
$userstatic->statut = $obj->user_statut;
$userstatic->status = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
@ -2773,10 +2773,10 @@ while ($i < $imaxinloop) {
$i++;
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
@ -2787,16 +2787,16 @@ if ($num == 0) {
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql);
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";
print '</div>'."\n";
print '</table>'."\n";
print '</div>'."\n";
print '</form>'."\n";
print '</form>'."\n";
if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
$hidegeneratedfilelistifempty = 1;
@ -2815,6 +2815,6 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords
print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
// End of page
llxFooter();
$db->close();
// End of page
llxFooter();
$db->close();

View file

@ -9051,7 +9051,8 @@ abstract class CommonObject
{
global $conf;
$file = ''; $originalfile = '';
$file = '';
$originalfile = '';
$newmodulepart = $modulepart;
if ($modulepart == 'unknown' && !empty($this->module)) {
$newmodulepart = $this->module;
@ -9124,6 +9125,10 @@ abstract class CommonObject
$pdir = '/'.get_exdir($this->id, 2, 0, 0, $this, $modulepart).$this->id."/photos/";
}
}
if ($modulepart == 'category') {
$dir = $sdir.'/'.get_exdir($this->id, 2, 0, 0, $this, $modulepart).$this->id."/photos/";
$pdir = '/'.get_exdir($this->id, 2, 0, 0, $this, $modulepart).$this->id."/photos/";
}
// Defined relative dir to DOL_DATA_ROOT
$relativedir = '';

View file

@ -2414,6 +2414,26 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" title="'.dol_escape_htmltag($langs->trans("UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv("Documents"))).'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
} elseif ($object->element == 'category') {
/** @var Categorie $object */
$width = 80;
$cssclass = 'photowithmargin photoref';
$showimage = $object->isAnyPhotoAvailable($conf->categorie->multidir_output[$entity]);
$maxvisiblephotos = getDolGlobalInt('CATEGORY_MAX_VISIBLE_PHOTO', 5);
if ($conf->browser->layout == 'phone') {
$maxvisiblephotos = 1;
}
if ($showimage) {
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('category', $conf->categorie->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0, '').'</div>';
} else {
if (getDolGlobalString('CATEGORY_NODISPLAYIFNOPHOTO')) {
$nophoto = '';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>';
} else { // Show no photo link
$nophoto = '/public/theme/common/nophoto.png';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" title="'.dol_escape_htmltag($langs->trans("UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv("Documents"))).'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
} elseif ($object->element == 'bom') {
/** @var Bom $object */
$width = 80;
@ -2437,6 +2457,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
} elseif ($object->element == 'ticket') {
$width = 80;
$cssclass = 'photoref';
/** @var Ticket $object */
$showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->ref);
$maxvisiblephotos = getDolGlobalInt('TICKET_MAX_VISIBLE_PHOTO', 2);
if ($conf->browser->layout == 'phone') {

View file

@ -15,7 +15,7 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
printTotalValCell($totalarray['type'][$i], $totalarray['val'][$totalarray['pos'][$i]]);
printTotalValCell($totalarray['type'][$i] ?? '', $totalarray['val'][$totalarray['pos'][$i]]);
} else {
if ($i == 1) {
if (is_null($limit) || $num < $limit) {

View file

@ -225,7 +225,8 @@ ALTER TABLE llx_ticket ADD COLUMN last_main_doc varchar(255);
ALTER TABLE llx_ticket ADD COLUMN extraparams varchar(255);
ALTER TABLE llx_ticket ADD COLUMN origin_replyto varchar(128);
ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL;
ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL;
ALTER TABLE llx_societe ADD COLUMN geolat double(24,8) DEFAULT NULL;
ALTER TABLE llx_societe ADD COLUMN geolong double(24,8) DEFAULT NULL;
ALTER TABLE llx_societe ADD COLUMN geopoint point DEFAULT NULL;

View file

@ -52,9 +52,9 @@ CREATE TABLE llx_expensereport (
detail_cancel varchar(255) DEFAULT NULL,
integration_compta integer DEFAULT NULL, -- not used
fk_bank_account integer DEFAULT NULL,
model_pdf varchar(50) DEFAULT NULL,
model_pdf varchar(255) DEFAULT NULL,
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
fk_multicurrency integer,
multicurrency_code varchar(3),
multicurrency_tx double(24,8) DEFAULT 1,
@ -65,4 +65,3 @@ CREATE TABLE llx_expensereport (
import_key varchar(14),
extraparams varchar(255) -- for other parameters with json format
) ENGINE=innodb;

View file

@ -4,7 +4,7 @@
-- Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
--
--
-- 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
-- the Free Software Foundation; either version 3 of the License, or
@ -27,18 +27,18 @@ create table llx_fichinter_rec
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_soc integer DEFAULT NULL,
datec datetime, -- date de creation
fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche
fk_user_author integer, -- createur
fk_projet integer, -- projet auquel est associe la facture
duree real, -- duree totale de l'intervention
description text,
modelpdf varchar(50),
modelpdf varchar(255),
note_private text,
note_public text,
frequency integer, -- frequency (for example: 3 for every 3 month)
unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)

View file

@ -47,6 +47,11 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Security check
if (!isModEnabled('bookcal')) {
httponly_accessforbidden('Module Bookcal isn\'t enabled');
}
$langs->loadLangs(array("main", "other", "dict", "agenda", "errors", "companies"));
$action = GETPOST('action', 'aZ09');
@ -103,11 +108,13 @@ if ($next_day < 6) {
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
$datechosen = GETPOST('datechosen', 'alpha');
$datetimechosen = GETPOST('datetimechosen', 'int');
$datetimechosen = GETPOSTINT('datetimechosen');
$isdatechosen = false;
$timebooking = GETPOST("timebooking");
$datetimebooking = GETPOST("datetimebooking", 'int');
$durationbooking = GETPOST("durationbooking", 'int');
$datetimebooking = GETPOSTINT("datetimebooking");
$durationbooking = GETPOSTINT("durationbooking");
$errmsg = '';
/**
* Show header for booking
*
@ -127,6 +134,8 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '<body id="mainbody" class="publicnewmemberform">';
$urllogo = '';
// Define urllogo
if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO') || getDolGlobalString('BOOPKCAL_PUBLIC_INTERFACE_TOPIC')) {
// Print logo
@ -410,13 +419,16 @@ if ($action == 'afteradd') {
$arrayofavailabledays = array();
$arrayofavailabilities = $availability->fetchAll('', '', 0, 0, array('status' => '1', 'fk_bookcal_calendar' => $id));
foreach ($arrayofavailabilities as $key => $value) {
$startarray = dol_getdate($value->start);
$endarray = dol_getdate($value->end);
for ($i = $startarray['mday']; $i <= $endarray['mday']; $i++) {
if ($todayarray['mon'] >= $startarray['mon'] && $todayarray['mon'] <= $endarray['mon']) {
$arrayofavailabledays[dol_mktime(0, 0, 0, $todayarray['mon'], $i, $todayarray['year'])] = dol_mktime(0, 0, 0, $todayarray['mon'], $i, $todayarray['year']);
if ($arrayofavailabilities < 0) {
setEventMessages($availability->error, $availability->errors, 'errors');
} else {
foreach ($arrayofavailabilities as $key => $value) {
$startarray = dol_getdate($value->start);
$endarray = dol_getdate($value->end);
for ($i = $startarray['mday']; $i <= $endarray['mday']; $i++) {
if ($todayarray['mon'] >= $startarray['mon'] && $todayarray['mon'] <= $endarray['mon']) {
$arrayofavailabledays[dol_mktime(0, 0, 0, $todayarray['mon'], $i, $todayarray['year'])] = dol_mktime(0, 0, 0, $todayarray['mon'], $i, $todayarray['year']);
}
}
}
}

View file

@ -63,8 +63,10 @@ if (!$vatNumber) {
print '<br>';
// Set the parameters to send to the WebService
$parameters = array("countryCode" => $countryCode,
"vatNumber" => $vatNumber);
$parameters = array(
"countryCode" => $countryCode,
"vatNumber" => $vatNumber,
);
// Set the WebService URL
dol_syslog("Create nusoap_client for URL=".$WS_DOL_URL." WSDL=".$WS_DOL_URL_WSDL);
@ -87,30 +89,23 @@ if (!$vatNumber) {
dol_syslog("Call method ".$WS_METHOD);
$result = $soapclient->call($WS_METHOD, $parameters);
//var_dump($parameters);
//var_dump($soapclient);
//print "x".is_array($result)."i";
//var_dump($result);
//print $soapclient->request.'<br>';
//print $soapclient->response.'<br>';
$messagetoshow = '';
print '<b>'.$langs->trans("Response").'</b>:<br>';
$faultstring = $result['faultstring'] ?? '';
// Service indisponible
if (!is_array($result) || preg_match('/SERVICE_UNAVAILABLE/i', $result['faultstring'])) {
if (!is_array($result) || preg_match('/SERVICE_UNAVAILABLE/i', $faultstring)) {
print '<span class="error">'.$langs->trans("ErrorServiceUnavailableTryLater").'</span><br>';
$messagetoshow = $soapclient->response;
} elseif (preg_match('/TIMEOUT/i', $result['faultstring'])) {
} elseif (preg_match('/TIMEOUT/i', $faultstring)) {
print '<span class="error">'.$langs->trans("ErrorServiceUnavailableTryLater").'</span><br>';
$messagetoshow = $soapclient->response;
} elseif (preg_match('/SERVER_BUSY/i', $result['faultstring'])) {
} elseif (preg_match('/SERVER_BUSY/i', $faultstring)) {
print '<span class="error">'.$langs->trans("ErrorServiceUnavailableTryLater").'</span><br>';
$messagetoshow = $soapclient->response;
} elseif ($result['faultstring']) {
} elseif ($faultstring) {
print '<span class="error">'.$langs->trans("Error").'</span><br>';
$messagetoshow = $result['faultstring'];
} elseif (preg_match('/INVALID_INPUT/i', $result['faultstring'])
$messagetoshow = $faultstring;
} elseif (preg_match('/INVALID_INPUT/i', $faultstring)
|| ($result['requestDate'] && !$result['valid'])) {
// Syntax ko
if ($result['requestDate']) {
@ -126,7 +121,7 @@ if (!$vatNumber) {
}
print $langs->trans("VATIntraSyntaxIsValid").': <span class="ok">'.$langs->trans("Yes").'</span><br>';
print $langs->trans("ValueIsValid").': ';
if (preg_match('/MS_UNAVAILABLE/i', $result['faultstring'])) {
if (preg_match('/MS_UNAVAILABLE/i', $faultstring)) {
print '<span class="error">'.$langs->trans("ErrorVATCheckMS_UNAVAILABLE", $countryCode).'</span><br>';
} else {
if (!empty($result['valid']) && ($result['valid'] == 1 || $result['valid'] == 'true')) {

View file

@ -12,7 +12,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2021 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Abbes Bahfir <dolipar@dolipar.org>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@ -2961,6 +2961,7 @@ class User extends CommonObject
'objecttype' => $this->element,
'infologin' => $infologin,
'option' => $option,
'hidethirdpartylogo' => $hidethirdpartylogo,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';