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

This commit is contained in:
Laurent Destailleur
2024-05-22 00:27:58 +02:00
15 changed files with 623 additions and 110 deletions

View File

@@ -169,6 +169,12 @@ if ($object->id > 0) {
$newcardbutton = '';
$messagingUrl = DOL_URL_ROOT.'/adherents/messaging.php?rowid='.$object->id;
$newcardbutton .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
$messagingUrl = DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id;
$newcardbutton .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
if (isModEnabled('agenda')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).($object->id > 0 ? '?id='.$object->id : '').'&origin=member&originid='.$id);
}
@@ -184,7 +190,7 @@ if ($object->id > 0) {
$param .= '&limit='.$limit;
}
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 0);
// List of all actions
$filters = array();

View File

@@ -2090,7 +2090,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAX = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
$morehtmlcenter = '';
$messagingUrl = DOL_URL_ROOT.'/adherents/messaging.php?rowid='.$object->id;
$morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@@ -0,0 +1,216 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.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/adherents/messaging.php
* \ingroup adherent
* \brief Page of adherents events
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal'));
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useragenda';
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$id = GETPOSTINT('rowid') ? GETPOSTINT('rowid') : GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('agendathirdparty', 'globalcard'));
// Security check
$result = restrictedArea($user, 'adherent', $id);
// Initialize technical objects
$object = new Adherent($db);
$result = $object->fetch($id);
if ($result > 0) {
$object->fetch_thirdparty();
$adht = new AdherentType($db);
$result = $adht->fetch($object->typeid);
}
/*
* Actions
*/
$parameters = array('id' => $socid);
$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');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
$title = $person_name." - ".$langs->trans('Info');
$help_url = '';
llxHeader('', $title, $help_url);
$head = member_prepare_head($object);
$title = $langs->trans("User");
print dol_get_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$linkback = '';
print '<br>';
$object->info($id);
dol_print_object_info($object, 1);
print '</div>';
print dol_get_fiche_end();
$objUser = $object;
$objcon = new stdClass();
$out = '';
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objUser->id) || !empty($objcon->id)) && $permok) {
if (is_object($objUser) && get_class($objUser) == 'User') {
$out .= '&amp;originid='.$objUser->id.($objUser->id > 0 ? '&amp;userid='.$objUser->id : '').'&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].($objUser->id > 0 ? '?userid='.$objUser->id : ''));
}
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '');
$out .= '&amp;datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel');
}
$morehtmlright = '';
$messagingUrl = DOL_URL_ROOT.'/adherents/messaging.php?rowid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2);
$messagingUrl = DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
if (isModEnabled('agenda')) {
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) {
print '<br>';
$param = '&userid='.urlencode((string) ($id));
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_user_'.$object->id;
$nbEvent = dol_getcache($cachekey); // TODO Add nb into badge in menu so we can get it from cache also here
$titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
if (!empty($conf->dol_optimize_smallscreen)) {
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
}
print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', '', 0, $morehtmlright, '', 0, 1, 0);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
$filters['search_rowid'] = $search_rowid;
show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
//End of page
llxFooter();
$db->close();

View File

@@ -0,0 +1,183 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Jesus Jerez <jesusballesteros@protonmail.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 htdocs/compta/paiement/document.php
* \ingroup facture, comptaisseur
* \brief Management page of attached documents to a payment
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.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/images.lib.php';
if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
// Load translation files required by the page
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers', 'other'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->socid) {
$socid = $user->socid;
}
if ($object !== null) {
$result = restrictedArea($user, $object->element, $object->id, 'payment', '');
}
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "name";
}
// Load object
$object = new Paiement($db);
if ($object->fetch($id, $ref)) {
$object->fetch_thirdparty();
$ref = dol_sanitizeFileName($object->ref);
$upload_dir = $conf->compta->payment->dir_output.'/'.dol_sanitizeFileName($object->ref);
} else {
$upload_dir = '';
}
$permissiontoadd = ($user->hasRight('facture', 'creer')); // Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
* View
*/
$form = new Form($db);
$title = $langs->trans('Payment')." - ".$langs->trans('Documents');
llxHeader('', $title);
if ($object->id > 0) {
$head = payment_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans("Payment"), -1, 'payment');
// Supplier order card
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Date of payment
$morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight('facture', 'creer')), 'datehourpicker', '', 0, 3).': ';
$morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight('facture', 'creer')), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
// Payment mode
$morehtmlref .= '<br>'.$langs->trans('PaymentMode').' : ';
$morehtmlref .= $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
$morehtmlref .= $object->num_payment ? ' - '.$object->num_payment : '';
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
// Amount
$morehtmlref .= '<br>'.$langs->trans('Amount').' : '. price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
$allow_delete = 1;
// Bank account
if (!empty($conf->banque->enabled)) {
if ($object->fk_account) {
$bankline = new AccountLine($db);
$bankline->fetch($object->bank_line);
if ($bankline->rappro) {
$allow_delete = 0;
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
}
$morehtmlref .= '<br>'.$langs->trans('BankAccount').' : ';
$accountstatic = new Account($db);
$accountstatic->fetch($bankline->fk_account);
$morehtmlref .= $accountstatic->getNomUrl(1);
$morehtmlref .= '<br>'.$langs->trans('BankTransactionLine').' : ';
$morehtmlref .= $bankline->getNomUrl(1, 0, 'showconciliated');
}
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize += $file['size'];
}
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print "</table>\n";
print "</div>\n";
print dol_get_fiche_end();
$modulepart = 'payment';
// TODO: get the appropriate permission
$permissiontoadd = true;
$permtoedit = true;
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
header('Location: index.php');
exit;
}
// End of page
llxFooter();
$db->close();

