FIX Assignement of actors on tasks
This commit is contained in:
parent
4d029194d3
commit
fed99aa3bb
@ -1055,7 +1055,6 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
$this->error = $this->db->errno();
|
$this->error = $this->db->errno();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
echo 'err rollback';
|
|
||||||
return -2;
|
return -2;
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->error();
|
$this->error = $this->db->error();
|
||||||
|
|||||||
@ -57,11 +57,22 @@ $projectstatic = new Project($db);
|
|||||||
// Add new contact
|
// Add new contact
|
||||||
if ($action == 'addcontact' && $user->rights->projet->creer)
|
if ($action == 'addcontact' && $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
|
$source = 'internal';
|
||||||
|
if (GETPOST("addsourceexternal")) {
|
||||||
|
$source ='external';
|
||||||
|
}
|
||||||
|
|
||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
|
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$idfortaskuser = (GETPOST("contactid") != 0) ?GETPOST("contactid") : GETPOST("userid"); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
|
if ($source == 'internal') {
|
||||||
|
$idfortaskuser = ((GETPOST("userid") != 0 && GETPOST('userid') != -1) ? GETPOST("userid") : 0); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
|
||||||
|
$typeid = GETPOST('type');
|
||||||
|
} else {
|
||||||
|
$idfortaskuser = ((GETPOST("contactid") > 0) ? GETPOST("contactid", 'int') : 0); // GETPOST('contactid') may val -1 to mean empty or -2 to means "everybody"
|
||||||
|
$typeid = GETPOST('typecontact');
|
||||||
|
}
|
||||||
if ($idfortaskuser == -2)
|
if ($idfortaskuser == -2)
|
||||||
{
|
{
|
||||||
$result = $projectstatic->fetch($object->fk_project);
|
$result = $projectstatic->fetch($object->fk_project);
|
||||||
@ -72,13 +83,11 @@ if ($action == 'addcontact' && $user->rights->projet->creer)
|
|||||||
$contactsofproject = $projectstatic->getListContactId('internal');
|
$contactsofproject = $projectstatic->getListContactId('internal');
|
||||||
foreach ($contactsofproject as $key => $val)
|
foreach ($contactsofproject as $key => $val)
|
||||||
{
|
{
|
||||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
$result = $object->add_contact($val, $typeid, $source);
|
||||||
$result = $object->add_contact($val, $type, GETPOST("source", 'aZ09'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
$result = $object->add_contact($idfortaskuser, $typeid, $source);
|
||||||
$result = $object->add_contact($idfortaskuser, $typeid, GETPOST("source", 'aZ09'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,6 +362,12 @@ if ($id > 0 || !empty($ref))
|
|||||||
/*
|
/*
|
||||||
* Add a new contact line
|
* Add a new contact line
|
||||||
*/
|
*/
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="action" value="addcontact">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
if ($action != 'editline' && $user->rights->projet->creer)
|
if ($action != 'editline' && $user->rights->projet->creer)
|
||||||
@ -365,13 +380,6 @@ if ($id > 0 || !empty($ref))
|
|||||||
print '<td colspan="3"> </td>';
|
print '<td colspan="3"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="action" value="addcontact">';
|
|
||||||
print '<input type="hidden" name="source" value="internal">';
|
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
|
||||||
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
|
||||||
|
|
||||||
// Ligne ajout pour contact interne
|
// Ligne ajout pour contact interne
|
||||||
print '<tr class="oddeven nohover">';
|
print '<tr class="oddeven nohover">';
|
||||||
|
|
||||||
@ -387,26 +395,17 @@ if ($id > 0 || !empty($ref))
|
|||||||
// On recupere les id des users deja selectionnes
|
// On recupere les id des users deja selectionnes
|
||||||
if ($object->project->public) $contactsofproject = ''; // Everybody
|
if ($object->project->public) $contactsofproject = ''; // Everybody
|
||||||
else $contactsofproject = $projectstatic->getListContactId('internal');
|
else $contactsofproject = $projectstatic->getListContactId('internal');
|
||||||
print $form->select_dolusers((GETPOST('contactid') ?GETPOST('contactid') : $user->id), 'contactid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
|
print $form->select_dolusers((GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 1, $langs->trans("ResourceNotAssignedToProject"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid');
|
$formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
|
print '<td class="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'" name="addsourceinternal"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
// Line to add an external contact. Only if project linked to a third party.
|
// Line to add an external contact. Only if project linked to a third party.
|
||||||
if ($projectstatic->socid)
|
if ($projectstatic->socid)
|
||||||
{
|
{
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="action" value="addcontact">';
|
|
||||||
print '<input type="hidden" name="source" value="external">';
|
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
|
||||||
if ($withproject) print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
@ -421,18 +420,16 @@ if ($id > 0 || !empty($ref))
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$contactofproject = $projectstatic->getListContactId('external');
|
$contactofproject = $projectstatic->getListContactId('external');
|
||||||
print $form->selectcontacts($selectedCompany, '', 'contactid', 0, '', $contactofproject);
|
print $form->selectcontacts($selectedCompany, '', 'contactid', 0, '', $contactofproject, 0, '', false, 0, 0);
|
||||||
$nbofcontacts = $form->num;
|
$nbofcontacts = $form->num;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formcompany->selectTypeContact($object, '', 'type', 'external', 'rowid');
|
$formcompany->selectTypeContact($object, '', 'typecontact', 'external', 'rowid');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="right" colspan="3" ><input type="submit" class="button" id="add-customer-contact" value="'.$langs->trans("Add").'"';
|
print '<td class="right" colspan="3" ><input type="submit" class="button" id="add-customer-contact" name="addsourceexternal" value="'.$langs->trans("Add").'"';
|
||||||
if (!$nbofcontacts) print ' disabled';
|
if (!$nbofcontacts) print ' disabled';
|
||||||
print '></td>';
|
print '></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,6 +532,9 @@ if ($id > 0 || !empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print "</form>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print "ErrorRecordNotFound";
|
print "ErrorRecordNotFound";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user