This commit is contained in:
Laurent Destailleur 2023-01-19 01:16:39 +01:00
parent 49473e5934
commit e28fce6318
27 changed files with 56 additions and 132 deletions

View File

@ -1,80 +0,0 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file bookcal/admin/about.php
* \ingroup bookcal
* \brief About page of module BookCal.
*/
// Load Dolibarr environment
require '../../main.inc.php';
// Libraries
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once '../lib/bookcal.lib.php';
// Translations
$langs->loadLangs(array("errors", "admin", "bookcal@bookcal"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
/*
* Actions
*/
// None
/*
* View
*/
$form = new Form($db);
$help_url = '';
$page_name = "BookCalAbout";
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'about', $langs->trans($page_name), 0, 'bookcal@bookcal');
dol_include_once('/bookcal/core/modules/modBookCal.class.php');
$tmpmodule = new modBookCal($db);
print $tmpmodule->getDescLong();
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once '../lib/bookcal.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('bookcal@bookcal', 'admin'));
$langs->loadLangs(array('agenda', 'admin'));
$extrafields = new ExtraFields($db);
$form = new Form($db);
@ -80,7 +80,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'availabilities_extrafields', $langs->trans($page_name), -1, 'bookcal@bookcal');
print dol_get_fiche_head($head, 'availabilities_extrafields', $langs->trans($page_name), -1, 'fa-calendar-check');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once '../lib/bookcal.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('bookcal@bookcal', 'admin'));
$langs->loadLangs(array('agenda', 'admin'));
$extrafields = new ExtraFields($db);
$form = new Form($db);
@ -80,7 +80,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'booking_extrafields', $langs->trans($page_name), -1, 'bookcal@bookcal');
print dol_get_fiche_head($head, 'booking_extrafields', $langs->trans($page_name), -1, 'fa-calendar-check');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -33,7 +33,7 @@ require_once '../lib/bookcal.lib.php';
//require_once "../class/myclass.class.php";
// Translations
$langs->loadLangs(array("admin", "bookcal@bookcal"));
$langs->loadLangs(array("admin", "agenda"));
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('bookcalsetup', 'globalsetup'));
@ -269,7 +269,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = bookcalAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "bookcal@bookcal");
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>';

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
$langs->loadLangs(array("agenda", "other"));
// Get parameters
$id = GETPOST('id', 'int');

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
$langs->loadLangs(array("agenda", "other"));
// Get parameters
$id = GETPOST('id', 'int');

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "companies", "other", "mails"));
$langs->loadLangs(array("agenda", "companies", "other", "mails"));
$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "companies", "other", "mails"));
$langs->loadLangs(array("agenda", "companies", "other", "mails"));
$action = GETPOST('action', 'aZ09');

View File

@ -36,7 +36,7 @@ require_once __DIR__.'/class/availabilities.class.php';
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
$langs->loadLangs(array("agenda", "other"));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@ -210,7 +210,7 @@ $now = dol_now();
//$help_url = "EN:Module_Availabilities|FR:Module_Availabilities_FR|ES:Módulo_Availabilities";
$help_url = '';
$title = $langs->trans("Availabilitiess");
$title = $langs->trans("Availabilities");
$morejs = array();
$morecss = array();

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_availabilities.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "companies"));
$langs->loadLangs(array("agenda", "companies"));
// Get parameters
$id = GETPOST('id', 'int');

View File

@ -30,7 +30,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal"));
$langs->loadLangs(array("agenda"));
$action = GETPOST('action', 'aZ09');

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_booking.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
$langs->loadLangs(array("agenda", "other"));
// Get parameters
$id = GETPOST('id', 'int');

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/booking.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_booking.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
$langs->loadLangs(array("agenda", "other"));
// Get parameters
$id = GETPOST('id', 'int');

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/booking.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_booking.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "companies", "other", "mails"));
$langs->loadLangs(array("agenda", "companies", "other", "mails"));
$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/booking.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_booking.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "companies", "other", "mails"));
$langs->loadLangs(array("agenda", "companies", "other", "mails"));
$action = GETPOST('action', 'aZ09');

