Fix link to create event from user card
This commit is contained in:
parent
330a1199e4
commit
9a5a3a3517
@ -1181,9 +1181,10 @@ if ($action == 'create') {
|
||||
// Type of event
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
||||
$default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
|
||||
$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV');
|
||||
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
|
||||
print $formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot
|
||||
$selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default);
|
||||
print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -165,9 +165,10 @@ class FormActions
|
||||
* @param int $max Max number of record
|
||||
* @param string $moreparambacktopage More param for the backtopage
|
||||
* @param string $morehtmlcenter More html text on center of title line
|
||||
* @param int $assignedtouser Assign event by default to this user id (will be ignored if not enough permissions)
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '')
|
||||
public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '', $assignedtouser = 0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
@ -225,9 +226,21 @@ class FormActions
|
||||
$taskid = $object->id;
|
||||
}
|
||||
|
||||
$usercanaddaction = 0;
|
||||
if (empty($assignedtouser) || $assignedtouser == $user->id) {
|
||||
$usercanaddaction = $user->hasRight('agenda', 'myactions', 'create');
|
||||
$assignedtouser = 0;
|
||||
} else {
|
||||
$usercanaddaction = $user->hasRight('agenda', 'allactions', 'create');
|
||||
}
|
||||
|
||||
$newcardbutton = '';
|
||||
if (isModEnabled('agenda') && !empty($user->rights->agenda->myactions->create)) {
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage);
|
||||
if (isModEnabled('agenda') && $usercanaddaction) {
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser'));
|
||||
$url .= '&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : ''));
|
||||
$url .= ($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '');
|
||||
$url .= ($assignedtouser > 0 ? '&assignedtouser='.$assignedtouser : '');
|
||||
$url .= '&backtopage='.urlencode($urlbacktopage);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
|
||||
}
|
||||
|
||||
|
||||
@ -2829,7 +2829,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'user', $socid, 1);
|
||||
$somethingshown = $formactions->showactions($object, 'user', $socid, 1, 'listactions', 0, '', '', $object->id);
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user