diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0b108d8b759..f7aa1990f13 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5916,19 +5916,20 @@ class Form
/**
* Output html select to select thirdparty
*
- * @param string $page Page
- * @param string $selected Id preselected
- * @param string $htmlname Name of HTML select
- * @param string $filter Optional filters criteras. Do not use a filter coming from input of users.
- * @param int $showempty Add an empty field
- * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
- * @param int $forcecombo Force to use combo box
- * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
- * @param int $nooutput No print output. Return it only.
- * @param array $excludeids Exclude IDs from the select combo
+ * @param string $page Page
+ * @param string $selected Id preselected
+ * @param string $htmlname Name of HTML select
+ * @param string $filter Optional filters criteras. Do not use a filter coming from input of users.
+ * @param int $showempty Add an empty field
+ * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
+ * @param int $forcecombo Force to use combo box
+ * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
+ * @param int $nooutput No print output. Return it only.
+ * @param array $excludeids Exclude IDs from the select combo
+ * @param string $textifnothirdparty Text to show if no thirdparty
* @return void|string
*/
- public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0, $excludeids = array())
+ public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0, $excludeids = array(), $textifnothirdparty = '')
{
// phpcs:enable
global $langs;
@@ -5946,9 +5947,9 @@ class Form
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$soc = new Societe($this->db);
$soc->fetch($selected);
- $out .= $soc->getNomUrl($langs);
+ $out .= $soc->getNomUrl(0, '');
} else {
- $out .= " ";
+ $out .= ''.$textifnothirdparty.'';
}
}
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index c61d794fcdc..b6001b2b27b 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -37,6 +37,7 @@ OpportunitiesStatusForOpenedProjects=Leads amount of open projects by status
OpportunitiesStatusForProjects=Leads amount of projects by status
ShowProject=Show project
ShowTask=Show task
+SetThirdParty=Set third party
SetProject=Set project
OutOfProject=Out of project
NoProject=No project defined or owned
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 38bb55b5a24..1495df77df7 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1279,7 +1279,7 @@ class Project extends CommonObject
$label .= ($label ? '
' : '').''.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
if (isset($this->public)) {
$label .= '
'.$langs->trans("Visibility").": ";
- $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"').$langs->trans("PrivateProject"));
+ $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject"));
}
if (!empty($this->thirdparty_name)) {
$label .= ($label ? '
' : '').''.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
@@ -1340,7 +1340,7 @@ class Project extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php
index eae0ae829e2..ac121045597 100644
--- a/htdocs/ticket/agenda.php
+++ b/htdocs/ticket/agenda.php
@@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+if (isModEnabled('project')) {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
+}
// Load translation files required by the page
$langs->loadLangs(array('companies', 'other', 'ticket'));
@@ -179,21 +184,18 @@ if ($object->fk_user_create > 0) {
// Thirdparty
if (isModEnabled("societe")) {
$morehtmlref .= '
';
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
- $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
- }*/
- if ($action == 'editcustomer') {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
- } else {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1);
+ $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
+ if ($action != 'editcustomer' && 0) {
+ $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' ';
}
+ $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);
}
// Project
if (isModEnabled('project')) {
$langs->load("projects");
- $morehtmlref .= '
';
- if ($permissiontoadd) {
+ if (0) {
+ $morehtmlref .= '
';
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
@@ -201,6 +203,7 @@ if (isModEnabled('project')) {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, '');
} else {
if (!empty($object->fk_project)) {
+ $morehtmlref .= '
';
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index eb824beb1d3..650735b7ec0 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -953,24 +953,24 @@ if ($action == 'create' || $action == 'presend') {
$morehtmlref .= dol_escape_htmltag($object->origin_email).' - '.$form->textwithpicto($langs->trans("CreatedByPublicPortal"), $htmltooptip, 1, 'help', '', 0, 3, 'tooltip').'';
}
+ $permissiontoedit = $object->status < 8 && !$user->socid && $user->rights->ticket->write;
+ //$permissiontoedit = 0;
+
// Thirdparty
if (isModEnabled("societe")) {
$morehtmlref .= '
';
- if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
- $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' ';
- }
- if ($action == 'editcustomer') {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
- } else {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1);
+ $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
+ if ($action != 'editcustomer' && $permissiontoedit) {
+ $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' ';
}
+ $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);
}
// Project
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '
';
- if ($permissiontoadd) {
+ if ($permissiontoedit) {
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index f045923e75d..5e7cadf07fe 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -34,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+if (isModEnabled('project')) {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
+}
// Load translation files required by the page
$langs->loadLangs(array('companies', 'ticket'));
@@ -213,21 +218,18 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
// Thirdparty
if (isModEnabled("societe")) {
$morehtmlref .= '
';
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
- $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
- }*/
- if ($action == 'editcustomer') {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
- } else {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1);
+ $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
+ if ($action != 'editcustomer' && 0) {
+ $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' ';
}
+ $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);
}
// Project
if (isModEnabled('project')) {
$langs->load("projects");
- $morehtmlref .= '
';
- if ($permissiontoadd) {
+ if (0) {
+ $morehtmlref .= '
';
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
@@ -235,6 +237,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, '');
} else {
if (!empty($object->fk_project)) {
+ $morehtmlref .= '
';
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);
diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php
index daa74536d1a..8a95623444f 100644
--- a/htdocs/ticket/document.php
+++ b/htdocs/ticket/document.php
@@ -33,6 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+if (isModEnabled('project')) {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
+}
// Load translation files required by the page
$langs->loadLangs(array("companies", "other", "ticket", "mails"));
@@ -148,21 +153,18 @@ if ($object->id) {
// Thirdparty
if (isModEnabled("societe")) {
$morehtmlref .= '
';
- /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
- $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' ';
- }*/
- if ($action == 'editcustomer') {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
- } else {
- $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1);
+ $morehtmlref .= img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth"');
+ if ($action != 'editcustomer' && 0) {
+ $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).' ';
}
+ $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, $action == 'editcustomer' ? 'editcustomer' : 'none', '', 1, 0, 0, array(), 1);
}
// Project
if (isModEnabled('project')) {
$langs->load("projects");
- $morehtmlref .= '
';
- if ($permissiontoadd) {
+ if (0) {
+ $morehtmlref .= '
';
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' ';
@@ -170,6 +172,7 @@ if ($object->id) {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, ($action == 'classify' ? 1 : 0), 0, 1, '');
} else {
if (!empty($object->fk_project)) {
+ $morehtmlref .= '
';
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= $proj->getNomUrl(1);