NEW : Contact filter project list
This commit is contained in:
parent
cd954e4ec3
commit
7a4b0e38cd
@ -1690,12 +1690,17 @@ class Form
|
|||||||
$out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
|
$out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
|
if($showempty && !is_numeric($showempty)) {
|
||||||
$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';
|
$textforempty = $showempty;
|
||||||
}
|
$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
|
||||||
if ($showempty == 2) {
|
} else {
|
||||||
$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
|
if(($showempty == 1 || ($showempty == 3 && $num > 1)) && ! $multiple) {
|
||||||
}
|
$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';
|
||||||
|
}
|
||||||
|
if($showempty == 2) {
|
||||||
|
$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num) {
|
if ($num) {
|
||||||
|
|||||||
@ -197,6 +197,7 @@ InputPerMonth=Input per month
|
|||||||
InputDetail=Input detail
|
InputDetail=Input detail
|
||||||
TimeAlreadyRecorded=This is time spent already recorded for this task/day and user %s
|
TimeAlreadyRecorded=This is time spent already recorded for this task/day and user %s
|
||||||
ProjectsWithThisUserAsContact=Projects with this user as contact
|
ProjectsWithThisUserAsContact=Projects with this user as contact
|
||||||
|
ProjectsWithThisContact=Projects with this contact
|
||||||
TasksWithThisUserAsContact=Tasks assigned to this user
|
TasksWithThisUserAsContact=Tasks assigned to this user
|
||||||
ResourceNotAssignedToProject=Not assigned to project
|
ResourceNotAssignedToProject=Not assigned to project
|
||||||
ResourceNotAssignedToTheTask=Not assigned to the task
|
ResourceNotAssignedToTheTask=Not assigned to the task
|
||||||
|
|||||||
@ -197,6 +197,7 @@ InputPerMonth=Saisie par mois
|
|||||||
InputDetail=Saisir le détail
|
InputDetail=Saisir le détail
|
||||||
TimeAlreadyRecorded=C'est le temps passé déjà enregistré pour cette tâche/jour et pour l'utilisateur %s
|
TimeAlreadyRecorded=C'est le temps passé déjà enregistré pour cette tâche/jour et pour l'utilisateur %s
|
||||||
ProjectsWithThisUserAsContact=Projets avec cet utilisateur comme contact
|
ProjectsWithThisUserAsContact=Projets avec cet utilisateur comme contact
|
||||||
|
ProjectsWithThisContact=Projets avec ce contact
|
||||||
TasksWithThisUserAsContact=Tâches assignées à cet utilisateur
|
TasksWithThisUserAsContact=Tâches assignées à cet utilisateur
|
||||||
ResourceNotAssignedToProject=Non assigné au projet
|
ResourceNotAssignedToProject=Non assigné au projet
|
||||||
ResourceNotAssignedToTheTask=Non assigné à la tache
|
ResourceNotAssignedToTheTask=Non assigné à la tache
|
||||||
|
|||||||
@ -98,6 +98,7 @@ $search_opp_amount = GETPOST("search_opp_amount", 'alpha');
|
|||||||
$search_budget_amount = GETPOST("search_budget_amount", 'alpha');
|
$search_budget_amount = GETPOST("search_budget_amount", 'alpha');
|
||||||
$search_public = GETPOST("search_public", 'int');
|
$search_public = GETPOST("search_public", 'int');
|
||||||
$search_project_user = GETPOST('search_project_user', 'int');
|
$search_project_user = GETPOST('search_project_user', 'int');
|
||||||
|
$search_project_contact = GETPOST('search_project_contact', 'int');
|
||||||
$search_sale = GETPOST('search_sale', 'int');
|
$search_sale = GETPOST('search_sale', 'int');
|
||||||
$search_usage_opportunity = GETPOST('search_usage_opportunity', 'int');
|
$search_usage_opportunity = GETPOST('search_usage_opportunity', 'int');
|
||||||
$search_usage_task = GETPOST('search_usage_task', 'int');
|
$search_usage_task = GETPOST('search_usage_task', 'int');
|
||||||
@ -252,6 +253,7 @@ if (empty($reshook)) {
|
|||||||
$search_public = "";
|
$search_public = "";
|
||||||
$search_sale = "";
|
$search_sale = "";
|
||||||
$search_project_user = '';
|
$search_project_user = '';
|
||||||
|
$search_project_contact = '';
|
||||||
$search_sday = "";
|
$search_sday = "";
|
||||||
$search_smonth = "";
|
$search_smonth = "";
|
||||||
$search_syear = "";
|
$search_syear = "";
|
||||||
@ -363,13 +365,14 @@ if (empty($user->rights->projet->all->lire)) {
|
|||||||
|
|
||||||
// Get id of types of contacts for projects (This list never contains a lot of elements)
|
// Get id of types of contacts for projects (This list never contains a lot of elements)
|
||||||
$listofprojectcontacttype = array();
|
$listofprojectcontacttype = array();
|
||||||
$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
$listofprojectcontacttypeexternal = array();
|
||||||
|
$sql = "SELECT ctc.rowid, ctc.code, ctc.source FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||||
$sql .= " WHERE ctc.element = '".$db->escape($object->element)."'";
|
$sql .= " WHERE ctc.element = '".$db->escape($object->element)."'";
|
||||||
$sql .= " AND ctc.source = 'internal'";
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
$listofprojectcontacttype[$obj->rowid] = $obj->code;
|
if($obj->source == 'internal') $listofprojectcontacttype[$obj->rowid] = $obj->code;
|
||||||
|
else $listofprojectcontacttypeexternal[$obj->rowid] = $obj->code;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -377,6 +380,9 @@ if ($resql) {
|
|||||||
if (count($listofprojectcontacttype) == 0) {
|
if (count($listofprojectcontacttype) == 0) {
|
||||||
$listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
|
$listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
|
||||||
}
|
}
|
||||||
|
if (count($listofprojectcontacttypeexternal) == 0) {
|
||||||
|
$listofprojectcontacttypeexternal[0] = '0'; // To avoid sql syntax error if not found
|
||||||
|
}
|
||||||
|
|
||||||
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
||||||
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
|
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
|
||||||
@ -417,6 +423,9 @@ if ($search_sale > 0) {
|
|||||||
if ($search_project_user > 0) {
|
if ($search_project_user > 0) {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp";
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp";
|
||||||
}
|
}
|
||||||
|
if ($search_project_contact > 0) {
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp_contact";
|
||||||
|
}
|
||||||
$sql .= " WHERE p.entity IN (".getEntity('project').')';
|
$sql .= " WHERE p.entity IN (".getEntity('project').')';
|
||||||
if (!empty($conf->categorie->enabled)) {
|
if (!empty($conf->categorie->enabled)) {
|
||||||
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_PROJECT, "p.rowid", $search_category_array);
|
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_PROJECT, "p.rowid", $search_category_array);
|
||||||
@ -501,6 +510,9 @@ if ($search_sale > 0) {
|
|||||||
if ($search_project_user > 0) {
|
if ($search_project_user > 0) {
|
||||||
$sql .= " AND ecp.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
|
$sql .= " AND ecp.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
|
||||||
}
|
}
|
||||||
|
if ($search_project_contact > 0) {
|
||||||
|
$sql .= " AND ecp_contact.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttypeexternal))).") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact);
|
||||||
|
}
|
||||||
if ($search_opp_amount != '') {
|
if ($search_opp_amount != '') {
|
||||||
$sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
|
$sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
|
||||||
}
|
}
|
||||||
@ -689,6 +701,9 @@ if ($search_public != '') {
|
|||||||
if ($search_project_user != '') {
|
if ($search_project_user != '') {
|
||||||
$param .= '&search_project_user='.urlencode($search_project_user);
|
$param .= '&search_project_user='.urlencode($search_project_user);
|
||||||
}
|
}
|
||||||
|
if ($search_project_contact != '') {
|
||||||
|
$param .= '&search_project_user='.urlencode($search_project_contact);
|
||||||
|
}
|
||||||
if ($search_sale > 0) {
|
if ($search_sale > 0) {
|
||||||
$param .= '&search_sale='.urlencode($search_sale);
|
$param .= '&search_sale='.urlencode($search_sale);
|
||||||
}
|
}
|
||||||
@ -808,6 +823,11 @@ if (empty($user->rights->user->user->lire)) {
|
|||||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250');
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
|
$tmptitle = $langs->trans('ProjectsWithThisContact');
|
||||||
|
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle);
|
||||||
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
// If the user can view thirdparties other than his'
|
// If the user can view thirdparties other than his'
|
||||||
if ($user->rights->societe->client->voir || $socid) {
|
if ($user->rights->societe->client->voir || $socid) {
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user