forked from Wavyzz/dolibarr
NEW Can add all user of a project as user of a task, in one step.
This commit is contained in:
@@ -1237,7 +1237,7 @@ class Form
|
||||
*
|
||||
* @param string $selected User id or user object of user preselected. If -1, we use id of current user.
|
||||
* @param string $htmlname Field name in form
|
||||
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* @param int $show_empty 0=list with no empty value, 1=add also an empty value into list
|
||||
* @param array $exclude Array list of users id to exclude
|
||||
* @param int $disabled If select list must be disabled
|
||||
* @param array $include Array list of users id to include or 'hierarchy' to have only supervised users
|
||||
@@ -1246,15 +1246,16 @@ class Form
|
||||
* @param int $maxlength Maximum length of string into list (0=no limit)
|
||||
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
|
||||
* @param string $morefilter Add more filters into sql request
|
||||
* @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
|
||||
* @return string HTML select string
|
||||
* @see select_dolgroups
|
||||
*/
|
||||
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
|
||||
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
// If no preselected user defined, we take current user
|
||||
if ((is_numeric($selected) && ($selected < -1 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
|
||||
$excludeUsers=null;
|
||||
$includeUsers=null;
|
||||
@@ -1333,6 +1334,7 @@ class Form
|
||||
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected="selected"':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.(($selected==-2)?' selected="selected"':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
$userstatic=new User($this->db);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -61,8 +61,27 @@ if ($action == 'addcontact' && $user->rights->projet->creer)
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$idfortaskuser=GETPOST("contactid")>0?GETPOST("contactid"):GETPOST("userid");
|
||||
$result = $object->add_contact($idfortaskuser, GETPOST("type"), GETPOST("source"));
|
||||
$idfortaskuser=(GETPOST("contactid")!=0)?GETPOST("contactid"):GETPOST("userid"); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
|
||||
if ($idfortaskuser == -2)
|
||||
{
|
||||
$result=$projectstatic->fetch($object->fk_project);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$projectstatic->error,$projectstatic->errors);
|
||||
}
|
||||
else
|
||||
{
|
||||
$contactsofproject=$projectstatic->getListContactId('internal');
|
||||
foreach($contactsofproject as $key => $val)
|
||||
{
|
||||
$result = $object->add_contact($val, GETPOST("type"), GETPOST("source"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $object->add_contact($idfortaskuser, GETPOST("type"), GETPOST("source"));
|
||||
}
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
@@ -282,7 +301,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
/*
|
||||
* Ajouter une ligne de contact
|
||||
* Add a new contact line
|
||||
* Non affiche en mode modification de ligne
|
||||
*/
|
||||
if ($action != 'editline' && $user->rights->projet->creer)
|
||||
@@ -318,7 +337,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td colspan="1">';
|
||||
// On recupere les id des users deja selectionnes
|
||||
$contactsofproject=$projectstatic->getListContactId('internal');
|
||||
$form->select_users($user->id,'contactid',0,'',0,'',$contactsofproject);
|
||||
print $form->select_dolusers((GETPOST('contactid')?GETPOST('contactid'):$user->id), 'contactid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formcompany->selectTypeContact($object, '', 'type','internal','rowid');
|
||||
|
||||
Reference in New Issue
Block a user