* Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * 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 . */ /** * \file htdocs/bookcal/booking_list.php * \ingroup bookcal * \brief Management of direct debit order or credit transfer of invoices */ // 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 * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ // Load translation files required by the page $langs->loadLangs(array("agenda", "other")); $id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); $socid = GETPOSTINT('socid'); $action = GETPOST('action', 'aZ09'); $type = GETPOST('type', 'aZ09'); $fieldid = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) { $socid = $user->socid; } $moreparam = ''; $object = new Calendar($db); // Load object if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref); $isdraft = (($object->status == Calendar::STATUS_DRAFT) ? 1 : 0); if ($ret > 0) { $object->fetch_thirdparty(); } } // There is several ways to check permission. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; if ($enablepermissioncheck) { $permissiontoread = $user->hasRight('bookcal', 'calendar', 'read'); $permissiontoadd = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->hasRight('bookcal', 'calendar', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissionnote = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight('bookcal', 'calendar', 'write'); // Used by the include of actions_dellink.inc.php } else { $permissiontoread = 1; $permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = 1; $permissionnote = 1; $permissiondellink = 1; } if (!isModEnabled("bookcal")) { accessforbidden(); } if (!$permissiontoread) { accessforbidden(); } /* * Actions */ $parameters = array(); $helpurl = ''; $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } /* * View */ $form = new Form($db); $now = dol_now(); $title = $langs->trans('Calendar')." - ".$langs->trans('Bookings'); llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'mod-bookcal page-list'); if ($object->id > 0) { $head = calendarPrepareHead($object); print dol_get_fiche_head($head, 'booking', $langs->trans("Calendar"), -1, $object->picto, 0, '', '', 0, '', 1); $formconfirm = ''; // 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 if (empty($reshook)) { $formconfirm .= $hookmanager->resPrint; } elseif ($reshook > 0) { $formconfirm = $hookmanager->resPrint; } // Print form confirm print $formconfirm; // Object card // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
'; print '
'; print '
'; print ''."\n"; // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes. Fields from hook formObjectOptions and Extrafields. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Link to public page print ''; print ''; print '
LinkPublic page'; print '
'; print '
'; print '
'; print '
'; print dol_get_fiche_end(); /* * Bookings */ print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; $sql = "SELECT ac.id, ac.ref, ac.datep as date_start, ac.datep2 as date_end, ac.label, acr.fk_element as elementid"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as ac"; $sql .= " JOIN ".MAIN_DB_PREFIX."actioncomm_resources as acr on acr.fk_actioncomm = ac.id"; $sql .= " WHERE ac.fk_bookcal_calendar = ".((int) $object->id); $sql .= " AND ac.code = 'AC_RDV'"; $sql .= " AND acr.element_type = 'socpeople'"; $resql = $db->query($sql); $num = 0; if ($resql) { $i = 0; $tmpcontact = new Contact($db); $tmpactioncomm = new ActionComm($db); $num = $db->num_rows($resql); while ($i < $num) { $obj = $db->fetch_object($resql); $tmpcontact->fetch($obj->elementid); $tmpactioncomm->fetch($obj->id); print ''; // Ref print '\n"; // Title print ''; // Amount print ''; // Date process print ''; // Link to make payment now print ''; print "\n"; $i++; } $db->free($resql); } else { dol_print_error($db); } print "
'.$langs->trans("Ref").''.$langs->trans("Title").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("Contact").'
'.$tmpactioncomm->getNomUrl(1, -1)."'; print $obj->label; print ''.dol_print_date($db->jdate($obj->date_start), "dayhour").''.dol_print_date($db->jdate($obj->date_end), "dayhour").''; print $tmpcontact->getNomUrl(1, -1); print '
"; print '
'; } // End of page llxFooter(); $db->close();