mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean code
This commit is contained in:
parent
5b22eeab31
commit
0f8d87da3b
|
|
@ -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 .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1279,7 +1279,7 @@ class Project extends CommonObject
|
|||
$label .= ($label ? '<br>' : '').'<b>'.$langs->trans('Label').': </b>'.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
|
||||
if (isset($this->public)) {
|
||||
$label .= '<br><b>'.$langs->trans("Visibility").":</b> ";
|
||||
$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 ? '<br>' : '').'<b>'.$langs->trans('ThirdParty').': </b>'.$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;
|
||||
|
|
|
|||
|
|
@ -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 .= '<br>';
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&token='.newToken().'&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a> ';
|
||||
}*/
|
||||
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 .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
|
||||
}
|
||||
$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 .= '<br>';
|
||||
if ($permissiontoadd) {
|
||||
if (0) {
|
||||
$morehtmlref .= '<br>';
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
|
|
@ -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 .= '<br>';
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
|
|
|
|||
|
|
@ -953,24 +953,24 @@ if ($action == 'create' || $action == 'presend') {
|
|||
$morehtmlref .= dol_escape_htmltag($object->origin_email).' <small class="hideonsmartphone opacitymedium">- '.$form->textwithpicto($langs->trans("CreatedByPublicPortal"), $htmltooptip, 1, 'help', '', 0, 3, 'tooltip').'</small>';
|
||||
}
|
||||
|
||||
$permissiontoedit = $object->status < 8 && !$user->socid && $user->rights->ticket->write;
|
||||
//$permissiontoedit = 0;
|
||||
|
||||
// Thirdparty
|
||||
if (isModEnabled("societe")) {
|
||||
$morehtmlref .= '<br>';
|
||||
if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 0).'</a> ';
|
||||
}
|
||||
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 .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
|
||||
}
|
||||
$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 .= '<br>';
|
||||
if ($permissiontoadd) {
|
||||
if ($permissiontoedit) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
|
|
|
|||
|
|
@ -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 .= '<br>';
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&token='.newToken().'&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a> ';
|
||||
}*/
|
||||
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 .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
|
||||
}
|
||||
$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 .= '<br>';
|
||||
if ($permissiontoadd) {
|
||||
if (0) {
|
||||
$morehtmlref .= '<br>';
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
|
|
@ -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 .= '<br>';
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
|
|
|
|||
|
|
@ -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 .= '<br>';
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&token='.newToken().'&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a> ';
|
||||
}*/
|
||||
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 .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('SetThirdParty'), 0).'</a> ';
|
||||
}
|
||||
$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 .= '<br>';
|
||||
if ($permissiontoadd) {
|
||||
if (0) {
|
||||
$morehtmlref .= '<br>';
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
|
|
@ -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 .= '<br>';
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user