Debug v23

This commit is contained in:
Laurent Destailleur
2025-10-13 21:57:19 +02:00
parent a74147f146
commit d37b717844
15 changed files with 71 additions and 132 deletions

View File

@@ -76,7 +76,7 @@ $formSetup = new FormSetup($db);
// Setup conf BOOKCAL_PUBLIC_INTERFACE_TOPIC
$item = $formSetup->newItem('BOOKCAL_PUBLIC_INTERFACE_TOPIC');
$item->defaultFieldValue = 'MyBigCompany public interface for Bookcal';
$item->fieldAttr['placeholder'] = 'MyBigCompany public interface for Bookcal';
$item->cssClass = 'minwidth300';
$setupnotempty = + count($formSetup->items);
@@ -180,8 +180,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "fa-calendar-check");
// Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("BookCalSetupPage").'</span><br><br>';
print '<br>';
if ($action == 'edit') {
print $formSetup->generateOutput(true);

View File

@@ -78,6 +78,9 @@ print load_fiche_titre($langs->trans("BookcalBookingTitle"), '', 'fa-calendar-ch
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<span class="opacitymedium">';
print $langs->trans("BookCalInitHelp");
print '</span>';
// BEGIN MODULEBUILDER DRAFT MYOBJECT
// Draft MyObject

View File

@@ -30,16 +30,6 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php';
// load module libraries
require_once __DIR__.'/class/calendar.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@@ -47,6 +37,14 @@ require_once __DIR__.'/class/calendar.class.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
// Load translation files required by the page
$langs->loadLangs(array("agenda", "other"));

View File

@@ -359,6 +359,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
@@ -375,8 +378,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Link to public page
print '<tr><td>Link</td>';
print '<td><a href="'. DOL_URL_ROOT.'/public/bookcal/index.php?id='.$object->id.'" target="_blank">Public page</a>';
print '<tr><td>'.$langs->trans("PublicLinkForBooking").'</td>';
print '<td>';
$linktobook = $urlwithroot.'/public/bookcal/index.php?id='.$object->id;
$encodedsecurekey = dol_hash(getDolGlobalString('BOOKCAL_SECUREKEY').'bookcal'.((int) $object->id), 'md5');
$linktobook .= '&securekey='.urlencode($encodedsecurekey);
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linktobook.'" class="quatrevingtpercent">'.$linktobook.'</a></div>';
print '<a target="_blank" rel="noopener noreferrer" href="'.$linktobook.'">'.img_picto('', 'globe').'</a>';
print '</td></tr>';
print '</table>';

View File

@@ -488,7 +488,7 @@ class Availabilities extends CommonObject
*/
public function validate($user, $notrigger = 0)
{
global $conf, $langs;
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -794,10 +794,6 @@ class Availabilities extends CommonObject
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
if (property_exists($this, 'amount')) {
$return .= '<br>';
$return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
}
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
$return .= '</div>';
$return .= '</div>';
@@ -937,55 +933,7 @@ class Availabilities extends CommonObject
*/
public function getNextNumRef()
{
global $langs, $conf;
$langs->load("agenda");
if (!getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON')) {
$conf->global->BOOKCAL_AVAILABILITIES_ADDON = 'mod_availabilities_standard';
}
if (getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON')) {
$mybool = false;
$file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON') . ".php";
$classname = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON');
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/bookcal/");
// Load file with numbering class (if found)
$mybool = ((bool) @include_once $dir.$file) || $mybool;
}
if (!$mybool) {
dol_print_error(null, "Failed to include file ".$file);
return '';
}
if (class_exists($classname)) {
$obj = new $classname();
'@phan-var-force CommonNumRefGenerator $obj';
/** @var CommonNumRefGenerator $obj */
$numref = $obj->getNextValue($this);
if ($numref != '' && $numref != '-1') {
return $numref;
} else {
$this->error = $obj->error;
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return "";
}
} else {
print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname;
return "";
}
} else {
print $langs->trans("ErrorNumberingModuleNotSetup", $this->element);
return "";
}
// Not used
}
/**
@@ -1001,7 +949,7 @@ class Availabilities extends CommonObject
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
global $conf, $langs;
global $langs;
$result = 0;

View File

@@ -1014,7 +1014,7 @@ class Calendar extends CommonObject
global $langs;
$result = 0;
/*
$langs->load("agenda");
if (!dol_strlen($modele)) {
@@ -1032,7 +1032,7 @@ class Calendar extends CommonObject
if (!empty($modele)) {
$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}
*/
return $result;
}
}

View File

