Merge pull request #16031 from frederic34/commtpl

add more infos in link
This commit is contained in:
Laurent Destailleur 2021-01-21 13:24:17 +01:00 committed by GitHub
commit f160246272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 53 deletions

View File

@ -531,11 +531,12 @@ if ($object->id > 0)
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('IntracommReportTransportMode');
print '<td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'edittransportmode')
{
if ($action == 'edittransportmode') {
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1);
}
else {
@ -562,8 +563,7 @@ if ($object->id > 0)
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent
if (!empty($conf->adherent->enabled))
{
if (!empty($conf->adherent->enabled)) {
$langs->load("members");
$langs->load("users");
@ -571,10 +571,9 @@ if ($object->id > 0)
print '<td>';
$adh = new Adherent($db);
$result = $adh->fetch('', '', $object->id);
if ($result > 0)
{
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
print $adh->getNomUrl(1);
print $adh->getNomUrl(-1);
} else {
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
}

View File

@ -1259,15 +1259,13 @@ if ($resql)
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0)
{
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val)
{
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
@ -1275,11 +1273,16 @@ if ($resql)
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print $userstatic->getNomUrl(-2);
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}

View File

@ -716,15 +716,13 @@ while ($i < min($num, $limit))
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) {
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0)
{
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val)
{
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
@ -732,11 +730,17 @@ while ($i < min($num, $limit))
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print $userstatic->getNomUrl(-2);
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}

View File

@ -766,8 +766,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['s.nom']['checked']))
{
print '<td class="tdoverflowmax100">';
if ($obj->socid)
{
if ($obj->socid) {
print $socstatic->getNomUrl(1);
} else {
print '&nbsp;';
@ -776,24 +775,20 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Sales Representatives
if (!empty($arrayfields['commercial']['checked']))
{
if (!empty($arrayfields['commercial']['checked'])) {
print '<td>';
if ($obj->socid)
{
if ($obj->socid) {
$socstatic->id = $obj->socid;
$socstatic->name = $obj->name;
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0)
{
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val)
{
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
@ -801,10 +796,15 @@ while ($i < min($num, $limit))
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
print $userstatic->getNomUrl(1, '', 0, 0, 12);
//print $userstatic->getNomUrl(-2);
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
if ($j < $nbofsalesrepresentative) {
print ' ';
}
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");

View File

@ -303,8 +303,7 @@ abstract class ActionsCardCommon
if ($nbofsalesrepresentative > 3) // We print only number
{
$this->tpl['sales_representatives'] .= $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0)
{
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($this->db);
$i = 0;
foreach ($listsalesrepresentatives as $val)

View File

@ -2753,11 +2753,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Parent company
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY))
{
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'.$langs->trans('ParentCompany').'</td>';
if ($action != 'editparentcompany' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editparentcompany&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
if ($action != 'editparentcompany' && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editparentcompany&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
$html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none';
@ -2769,17 +2770,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent
if (!empty($conf->adherent->enabled))
{
if (!empty($conf->adherent->enabled)) {
$langs->load("members");
print '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<td>';
$adh = new Adherent($db);
$result = $adh->fetch('', '', $object->id);
if ($result > 0)
{
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
print $adh->getNomUrl(1);
print $adh->getNomUrl(-1);
} else {
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
}

View File

@ -2197,7 +2197,7 @@ class Societe extends CommonObject
$reparray = array();
$sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo";
$sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo, u.gender";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
@ -2234,6 +2234,7 @@ class Societe extends CommonObject
$reparray[$i]['entity'] = $obj->entity;
$reparray[$i]['login'] = $obj->login;
$reparray[$i]['photo'] = $obj->photo;
$reparray[$i]['gender'] = $obj->gender;
} else {
$reparray[] = $obj->rowid;
}

View File

@ -16,8 +16,7 @@
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf))
{
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit;
}
@ -42,7 +41,9 @@ if ($action == 'editsalesrepresentatives') {
print '<input type="hidden" name="socid" value="'.$object->id.'" />';
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
$arrayselected = GETPOST('commercial', 'array');
if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1);
if (empty($arrayselected)) {
$arrayselected = $object->getSalesRepresentatives($user, 1);
}
print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%");
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'" />';
print '</form>';
@ -62,6 +63,7 @@ if ($action == 'editsalesrepresentatives') {
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->entity = $val['entity'];
$userstatic->gender = $val['gender'];
print $userstatic->getNomUrl(-1);
print ' ';
}