Merge pull request #21433 from FHenry/dev_add_customer_to_timelist
NEW : add thirdparty column to time list (projet/tasks/time.php)
This commit is contained in:
commit
0704cd5b82
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langsLoad=array('projects', 'bills', 'orders');
|
$langsLoad=array('projects', 'bills', 'orders', 'companies');
|
||||||
if (!empty($conf->eventorganization->enabled)) {
|
if (!empty($conf->eventorganization->enabled)) {
|
||||||
$langsLoad[]='eventorganization';
|
$langsLoad[]='eventorganization';
|
||||||
}
|
}
|
||||||
@ -73,6 +73,7 @@ $search_task_ref = GETPOST('search_task_ref', 'alpha');
|
|||||||
$search_task_label = GETPOST('search_task_label', 'alpha');
|
$search_task_label = GETPOST('search_task_label', 'alpha');
|
||||||
$search_user = GETPOST('search_user', 'int');
|
$search_user = GETPOST('search_user', 'int');
|
||||||
$search_valuebilled = GETPOST('search_valuebilled', 'int');
|
$search_valuebilled = GETPOST('search_valuebilled', 'int');
|
||||||
|
$search_company = GETPOST('$search_company', 'alpha');
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
@ -161,6 +162,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_date_creation = '';
|
$search_date_creation = '';
|
||||||
$search_date_update = '';
|
$search_date_update = '';
|
||||||
$search_task_ref = '';
|
$search_task_ref = '';
|
||||||
|
$search_company = '';
|
||||||
$search_task_label = '';
|
$search_task_label = '';
|
||||||
$search_user = 0;
|
$search_user = 0;
|
||||||
$search_valuebilled = '';
|
$search_valuebilled = '';
|
||||||
@ -1071,6 +1073,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
$arrayfields = array();
|
$arrayfields = array();
|
||||||
$arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1);
|
$arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1);
|
||||||
|
$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1);
|
||||||
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
|
if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task
|
||||||
$arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1);
|
$arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1);
|
||||||
$arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1);
|
$arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1);
|
||||||
@ -1104,6 +1107,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
if ($search_task_ref != '') {
|
if ($search_task_ref != '') {
|
||||||
$param .= '&search_task_ref='.urlencode($search_task_ref);
|
$param .= '&search_task_ref='.urlencode($search_task_ref);
|
||||||
}
|
}
|
||||||
|
if ($search_company != '') {
|
||||||
|
$param .= '&$search_company='.urlencode($search_company);
|
||||||
|
}
|
||||||
if ($search_task_label != '') {
|
if ($search_task_label != '') {
|
||||||
$param .= '&search_task_label='.urlencode($search_task_label);
|
$param .= '&search_task_label='.urlencode($search_task_label);
|
||||||
}
|
}
|
||||||
@ -1304,6 +1310,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
$sql .= " pt.ref, pt.label, pt.fk_projet,";
|
$sql .= " pt.ref, pt.label, pt.fk_projet,";
|
||||||
$sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,";
|
$sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,";
|
||||||
$sql .= " il.fk_facture as invoice_id, inv.fk_statut,";
|
$sql .= " il.fk_facture as invoice_id, inv.fk_statut,";
|
||||||
|
$sql .= " p.fk_soc,";
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
@ -1312,13 +1319,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facturedet as il ON il.rowid = t.invoice_line_id";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facturedet as il ON il.rowid = t.invoice_line_id";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture";
|
||||||
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as pt ON pt.rowid = t.fk_task";
|
||||||
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON t.fk_user = u.rowid";
|
||||||
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = pt.fk_projet";
|
||||||
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||||
|
|
||||||
// Add table from hooks
|
// Add table from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
$sql .= " WHERE 1 = 1 ";
|
||||||
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
|
||||||
|
|
||||||
if (empty($projectidforalltimes) && empty($allprojectforuser)) {
|
if (empty($projectidforalltimes) && empty($allprojectforuser)) {
|
||||||
// Limit on one task
|
// Limit on one task
|
||||||
$sql .= " AND t.fk_task =".((int) $object->id);
|
$sql .= " AND t.fk_task =".((int) $object->id);
|
||||||
@ -1339,6 +1349,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
if ($search_task_ref) {
|
if ($search_task_ref) {
|
||||||
$sql .= natural_search('pt.ref', $search_task_ref);
|
$sql .= natural_search('pt.ref', $search_task_ref);
|
||||||
}
|
}
|
||||||
|
if ($search_company) {
|
||||||
|
$sql .= natural_search('s.nom', $search_company);
|
||||||
|
}
|
||||||
if ($search_task_label) {
|
if ($search_task_label) {
|
||||||
$sql .= natural_search('pt.label', $search_task_label);
|
$sql .= natural_search('pt.label', $search_task_label);
|
||||||
}
|
}
|
||||||
@ -1572,6 +1585,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
print $formother->selectyear($search_year, 'search_year', 1, 20, 5);
|
print $formother->selectyear($search_year, 'search_year', 1, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Thirdparty
|
||||||
|
if (!empty($arrayfields['p.fk_soc']['checked'])) {
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($allprojectforuser)) {
|
if (!empty($allprojectforuser)) {
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
@ -1624,6 +1642,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
if (!empty($arrayfields['t.task_date']['checked'])) {
|
if (!empty($arrayfields['t.task_date']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
if (!empty($arrayfields['p.fk_soc']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['p.fk_soc']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder);
|
||||||
|
}
|
||||||
if (!empty($allprojectforuser)) {
|
if (!empty($allprojectforuser)) {
|
||||||
print_liste_field_titre("Project", $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Project", $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
@ -1697,6 +1718,23 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Thirdparty
|
||||||
|
if (!empty($arrayfields['p.fk_soc']['checked'])) {
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
if (empty($conf->cache['thridparty'][$task_time->fk_soc])) {
|
||||||
|
$tmpsociete = new Societe($db);
|
||||||
|
$tmpsociete->fetch($task_time->fk_soc);
|
||||||
|
$conf->cache['thridparty'][$task_time->fk_soc] = $tmpsociete;
|
||||||
|
} else {
|
||||||
|
$tmpsociete = $conf->cache['thridparty'][$task_time->fk_soc];
|
||||||
|
}
|
||||||
|
print $tmpsociete->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Project ref
|
// Project ref
|
||||||
if (!empty($allprojectforuser)) {
|
if (!empty($allprojectforuser)) {
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user