Debug v19

This commit is contained in:
Laurent Destailleur
2023-11-04 16:02:24 +01:00
parent c0ab3e0dff
commit 2a2dec2f88
16 changed files with 518 additions and 764 deletions

View File

@@ -1,8 +1,8 @@
# BOOKCAL FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
# ONLINE APPOINTMENT FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
## Features
Provide features to be able to record online booking.
Provides an online appointment booking system. This allow anyone to book rendez-vous, according to predefined ranges or availabilities.
<!--
![Screenshot bookcal](img/screenshot_bookcal.png?raw=true "BookCal"){imgmd}

View File

@@ -242,6 +242,7 @@ if ($object->id > 0) {
print '</div>';
/*
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
@@ -253,14 +254,12 @@ if ($object->id > 0) {
// Try to know count of actioncomm from cache
$nbEvent = 0;
/*require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_myobject_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnMyObject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
*/
//require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
//$cachekey = 'count_events_myobject_'.$object->id;
//$nbEvent = dol_getcache($cachekey);
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': '');
print load_fiche_titre($titlelist, '', '');
print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
// List of all actions
$filters = array();
@@ -270,6 +269,7 @@ if ($object->id > 0) {
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
}
*/
}
// End of page

View File

@@ -291,7 +291,7 @@ if ($object->id > 0) {
}
}
/*
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
print '<br>';
@@ -305,12 +305,9 @@ if ($object->id > 0) {
// Try to know count of actioncomm from cache
$nbEvent = 0;
/*require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_myobject_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnMyObject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
*/
//require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
//$cachekey = 'count_events_myobject_'.$object->id;
//$nbEvent = dol_getcache($cachekey);
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': '');
print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
@@ -322,6 +319,7 @@ if ($object->id > 0) {
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : '');
}
*/
}
// End of page

View File