@@ -31,7 +31,7 @@
*/
function calendarPrepareHead($object)
{
global $db, $langs, $conf;
global $langs, $conf;
$langs->load("agenda");
@@ -43,12 +43,12 @@ function calendarPrepareHead($object)
$head[$h][2] = 'card';
$h++;
if ($object->status == Calendar::STATUS_VALIDATED) {
//if ($object->status == Calendar::STATUS_VALIDATED) {
$head[$h][0] = DOL_URL_ROOT . '/bookcal/booking_list.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Bookings");
$head[$h][2] = 'booking';
$h++;
}
//}
// $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_contact.php?id=' . $object->id;
// $head[$h][1] = $langs->trans("Contacts");

View File

@@ -487,42 +487,6 @@ class modBookCal extends DolibarrModules
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('availabilities').')';
$r++; */
/* END MODULEBUILDER EXPORT AVAILABILITIES */
// Imports profiles provided by this module
$r = 1;
/* BEGIN MODULEBUILDER IMPORT AVAILABILITIES */
/*
$langs->load("agenda");
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]='AvailabilitiesLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->import_icon[$r]='availabilities@bookcal';
$this->import_tables_array[$r] = array('t' => MAIN_DB_PREFIX.'bookcal_availabilities', 'extra' => MAIN_DB_PREFIX.'bookcal_availabilities_extrafields');
$this->import_tables_creator_array[$r] = array('t' => 'fk_user_author'); // Fields to store import user id
$import_sample = array();
$keyforclass = 'Availabilities'; $keyforclassfile='/bookcal/class/availabilities.class.php'; $keyforelement='availabilities@bookcal';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinimport.inc.php';
$import_extrafield_sample = array();
$keyforselect='availabilities'; $keyforaliasextra='extra'; $keyforelement='availabilities@bookcal';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bookcal_availabilities');
$this->import_regex_array[$r] = array();
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('t.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array(
't.ref' => array(
'rule'=>'getrefifauto',
'class'=>(empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON) ? 'mod_availabilities_standard' : $conf->global->BOOKCAL_AVAILABILITIES_ADDON),
'path'=>"/core/modules/commande/".(empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON) ? 'mod_availabilities_standard' : $conf->global->BOOKCAL_AVAILABILITIES_ADDON).'.php'
'classobject'=>'Availabilities',
'pathobject'=>'/bookcal/class/availabilities.class.php',
),
't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'),
't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'),
);
$r++; */
/* END MODULEBUILDER IMPORT AVAILABILITIES */
}
/**

View File

@@ -28,16 +28,6 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@@ -47,6 +37,15 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
*
* @var string $dolibarr_main_url_root
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
@@ -343,6 +342,10 @@ if ($projectid > 0) {
dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
@@ -498,9 +501,6 @@ if ($projectid > 0) {
// Link to ICS for the event
print '<tr><td class="titlefield valignmiddle">'.$langs->trans("EventOrganizationICSLinkProject").'</td><td class="valuefield">';
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message
$message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
@@ -520,9 +520,6 @@ if ($projectid > 0) {
print '<span class="opacitymedium">('.$nbofconfbooth.')</span>';
}
print '</td><td class="valuefield">';
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
// Show message
$message = '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");

View File

@@ -211,3 +211,5 @@ ReadLess = Read less
RecurringEvent=Recurring event
EventPartOfARecurringSerie=Event is part of a recurring series with ID %s
BookCalSystem=Online booking
BookCalInitHelp=To start, go into menu to create a new Calendar with availabilities...
PublicLinkForBooking=Public link for booking

View File

@@ -364,6 +364,7 @@ ErrorIsNotInError=%s is not in error
ErrorFilenameExtensionNotAllowed=File %s has a forbidden file extension
ErrorNoValueForSelectListType=Error, a value for this type of field is mandatory
ErrorPaymentAmountMustNotBeNull=Error, payment amount must be defined and not zero
ErrorCalendarIsNotYetOpenOrHasBeenClosed=This calendar is not yet open or has been closed
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@@ -351,7 +351,7 @@ FTPFailedToUploadFile=Failed to upload the file <b>%s</b>.
AddFolder=Create folder
FileWasCreateFolder=Folder <b>%s</b> has been created
FTPFailedToCreateFolder=Failed to create folder <b>%s</b>.
SelectADay=Select a day in calendar
SelectADay=Select an available slot in the calendar
SelectANewDate=Select a new date
EmailContent=Email content
Pre-Prompt=Pre-prompt

View File

@@ -284,6 +284,11 @@ llxHeaderVierge('BookingCalendar');
print '<center><br><h2>'.(!empty($object->label) ? $object->label : $object->ref).'</h2></center>';
if ($object->status == $object::STATUS_DRAFT) {
$langs->trans("errors");
$errmsg = $langs->trans("ErrorCalendarIsNotYetOpenOrHasBeenClosed");
}
dol_htmloutput_errors($errmsg);
if ($action == 'create') {
@@ -308,7 +313,7 @@ if ($action == 'afteradd') {
print '<tr>';
print '<td>';
if ($action != 'create') {
print '<form name="formsearch" action="'.$_SERVER["PHP_SELF"].'">';
print '<form name="formsearch" class="bookcalsearch" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
$nav = '<a href="?id='.$id."&year=".$prev_year."&month=".$prev_month.$param.'"><i class="fa fa-chevron-left"></i></a> &nbsp;'."\n";

View File

@@ -8763,9 +8763,13 @@ table.jPicker {
}
.bookcalform {
border: 1px solid #000;
padding: 15px;
padding: 20px;
border-radius: 5px;
margin-bottom: 15px;
box-shadow: 10px 10px 10px #ddd;
}
.bookcalsearch {
padding-bottom: 10px;
}
.topmenuimage {
@@ -9142,6 +9146,10 @@ table.jPicker {
text-align: start;
}
.bookcalform {
padding: 8px;
box-shadow: none;
}
.bookcalform.boxtable .minwidth75 {
min-width: auto;
}

View File

@@ -8613,11 +8613,14 @@ table.jPicker {
}
.bookcalform {
border: 1px solid #000;
padding: 15px;
padding: 20px;
border-radius: 5px;
margin-bottom: 15px;
box-shadow: 10px 10px 10px #ddd;
}
.bookcalsearch {
padding-bottom: 10px;
}
/* ============================================================================== */