View File

@@ -318,6 +318,7 @@ class Conf extends stdClass
// First level object
// TODO Remove this part.
$this->fournisseur = new stdClass();
$this->compta = new stdClass();
$this->product = new stdClass();
$this->service = new stdClass();
$this->contrat = new stdClass();
@@ -660,6 +661,11 @@ class Conf extends stdClass
}
}
// Module compta
$this->compta->payment = new stdClass();
$this->compta->payment->dir_output = $rootfordata."/compta/payment";
$this->compta->payment->dir_temp = $rootfortemp."/compta/payment/temp";
// Module product/service
$this->product->multidir_output = array($this->entity => $rootfordata."/produit");
$this->product->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");

View File

@@ -135,7 +135,12 @@ class FormWebsite
$lasttypecontainer = '';
while ($i < $num) {
$obj = $this->db->fetch_object($result);
if (in_array($obj->typecontainer, array('library', 'service'))) {
if (!getDolGlobalString('WEBSITE_ADD_PAGE_TYPE_PHPLIB')) {
$i++;
continue;
}
}
if ($obj->typecontainer != $lasttypecontainer) {
$out .= '<option value="0" disabled>--- ';
$transcodecontainer = ucfirst($obj->typecontainer);

View File

@@ -3213,6 +3213,12 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
$original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} elseif ($modulepart == 'payment') {
// Wrapping pour les rapport de paiements
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->compta->payment->dir_output.'/'.$original_file;
} elseif ($modulepart == 'facture_paiement' && !empty($conf->invoice->dir_output)) {
// Wrapping pour les rapport de paiements
if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) {

View File

@@ -29,7 +29,7 @@
*/
function payment_prepare_head(Paiement $object)
{
global $langs, $conf;
global $langs, $conf, $db;
$h = 0;
$head = array();
@@ -50,6 +50,19 @@ function payment_prepare_head(Paiement $object)
$head[$h][2] = 'info';
$h++;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->compta->payment->dir_output.'/'.$object->ref;
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
}
$head[$h][2] = 'documents';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove');
return $head;

View File

@@ -330,6 +330,10 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = 0)
// Warning: we may replace twice if href="..." was inside an include (dolWebsiteOutput called by include and the by final page), that's why
// at end we replace the '!~!~!~' only if we are in final parent page.
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
// Replace occurrence like _service_page_XXX.php with dolibarr URL
$content = preg_replace('/([\'"])_service_page_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_service_page_\2\1', $content, -1, $nbrep);
// Replace occurrence like _library_page_XXX.php with dolibarr URL
$content = preg_replace('/([\'"])_library_page_([^\'"]+)\.php\1/', '\1!~!~!~' . DOL_URL_ROOT . '/public/website/index.php?website=' . $website->ref . '&pageref=_library_page_\2\1', $content, -1, $nbrep);
// Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php"
$content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);