View File

@ -36,7 +36,7 @@ require_once __DIR__.'/class/booking.class.php';
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));
$langs->loadLangs(array("agenda", "other"));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/booking.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_booking.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "companies"));
$langs->loadLangs(array("agenda", "companies"));
// Get parameters
$id = GETPOST('id', 'int');

View File

@ -116,10 +116,10 @@ class Availabilities extends CommonObject
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Canceled'), 'validate'=>'1',),
'start' => array('type'=>'date', 'label'=>'Start Date', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'isameasure'=>'1',),
'end' => array('type'=>'date', 'label'=>'End Date', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'isameasure'=>'1',),
'start' => array('type'=>'date', 'label'=>'Start Date', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'searchall'=>1),
'end' => array('type'=>'date', 'label'=>'End Date', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'searchall'=>1),
'type' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>'1', 'position'=>49, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Customer', '1'=>'Supplier', '2'=>'Else'),),
'duration' => array('type'=>'integer', 'label'=>'Duration', 'enabled'=>'1', 'position'=>47, 'notnull'=>1, 'visible'=>1, 'default'=>'30', 'isameasure'=>'1',),
'duration' => array('type'=>'integer', 'label'=>'Duration', 'enabled'=>'1', 'position'=>47, 'notnull'=>1, 'visible'=>1, 'default'=>'30'),
'startHour' => array('type'=>'integer', 'label'=>'Start Hour', 'enabled'=>'1', 'position'=>46, 'notnull'=>1, 'visible'=>-1,),
'endHour' => array('type'=>'integer', 'label'=>'End Hour', 'enabled'=>'1', 'position'=>46.5, 'notnull'=>1, 'visible'=>-1,),
);
@ -842,7 +842,7 @@ class Availabilities extends CommonObject
// phpcs:enable
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
//$langs->load("bookcal@bookcal");
//$langs->load("agenda");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
@ -944,7 +944,7 @@ class Availabilities extends CommonObject
public function getNextNumRef()
{
global $langs, $conf;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
if (empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) {
$conf->global->BOOKCAL_AVAILABILITIES_ADDON = 'mod_availabilities_standard';
@ -1009,7 +1009,7 @@ class Availabilities extends CommonObject
$result = 0;
$includedocgeneration = 0;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
if (!dol_strlen($modele)) {
$modele = 'standard_availabilities';

View File

@ -842,7 +842,7 @@ class Booking extends CommonObject
// phpcs:enable
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
//$langs->load("bookcal@bookcal");
//$langs->load("agenda");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
@ -944,7 +944,7 @@ class Booking extends CommonObject
public function getNextNumRef()
{
global $langs, $conf;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
if (empty($conf->global->BOOKCAL_BOOKING_ADDON)) {
$conf->global->BOOKCAL_BOOKING_ADDON = 'mod_booking_standard';
@ -1009,7 +1009,7 @@ class Booking extends CommonObject
$result = 0;
$includedocgeneration = 0;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
if (!dol_strlen($modele)) {
$modele = 'standard_booking';

View File

@ -30,7 +30,7 @@ function bookcalAdminPrepareHead()
{
global $langs, $conf;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
$h = 0;
$head = array();
@ -47,11 +47,6 @@ function bookcalAdminPrepareHead()
$h++;
*/
$head[$h][0] = dol_buildpath("/bookcal/admin/about.php", 1);
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(

View File

@ -31,7 +31,7 @@ function availabilitiesPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
$showtabofpagecontact = 1;
$showtabofpagenote = 1;

View File

@ -31,7 +31,7 @@ function bookingPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("bookcal@bookcal");
$langs->load("agenda");
$showtabofpagecontact = 1;
$showtabofpagenote = 1;

View File

@ -1945,7 +1945,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
$listofusertoshow = '';
$listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
$listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle');
print $listofusertoshow;
} else { // Other calendar
// Picto
@ -2020,7 +2020,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$cacheusers[$tmpid] = $newuser;
}
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle');
}
print $titletoshow;
@ -2070,7 +2070,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$linerelatedto .= dolGetElementUrl($event->fk_element, $event->elementtype, 1);
}
if ($linerelatedto) {
print '<br>'.$linerelatedto;
print ' '.$linerelatedto;
}
}

View File

@ -7858,30 +7858,34 @@ abstract class CommonObject
/**
* Return validation test result for a field
*
* @param array $val Array of properties of field to show
* @param array $fields Array of properties of field to show
* @param string $fieldKey Key of attribute
* @param string $fieldValue value of attribute
* @return bool return false if fail true on success, see $this->error for error message
*/
public function validateField($val, $fieldKey, $fieldValue)
public function validateField($fields, $fieldKey, $fieldValue)
{
global $langs;
if (!class_exists('Validate')) { require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; }
if (!class_exists('Validate')) {
require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
}
$this->clearFieldError($fieldKey);
if (!isset($val[$fieldKey])) {
if (!isset($fields[$fieldKey])) {
$this->setFieldError($fieldKey, $langs->trans('FieldNotFoundInObject'));
return false;
}
$val = $fields[$fieldKey];
$param = array();
$param['options'] = array();
$type = $val[$fieldKey]['type'];
$type = $val['type'];
$required = false;
if (isset($val[$fieldKey]['notnull']) && $val[$fieldKey]['notnull'] === 1) {
if (isset($val['notnull']) && $val['notnull'] === 1) {
// 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
$required = true;
}
@ -7892,6 +7896,7 @@ abstract class CommonObject
//
// PREPARE Elements
//
$reg = array();
// Convert var to be able to share same code than showOutputField of extrafields
if (preg_match('/varchar\((\d+)\)/', $type, $reg)) {
@ -7905,7 +7910,7 @@ abstract class CommonObject
$type = 'select';
}
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
if (!empty($val['type']) && preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
$type = 'link';
}

View File

@ -40,11 +40,12 @@ class modBookCal extends DolibarrModules
public function __construct($db)
{
global $langs, $conf;
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
$this->numero = 2430;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'bookcal';
@ -76,7 +77,7 @@ class modBookCal extends DolibarrModules
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
$this->picto = 'fa-generic';
$this->picto = 'fa-calendar-check';
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array(
@ -463,8 +464,7 @@ class modBookCal extends DolibarrModules
{
global $conf, $langs;
//$result = $this->_load_tables('/install/mysql/', 'bookcal');
$result = $this->_load_tables('/bookcal/sql/');
$result = $this->_load_tables('/install/mysql/', 'bookcal');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@ -645,6 +645,8 @@ Module2300Name=Scheduled jobs
Module2300Desc=Scheduled jobs management (alias cron or chrono table)
Module2400Name=Events/Agenda
Module2400Desc=Track events. Log automatic events for tracking purposes or record manual events or meetings. This is the principal module for good Customer or Vendor Relationship Management.
Module2430Name=Booking Calendar System
Module2430Desc=Provide an online calendar to allow anyone to book rendez-vous, according to predefined ranges or availabilities.
Module2500Name=DMS / ECM
Module2500Desc=Document Management System / Electronic Content Management. Automatic organization of your generated or stored documents. Share them when you need.
Module2600Name=API / Web services (SOAP server)

View File

@ -2763,11 +2763,13 @@ class Societe extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip refurl"';
$linkclose .= ' class="classfortooltip refurl valignmiddle"';
$target_value = array('_self', '_blank', '_parent', '_top');
if (in_array($target, $target_value)) {
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
}
} else {
$linkclose .= ' class="valignmiddle"';
}
$linkstart .= $linkclose.'>';
$linkend = '</a>';