diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 4015b202d62..a12867c0800 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -55,6 +55,10 @@ $contactid=GETPOST('contactid','int');
$origin=GETPOST('origin','alpha');
$originid=GETPOST('originid','int');
+$fulldayevent=GETPOST('fullday');
+$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
+$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
+
// Security check
$socid = GETPOST('socid','int');
$id = GETPOST('id','int');
@@ -63,6 +67,7 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
$error=GETPOST("error");
+$donotclearsession=0;
$cactioncomm = new CActionComm($db);
$object = new ActionComm($db);
@@ -82,6 +87,19 @@ $hookmanager->initHooks(array('actioncard'));
* Actions
*/
+if (GETPOST('addassignedtouser'))
+{
+ // Add a new user
+ if (GETPOST('affectedto') > 0)
+ {
+ $assignedtouser=array();
+ if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
+ $assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
+ $_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
+ }
+ $donotclearsession=1;
+ $action='create';
+}
// Add action
if ($action == 'add_action')
{
@@ -104,12 +122,11 @@ if ($action == 'add_action')
exit;
}
- $fulldayevent=GETPOST('fullday');
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters
- $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
- $datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
+ $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
+ $datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
// Check parameters
if (! $datef && $percentage == 100)
@@ -519,15 +536,16 @@ if ($action == 'create')
print '
'.$langs->trans("EventOnFullDay").'
';
// Date start
- $datep=$object->datep;
+ $datep=($datep?$datep:$object->datep);
if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0);
print '
'.$langs->trans("DateActionStart").'
';
if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend');
else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
print '
';
+
// Date end
- $datef=$object->datef;
+ $datef=($datef?$datef:$object->datef);
if (GETPOST('datef','int',1)) $datef=dol_stringtotime(GETPOST('datef','int',1),0);
print '
'.$langs->trans("DateActionEnd").'
';
if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
@@ -539,29 +557,29 @@ if ($action == 'create')
print '
';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 9b52fd0e497..7dfe2b3e7d3 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1273,6 +1273,49 @@ class Form
}
+ /**
+ * Return select list of users. Selected users are stored into session.
+ *
+ * @param string $htmlname Field name in form
+ * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
+ * @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
+ * @param array $enableonly Array list of users id to be enabled. All other must be disabled
+ * @param int $force_entity 0 or Id of environment to force
+ * @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
+ * @return string HTML select string
+ * @see select_dolgroups
+ */
+ function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
+ {
+ global $conf,$user,$langs;
+
+ $userstatic=new User($this->db);
+
+ // Method with no ajax
+ //$out.='';
+ return $out;
+ }
+
+
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*