View File

@@ -164,112 +164,121 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$shortlangcode = substr($object->lang, 0, 2); // en_US or en-US -> en
}
if (!empty($objectpage->type_container) && in_array($objectpage->type_container, array('library', 'service'))) {
$originalcontentonly = 1;
}
$tplcontent = '';
$tplcontent .= "<?php // BEGIN PHP\n";
$tplcontent .= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
$tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n";
$tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n";
$tplcontent .= "} // Not already loaded\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent .= "ob_start();\n";
$tplcontent .= "// END PHP ?>\n";
if (getDolGlobalString('WEBSITE_FORCE_DOCTYPE_HTML5')) {
$tplcontent .= "<!DOCTYPE html>\n";
}
$tplcontent .= '<html'.($shortlangcode ? ' lang="'.$shortlangcode.'"' : '').'>'."\n";
$tplcontent .= '<head>'."\n";
$tplcontent .= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
$tplcontent .= '<meta charset="utf-8">'."\n";
$tplcontent .= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent .= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
$tplcontent .= '<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords).'" />'."\n";
$tplcontent .= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
$tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
if (!isset($originalcontentonly)) {
$tplcontent .= "<?php // BEGIN PHP\n";
$tplcontent .= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
$tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n";
$tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n";
$tplcontent .= "} // Not already loaded\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent .= "ob_start();\n";
$tplcontent .= "// END PHP ?>\n";
if (getDolGlobalString('WEBSITE_FORCE_DOCTYPE_HTML5')) {
$tplcontent .= "<!DOCTYPE html>\n";
}
$tplcontent .= '<html'.($shortlangcode ? ' lang="'.$shortlangcode.'"' : '').'>'."\n";
$tplcontent .= '<head>'."\n";
$tplcontent .= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
$tplcontent .= '<meta charset="utf-8">'."\n";
$tplcontent .= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent .= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
$tplcontent .= '<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords).'" />'."\n";
$tplcontent .= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
$tplcontent .= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent .= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent .= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
// Add favicon
if ($objectpage->id == $object->fk_default_home) {
$tplcontent .= '<link rel="icon" type="image/png" href="/favicon.png" />'."\n";
}
// Add canonical reference
if ($object->virtualhost) {
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
}
// Add translation reference (main language)
if ($object->isMultiLang()) {
// Add page "translation of"
$translationof = $objectpage->fk_page;
if ($translationof) {
$tmppage = new WebsitePage($db);
$tmppage->fetch($translationof);
if ($tmppage->id > 0) {
$tmpshortlangcode = '';
if ($tmppage->lang) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
}
if (empty($tmpshortlangcode)) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
}
if ($tmpshortlangcode != $shortlangcode) {
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="<?php echo $website->virtualhost; ?>'.($object->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php').'" />'."\n";
}
}
// Add favicon
if ($objectpage->id == $object->fk_default_home) {
$tplcontent .= '<link rel="icon" type="image/png" href="/favicon.png" />'."\n";
}
// Add "has translation pages"
$sql = "SELECT rowid as id, lang, pageurl from ".MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objectpage->id.($translationof ? ", ".$translationof : '')).")";
$resql = $db->query($sql);
if ($resql) {
$num_rows = $db->num_rows($resql);
if ($num_rows > 0) {
while ($obj = $db->fetch_object($resql)) {
// Add canonical reference
if ($object->virtualhost) {
$tplcontent .= '<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" />'."\n";
}
// Add translation reference (main language)
if ($object->isMultiLang()) {
// Add page "translation of"
$translationof = $objectpage->fk_page;
if ($translationof) {
$tmppage = new WebsitePage($db);
$tmppage->fetch($translationof);
if ($tmppage->id > 0) {
$tmpshortlangcode = '';
if ($obj->lang) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en
if ($tmppage->lang) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
}
if (empty($tmpshortlangcode)) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
}
if ($tmpshortlangcode != $shortlangcode) {
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="<?php echo $website->virtualhost; ?>'.($object->fk_default_home == $obj->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$obj->pageurl.'.php').'" />'."\n";
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="<?php echo $website->virtualhost; ?>'.($object->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php').'" />'."\n";
}
}
}
} else {
dol_print_error($db);
// Add "has translation pages"
$sql = "SELECT rowid as id, lang, pageurl from ".MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objectpage->id.($translationof ? ", ".$translationof : '')).")";
$resql = $db->query($sql);
if ($resql) {
$num_rows = $db->num_rows($resql);
if ($num_rows > 0) {
while ($obj = $db->fetch_object($resql)) {
$tmpshortlangcode = '';
if ($obj->lang) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en
}
if ($tmpshortlangcode != $shortlangcode) {
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="<?php echo $website->virtualhost; ?>'.($object->fk_default_home == $obj->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$obj->pageurl.'.php').'" />'."\n";
}
}
}
} else {
dol_print_error($db);
}
// Add myself
$tplcontent .= '<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n";
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="<?php echo $website->virtualhost; ?>'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php').'" />'."\n";
$tplcontent .= '<?php } ?>'."\n";
}
// Add manifest.json. Do we have to add it only on home page ?
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
$tplcontent .= '<!-- Include link to CSS file -->'."\n";
// Add js
$tplcontent .= '<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent .= '<!-- Include link to JS file -->'."\n";
$tplcontent .= '<script nonce="'.getNonce().'" async src="/javascript.js.php?website=<?php echo $websitekey; ?>"></script>'."\n";
// Add headers
$tplcontent .= '<!-- Include HTML header from common file -->'."\n";
$tplcontent .= '<?php if (file_exists(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")) include DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html"; ?>'."\n";
$tplcontent .= '<!-- Include HTML header from page header block -->'."\n";
$tplcontent .= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
$tplcontent .= '</head>'."\n";
// Add myself
$tplcontent .= '<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n";
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="<?php echo $website->virtualhost; ?>'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php').'" />'."\n";
$tplcontent .= '<!-- File generated by Dolibarr website module editor -->'."\n";
$tplcontent .= '<body id="bodywebsite" class="bodywebsite bodywebpage-'.$objectpage->ref.'">'."\n";
$tplcontent .= $objectpage->content."\n";
$tplcontent .= '</body>'."\n";
$tplcontent .= '</html>'."\n";
$tplcontent .= '<?php } ?>'."\n";
$tplcontent .= '<?php // BEGIN PHP'."\n";
$tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.'); dolWebsiteIncrementCounter('.$object->id.', "'.$objectpage->type_container.'", '.$objectpage->id.');'."\n";
$tplcontent .= "// END PHP ?>\n";
} else {
$tplcontent .= "<?php\n// This is a library page.\n?>\n";
$tplcontent .= $objectpage->content;
}
// Add manifest.json. Do we have to add it only on home page ?
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
$tplcontent .= '<!-- Include link to CSS file -->'."\n";
// Add js
$tplcontent .= '<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent .= '<!-- Include link to JS file -->'."\n";
$tplcontent .= '<script nonce="'.getNonce().'" async src="/javascript.js.php?website=<?php echo $websitekey; ?>"></script>'."\n";
// Add headers
$tplcontent .= '<!-- Include HTML header from common file -->'."\n";
$tplcontent .= '<?php if (file_exists(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")) include DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html"; ?>'."\n";
$tplcontent .= '<!-- Include HTML header from page header block -->'."\n";
$tplcontent .= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
$tplcontent .= '</head>'."\n";
$tplcontent .= '<!-- File generated by Dolibarr website module editor -->'."\n";
$tplcontent .= '<body id="bodywebsite" class="bodywebsite bodywebpage-'.$objectpage->ref.'">'."\n";
$tplcontent .= $objectpage->content."\n";
$tplcontent .= '</body>'."\n";
$tplcontent .= '</html>'."\n";
$tplcontent .= '<?php // BEGIN PHP'."\n";
$tplcontent .= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.'); dolWebsiteIncrementCounter('.$object->id.', "'.$objectpage->type_container.'", '.$objectpage->id.');'."\n";
$tplcontent .= "// END PHP ?>\n";
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);

