Dolibarize module ticket
This commit is contained in:
parent
ff505ba148
commit
a7d472bf7b
@ -34,7 +34,7 @@ if (!empty($conf->projet->enabled)) {
|
||||
}
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("ticketsup","companies","other"));
|
||||
$langs->loadLangs(array("ticketsup","companies","other","projects"));
|
||||
|
||||
|
||||
// Get parameters
|
||||
@ -53,6 +53,7 @@ $id = GETPOST('id','int');
|
||||
$msg_id = GETPOST('msg_id', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$projectid = GETPOST('projectid', 'int');
|
||||
$search_fk_project=GETPOST('search_fk_project','int')?GETPOST('search_fk_project','int'):GETPOST('projectid','int');
|
||||
$search_fk_status = GETPOST('search_fk_status', 'alpha');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
@ -112,6 +113,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
if ($projectid > 0)
|
||||
{
|
||||
unset($arrayfields['t.fk_project']);
|
||||
}
|
||||
|
||||
|
||||
// Filters
|
||||
@ -121,7 +126,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
// $search_type = GETPOST("search_type", 'alpha');
|
||||
// $search_category = GETPOST("search_category", 'alpha');
|
||||
// $search_severity = GETPOST("search_severity", 'alpha');
|
||||
// $search_project = GETPOST("search_project", 'int');
|
||||
// $search_fk_project = GETPOST("search_fk_project", 'int');
|
||||
// $search_fk_user_create = GETPOST("search_fk_user_create", 'int');
|
||||
// $search_fk_user_assign = GETPOST("search_fk_user_assign", 'int');
|
||||
|
||||
@ -218,7 +223,7 @@ foreach($search as $key => $val)
|
||||
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search));
|
||||
}
|
||||
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
|
||||
if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project);
|
||||
if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY))) {
|
||||
$sql.= " AND t.fk_user_assign=".$user->id;
|
||||
}
|
||||
@ -336,11 +341,14 @@ if ($socid && !$projectid && $user->rights->societe->lire) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($projectid) {
|
||||
if ($projectid > 0) {
|
||||
$projectstat = new Project($db);
|
||||
if ($projectstat->fetch($projectid) > 0) {
|
||||
$projectstat->fetch_thirdparty();
|
||||
|
||||
$savobject = $object;
|
||||
$object = $projectstat;
|
||||
|
||||
// To verify role of users
|
||||
//$userAccess = $object->restrictedProjectArea($user,'read');
|
||||
$userWrite = $projectstat->restrictedProjectArea($user, 'write');
|
||||
@ -348,55 +356,52 @@ if ($projectid) {
|
||||
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
|
||||
|
||||
$head = project_prepare_head($projectstat);
|
||||
dol_fiche_head($head, 'ticketsup', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project'));
|
||||
dol_fiche_head($head, 'ticketsup', $langs->trans("Project"), -1, ($projectstat->public ? 'projectpub' : 'project'));
|
||||
|
||||
// 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)
|
||||
{
|
||||
$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);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
/*
|
||||
* Projet synthese pour rappel
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/projet/list.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td><td>';
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (!$user->rights->projet->all->lire) {
|
||||
$objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
|
||||
$projectstat->next_prev_filter = " rowid in (" . (count($objectsListId) ? join(',', array_keys($objectsListId)) : '0') . ")";
|
||||
}
|
||||
print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td><td>' . $projectstat->title . '</td></tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>" . $langs->trans("ThirdParty") . "</td>";
|
||||
print '<td>';
|
||||
if ($projectstat->thirdparty->id > 0) {
|
||||
print $projectstat->thirdparty->getNomUrl(1);
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
print '<tr><td>' . $langs->trans("Visibility") . '</td><td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>';
|
||||
if ($projectstat->public) {
|
||||
print $langs->trans('SharedProject');
|
||||
} else {
|
||||
print $langs->trans('PrivateProject');
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>' . $langs->trans("Status") . '</td><td>' . $projectstat->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
dol_fiche_end();
|
||||
|
||||
$object = $savobject;
|
||||
|
||||
} else {
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
@ -591,24 +596,24 @@ while ($i < min($num, $limit))
|
||||
print '<tr class="oddeven">';
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
if ($align) print ' class="'.$align.'"';
|
||||
print '>';
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
{
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
}
|
||||
}
|
||||
$align='';
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
if ($align) print ' class="'.$align.'"';
|
||||
print '>';
|
||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! empty($val['isameasure']))
|
||||
{
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user