@@ -353,36 +353,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
if ($action == 'generate') {
print '<i> Link : </i> <strong> <a href="'. DOL_URL_ROOT.'/public/bookcal/index.php?id='.$object->id . '">Public page</a></strong>' ;
}
// Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
if ($action == 'xxx') {
$text = $langs->trans('ConfirmActionCalendar', $object->ref);
/*if (isModEnabled('notification'))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($db);
$text .= '<br>';
$text .= $notify->confirmMessage('MYOBJECT_CLOSE', $object->socid, $object);
}*/
$formquestion = array();
/*
$forcecombo=0;
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
);
*/
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@@ -452,6 +422,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Other attributes. Fields from hook formObjectOptions and Extrafields.
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 '</td></tr>';
print '</table>';
print '</div>';
print '</div>';
@@ -524,9 +499,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
/*if (empty($user->socid)) {
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
}*/
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
@@ -550,10 +525,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
}
// Generate link
if ($object->status == Calendar::STATUS_VALIDATED) {
print dolGetButtonAction($langs->trans('generateLink'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=generate', '', $permissiontoadd);
}
/*
if ($permissiontoadd) {
if ($object->status == $object::STATUS_ENABLED) {
@@ -584,6 +555,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$action = 'presend';
}
/*
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
@@ -632,6 +604,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$trackid = 'calendar'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
}
// End of page

View File

@@ -129,9 +129,9 @@ class Availabilities extends CommonObject
'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,),
'duration' => array('type'=>'integer', 'label'=>'DurationOfRange', 'enabled'=>'1', 'position'=>47, 'notnull'=>1, 'visible'=>1, 'default'=>'30', 'css'=>'width50 right'),
'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,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Closed'), 'validate'=>'1'),
'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,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Closed'), 'default'=>1, 'validate'=>'1'),
);
public $rowid;
public $label;

View File

@@ -117,6 +117,8 @@ class Calendar extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'right', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object", 'css'=>'width100'),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'alwayseditable'=>'1', 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',),
'visibility' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Owner', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'picto'=>'user', 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150',),
'type' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>'1', 'position'=>42, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'Customer', '1'=>'Supplier', '3'=>'Other'),),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150', 'help'=>"ThirdPartyBookCalHelp", 'validate'=>'1',),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'isModEnabled("project")', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150', 'validate'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
@@ -127,13 +129,13 @@ class Calendar extends CommonObject
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2, 'csslist'=>'tdoverflowmax150',),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'type' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'Customer', '1'=>'Supplier', '3'=>'Other'),),
'visibility' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Owner', 'enabled'=>'1', 'position'=>41, 'notnull'=>1, 'visible'=>1, 'picto'=>'user', 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150',),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'default'=>0, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Closed'), 'validate'=>'1',),
);
public $rowid;
public $ref;
public $label;
public $type;
public $visibility;
public $fk_soc;
public $fk_project;
public $description;
@@ -145,47 +147,9 @@ class Calendar extends CommonObject
public $fk_user_modif;
public $import_key;
public $status;
public $type;
public $visibility;
// END MODULEBUILDER PROPERTIES
// If this object has a subtable with lines
// /**
// * @var string Name of subtable line
// */
// public $table_element_line = 'bookcal_calendarline';
// /**
// * @var string Field with ID of parent key if this object has a parent
// */
// public $fk_element = 'fk_calendar';
// /**
// * @var string Name of subtable class that manage subtable lines
// */
// public $class_element_line = 'Calendarline';
// /**
// * @var array List of child tables. To test if we can delete object.
// */
// protected $childtables = array('mychildtable' => array('name'=>'Calendar', 'fk_element'=>'fk_calendar'));
// /**
// * @var array List of child tables. To know object to delete on cascade.
// * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
// * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
// */
// protected $childtablesoncascade = array('bookcal_calendardet');
// /**
// * @var CalendarLine[] Array of subtable lines
// */
// public $lines = array();
/**
* Constructor
*
@@ -193,7 +157,7 @@ class Calendar extends CommonObject
*/
public function __construct(DoliDB $db)
{
global $conf, $langs;
global $langs, $user;
$this->db = $db;
@@ -209,6 +173,7 @@ class Calendar extends CommonObject
$this->fields['myfield']['visible'] = 1;
$this->fields['myfield']['noteditable'] = 0;
}*/
$this->fields['visibility']['default'] = $user->id;
// Unset fields that are disabled
foreach ($this->fields as $key => $val) {
@@ -387,8 +352,6 @@ class Calendar extends CommonObject
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG);
$records = array();
@@ -507,7 +470,7 @@ class Calendar extends CommonObject
*/
public function validate($user, $notrigger = 0)
{
global $conf, $langs;
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -710,7 +673,7 @@ class Calendar extends CommonObject
*/
public function getTooltipContentArray($params)
{
global $conf, $langs;
global $langs;
$datas = [];
@@ -933,7 +896,9 @@ class Calendar extends CommonObject
}
$statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
if ($status == self::STATUS_VALIDATED) {
$statusType = 'status4';
}
if ($status == self::STATUS_CANCELED) {
$statusType = 'status6';
}

View File

@@ -31,18 +31,18 @@ function calendarPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("bookcal@bookcal");
$langs->load("bookcal");
$showtabofpagecontact = 0;
$showtabofpagenote = 1;
$showtabofpagedocument = 1;
$showtabofpagedocument = 0;
$showtabofpageagenda = 1;
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/bookcal/calendar_card.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][1] = $langs->trans("Calendar");
$head[$h][2] = 'card';
$h++;

View File

@@ -2249,6 +2249,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out .= "\n".'<div id="dragDropAreaTabBar" class="tabBar'.($notab == -1 ? '' : ($notab == -2 ? ' tabBarNoTop' : (($notab == -3 ? ' noborderbottom' : '').' tabBarWithBottom'))).'">'."\n";
}
if (!empty($dragdropfile)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$out .= dragAndDropFileUpload("dragDropAreaTabBar");
}
$parameters = array('tabname' => $active, 'out' => $out);

View File

@@ -21,13 +21,13 @@
ModuleBookCalName = Booking Calendar System
# Module description 'ModuleBookCalDesc'
ModuleBookCalDesc = Manage a Calendar to book appointments
MenuBookcalIndex=Rendez-vous en ligne
MenuBookcalIndex=Online appointment
BookcalLabelAvailabilityHelp=Label of the availability range. For example:<br>General availability<br>Availability during christmas holidays
DurationOfRange=Duration of ranges
BookCalSetup = BookCal setup
BookCalSetup = Online appointment setup
Settings = Settings
BookCalSetupPage = BookCal setup page
BookCalSetupPage = Online appointment setup page
BOOKCAL_PUBLIC_INTERFACE_TOPIC = Interface title
About = About
BookCalAbout = About BookCal

View File

@@ -42,7 +42,7 @@ function myobjectPrepareHead($object)
$head = array();
$head[$h][0] = dol_buildpath("/mymodule/myobject_card.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][1] = $langs->trans("MyObject");
$head[$h][2] = 'card';
$h++;

View File

@@ -307,12 +307,9 @@ if ($object->id > 0) {
// Try to know count of actioncomm from cache
$nbEvent = 0;
/*require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_myobject_'.$object->id;
$nbEvent = dol_getcache($cachekey);
print_barre_liste($langs->trans("ActionsOnMyObject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
*/
//require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
//$cachekey = 'count_events_myobject_'.$object->id;
//$nbEvent = dol_getcache($cachekey);
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': '');
print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);

View File

@@ -1,588 +0,0 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2023 anthony Berton <anthony.berton@bb2a.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
* 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 htdocs/public/bookcal/booking.php
* \ingroup core
* \brief File to offer a way to make an online signature for a particular Dolibarr entity
* Example of URL: https://localhost/public/bookcal/booking.php?ref=PR...
*/
if (!defined('NOLOGIN')) {
define("NOLOGIN", 1); // This means this output page does not require to be logged.
}
if (!defined('NOCSRFCHECK')) {
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
}
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
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';
$langs->loadLangs(array("main", "other", "dict", "agenda", "errors", "companies"));
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$fk_calendar = GETPOST('fk_calendar', 'int');
$availability = new Availabilities($db);
$result = $availability->fetch($id);
$year = GETPOST("year", "int") ?GETPOST("year", "int") : date("Y");
$month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m");
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'), 'tzuserrel');
if ($dateselect > 0) {
$day = GETPOST('dateselectday', 'int');
$month = GETPOST('dateselectmonth', 'int');
$year = GETPOST('dateselectyear', 'int');
}
$backtopage = GETPOST("backtopage", "alpha");
$now = dol_now();
$nowarray = dol_getdate($now);
$nowyear = $nowarray['year'];
$nowmonth = $nowarray['mon'];
$nowday = $nowarray['mday'];
$prev = dol_get_prev_month($month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
$next = dol_get_next_month($month, $year);
$next_year = $next['year'];
$next_month = $next['month'];
$max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month
// tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
$tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 fo sunday
$tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
if ($tmpday >= 1) {
$tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
}
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'tzuserrel');
$next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
if ($next_day < 6) {
$next_day += 7;
}
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
$datechosen = GETPOST('datechosen', 'alpha');
$datetimechosen = GETPOST('datetimechosen', 'int');
$isdatechosen = false;
$timebooking = GETPOST("timebooking");
$datetimebooking = GETPOST("datetimebooking", 'int');
/**
* Show header for booking
*
* @param string $title Title
* @param string $head Head array
* @param int $disablejs More content into html header
* @param int $disablehead More content into html header
* @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files
* @return void
*/
function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
{
global $user, $conf, $langs, $mysoc;
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
print '<body id="mainbody" class="publicnewmemberform">';
// Define urllogo
if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO') || getDolGlobalString('BOOPKCAL_PUBLIC_INTERFACE_TOPIC')) {
// Print logo
if (getDolGlobalInt('BOOKCAL_SHOW_COMPANY_LOGO')) {
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
$urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$mysoc->logo);
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
}
}
}
print '<div class="center">';
// Output html code for logo
if ($urllogo || getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) {
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
if ($urllogo) {
print '<a href="'.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 1)).'">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
print '>';
print '</a>';
}
if (getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) {
print '<div class="clearboth"></div><strong>'.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : $langs->trans("BookCalSystem")).'</strong>';
}
print '</div>';
if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) {
print '<div class="poweredbypublicpayment opacitymedium right hideonsmartphone"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
}
print '</div>';
}
print '</div>';
print '<div class="divmainbodylarge">';
}
/*
* Actions
*/
if ($action == 'add') {
$error = 0;
$idcontact = 0;
$calendar = new Calendar($db);
$contact = new Contact($db);
$actioncomm = new ActionComm($db);
$res = $calendar->fetch($fk_calendar);
if ($res < 0) {
$error++;
$errmsg .= $calendar->error." ".join(',', $calendar->errors);
}
if (!is_object($user)) {
$user = new User($db);
}
$db->begin();
if (!GETPOST("lastname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
}
if (!GETPOST("firstname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
}
if (!GETPOST("email")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
}
if (!$error) {
$sql = "SELECT s.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as s";
$sql .= " WHERE s.lastname = '".GETPOST("lastname")."'";
$sql .= " AND s.firstname = '".GETPOST("firstname")."'";
$sql .= " AND s.email = '".GETPOST("email")."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
if ($num > 0) {
$obj = $db->fetch_object($resql);
$idcontact = $obj->rowid;
$contact->fetch($idcontact);
} else {
$contact->lastname = GETPOST("lastname");
$contact->firstname = GETPOST("firstname");
$contact->email = GETPOST("email");
$result = $contact->create($user);
if ($result < 0) {
$error++;
$errmsg .= $contact->error." ".join(',', $contact->errors);
}
}
} else {
$error++;
$errmsg .= $db->lasterror();
}
}
if (!$error) {
$dateend = dol_time_plus_duree(GETPOST("datetimebooking", 'int'), GETPOST("duration"), 'i');
$actioncomm->label = "test";
$actioncomm->type = 'AC_RDV';
$actioncomm->type_id = 5;
$actioncomm->datep = GETPOST("datetimebooking", 'int');
$actioncomm->datef = $dateend;
$actioncomm->note_private = GETPOST("description");
$actioncomm->percentage = -1;
$actioncomm->fk_bookcal_availability = GETPOST("id", 'int');
$actioncomm->userownerid = $calendar->visibility;
$actioncomm->contact_id = $contact->id;
$actioncomm->socpeopleassigned = $contact->id;
$result = $actioncomm->create($user);
if ($result < 0) {
$error++;
$errmsg .= $actioncomm->error." ".join(',', $actioncomm->errors);
}
if (!$error) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources";
$sql .= "(fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
$sql .= ") VALUES (";
$sql .= (int) $actioncomm->id;
$sql .= ", 'socpeople'";
$sql .= ", ". (int) $contact->id;
$sql .= ", 0, 0, 0)";
$resql = $db->query($sql);
if (!$resql) {
$error++;
$errmsg .= $db->lasterror();
}
}
}
if (!$error) {
$db->commit();
$action = 'afteradd';
} else {
$db->rollback();
$action = 'create';
}
}
/*
* View
*/
$form = new Form($db);
llxHeaderVierge('BookingCalendar');
dol_htmloutput_errors($errmsg);
if ($action == 'create') {
$backtopage = $_SERVER["PHP_SELF"].'?id='.$id.'&datechosen='.$datechosen.'&fk_calendar='.$fk_calendar;
} else {
$backtopage = DOL_URL_ROOT.'/public/bookcal/index.php?id='.$fk_calendar;
}
print '<div class="bookcalpublicarea centpercent center" style="min-width:30%;position:absolute;width:fit-content;height:70%;top:60%;left: 50%;transform: translate(-50%, -50%);">';
print '<div class="bookcalform boxtable" style="border:thin solid gray;padding:5px;min-height:50%">';
if ($action == 'afteradd') {
print '<h2>';
print $langs->trans("BookingSuccessfullyBooked");
print '</h2>';
print $langs->trans("BookingReservationHourAfter", dol_print_date(GETPOST("datetimebooking", 'int'), "dayhourtext"));
} else {
print '<table>';
print '<tr>';
print '<td>';
print '<a href="'.$backtopage.'">Cancel</a>';
print '</td>';
print '<td>';
if ($action == 'create') {
print '<span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
} else {
print '<form name="formsearch" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="fk_calendar" value="'.$fk_calendar.'">';
$nav = "<a href=\"?id=".$id."&year=".$prev_year."&month=".$prev_month.$param."&fk_calendar=".$fk_calendar."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?id=".$id."&year=".$next_year."&month=".$next_month.$param."&fk_calendar=".$fk_calendar."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; <a href=\"?id=".$id."&year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param.'&amp;fk_calendar='.$fk_calendar.'" class="datenowlink">'.$langs->trans("Today").'</a> ';
}
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= '<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
print $nav;
print '</form>';
}
print '</td>';
print '<td>';
print '<div class="center hidden bookingtab" style="height:50%">';
print '<span id="bookingtabspandate"></span>';
print '</div>';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print '<h2>'.(!empty($availability->label) ? $availability->label : $availability->ref).'</h2>';
print '<span>'.$langs->trans("AppointmentDuration", $availability->duration).'</span>';
if ($action == 'create') {
print '<br>';
if (empty($datetimebooking)) {
$timebookingarray = explode(":", $timebooking);
$datetimebooking = dol_time_plus_duree($datetimechosen, intval($timebookingarray[0]), "h");
$datetimebooking = dol_time_plus_duree($datetimebooking, intval($timebookingarray[1]), "i");
}
print '<span>'.img_picto("", "calendar")."&nbsp;".dol_print_date($datetimebooking, 'dayhourtext').'</span>';
}
print '</td>';
print '<td>';
if ($action == "create") {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="datetimebooking" value="'.$datetimebooking.'">';
print '<input type="hidden" name="datechosen" value="'.$datechosen.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="fk_calendar" value="'.$fk_calendar.'">';
print '<input type="hidden" name="duration" value="'.$availability->duration.'">';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").' <span class="star">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
// Firstname
print '<tr><td>'.$langs->trans("Firstname").' <span class="star">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
// EMail
print '<tr><td>'.$langs->trans("Email").' <span class="star">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Message").'</td>';
print '<td class="tdtop"><textarea name="description" id="description" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('description', 'restricthtml'), 0, 1).'</textarea></td>';
print '</tr>'."\n";
print '</table>'."\n";
print '<div class="center">';
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
print '</div>';
print '</form>';
} else {
print '<table class="centpercent noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">';
// Column title of weeks numbers
echo ' <td class="center">#</td>';
$i = 0;
while ($i < 7) {
print ' <td class="center bold uppercase tdfordaytitle'.($i == 0 ? ' borderleft' : '').'">';
$numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7);
if (!empty($conf->dol_optimize_smallscreen)) {
$labelshort = array(0=>'SundayMin', 1=>'MondayMin', 2=>'TuesdayMin', 3=>'WednesdayMin', 4=>'ThursdayMin', 5=>'FridayMin', 6=>'SaturdayMin');
print $langs->trans($labelshort[$numdayinweek]);
} else {
print $langs->trans("Day".$numdayinweek);
}
print ' </td>'."\n";
$i++;
}
echo ' </tr>'."\n";
$todayarray = dol_getdate($now, 'fast');
$todaytms = dol_mktime(0, 0, 0, $todayarray['mon'], $todayarray['mday'], $todayarray['year']);
$availabilities_start = $availability->start;
$availabilities_end = $availability->end;
for ($iter_week = 0; $iter_week < 6; $iter_week++) {
echo " <tr>\n";
// Get date of the current day, format 'yyyy-mm-dd'
if ($tmpday <= 0) { // If number of the current day is in previous month
$currdate0 = sprintf("%04d", $prev_year).sprintf("%02d", $prev_month).sprintf("%02d", $max_day_in_prev_month + $tmpday);
} elseif ($tmpday <= $max_day_in_month) { // If number of the current day is in current month
$currdate0 = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $tmpday);
} else // If number of the current day is in next month
{
$currdate0 = sprintf("%04d", $next_year).sprintf("%02d", $next_month).sprintf("%02d", $tmpday - $max_day_in_month);
}
// Get week number for the targeted date '$currdate0'
$numweek0 = date("W", strtotime(date($currdate0)));
// Show the week number, and define column width
echo ' <td class="center weeknumber opacitymedium" width="2%">'.$numweek0.'</td>';
for ($iter_day = 0; $iter_day < 7; $iter_day++) {
if ($tmpday <= 0) {
/* Show days before the beginning of the current month (previous month) */
$style = 'cal_other_month cal_past';
if ($iter_day == 6) {
$style .= ' cal_other_month_right';
}
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_bookcal_day_events($max_day_in_prev_month + $tmpday, $prev_month, $prev_year);
echo " </td>\n";
} elseif ($tmpday <= $max_day_in_month) {
/* Show days of the current month */
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
$style = 'cal_current_month';
if ($iter_day == 6) {
$style .= ' cal_current_month_right';
}
$today = 0;
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) {
$today = 1;
}
if ($curtime > $todaytms && $availabilities_start <= $curtime && $availabilities_end >= $curtime) {
$style .= ' cal_available cursorpointer';
}
if ($curtime < $todaytms) {
$style .= ' cal_past';
}
$dateint = sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $tmpday);
if (!empty(explode('dayevent_', $datechosen)[1]) && explode('dayevent_', $datechosen)[1] == $dateint) {
$style .= ' cal_chosen';
$isdatechosen = true;
}
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_bookcal_day_events($tmpday, $month, $year, $today);
echo "</td>\n";
} else {
/* Show days after the current month (next month) */
$style = 'cal_other_month';
if ($iter_day == 6) {
$style .= ' cal_other_month_right';
}
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_bookcal_day_events($tmpday - $max_day_in_month, $next_month, $next_year);
echo "</td>\n";
}
$tmpday++;
}
echo " </tr>\n";
}
print '</table>';
print '</td>';
print '<td>';
print '<div class="center hidden bookingtab" style="height:50%">';
print '<div style="margin-top:8px;max-height:330px" class="div-table-responsive-no-min">';
print '<form name="formbooking" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="create">';
print '<input type="hidden" id="datechosen" name="datechosen" value="">';
print '<input type="hidden" id="datetimechosen" name="datetimechosen" value="">';
print '<input type="hidden" id="fk_calendar" name="fk_calendar" value="'.$fk_calendar.'">';
$hoursavailabilities_start = $availability->startHour;
$hoursavailabilities_end = $availability->endHour;
$hoursavailabilities_duration = $availability->duration;
for ($i=$hoursavailabilities_start; $i < $hoursavailabilities_end; $i++) {
for ($j=0; $j < 60 ; $j += $hoursavailabilities_duration) {
$timestring = ($i < 10 ? '0'.$i : $i).':'.($j < 10 ? '0'.$j : $j);
$timestringid = ($i < 10 ? '0'.$i : $i).''.($j < 10 ? '0'.$j : $j);
print '<span id="'.$timestringid.'" class="btnformbooking"><input type="submit" class="button" name="timebooking" value="'.$timestring.'"><br></span>';
}
}
print '</form>';
print '</div>';
print '</div>';
print '</td>';
}
print '</td>';
print '</tr>';
print '</table>';
print '</div>';
print '</div>';
print '<script>';
print '
function hideTimeBooking(time){
console.log("#"+time);
$("#"+time).hide();
}';
print '$(document).ready(function() {
$(".cal_available").on("click", function(){
$(".cal_chosen").removeClass("cal_chosen");
$(this).addClass("cal_chosen");
$.ajax({
type: "POST",
url: "'.DOL_URL_ROOT.'/core/ajax/bookcalAjax.php",
data: {
action: "verifyavailability",
id: '.$id.',
datetocheck: $(this).children("div").data("datetime"),
token: "'.currentToken().'",
}
}).done(function (data) {
data = JSON.parse(data);
$(".btnformbooking").show();
console.log("We show all booking");
if(data["code"] == "SUCCESS"){
timearray = data["content"];
timearray.forEach((time) => hideTimeBooking(time));
console.log("We hide all taken time for booking");
} else {
if(data["code"] == "NO_DATA_FOUND"){
console.log("No booking to hide");
} else {
console.log(data["message"]);
}
}
});
$(".bookingtab").removeClass("hidden");
$("#bookingtabspandate").text($(this).children("div").data("date"));
$("#datechosen").val($(this).children("div").attr("id"));
$("#datetimechosen").val($(this).children("div").data("datetime"));
});
$("btnformbooking")
'.($datechosen ? '$(".cal_chosen").trigger( "click" )' : '').'
});';
print '</script>';
}
llxFooter('', 'public');
/**
* Show event of a particular day
*
* @param int $day Day
* @param int $month Month
* @param int $year Year
* @param int $today Today's day
* @return void
*/
function show_bookcal_day_events($day, $month, $year, $today = 0)
{
global $conf;
if ($conf->use_javascript_ajax) { // Enable the "Show more button..."
$conf->global->MAIN_JS_SWITCH_AGENDA = 1;
}
$dateint = sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day);
$eventdatetime = dol_mktime(-1, -1, -1, $month, $day, $year);
//print 'show_bookcal_day_events day='.$day.' month='.$month.' year='.$year.' dateint='.$dateint;
print "\n";
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
// Line with title of day
print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding" data-datetime="'.$eventdatetime.'" data-date="'.dol_print_date($eventdatetime, "daytext").'">'."\n";
print dol_print_date($curtime, '%d');
print '<br>';
if ($today) {
print img_picto('today', 'fontawesome_circle_fas_black_7px');
} else {
print '<br>';
}
print '</div>'; // table
print "\n";
}

