';
@@ -627,10 +646,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder")));
';
/*$noparam = array();
- foreach ($arrayoftypes as $key => $value)
- {
- if ($value['noparam']) $noparam[] = $key;
- }*/
+ foreach ($arrayoftypes as $key => $value)
+ {
+ if ($value['noparam']) $noparam[] = $key;
+ }*/
print '})';
print ''."\n";
@@ -671,7 +690,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$arrayoftypes = array(
'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
- 'loadandcreatecontact' => $langs->trans('LoadContactFromEmailOrCreate', $langs->transnoentities("Email")),
'recordjoinpiece' => 'AttachJoinedDocumentsToObject',
'recordevent' => 'RecordEvent'
);
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index fb09143412f..de18b57b297 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -273,25 +273,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
-
-/* If a group by is required
-$sql.= " GROUP BY ";
-foreach ($object->fields as $key => $val) {
- $sql .= "t.".$db->escape($key).", ";
-}
-// Add fields from extrafields
-if (!empty($extrafields->attributes[$object->table_element]['label'])) {
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
- }
-}
-// Add where from hooks
-$parameters=array();
-$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
-$sql .= $hookmanager->resPrint;
-$sql = preg_replace('/,\s*$/', '', $sql);
-*/
-
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@@ -333,6 +314,22 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
+
+$linkback = '
';
+print load_fiche_titre($title, $linkback, 'title_setup');
+
+
+$head = array();
+$h = 0;
+$head[$h][0] = DOL_URL_ROOT."/admin/emailcollector_list.php";
+$head[$h][1] = $langs->trans("Setup");
+$head[$h][2] = 'common';
+$h++;
+
+print dol_get_fiche_head($head, 'common', '', -1);
+
+
+
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
@@ -388,11 +385,9 @@ print '
';
-
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
-print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit, 0, 0, 1);
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1);
// Add code for pre mass action (confirmation or email presend form)
/*$topicmail="";
@@ -699,7 +694,22 @@ print '
';
print "\n";
-// Hide e-mail headers from collected messages
+// MAIN_IMAP_USE_PHPIMAP: Enable use of the PHP Imap library
+print '
';
+
+// MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER: Hide e-mail headers from collected messages
print '
| '.$form->textwithpicto($langs->trans("EmailCollectorHideMailHeaders"), $langs->transnoentitiesnoconv("EmailCollectorHideMailHeadersHelp")).' | ';
print '';
if ($conf->use_javascript_ajax) {
@@ -738,6 +748,10 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
print $formfile->showdocuments('massfilesarea_emailcollector', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
+
+dol_get_fiche_end();
+
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/admin/mails_ingoing.php b/htdocs/admin/mails_ingoing.php
new file mode 100644
index 00000000000..010d933821e
--- /dev/null
+++ b/htdocs/admin/mails_ingoing.php
@@ -0,0 +1,137 @@
+
+ * Copyright (C) 2009-2012 Regis Houssin
+ * Copyright (C) 2013 Juanjo Menent
+ * Copyright (C) 2016 Jonathan TISSEAU
+ *
+ * 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/admin/mails_ingoing.php
+ * \brief Page to setup emails entry
+ */
+
+// Load Dolibarr environment
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors"));
+
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'aZ09');
+
+$trackid = GETPOST('trackid');
+
+if (!$user->admin) {
+ accessforbidden();
+}
+
+
+/*
+ * Actions
+ */
+
+if ($action == 'update' && !$cancel) {
+}
+
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$linuxlike = 1;
+if (preg_match('/^win/i', PHP_OS)) {
+ $linuxlike = 0;
+}
+if (preg_match('/^mac/i', PHP_OS)) {
+ $linuxlike = 0;
+}
+
+
+//$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
+$wikihelp = '';
+llxHeader('', $langs->trans("Setup"), $wikihelp);
+
+print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
+
+$head = email_admin_prepare_head();
+
+// List of sending methods
+$listofmethods = array();
+$listofmethods['mail'] = 'PHP mail function';
+$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
+if (version_compare(phpversion(), '7.0', '>=')) {
+ $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
+}
+
+// List of oauth services
+$oauthservices = array();
+
+foreach ($conf->global as $key => $val) {
+ if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
+ $key = preg_replace('/^OAUTH_/', '', $key);
+ $key = preg_replace('/_ID$/', '', $key);
+ if (preg_match('/^.*-/', $key)) {
+ $name = preg_replace('/^.*-/', '', $key);
+ } else {
+ $name = $langs->trans("NoName");
+ }
+ $provider = preg_replace('/-.*$/', '', $key);
+ $provider = ucfirst(strtolower($provider));
+
+ $oauthservices[$key] = $name." (".$provider.")";
+ }
+}
+
+print dol_get_fiche_head($head, 'common_ingoing', '', -1);
+
+print ' ';
+print ''.$langs->trans("EMailsInGoingDesc", $langs->transnoentitiesnoconv("EmailCollector"))." \n";
+print "
\n";
+
+/*
+print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
+print ' ';
+print '| '.$langs->trans("Parameter").' | '.$langs->trans("Value").' | ';
+
+print ' ';
+
+print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
+print ' ';
+
+// SMTPS oauth service
+if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") {
+ $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE];
+ if (empty($text)) {
+ $text = $langs->trans("Undefined").img_warning();
+ }
+ print '| '.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").' | '.$text.' | ';
+}
+
+print ' ';
+print ' ';
+*/
+
+print dol_get_fiche_end();
+
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index a42ecc5c34d..c3f066a464e 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -1101,7 +1101,7 @@ if ($mode == 'marketplace') {
print '';
- print ' ';
- print $form->buttonsSaveCancel("Modify", '');
+ print $form->buttonsSaveCancel("Save", '');
print '';
}
diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php
index 9a0532880cd..5c0ecdb007d 100644
--- a/htdocs/admin/oauthlogintokens.php
+++ b/htdocs/admin/oauthlogintokens.php
@@ -162,8 +162,10 @@ if ($mode == 'setup' && $user->admin) {
$keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
$keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
+ $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
$keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
} else {
+ $keybeforeprovider = $keyforsupportedoauth2array;
$keyforprovider = '';
}
$keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
@@ -179,13 +181,12 @@ if ($mode == 'setup' && $user->admin) {
$state = $shortscope; // TODO USe a better state
// Define $urltorenew, $urltodelete, $urltocheckperms
- // TODO Use array $supportedoauth2array
if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
// We pass this param list in to 'state' because we need it before and after the redirect.
// Note: github does not accept csrf key inside the state parameter (only known values)
- $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://github.com/settings/applications/';
} elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
@@ -195,17 +196,9 @@ if ($mode == 'setup' && $user->admin) {
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
- } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') {
- $urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltodelete = '';
- $urltocheckperms = '';
- } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') {
- $urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltodelete = '';
- $urltocheckperms = '';
- } elseif ($keyforsupportedoauth2array = 'OAUTH_OTHER_NAME') {
- $urltorenew = $urlwithroot.'/core/modules/oauth/generic_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltodelete = '';
+ } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) {
+ $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = '';
} else {
$urltorenew = '';
@@ -220,17 +213,22 @@ if ($mode == 'setup' && $user->admin) {
$urltodelete .= '&keyforprovider='.urlencode($keyforprovider);
}
-
// Show value of token
$tokenobj = null;
// Token
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
// Dolibarr storage
- $storage = new DoliStorage($db, $conf);
+ $storage = new DoliStorage($db, $conf, $keyforprovider);
try {
+ // $OAUTH_SERVICENAME is for example 'Google-keyforprovider'
+ print ''."\n";
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
+ //print $storage->token.' ';
+ //print $tokenobj->getExtraParams()['id_token'].' ';
+ //print $tokenobj->getAccessToken().' ';
} catch (Exception $e) {
// Return an error if token not found
+ //print $e->getMessage();
}
// Set other properties
@@ -321,7 +319,11 @@ if ($mode == 'setup' && $user->admin) {
// Links to delete/checks token
if (is_object($tokenobj)) {
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
- print ' '.$langs->trans('DeleteAccess').'';
+ if ($urltodelete) {
+ print ' '.$langs->trans('DeleteAccess').'';
+ } else {
+ print ' '.$langs->trans('GoOnTokenProviderToDeleteToken').'';
+ }
}
// Request remote token
if ($urltorenew) {
@@ -343,7 +345,6 @@ if ($mode == 'setup' && $user->admin) {
print ' ';
if (is_object($tokenobj)) {
- //var_dump($tokenobj);
$tokentoshow = $tokenobj->getAccessToken();
print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).' ';
//print 'Refresh: '.$tokenobj->getRefreshToken().' ';
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 84bae509ebd..d5e3532dbd6 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -1,5 +1,6 @@
+/* Copyright (C) 2019 Laurent Destailleur
+ * Copyright (C) 2023 Benjamin Falière
*
* 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
@@ -16,7 +17,7 @@
*/
/**
- * \file bom/class/bom.class.php
+ * \file htdocs/bom/class/bom.class.php
* \ingroup bom
* \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete)
*/
@@ -1064,6 +1065,43 @@ class BOM extends CommonObject
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN');
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $langs->loadLangs(['product', 'mrp']);
+
+ $datas = [];
+
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("ShowBillOfMaterials")];
+ }
+ $picto = img_picto('', $this->picto).' '.$langs->trans("BillOfMaterials").'';
+ if (isset($this->status)) {
+ $picto .= ' '.$this->getLibStatut(5);
+ }
+ $datas['picto'] = $picto;
+ $datas['ref'] = ' '.$langs->trans('Ref').': '.$this->ref;
+ if (isset($this->label)) {
+ $datas['label'] = ' '.$langs->trans('Label').': '.$this->label;
+ }
+ if (!empty($this->fk_product) && $this->fk_product > 0) {
+ include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+ $product = new Product($this->db);
+ $resultFetch = $product->fetch($this->fk_product);
+ if ($resultFetch > 0) {
+ $datas['product'] = " ".$langs->trans("Product").': '.$product->ref.' - '.$product->label;
+ }
+ }
+
+ return $datas;
+ }
/**
* Return a link to the object card (with optionaly the picto)
@@ -1084,24 +1122,20 @@ class BOM extends CommonObject
}
$result = '';
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
+ }
- $label = img_picto('', $this->picto).' '.$langs->trans("BillOfMaterials").'';
- if (isset($this->status)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- $label .= ' ';
- $label .= ''.$langs->trans('Ref').': '.$this->ref;
- if (isset($this->label)) {
- $label .= ' '.$langs->trans('Label').': '.$this->label;
- }
- if (!empty($this->fk_product) && $this->fk_product > 0) {
- include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
- $product = new Product($db);
- $resultFetch = $product->fetch($this->fk_product);
- if ($resultFetch > 0) {
- $label .= " ".$langs->trans("Product").': '.$product->ref.' - '.$product->label;
- }
- }
+ $label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;
@@ -1124,7 +1158,7 @@ class BOM extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -1135,7 +1169,7 @@ class BOM extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
@@ -1365,7 +1399,11 @@ class BOM extends CommonObject
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
if (empty($line->unit_cost)) {
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
- $line->unit_cost = $productFournisseur->fourn_unitprice;
+ if ($productFournisseur->fourn_remise_percent != "0") {
+ $line->unit_cost = $productFournisseur->fourn_unitprice_with_discount;
+ } else {
+ $line->unit_cost = $productFournisseur->fourn_unitprice;
+ }
}
}
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 4d6e3e1736f..592b0204983 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 Raphaël Doursenaud
* Copyright (C) 2016 Charlie Benke
- * Copyright (C) 2018-2022 Frédéric France
+ * Copyright (C) 2018-2023 Frédéric France
*
* 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
@@ -1597,6 +1597,23 @@ class Categorie extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $langs;
+
+ $datas = [];
+
+ $datas['label'] = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label);
+
+ return $datas;
+ }
+
/**
* Return name and link of category (with picto)
* Use ->id, ->ref, ->label, ->color
@@ -1612,7 +1629,19 @@ class Categorie extends CommonObject
global $langs, $hookmanager;
$result = '';
- $label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label);
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
+ }
+ $label = implode($this->getTooltipContentArray($params));
// Check contrast with background and correct text color
$forced_color = 'categtextwhite';
@@ -1621,15 +1650,15 @@ class Categorie extends CommonObject
$forced_color = 'categtextblack';
}
}
-
- $link = '';
+ $link = '';
$linkend = '';
$picto = 'category';
if ($withpicto) {
- $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index af98356ab18..fd5b55e70fe 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -5,7 +5,7 @@
* Copyright (C) 2011-2017 Juanjo Menent
* Copyright (C) 2015 Marcos García
* Copyright (C) 2018 Nicolas ZABOURI
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018-2023 Frédéric France
*
* 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
@@ -1568,6 +1568,73 @@ class ActionComm extends CommonObject
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+ $langs->load('agenda');
+ $datas = [];
+
+ // Set label of type
+ $labeltype = '';
+ if ($this->type_code) {
+ $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code) ? $langs->transnoentities("Action".$this->type_code) : $this->type_label;
+ }
+ if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
+ if ($this->type_code != 'AC_OTH_AUTO') {
+ $labeltype = $langs->trans('ActionAC_MANUAL');
+ }
+ }
+
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans('Action').'';
+ if (!empty($this->ref)) {
+ $datas['ref'] = ' '.$langs->trans('Ref').': '.dol_escape_htmltag($this->ref);
+ }
+ if (!empty($this->label)) {
+ $datas['title'] = ' '.$langs->trans('Title').': '.dol_escape_htmltag($this->label);
+ }
+ if (!empty($labeltype)) {
+ $datas['labeltype'] = ' '.$langs->trans('Type').': '.dol_escape_htmltag($labeltype);
+ }
+ if (!empty($this->location)) {
+ $datas['location'] = ' '.$langs->trans('Location').': '.dol_escape_htmltag($this->location);
+ }
+ if (isset($this->transparency)) {
+ $datas['transparency'] = ' '.$langs->trans('Busy').': '.yn($this->transparency);
+ }
+ if (!empty($this->email_msgid)) {
+ $langs->load("mails");
+ $datas['space'] = ' ';
+ // $datas['email'] = ' '.img_picto('', 'email').' '.$langs->trans("Email").'';
+ $datas['mailtopic'] = ' '.$langs->trans('MailTopic').': '.dol_escape_htmltag($this->email_subject);
+ $datas['mailfrom'] = ' '.$langs->trans('MailFrom').': '.str_replace(array('<', '>'), array('<', '>'), $this->email_from);
+ $datas['mailto'] = ' '.$langs->trans('MailTo').': '.str_replace(array('<', '>'), array('<', '>'), $this->email_to);
+ if (!empty($this->email_tocc)) {
+ $datas['mailcc'] = ' '.$langs->trans('MailCC').': '.str_replace(array('<', '>'), array('<', '>'), $this->email_tocc);
+ }
+ /* Disabled because bcc must remain by defintion not visible
+ if (!empty($this->email_tobcc)) {
+ $datas['mailccc'] = ' '.$langs->trans('MailCCC').': '.$this->email_tobcc;
+ } */
+ }
+ if (!empty($this->note_private)) {
+ $datas['description'] = ' '.$langs->trans('Description').': ';
+ // Try to limit length of content
+ $texttoshow = dolGetFirstLineOfText($this->note_private, 10);
+ // Restrict height of content into the tooltip
+ $datas['note'] = '';
+ $datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), ' ', $texttoshow));
+ $datas['note'] .= ' ';
+ }
+
+ return $datas;
+ }
+
/**
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
@@ -1660,6 +1727,18 @@ class ActionComm extends CommonObject
$tooltip .= '';
}
$linkclose = '';
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
+ }
//if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
// $linkclose = ' style="background-color:#'.$this->type_color.'"';
@@ -1669,7 +1748,7 @@ class ActionComm extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
- $linkclose .= ' class="'.$classname.' classfortooltip"';
+ $linkclose .= $dataparams.' class="'.$classname.' '.$classfortooltip.'"';
} else {
$linkclose .= ' class="'.$classname.'"';
}
@@ -1729,7 +1808,7 @@ class ActionComm extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
$result .= dol_escape_htmltag($labelshort);
$result .= $linkend;
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 41913afe8b9..3a48230de40 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -3690,6 +3690,52 @@ class Propal extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $datas = [];
+
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("Proposal")];
+ }
+ if ($user->hasRight('propal', 'lire')) {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Proposal").'';
+ if (isset($this->statut)) {
+ $datas['status'] = ' '.$this->getLibStatut(5);
+ }
+ if (!empty($this->ref)) {
+ $datas['ref'] = ' '.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->ref_client)) {
+ $datas['refcustomer'] = ' '.$langs->trans('RefCustomer').': '.$this->ref_client;
+ }
+ if (!empty($this->total_ht)) {
+ $datas['amountht'] = ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_tva)) {
+ $datas['vat'] = ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_ttc)) {
+ $datas['amountttc'] = ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->date)) {
+ $datas['date'] = ' '.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
+ }
+ if (!empty($this->delivery_date)) {
+ $datas['deliverydate'] = ' '.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour');
+ }
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -3710,36 +3756,22 @@ class Propal extends CommonObject
}
$result = '';
- $label = '';
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
+ }
+ $label = implode($this->getTooltipContentArray($params));
+
$url = '';
-
if ($user->rights->propal->lire) {
- $label = img_picto('', $this->picto).' '.$langs->trans("Proposal").'';
- if (isset($this->statut)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- if (!empty($this->ref)) {
- $label .= ' '.$langs->trans('Ref').': '.$this->ref;
- }
- if (!empty($this->ref_client)) {
- $label .= ' '.$langs->trans('RefCustomer').': '.$this->ref_client;
- }
- if (!empty($this->total_ht)) {
- $label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_tva)) {
- $label .= ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_ttc)) {
- $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->date)) {
- $label .= ' '.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
- }
- if (!empty($this->delivery_date)) {
- $label .= ' '.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour');
- }
-
if ($option == '') {
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params;
} elseif ($option == 'compta') { // deprecated
@@ -3769,7 +3801,7 @@ class Propal extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}
$linkstart = 'picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index bca5992b5ba..5b111f67e6c 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3714,6 +3714,48 @@ class Commande extends CommonOrder
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip));
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $datas = [];
+
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("Order")];
+ }
+
+ if ($user->hasRight('commande', 'lire')) {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Order").'';
+ if (isset($this->statut)) {
+ $datas[] = ' '.$this->getLibStatut(5);
+ }
+ $datas['Ref'] = ' '.$langs->trans('Ref').': '.$this->ref;
+ $datas['RefCustomer'] = ' '.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer);
+ if (!empty($this->total_ht)) {
+ $datas['AmountHT'] = ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_tva)) {
+ $datas['VAT'] = ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_ttc)) {
+ $datas['AmountTTC'] = ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->date)) {
+ $datas['Date'] = ' '.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
+ }
+ if (!empty($this->delivery_date)) {
+ $datas['DeliveryDate'] = ' '.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour');
+ }
+ }
+
+ return $datas;
+ }
/**
* Return clicable link of object (with eventually picto)
@@ -3762,33 +3804,21 @@ class Commande extends CommonOrder
if ($short) {
return $url;
}
-
- $label = '';
-
- if ($user->rights->commande->lire) {
- $label = img_picto('', $this->picto).' '.$langs->trans("Order").'';
- if (isset($this->statut)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- $label .= ' '.$langs->trans('Ref').': '.$this->ref;
- $label .= ' '.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer);
- if (!empty($this->total_ht)) {
- $label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_tva)) {
- $label .= ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_ttc)) {
- $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->date)) {
- $label .= ' '.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
- }
- if (!empty($this->delivery_date)) {
- $label .= ' '.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour');
- }
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
}
+ $label = implode($this->getTooltipContentArray($params));
+
$linkclose = '';
if (empty($notooltip) && $user->rights->commande->lire) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
@@ -3796,9 +3826,9 @@ class Commande extends CommonOrder
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.'"';
- $target_value=array('_self', '_blank', '_parent', '_top');
+ $target_value = array('_self', '_blank', '_parent', '_top');
if (in_array($target, $target_value)) {
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
}
@@ -3815,7 +3845,7 @@ class Commande extends CommonOrder
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 119d88e7cf4..9c06f86e8c3 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -2077,7 +2077,11 @@ if ($resql) {
// Third party
if (!empty($arrayfields['s.nom']['checked'])) {
print '';
- print $getNomUrl_cache[$obj->socid];
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ print $companystatic->getNomUrl(1, 'customer', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
+ } else {
+ print $getNomUrl_cache[$obj->socid];
+ }
// If module invoices enabled and user with invoice creation permissions
if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 36bf8795f47..7032f9c40e2 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -9,7 +9,7 @@
* Copyright (C) 2015-2017 Alexandre Spangaro
* Copyright (C) 2016 Ferran Marcet
* Copyright (C) 2019 JC Prieto
- * Copyright (C) 2022 Frédéric France
+ * Copyright (C) 2022-2023 Frédéric France
*
* 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
@@ -244,6 +244,20 @@ class Account extends CommonObject
*/
public $date_solde;
+ /**
+ * Balance. Used in Account::create
+ * @var float
+ * @deprecated
+ * @see $balance
+ */
+ public $solde;
+
+ /**
+ * Balance. Used in Account::create
+ * @var float
+ */
+ public $balance;
+
/**
* Creditor Identifier CI. Some banks use different ICS for direct debit and bank tranfer
* @var string
@@ -1390,6 +1404,40 @@ class Account extends CommonObject
return $nb;
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $langs;
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
+
+ $datas = [];
+
+ $pictos = img_picto('', $this->picto).' '.$langs->trans("BankAccount").'';
+ if (isset($this->status)) {
+ $pictos .= ' '.$this->getLibStatut(5);
+ }
+ $datas['picto'] = $pictos;
+ $datas['label'] = ' '.$langs->trans('Label').': '.$this->label;
+ $datas['accountnumber'] = ' '.$langs->trans('AccountNumber').': '.$this->number;
+ $datas['iban'] = ' '.$langs->trans('IBAN').': '.getIbanHumanReadable($this);
+ $datas['bic'] = ' '.$langs->trans('BIC').': '.$this->bic;
+ $datas['accountcurrency'] = ' '.$langs->trans("AccountCurrency").': '.$this->currency_code;
+
+ if (isModEnabled('accounting')) {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+ $langs->load("accountancy");
+ $datas['accountaccounting'] = ' '.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number);
+ $datas['accountancyjournal'] = ' '.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal;
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable name (with picto eventually)
*
@@ -1426,8 +1474,19 @@ class Account extends CommonObject
$label .= ' '.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number);
$label .= ' '.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal;
}
-
- $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ $label = $langs->trans('Loading');
+ }
+ $linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">';
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
if ($mode == 'transactions') {
@@ -1457,7 +1516,7 @@ class Account extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '');
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 75869a900dd..8505af85ce5 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1766,6 +1766,71 @@ class Facture extends CommonInvoice
return $deposit;
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $mysoc, $user;
+
+ $langs->load('bills');
+
+ $datas = [];
+ $moretitle = $params['moretitle'] ?? '';
+ $picto = $this->picto;
+ if ($this->type == self::TYPE_REPLACEMENT) {
+ $picto .= 'r'; // Replacement invoice
+ }
+ if ($this->type == self::TYPE_CREDIT_NOTE) {
+ $picto .= 'a'; // Credit note
+ }
+ if ($this->type == self::TYPE_DEPOSIT) {
+ $picto .= 'd'; // Deposit invoice
+ }
+
+ if ($user->hasRight("facture", "read")) {
+ $datas['picto'] = img_picto('', $picto).' '.$langs->trans("Invoice").'';
+ if (isset($this->statut) && isset($this->alreadypaid)) {
+ $datas['picto'] .= ' '.$this->getLibStatut(5, $this->alreadypaid);
+ }
+ $datas['picto'] .= ' '.$this->getLibType(1);
+ if ($moretitle) {
+ $datas['picto'] = ' - '.$moretitle;
+ }
+ if (!empty($this->ref)) {
+ $datas['ref'] = ' '.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->ref_customer)) {
+ $datas['refcustomer'] = ' '.$langs->trans('RefCustomer').': '.$this->ref_customer;
+ }
+ if (!empty($this->date)) {
+ $datas['date'] = ' '.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
+ }
+ if (!empty($this->total_ht)) {
+ $datas['amountht'] = ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_tva)) {
+ $datas['amountvat'] = ' '.$langs->trans('AmountVAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) {
+ // We keep test != 0 because $this->total_localtax1 can be '0.00000000'
+ $datas['amountlt1'] = ' '.$langs->transcountry('AmountLT1', $mysoc->country_code).': '.price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_localtax2) && $this->total_localtax2 != 0) {
+ $datas['amountlt2'] = ' '.$langs->transcountry('AmountLT2', $mysoc->country_code).': '.price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_ttc)) {
+ $datas['amountttc'] = ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -1825,42 +1890,20 @@ class Facture extends CommonInvoice
if ($this->type == self::TYPE_DEPOSIT) {
$picto .= 'd'; // Deposit invoice
}
- $label = '';
-
- if ($user->hasRight("facture", "read")) {
- $label = img_picto('', $picto).' '.$langs->trans("Invoice").'';
- if (isset($this->statut) && isset($this->alreadypaid)) {
- $label .= ' '.$this->getLibStatut(5, $this->alreadypaid);
- }
- $label .= ' '.$this->getLibType(1);
- if (!empty($this->ref)) {
- $label .= ' '.$langs->trans('Ref').': '.$this->ref;
- }
- if (!empty($this->ref_client)) {
- $label .= ' '.$langs->trans('RefCustomer').': '.$this->ref_client;
- }
- if (!empty($this->date)) {
- $label .= ' '.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
- }
- if (!empty($this->total_ht)) {
- $label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_tva)) {
- $label .= ' '.$langs->trans('AmountVAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) { // We keep test != 0 because $this->total_localtax1 can be '0.00000000'
- $label .= ' '.$langs->transcountry('AmountLT1', $mysoc->country_code).': '.price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_localtax2) && $this->total_localtax2 != 0) {
- $label .= ' '.$langs->transcountry('AmountLT2', $mysoc->country_code).': '.price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_ttc)) {
- $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if ($moretitle) {
- $label .= ' - '.$moretitle;
- }
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'moretitle' => $moretitle,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
}
+ $label = implode($this->getTooltipContentArray($params));
$linkclose = ($target ? ' target="'.$target.'"' : '');
if (empty($notooltip) && $user->hasRight("facture", "read")) {
@@ -1868,8 +1911,8 @@ class Facture extends CommonInvoice
$label = $langs->trans("Invoice");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.'"';
}
$linkstart = 'ref, $max) : $this->ref);
diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php
index 1802c3d127d..b668880e9d3 100644
--- a/htdocs/compta/prelevement/line.php
+++ b/htdocs/compta/prelevement/line.php
@@ -312,7 +312,11 @@ if ($id) {
print img_object($langs->trans("ShowBill"), "bill");
print ' ';
- print ''.$obj->ref." | \n";
+ if ($type == 'bank-transfer') {
+ print ''.$obj->ref." | \n";
+ } else {
+ print ' '.$obj->ref."\n";
+ }
print ' ';
print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name." | \n";
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index b9963b1e16c..b44d22da312 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -133,6 +133,11 @@ class Contact extends CommonObject
public $civility_code;
public $civility;
+ /**
+ * @var string gender
+ */
+ public $gender;
+
/**
* @var int egroupware_id
*/
@@ -193,6 +198,11 @@ class Contact extends CommonObject
public $socid; // both socid and fk_soc are used
public $fk_soc; // both socid and fk_soc are used
+ /**
+ * @var string thirdparty name
+ */
+ public $socname;
+
/**
* @var int 0=inactive, 1=active
*/
@@ -206,6 +216,14 @@ class Contact extends CommonObject
*/
public $email;
+ /**
+ * Email
+ * @var string
+ * @deprecated
+ * @see $email
+ */
+ public $mail;
+
/**
* URL
* @var string
@@ -1045,12 +1063,12 @@ class Contact extends CommonObject
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_id ? $obj->country_code : '';
- $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
+ $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
- $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used
- $this->socid = $obj->fk_soc; // Both fk_soc and socid are used
- $this->socname = $obj->socname;
- $this->poste = $obj->poste;
+ $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used
+ $this->socid = $obj->fk_soc; // Both fk_soc and socid are used
+ $this->socname = $obj->socname;
+ $this->poste = $obj->poste;
$this->statut = $obj->statut;
$this->fk_prospectlevel = $obj->fk_prospectlevel;
@@ -1066,22 +1084,22 @@ class Contact extends CommonObject
$this->phone_perso = trim($obj->phone_perso);
$this->phone_mobile = trim($obj->phone_mobile);
- $this->email = $obj->email;
+ $this->email = $obj->email;
$this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array());
- $this->photo = $obj->photo;
- $this->priv = $obj->priv;
- $this->mail = $obj->email;
+ $this->photo = $obj->photo;
+ $this->priv = $obj->priv;
+ $this->mail = $obj->email;
$this->birthday = $this->db->jdate($obj->birthday);
- $this->note = $obj->note_private; // deprecated
- $this->note_private = $obj->note_private;
+ $this->note = $obj->note_private; // deprecated
+ $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
- $this->default_lang = $obj->default_lang;
+ $this->default_lang = $obj->default_lang;
$this->user_id = $obj->user_id;
- $this->user_login = $obj->user_login;
+ $this->user_login = $obj->user_login;
$this->canvas = $obj->canvas;
- $this->import_key = $obj->import_key;
+ $this->import_key = $obj->import_key;
// Define gender according to civility
$this->setGenderFromCivility();
@@ -1404,6 +1422,52 @@ class Contact extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $datas = [];
+
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("ShowContact")];
+ }
+ if (!empty($this->photo) && class_exists('Form')) {
+ $photo = ' ';
+ $photo .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
+ $photo .= ' ';
+ $datas['photo'] = $photo;
+ }
+
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Contact").' ' . $this->getLibStatut(4);
+ $datas['name'] = ' '.$langs->trans("Name").': '.$this->getFullName($langs);
+ // if ($this->civility_id) $datas['civility'] = ' ' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate civilty_id code
+ if (!empty($this->poste)) {
+ $datas['job'] = ' '.$langs->trans("Poste").': '.$this->poste;
+ }
+ $datas['email'] = ' '.$langs->trans("EMail").': '.$this->email;
+ $phonelist = array();
+ $country_code = empty($this->country_code) ? '': $this->country_code;
+ if ($this->phone_pro) {
+ $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone');
+ }
+ if ($this->phone_mobile) {
+ $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile');
+ }
+ if ($this->phone_perso) {
+ $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone');
+ }
+ $datas['phonelist'] = ' '.$langs->trans("Phone").': '.implode(' ', $phonelist);
+ $datas['address'] = ' '.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs);
+
+ return $datas;
+ }
+
/**
* Return name of contact with link (and eventually picto)
* Use $this->id, $this->lastname, $this->firstname, this->civility_id
@@ -1421,35 +1485,20 @@ class Contact extends CommonObject
{
global $conf, $langs, $hookmanager;
- $result = ''; $label = '';
- if (!empty($this->photo) && class_exists('Form')) {
- $label .= ' ';
- $label .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
- $label .= ' ';
- //$label .= ' ';
+ $result = '';
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
}
-
- $label .= img_picto('', $this->picto).' '.$langs->trans("Contact").'';
- $label .= ' '.$this->getLibStatut(4);
- $label .= ' '.$langs->trans("Name").': '.$this->getFullName($langs);
- //if ($this->civility_id) $label.= ' ' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code
- if (!empty($this->poste)) {
- $label .= ' '.$langs->trans("Poste").': '.$this->poste;
- }
- $label .= ' '.$langs->trans("EMail").': '.$this->email;
- $phonelist = array();
- $country_code = empty($this->country_code) ? '': $this->country_code;
- if ($this->phone_pro) {
- $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone');
- }
- if ($this->phone_mobile) {
- $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile');
- }
- if ($this->phone_perso) {
- $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone');
- }
- $label .= ' '.$langs->trans("Phone").': '.implode(' ', $phonelist);
- $label .= ' '.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs);
+ $label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id;
@@ -1473,7 +1522,7 @@ class Contact extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}
$linkstart = ' ';
if ($option == 'xxx') {
- $linkstart = '';
+ $linkstart = '';
$linkend = '';
}
@@ -1490,7 +1539,7 @@ class Contact extends CommonObject
if ($withpicto < 0) {
$result .= ' '.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'';
} else {
- $result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
}
if ($withpicto != 2 && $withpicto != -2) {
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 6078e33cb6a..97b586a2cde 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2014-2015 Marcos García
* Copyright (C) 2018 Nicolas ZABOURI
- * Copyright (C) 2018-2021 Frédéric France
+ * Copyright (C) 2018-2023 Frédéric France
* Copyright (C) 2015-2018 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
@@ -185,6 +185,7 @@ class Contrat extends CommonObject
public $nbofserviceswait;
public $nbofservicesopened;
public $nbofservicesexpired;
+ public $nbofservicesclosed;
//public $lower_planned_end_date;
//public $higher_planner_end_date;
@@ -1981,6 +1982,42 @@ class Contrat extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $datas = [];
+
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("ShowContract")];
+ }
+ if ($user->hasRight('contrat', 'lire')) {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Contract").'';
+ /* Status of a contract is status of all services, so disabled
+ if (isset($this->statut)) {
+ $label .= ' '.$this->getLibStatut(5);
+ }*/
+ $datas['ref'] = ' '.$langs->trans('Ref').': '.($this->ref ? $this->ref : $this->id);
+ $datas['refcustomer'] = ' '.$langs->trans('RefCustomer').': '. $this->ref_customer;
+ $datas['refsupplier'] = ' '.$langs->trans('RefSupplier').': '.$this->ref_supplier;
+ if (!empty($this->total_ht)) {
+ $datas['amountht'] = ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_tva)) {
+ $datas['vatamount'] = ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_ttc)) {
+ $datas['amounttc'] = ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ }
+ return $datas;
+ }
/**
* Return clicable name (with picto eventually)
@@ -2010,47 +2047,36 @@ class Contrat extends CommonObject
$url .= '&save_lastsearch_values=1';
}
//}
-
- $label = '';
-
- if ($user->rights->contrat->lire) {
- $label = img_picto('', $this->picto).' '.$langs->trans("Contract").'';
- /* Status of a contract is status of all services, so disabled
- if (isset($this->statut)) {
- $label .= ' '.$this->getLibStatut(5);
- }*/
- $label .= ' '.$langs->trans('Ref').': '.($this->ref ? $this->ref : $this->id);
- $ref_customer = (!empty($this->ref_customer) ? $this->ref_customer : (empty($this->ref_client) ? '' : $this->ref_client));
- $label .= ' '.$langs->trans('RefCustomer').': '.$ref_customer;
- $label .= ' '.$langs->trans('RefSupplier').': '.$this->ref_supplier;
- if (!empty($this->total_ht)) {
- $label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_tva)) {
- $label .= ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_ttc)) {
- $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- }
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
}
+ $label = implode($this->getTooltipContentArray($params));
+
$linkclose = '';
if (empty($notooltip) && $user->rights->contrat->lire) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
- $label = $langs->trans("ShowOrder");
+ $label = $langs->trans("ShowContract");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}
-
$linkstart = '';
$linkend = '';
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= ($this->ref ? $this->ref : $this->id);
@@ -3072,7 +3098,26 @@ class ContratLigne extends CommonObjectLine
}
/**
- * Return clicable name (with picto eventually)
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $datas = [];
+ $datas['label'] = $langs->trans("ShowContractOfService").': '.$this->label;
+ if (empty($datas['label'])) {
+ $datas['label'] = $this->description;
+ }
+
+ return $datas;
+ }
+
+ /**
+ * Return clicable name (with picto eventually) for ContratLigne
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max length
@@ -3087,8 +3132,19 @@ class ContratLigne extends CommonObjectLine
if (empty($label)) {
$label = $this->description;
}
-
- $link = '';
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $params = [
+ 'id' => $this->fk_contrat,
+ 'objecttype' => $this->element,
+ ];
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
+ // $label = $langs->trans('Loading');
+ }
+ $link = '';
$linkend = '';
$picto = 'service';
@@ -3097,7 +3153,7 @@ class ContratLigne extends CommonObjectLine
}
if ($withpicto) {
- $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';
diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php
new file mode 100644
index 00000000000..60220a221ff
--- /dev/null
+++ b/htdocs/core/ajax/ajaxtooltip.php
@@ -0,0 +1,234 @@
+
+ * Copyright (C) 2018-2023 Frédéric France
+ *
+ * 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/core/ajax/ajaxtooltip.php
+ * \ingroup tooltip
+ * \brief This script returns content of tooltip
+ */
+
+
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1); // Disables token renewal
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', '1');
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
+include '../../main.inc.php';
+include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+
+top_httphead();
+
+// opensurvey as aZ09 id
+$id = GETPOST('id', 'aZ09');
+$objecttype = GETPOST('objecttype', 'aZ09');
+
+$html = '';
+$regs = array();
+$params = array();
+if (GETPOSTISSET('infologin')) {
+ $params['infologin'] = GETPOST('infologin', 'int');
+}
+if (GETPOSTISSET('option')) {
+ $params['option'] = GETPOST('option', 'restricthtml');
+}
+// If we ask a resource form external module (instead of default path)
+if (preg_match('/^([^@]+)@([^@]+)$/i', $objecttype, $regs)) {
+ $myobject = $regs[1];
+ $module = $regs[2];
+} else {
+ // Parse $objecttype (ex: project_task)
+ $module = $myobject = $objecttype;
+ if (preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
+ $module = $regs[1];
+ $myobject = $regs[2];
+ }
+}
+
+// Generic case for $classpath
+$classpath = $module.'/class';
+
+// Special cases, to work with non standard path
+if ($objecttype == 'facture' || $objecttype == 'invoice') {
+ $langs->load('bills');
+ $classpath = 'compta/facture/class';
+ $module = 'facture';
+ $myobject = 'facture';
+} elseif ($objecttype == 'bank_account') {
+ $langs->loadLangs(['banks', 'compta']);
+ $classpath = 'compta/bank/class';
+ $module = 'banque';
+ $myobject = 'account';
+} elseif ($objecttype == 'category') {
+ $langs->loadLangs(['categories']);
+ $classpath = 'categories/class';
+ $module = 'categorie';
+ $myobject = 'categorie';
+} elseif ($objecttype == 'commande' || $objecttype == 'order') {
+ $langs->load('orders');
+ $classpath = 'commande/class';
+ $module = 'commande';
+ $myobject = 'commande';
+} elseif ($objecttype == 'propal') {
+ $langs->load('propal');
+ $classpath = 'comm/propal/class';
+} elseif ($objecttype == 'action') {
+ $langs->load('agenda');
+ $classpath = 'comm/action/class';
+ $module = 'agenda';
+ $myobject = 'actioncomm';
+} elseif ($objecttype == 'supplier_proposal') {
+ $langs->load('supplier_proposal');
+ $classpath = 'supplier_proposal/class';
+} elseif ($objecttype == 'shipping') {
+ $langs->load('sendings');
+ $classpath = 'expedition/class';
+ $myobject = 'expedition';
+ $module = 'expedition_bon';
+} elseif ($objecttype == 'delivery') {
+ $langs->load('deliveries');
+ $classpath = 'delivery/class';
+ $myobject = 'delivery';
+ $module = 'delivery_note';
+} elseif ($objecttype == 'contract') {
+ $langs->load('contracts');
+ $classpath = 'contrat/class';
+ $module = 'contrat';
+ $myobject = 'contrat';
+} elseif ($objecttype == 'member') {
+ $langs->load('members');
+ $classpath = 'adherents/class';
+ $module = 'adherent';
+ $myobject = 'adherent';
+} elseif ($objecttype == 'fichinter') {
+ $langs->load('interventions');
+ $classpath = 'fichinter/class';
+ $module = 'ficheinter';
+ $myobject = 'fichinter';
+} elseif ($objecttype == 'project') {
+ $langs->load('projects');
+ $classpath = 'projet/class';
+ $module = 'projet';
+} elseif ($objecttype == 'project_task') {
+ $classpath = 'projet/class';
+ $module = 'projet';
+ $myobject = 'task';
+} elseif ($objecttype == 'stock') {
+ $classpath = 'product/stock/class';
+ $module = 'stock';
+ $myobject = 'stock';
+} elseif ($objecttype == 'inventory') {
+ $classpath = 'product/inventory/class';
+ $module = 'stock';
+ $myobject = 'inventory';
+} elseif ($objecttype == 'mo') {
+ $classpath = 'mrp/class';
+ $module = 'mrp';
+ $myobject = 'mo';
+} elseif ($objecttype == 'productlot') {
+ $classpath = 'product/stock/class';
+ $module = 'stock';
+ $myobject = 'productlot';
+} elseif ($objecttype == 'usergroup') {
+ $classpath = 'user/class';
+ $module = 'user';
+ $myobject = 'usergroup';
+} elseif ($objecttype == 'dolresource') {
+ $classpath = 'resource/class';
+ $module = 'resource';
+ $myobject = 'dolresource';
+} elseif ($objecttype == 'opensurvey_sondage') {
+ $classpath = 'opensurvey/class';
+ $module = 'opensurvey';
+ $myobject = 'opensurveysondage';
+}
+
+// Generic case for $classfile and $classname
+$classfile = strtolower($myobject);
+$classname = ucfirst($myobject);
+
+if ($objecttype == 'invoice_supplier') {
+ $classfile = 'fournisseur.facture';
+ $classname = 'FactureFournisseur';
+ $classpath = 'fourn/class';
+ $module = 'fournisseur';
+} elseif ($objecttype == 'order_supplier') {
+ $classfile = 'fournisseur.commande';
+ $classname = 'CommandeFournisseur';
+ $classpath = 'fourn/class';
+ $module = 'fournisseur';
+} elseif ($objecttype == 'supplier_proposal') {
+ $classfile = 'supplier_proposal';
+ $classname = 'SupplierProposal';
+ $classpath = 'supplier_proposal/class';
+ $module = 'supplier_proposal';
+} elseif ($objecttype == 'stock') {
+ $classpath = 'product/stock/class';
+ $classfile = 'entrepot';
+ $classname = 'Entrepot';
+} elseif ($objecttype == 'facturerec') {
+ $classpath = 'compta/facture/class';
+ $classfile = 'facture-rec';
+ $classname = 'FactureRec';
+ $module = 'facture';
+} elseif ($objecttype == 'mailing') {
+ $classpath = 'comm/mailing/class';
+ $classfile = 'mailing';
+ $classname = 'Mailing';
+} elseif ($objecttype == 'adherent_type') {
+ $classpath = 'adherents/class';
+ $classfile = 'adherent_type';
+ $module = 'adherent';
+ $myobject = 'adherent_type';
+ $classname = 'AdherentType';
+} elseif ($objecttype == 'contact') {
+ $module = 'societe';
+} elseif ($objecttype == 'salary') {
+ $classpath = 'salaries/class';
+ $module = 'salaries';
+}
+// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath." ";
+
+if (isModEnabled($module)) {
+ $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
+ if ($res) {
+ if (class_exists($classname)) {
+ $object = new $classname($db);
+ $res = $object->fetch($id);
+ if ($res > 0) {
+ $html = $object->getTooltipContent($params);
+ } elseif ($res == 0) {
+ $html = $langs->trans('Deleted');
+ }
+ unset($object);
+ } else {
+ dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR);
+ }
+ }
+}
+
+print $html;
+
+$db->close();
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index cf0bfa6ed3b..4dd466d96ab 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -908,7 +908,7 @@ class CMailFile
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
- $storage = new DoliStorage($db, $conf);
+ $storage = new DoliStorage($db, $conf, $keyforprovider);
try {
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
$expire = false;
@@ -1030,7 +1030,7 @@ class CMailFile
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
- $storage = new DoliStorage($db, $conf);
+ $storage = new DoliStorage($db, $conf, $keyforprovider);
try {
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 33f0b369c14..33d5e5a97c6 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -553,6 +553,12 @@ abstract class CommonDocGenerator
$resarray[$array_key.'_project_description'] = $object->project->description;
$resarray[$array_key.'_project_date_start'] = dol_print_date($object->project->date_start, 'day');
$resarray[$array_key.'_project_date_end'] = dol_print_date($object->project->date_end, 'day');
+ } else { // empty replacement
+ $resarray[$array_key.'_project_ref'] ='';
+ $resarray[$array_key.'_project_title'] = '';
+ $resarray[$array_key.'_project_description'] = '';
+ $resarray[$array_key.'_project_date_start'] = '';
+ $resarray[$array_key.'_project_date_end'] = '';
}
// Add vat by rates
@@ -716,6 +722,14 @@ abstract class CommonDocGenerator
foreach ($tmpproduct->array_options as $key => $label) {
$resarray["line_product_".$key] = $label;
}
+ } else {
+ // Set unused placeholders as blank
+ $extrafields->fetch_name_optionals_label("product");
+ $extralabels = $extrafields->attributes["product"]['label'];
+
+ foreach ($extralabels as $key => $label) {
+ $resarray['line_product_options_'.$key] = '';
+ }
}
return $resarray;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index d30d88e9c37..98836dff8cc 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -593,6 +593,11 @@ abstract class CommonObject
protected $labelStatus;
protected $labelStatusShort;
+ /**
+ * @var int showphoto_on_popup
+ */
+ public $showphoto_on_popup;
+
/**
* @var array nb used in load_stateboard
*/
@@ -664,6 +669,57 @@ abstract class CommonObject
}
return -1;
}
+ /**
+ * getTooltipContentArray
+ *
+ * @since v18
+ * @param array $params params to construct tooltip data
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ return [];
+ }
+
+ /**
+ * getTooltipContent
+ *
+ * @param array $params params
+ * @since v18
+ * @return string
+ */
+ public function getTooltipContent($params)
+ {
+ global $action, $extrafields, $langs, $hookmanager;
+
+ $datas = $this->getTooltipContentArray($params);
+
+ if (!empty($extrafields->attributes[$this->table_element]['label'])) {
+ foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
+ if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) {
+ $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
+ }
+ $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
+ if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
+ $datas[$key]= ' '. $labelextra . '';
+ } else {
+ $value = $this->array_options['options_' . $key];
+ $datas[$key]= ' '. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
+ }
+ }
+ }
+
+ $hookmanager->initHooks(array($this->element . 'dao'));
+ $parameters = array(
+ 'tooltipcontentarray' => &$datas
+ );
+ // Note that $action and $object may have been modified by some hooks
+ $hookmanager->executeHooks('getTooltipContent', $parameters, $this, $action);
+
+ $label = implode($datas);
+
+ return $label;
+ }
/**
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index c6cf71fbe44..7de2938e299 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -202,9 +202,10 @@ class Form
* @param string $paramid Key of parameter for id ('id', 'socid')
* @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date)
* @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1)
+ * @param string $editaction [=''] use GETPOST default action or set action to edit mode
* @return string HTML edit field
*/
- public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 1, $formatfunc = '', $paramid = 'id', $gm = 'auto', $moreoptions = array())
+ public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 1, $formatfunc = '', $paramid = 'id', $gm = 'auto', $moreoptions = array(), $editaction = '')
{
global $conf, $langs;
@@ -233,7 +234,10 @@ class Form
if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
$ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg);
} else {
- $editmode = (GETPOST('action', 'aZ09') == 'edit'.$htmlname);
+ if ($editaction == '') {
+ $editaction = GETPOST('action', 'aZ09');
+ }
+ $editmode = ($editaction == 'edit'.$htmlname);
if ($editmode) {
$ret .= "\n";
$ret .= ' |