Merge pull request #8798 from atm-florian/6.0

fix SQL and add hook
This commit is contained in:
Laurent Destailleur 2018-05-18 11:18:10 +02:00 committed by GitHub
commit 2e9f5d1c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 19 deletions

View File

@ -49,6 +49,7 @@ $socid=0;
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id,'projet&project');
$hookmanager->initHooks(array('projectcontactcard','globalcard'));
/*
* Actions
@ -150,26 +151,26 @@ if ($id > 0 || ! empty($ref))
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Title
$morehtmlref.=$object->title;
// Thirdparty
if ($object->thirdparty->id > 0)
if ($object->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -178,7 +179,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject');
@ -192,7 +193,7 @@ if ($id > 0 || ! empty($ref))
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print '</td></tr>';
// Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %';
@ -203,7 +204,7 @@ if ($id > 0 || ! empty($ref))
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
print '</td></tr>';
}
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
$start = dol_print_date($object->date_start,'dayhour');
@ -222,40 +223,40 @@ if ($id > 0 || ! empty($ref))
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print "</table>";
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($object->description);
print '</td></tr>';
// Categories
if ($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id,'project',1);
print "</td></tr>";
}
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
print '<br>';
// Contacts lines (modules that overwrite templates must declare this into descriptor)
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)

View File

@ -145,7 +145,7 @@ $morehtmlref.='</div>';
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
$object->next_prev_filter=" te.rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);