View File

@@ -93,6 +93,7 @@ if (!isset($savingdocmask) || getDolGlobalString('MAIN_DISABLE_SUGGEST_REF_AS_PR
'facture',
'commande',
'propal',
'payment',
'supplier_proposal',
'ficheinter',
'contract',

View File

@@ -1292,18 +1292,24 @@ if (!$variants || getDolGlobalString('VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PA
$pse = new ProductStockEntrepot($db);
$lines = $pse->fetchAll($id);
$visibleWarehouseEntities = explode(',', getEntity('stock')); // For MultiCompany compatibility
if (!empty($lines)) {
$var = false;
foreach ($lines as $line) {
$ent = new Entrepot($db);
$ent->fetch($line['fk_entrepot']);
print '<tr class="oddeven"><td>'.$ent->getNomUrl(3).'</td>';
print '<td class="right">'.$line['seuil_stock_alerte'].'</td>';
print '<td class="right">'.$line['desiredstock'].'</td>';
if ($user->hasRight('produit', 'creer')) {
print '<td class="right"><a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse&token='.newToken().'">'.img_delete().'</a></td>';
if (!isModEnabled("multicompany") || in_array($ent->entity, $visibleWarehouseEntities)) {
// Display only warehouses from our entity and entities sharing stock with actual entity
print '<tr class="oddeven"><td>'.$ent->getNomUrl(3).'</td>';
print '<td class="right">'.$line['seuil_stock_alerte'].'</td>';
print '<td class="right">'.$line['desiredstock'].'</td>';
if ($user->hasRight('produit', 'creer')) {
print '<td class="right"><a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse&token='.newToken().'">'.img_delete().'</a></td>';
}
print '</tr>';
}
print '</tr>';
}
}

View File

@@ -418,7 +418,8 @@ if ($action == 'confirm_generateinvoice') {
$tmptimespent = new Task($db);
$tmpproduct = new Product($db);
$fuser = new User($db);
$remiseproject = price2num(GETPOST('remiseprojet', 'alphanohtml'));
$condidproject = GETPOSTINT('condidproject');
$db->begin();
$idprod = GETPOSTINT('productid');
$generateinvoicemode = GETPOST('generateinvoicemode', 'alphanohtml');
@@ -458,7 +459,7 @@ if ($action == 'confirm_generateinvoice') {
$tmpinvoice->socid = $projectstatic->thirdparty->id;
$tmpinvoice->date = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
$tmpinvoice->fk_project = $projectstatic->id;
$tmpinvoice->cond_reglement_id = $projectstatic->thirdparty->cond_reglement_id;
$tmpinvoice->cond_reglement_id = $condidproject;
$tmpinvoice->mode_reglement_id = $projectstatic->thirdparty->mode_reglement_id;
$tmpinvoice->fk_account = $projectstatic->thirdparty->fk_account;
@@ -549,7 +550,7 @@ if ($action == 'confirm_generateinvoice') {
}
// Add lines
$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0));
$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject);
if ($lineid < 0) {
$error++;
setEventMessages(null, $tmpinvoice->errors, 'errors');
@@ -648,7 +649,7 @@ if ($action == 'confirm_generateinvoice') {
}
$idprodline = $value['fk_product'];
}
$lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0));
$lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject);
if ($lineid < 0) {
$error++;
setEventMessages(null, $tmpinvoice->errors, 'errors');
@@ -746,7 +747,7 @@ if ($action == 'confirm_generateinvoice') {
$date_start = '';
$date_end = '';
$lineName = $ftask->ref . ' - ' . $ftask->label;
$lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht);
$lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), $remiseproject, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht);
if ($lineid < 0) {
$error++;
setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors');
@@ -1465,7 +1466,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '</td>';
print '</tr>';
}
print '<tr>';
print '<td class="titlefield">';
print $langs->trans('InvoiceToUse');
@@ -1474,6 +1474,22 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print $form->selectInvoice($projectstatic->thirdparty->id, '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), 1, 0, 0, 'maxwidth500', '', 'all');
print '</td>';
print '</tr>';
print '<tr>';
print '<td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount");
print '</td>';
print '<td>';
print '<input type="text" size="5" name="remiseproject" value="'.$projectstatic->thirdparty->remise_percent.'">%';
print '</td>';
print '</tr>';
print '<tr class="newinvoicedetail">';
print '<td class="titlefield">';
print $langs->trans("PaymentConditions");
print '</td>';
print '<td>';
print $form->getSelectConditionsPaiements($projectstatic->thirdparty->cond_reglement_id, 'condidproject');
print '</td>';
print '</tr>';
/*print '<tr>';
print '<td>';
print $langs->trans('ValidateInvoices');

View File

@@ -153,6 +153,16 @@ if (empty($pageid)) {
include DOL_DOCUMENT_ROOT.'/public/error-404.php';
exit;
}
if (empty($pageref)) {
$objectpage = new WebsitePage($db);
$result = $objectpage->fetch($pageid);
if ($result > 0) {
$pageref = $objectpage->ref;
}
}
if (preg_match('/^_(library|service)_page_/', $pageref)) {
$originalcontentonly = 1;
}
$appli = constant('DOL_APPLICATION_TITLE');
if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
@@ -224,7 +234,9 @@ if (!file_exists($original_file_osencoded)) {
// Output page content
define('USEDOLIBARRSERVER', 1);
print '<!-- Page content '.$original_file.' rendered with DOLIBARR SERVER : Html with CSS link and html header + Body that was saved into tpl dir -->'."\n";
if (!isset($originalcontentonly)) {
print '<!-- Page content '.$original_file.' rendered with DOLIBARR SERVER : Html with CSS link and html header + Body that was saved into tpl dir -->'."\n";
}
include_once $original_file_osencoded; // Note: The pageXXX.tpl.php showed here contains a formatage with dolWebsiteOutput() at end of page.
if (is_object($db)) {

View File

@@ -4358,6 +4358,12 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
} else {
jQuery(".trpublicauthor").hide();
}
if (jQuery("#selectWEBSITE_TYPE_CONTAINER").val() == \'service\' || jQuery("#selectWEBSITE_TYPE_CONTAINER").val() == \'library\') {
$(".spanprefix").html("_" + $("#selectWEBSITE_TYPE_CONTAINER").val() + "_page_");
jQuery(".spanprefix").show();
} else {
jQuery(".spanprefix").hide();
}
});
});
</script>
@@ -4374,9 +4380,30 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('WEBSITE_PAGENAME');
print '</td><td>';
print '<input type="text" class="flat minwidth300" name="WEBSITE_PAGENAME" id="WEBSITE_PAGENAME" value="'.dol_escape_htmltag($pageurl).'">';
print '<span class="opacitymedium spanprefix hidden"></span> ';
print '<input type="text" class="flat minwidth300" name="WEBSITE_PAGENAME" id="WEBSITE_PAGENAME" value="'.dol_escape_htmltag(substr((string) $pageurl, strlen('_'.$type_container.'_page_'))).'">';
print '</td></tr>';
print '<script type="text/javascript">
$(document).ready(function() {
if ($("#selectWEBSITE_TYPE_CONTAINER").val() == "service" || $("#selectWEBSITE_TYPE_CONTAINER").val() == "library") {
$(".spanprefix").html("_" + $("#selectWEBSITE_TYPE_CONTAINER").val() + "_page_");
$(".spanprefix").show();
}
$(".websiteformtoolbar").on("submit", function(event) {
if ($("#selectWEBSITE_TYPE_CONTAINER").val() == "service" || $("#selectWEBSITE_TYPE_CONTAINER").val() == "library") {
var prefix = "_" + $("#selectWEBSITE_TYPE_CONTAINER").val() + "_page_";
var userInput = $("#WEBSITE_PAGENAME").val();
var $inputField = $("#WEBSITE_PAGENAME");
if (userInput.indexOf(prefix) !== 0) {
$inputField.val(prefix + userInput);
}
}
});
});
</script>
';
print '<tr><td class="titlefieldcreate">';
$htmlhelp = $langs->trans("WEBSITE_ALIASALTDesc");
print $form->textwithpicto($langs->trans('WEBSITE_ALIASALT'), $htmlhelp, 1, 'help', '', 0, 2, 'aliastooltip');