View File

@@ -21,8 +21,8 @@
/**
* \file htdocs/public/bookcal/index.php
* \ingroup core
* \brief File to offer a way to make an online signature for a particular Dolibarr entity
* Example of URL: https://localhost/public/bookcal/booking.php?ref=PR...
* \brief File to offer a way to book a rendez-vous into a public calendar
* Example of URL: https://localhost/public/bookcal/index.php?id=...
*/
if (!defined('NOLOGIN')) {
@@ -44,17 +44,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
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';
$langs->loadLangs(array("main", "other", "dict", "agenda", "errors", "bookcal"));
$langs->loadLangs(array("main", "other", "dict", "agenda", "errors", "companies"));
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$object = new Calendar($db);
$result = $object->fetch($id);
$availabilities = new Availabilities($db);
$availability = new Availabilities($db);
$result = $availability->fetch($id);
$year = GETPOST("year", "int") ?GETPOST("year", "int") : date("Y");
$month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m");
@@ -66,6 +65,11 @@ if ($dateselect > 0) {
$month = GETPOST('dateselectmonth', 'int');
$year = GETPOST('dateselectyear', 'int');
}
$backtopage = GETPOST("backtopage", "alpha");
$object = new Calendar($db);
$result = $object->fetch($id);
$now = dol_now();
$nowarray = dol_getdate($now);
@@ -73,7 +77,6 @@ $nowyear = $nowarray['year'];
$nowmonth = $nowarray['mon'];
$nowday = $nowarray['mday'];
$prev = dol_get_prev_month($month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
@@ -97,8 +100,11 @@ if ($next_day < 6) {
}
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
$daychosen = GETPOST('daychosen', 'alpha');
$isdaychosen = false;
$datechosen = GETPOST('datechosen', 'alpha');
$datetimechosen = GETPOST('datetimechosen', 'int');
$isdatechosen = false;
$timebooking = GETPOST("timebooking");
$datetimebooking = GETPOST("datetimebooking", 'int');
/**
* Show header for booking
@@ -137,24 +143,24 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '<div class="center">';
// Output html code for logo
if ($urllogo || getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) {
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
if ($urllogo) {
print '<a href="'.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 1)).'">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
print '>';
print '<img id="dolpaymentlogo" src="'.$urllogo.'">';
print '</a>';
}
if (getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) {
print '<div class="clearboth"></div><strong>'.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : $langs->trans("BookCalSystem")).'</strong>';
}
if (empty($urllogo) && ! getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) {
print $mysoc->name;
}
print '</div>';
if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) {
print '<div class="poweredbypublicpayment opacitymedium right hideonsmartphone"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
}
print '</div>';
}
print '</div>';
@@ -166,41 +172,419 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
* Actions
*/
// None
if ($action == 'add') {
$error = 0;
$idcontact = 0;
$calendar = $object;
$contact = new Contact($db);
$actioncomm = new ActionComm($db);
/*
* View
*/
$form = new Form($db);
if (!is_object($user)) {
$user = new User($db);
}
llxHeaderVierge('BookingCalendar');
$db->begin();
if (!GETPOST("lastname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
}
if (!GETPOST("firstname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
}
if (!GETPOST("email")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
}
print '<div class="bookcalpublicarea centpercent" style="position:absolute;top:50%;transform: translateY(-50%)">';
print '<div class="bookcalform center" style="width:70%;padding:5px;max-height:360px">';
print '<h2>'.(!empty($object->label) ? $object->label : $object->ref).'</h2>';
$sql = "SELECT b.rowid, b.label, b.start, b.end, b.duration, b.startHour, b.endHour";
$sql .= " FROM ".MAIN_DB_PREFIX."bookcal_availabilities as b";
$sql .= " WHERE b.status = ".(int) $availabilities::STATUS_VALIDATED;
$sql .= " AND b.fk_bookcal_calendar = ".(int) $id;
if (!$error) {
$sql = "SELECT s.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as s";
$sql .= " WHERE s.lastname = '".$db->escape(GETPOST("lastname"))."'";
$sql .= " AND s.firstname = '".$db->escape(GETPOST("firstname"))."'";
$sql .= " AND s.email = '".$db->escape(GETPOST("email"))."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$i++;
if ($num > 0) {
$obj = $db->fetch_object($resql);
print '<a href="'.DOL_URL_ROOT.'/public/bookcal/booking.php?id='.$obj->rowid.'&fk_calendar='.$id.'"><button type="button">'.(!empty($obj->label) ? $obj->label : $obj->id).'</button>';
$idcontact = $obj->rowid;
$contact->fetch($idcontact);
} else {
$contact->lastname = GETPOST("lastname");
$contact->firstname = GETPOST("firstname");
$contact->email = GETPOST("email");
$result = $contact->create($user);
if ($result < 0) {
$error++;
$errmsg .= $contact->error." ".join(',', $contact->errors);
}
}
} else {
$error++;
$errmsg .= $db->lasterror();
}
}
if (!$error) {
$dateend = dol_time_plus_duree(GETPOST("datetimebooking", 'int'), GETPOST("duration"), 'i');
$actioncomm->label = "test";
$actioncomm->type = 'AC_RDV';
$actioncomm->type_id = 5;
$actioncomm->datep = GETPOST("datetimebooking", 'int');
$actioncomm->datef = $dateend;
$actioncomm->note_private = GETPOST("description");
$actioncomm->percentage = -1;
$actioncomm->fk_bookcal_availability = GETPOST("id_availability", 'int');
$actioncomm->userownerid = $calendar->visibility;
$actioncomm->contact_id = $contact->id;
$actioncomm->socpeopleassigned = $contact->id;
$result = $actioncomm->create($user);
if ($result < 0) {
$error++;
$errmsg .= $actioncomm->error." ".join(',', $actioncomm->errors);
}
if (!$error) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources";
$sql .= "(fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
$sql .= ") VALUES (";
$sql .= (int) $actioncomm->id;
$sql .= ", 'socpeople'";
$sql .= ", ". (int) $contact->id;
$sql .= ", 0, 0, 0)";
$resql = $db->query($sql);
if (!$resql) {
$error++;
$errmsg .= $db->lasterror();
}
}
}
if (!$error) {
$db->commit();
$action = 'afteradd';
} else {
$db->rollback();
$action = 'create';
}
}
/*
* View
*/
$form = new Form($db);
llxHeaderVierge('BookingCalendar');
print '<center><br><h2>'.(!empty($object->label) ? $object->label : $object->ref).'</h2></center>';
dol_htmloutput_errors($errmsg);
if ($action == 'create') {
$backtopage = $_SERVER["PHP_SELF"].'?id='.$id.'&datechosen='.$datechosen;
} else {
$backtopage = DOL_URL_ROOT.'/public/bookcal/index.php?id='.$id;
}
print '<div class="bookcalpublicarea centpercent center" style="min-width:30%;position:absolute;width:fit-content;height:70%;top:60%;left: 50%;transform: translate(-50%, -50%);">';
print '<div class="bookcalform boxtable" style="border:thin solid gray;padding:5px;min-height:50%">';
if ($action == 'afteradd') {
print '<h2>';
print $langs->trans("BookingSuccessfullyBooked");
print '</h2>';
print $langs->trans("BookingReservationHourAfter", dol_print_date(GETPOST("datetimebooking", 'int'), "dayhourtext"));
} else {
$param = '';
print '<table>';
print '<tr>';
print '<td>';
print '<a href="'.$backtopage.'">Cancel</a>';
print '</td>';
print '<td>';
if ($action == 'create') {
print '<span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
} else {
print '<form name="formsearch" 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";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?id=".$id."&year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " &nbsp; <a href=\"?id=".$id."&year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param.'" class="datenowlink">'.$langs->trans("Today").'</a> ';
}
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= '<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
print $nav;
print '</form>';
}
print '</td>';
print '<td>';
print '<div class="center hidden bookingtab" style="height:50%">';
print '<span id="bookingtabspandate"></span>';
print '</div>';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print '<h2>'.(!empty($availability->label) ? $availability->label : $availability->ref).'</h2>';
print '<span>'.$langs->trans("AppointmentDuration", $availability->duration).'</span>';
if ($action == 'create') {
print '<br>';
if (empty($datetimebooking)) {
$timebookingarray = explode(":", $timebooking);
$datetimebooking = dol_time_plus_duree($datetimechosen, intval($timebookingarray[0]), "h");
$datetimebooking = dol_time_plus_duree($datetimebooking, intval($timebookingarray[1]), "i");
}
print '<span>'.img_picto("", "calendar")."&nbsp;".dol_print_date($datetimebooking, 'dayhourtext').'</span>';
}
print '</td>';
print '<td>';
if ($action == "create") {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="datetimebooking" value="'.$datetimebooking.'">';
print '<input type="hidden" name="datechosen" value="'.$datechosen.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="duration" value="'.$availability->duration.'">';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").' <span class="star">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
// Firstname
print '<tr><td>'.$langs->trans("Firstname").' <span class="star">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
// EMail
print '<tr><td>'.$langs->trans("Email").' <span class="star">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Message").'</td>';
print '<td class="tdtop"><textarea name="description" id="description" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('description', 'restricthtml'), 0, 1).'</textarea></td>';
print '</tr>'."\n";
print '</table>'."\n";
print '<div class="center">';
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
print '</div>';
print '</form>';
} else {
print '<table class="centpercent noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">';
// Column title of weeks numbers
echo ' <td class="center">#</td>';
$i = 0;
while ($i < 7) {
print ' <td class="center bold uppercase tdfordaytitle'.($i == 0 ? ' borderleft' : '').'">';
$numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7);
if (!empty($conf->dol_optimize_smallscreen)) {
$labelshort = array(0=>'SundayMin', 1=>'MondayMin', 2=>'TuesdayMin', 3=>'WednesdayMin', 4=>'ThursdayMin', 5=>'FridayMin', 6=>'SaturdayMin');
print $langs->trans($labelshort[$numdayinweek]);
} else {
print $langs->trans("Day".$numdayinweek);
}
print ' </td>'."\n";
$i++;
}
echo ' </tr>'."\n";
$todayarray = dol_getdate($now, 'fast');
$todaytms = dol_mktime(0, 0, 0, $todayarray['mon'], $todayarray['mday'], $todayarray['year']);
$availabilities_start = $availability->start;
$availabilities_end = $availability->end;
for ($iter_week = 0; $iter_week < 6; $iter_week++) {
echo " <tr>\n";
// Get date of the current day, format 'yyyy-mm-dd'
if ($tmpday <= 0) { // If number of the current day is in previous month
$currdate0 = sprintf("%04d", $prev_year).sprintf("%02d", $prev_month).sprintf("%02d", $max_day_in_prev_month + $tmpday);
} elseif ($tmpday <= $max_day_in_month) { // If number of the current day is in current month
$currdate0 = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $tmpday);
} else // If number of the current day is in next month
{
$currdate0 = sprintf("%04d", $next_year).sprintf("%02d", $next_month).sprintf("%02d", $tmpday - $max_day_in_month);
}
// Get week number for the targeted date '$currdate0'
$numweek0 = date("W", strtotime(date($currdate0)));
// Show the week number, and define column width
echo ' <td class="center weeknumber opacitymedium" width="2%">'.$numweek0.'</td>';
for ($iter_day = 0; $iter_day < 7; $iter_day++) {
if ($tmpday <= 0) {
/* Show days before the beginning of the current month (previous month) */
$style = 'cal_other_month cal_past';
if ($iter_day == 6) {
$style .= ' cal_other_month_right';
}
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_bookcal_day_events($max_day_in_prev_month + $tmpday, $prev_month, $prev_year);
echo " </td>\n";
} elseif ($tmpday <= $max_day_in_month) {
/* Show days of the current month */
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
$style = 'cal_current_month';
if ($iter_day == 6) {
$style .= ' cal_current_month_right';
}
$today = 0;
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $month && $todayarray['year'] == $year) {
$today = 1;
}
if ($curtime > $todaytms && $availabilities_start <= $curtime && $availabilities_end >= $curtime) {
$style .= ' cal_available cursorpointer';
}
if ($curtime < $todaytms) {
$style .= ' cal_past';
}
$dateint = sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $tmpday);
if (!empty(explode('dayevent_', $datechosen)[1]) && explode('dayevent_', $datechosen)[1] == $dateint) {
$style .= ' cal_chosen';
$isdatechosen = true;
}
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_bookcal_day_events($tmpday, $month, $year, $today);
echo "</td>\n";
} else {
/* Show days after the current month (next month) */
$style = 'cal_other_month';
if ($iter_day == 6) {
$style .= ' cal_other_month_right';
}
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
show_bookcal_day_events($tmpday - $max_day_in_month, $next_month, $next_year);
echo "</td>\n";
}
$tmpday++;
}
echo " </tr>\n";
}
print '</table>';
print '</td>';
print '<td>';
print '<div class="center hidden bookingtab" style="height:50%">';
print '<div style="margin-top:8px;max-height:330px" class="div-table-responsive-no-min">';
print '<form name="formbooking" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="create">';
print '<input type="hidden" id="datechosen" name="datechosen" value="">';
print '<input type="hidden" id="datetimechosen" name="datetimechosen" value="">';
$hoursavailabilities_start = $availability->startHour;
$hoursavailabilities_end = $availability->endHour;
$hoursavailabilities_duration = $availability->duration;
for ($i=$hoursavailabilities_start; $i < $hoursavailabilities_end; $i++) {
for ($j=0; $j < 60 ; $j += $hoursavailabilities_duration) {
$timestring = ($i < 10 ? '0'.$i : $i).':'.($j < 10 ? '0'.$j : $j);
$timestringid = ($i < 10 ? '0'.$i : $i).''.($j < 10 ? '0'.$j : $j);
print '<span id="'.$timestringid.'" class="btnformbooking"><input type="submit" class="button" name="timebooking" value="'.$timestring.'"><br></span>';
}
}
print '</form>';
print '</div>';
print '</div>';
print '</td>';
}
print '</td>';
print '</tr>';
print '</table>';
print '</div>';
print '</div>';
print '<script>';
print '
function hideTimeBooking(time){
console.log("#"+time);
$("#"+time).hide();
}';
print '$(document).ready(function() {
$(".cal_available").on("click", function(){
$(".cal_chosen").removeClass("cal_chosen");
$(this).addClass("cal_chosen");
$.ajax({
type: "POST",
url: "'.DOL_URL_ROOT.'/core/ajax/bookcalAjax.php",
data: {
action: "verifyavailability",
id: '.$id.',
datetocheck: $(this).children("div").data("datetime"),
token: "'.currentToken().'",
}
}).done(function (data) {
data = JSON.parse(data);
$(".btnformbooking").show();
console.log("We show all booking");
if(data["code"] == "SUCCESS"){
timearray = data["content"];
timearray.forEach((time) => hideTimeBooking(time));
console.log("We hide all taken time for booking");
} else {
if(data["code"] == "NO_DATA_FOUND"){
console.log("No booking to hide");
} else {
console.log(data["message"]);
}
}
});
$(".bookingtab").removeClass("hidden");
$("#bookingtabspandate").text($(this).children("div").data("date"));
$("#datechosen").val($(this).children("div").attr("id"));
$("#datetimechosen").val($(this).children("div").data("datetime"));
});
$("btnformbooking")
'.($datechosen ? '$(".cal_chosen").trigger( "click" )' : '').'
});';
print '</script>';
}
llxFooter('', 'public');
/**
* Show event of a particular day
*
* @param int $day Day
* @param int $month Month
* @param int $year Year
* @param int $today Today's day
* @return void
*/
function show_bookcal_day_events($day, $month, $year, $today = 0)
{
global $conf;
if ($conf->use_javascript_ajax) { // Enable the "Show more button..."
$conf->global->MAIN_JS_SWITCH_AGENDA = 1;
}
$dateint = sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day);
$eventdatetime = dol_mktime(-1, -1, -1, $month, $day, $year);
//print 'show_bookcal_day_events day='.$day.' month='.$month.' year='.$year.' dateint='.$dateint;
print "\n";
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
// Line with title of day
print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding" data-datetime="'.$eventdatetime.'" data-date="'.dol_print_date($eventdatetime, "daytext").'">'."\n";
print dol_print_date($curtime, '%d');
print '<br>';
if ($today) {
print img_picto('today', 'fontawesome_circle_fas_black_7px');
} else {
print '<br>';
}
print '</div>'; // table
print "\n";
}

View File

@@ -968,7 +968,7 @@ if (!empty($conf->global->PAYMENT_NEWFORM_TEXT)) {
}
if (empty($text)) {
$text .= '<tr><td class="textpublicpayment"><br><strong>'.$langs->trans("WelcomeOnPaymentPage").'</strong></td></tr>'."\n";
$text .= '<tr><td class="textpublicpayment">'.$langs->trans("ThisScreenAllowsYouToPay", $creditor).'<br><br></td></tr>'."\n";
$text .= '<tr><td class="textpublicpayment"><span class="opacitymedium">'.$langs->trans("ThisScreenAllowsYouToPay", $creditor).'</span><br><br></td></tr>'."\n";
}
print $text;
@@ -2065,17 +2065,21 @@ if ($action != 'dopayment') {
}
if ($source == 'order' && $object->billed) {
print '<br><br><span class="amountpaymentcomplete size15x">'.$langs->trans("OrderBilled").'</span>';
print '<br><br><span class="amountpaymentcomplete size12x">'.$langs->trans("OrderBilled").'</span>';
} elseif ($source == 'invoice' && $object->paye) {
print '<br><br><span class="amountpaymentcomplete size15x">'.$langs->trans("InvoicePaid").'</span>';
print '<br><br><span class="amountpaymentcomplete size12x">'.$langs->trans("InvoicePaid").'</span>';
} elseif ($source == 'donation' && $object->paid) {
print '<br><br><span class="amountpaymentcomplete size15x">'.$langs->trans("DonationPaid").'</span>';
print '<br><br><span class="amountpaymentcomplete size12x">'.$langs->trans("DonationPaid").'</span>';
} else {
// Membership can be paid and we still allow to make renewal
if (($source == 'member' || $source == 'membersubscription') && $object->datefin > dol_now()) {
$langs->load("members");
print '<br><span class="amountpaymentcomplete size15x">'.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'</span><br>';
print '<br><span class="amountpaymentcomplete size12x">';
$s = $langs->trans("MembershipPaid", '{s1}');
print str_replace('{s1}', '<span class="nobold">'.dol_print_date($object->datefin, 'day').'</span>', $s);
print '</span><br>';
print '<div class="opacitymedium margintoponly">'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'</div>';
print '<br>';
}
// Buttons for all payments registration methods

View File

@@ -51,7 +51,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
--refidnocolor:#444;
--tableforfieldcolor:#888;
--amountremaintopaycolor:#880000;
--amountpaymentcomplete:#008800;
--amountpaymentcomplete:#008855;
--amountremaintopaybackcolor:none;
--productlinestockod: #002200;
--productlinestocktoolow: #884400;
@@ -1047,6 +1047,7 @@ span.fa.fa-plus-circle.paddingleft {
padding-bottom: 2px;
}
.size12x { font-size: 1.2em !important; }
.size15x { font-size: 1.5em !important; }
.fa-toggle-on, .fa-toggle-off, .size2x { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
@@ -1495,7 +1496,7 @@ table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaint
.onlinepaymentbody .amountpaymentcomplete {
background-color: var(--amountpaymentcomplete);
color: #fff;
padding: 5px;
padding: 10px;
border-radius: 5px;
}
@@ -1689,7 +1690,7 @@ maxscreenheightless200 {
.minheight30 { min-height: 30px; }
.minheight40 { min-height: 40px; }
.titlefieldcreate { width: 20%; }
.titlefield { /* width: 25%; */ min-width: 250px; width: 25%; }
.titlefield { /* width: 25%; */ min-width: 150px; width: 25%; }
.titlefieldmiddle { width: 45%; }
.titlefieldmax45 { max-width: 45%; }
.imgmaxwidth180 { max-width: 180px; }
@@ -4992,7 +4993,15 @@ table.table-fiche-title {
}
div.backgreypublicpayment { background-color: #f0f0f0; padding: 20px; border-bottom: 1px solid #ddd; text-align: center; }
div.backgreypublicpayment {
background-color: #f0f0f0;
padding: 20px;
border-bottom: 1px solid #ddd;
text-align: center;
position: sticky;
top: 0;
z-index: 1005;
}
.backgreypublicpayment a { color: #222 !important; }
.poweredbypublicpayment {
float: right;

View File

@@ -306,6 +306,8 @@ print 'nbtopmenuentries='.$nbtopmenuentries."\n";
print '*/'."\n";
?>
/* <style type="text/css" > */
/* ============================================================================== */
/* Default styles */
@@ -352,7 +354,7 @@ print '*/'."\n";
--refidnocolor:#444;
--tableforfieldcolor:#666;
--amountremaintopaycolor:#880000;
--amountpaymentcomplete:#008800;
--amountpaymentcomplete:#008855;
--amountremaintopaybackcolor:none;
--productlinestockod: #002200;
--productlinestocktoolow: #884400;
@@ -1301,6 +1303,7 @@ span.fa.fa-plus-circle.paddingleft {
padding-bottom: 2px;
}
.size12x { font-size: 1.2em !important; }
.size15x { font-size: 1.5em !important; }
.fa-toggle-on, .fa-toggle-off, .size2x { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off,
@@ -1919,7 +1922,7 @@ tr.nobottom td {
.minheight30 { min-height: 30px; }
.minheight40 { min-height: 40px; }
.titlefieldcreate { width: 20%; }
.titlefield { /* width: 25%; */ min-width: 250px; width: 25%; }
.titlefield { /* width: 25%; */ min-width: 150px; width: 25%; }
.titlefieldmiddle { width: 50%; }
.imgmaxwidth180 { max-width: 180px; }
.imgmaxheight50 { max-height: 50px; }
@@ -5041,7 +5044,15 @@ table.table-fiche-title .col-title div.titre, .col-right .btnTitle-icon {
line-height: 40px;
}
div.backgreypublicpayment { background-color: #f0f0f0; padding: 20px; border-bottom: 1px solid #ddd; text-align: center; }
div.backgreypublicpayment {
background-color: #f0f0f0;
padding: 20px;
border-bottom: 1px solid #ddd;
text-align: center;
position: sticky;
top: 0;
z-index: 1005;
}
.backgreypublicpayment a { color: #222 !important; }
.poweredbypublicpayment {
float: right;