Uniformize field name
This commit is contained in:
parent
aba4c90d2b
commit
640bf7c34b
@ -105,11 +105,11 @@ if (! empty($_POST['removedassigned']))
|
||||
if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
|
||||
{
|
||||
// Add a new user
|
||||
if (GETPOST('affectedto') > 0)
|
||||
if (GETPOST('assignedtouser') > 0)
|
||||
{
|
||||
$assignedtouser=array();
|
||||
if (! empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
||||
$assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
|
||||
$assignedtouser[GETPOST('assignedtouser')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
|
||||
$_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
|
||||
}
|
||||
$donotclearsession=1;
|
||||
@ -647,11 +647,11 @@ if ($action == 'create')
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
if (empty($donotclearsession))
|
||||
{
|
||||
$assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
|
||||
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
|
||||
$_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1)));
|
||||
}
|
||||
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1);
|
||||
//print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
|
||||
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1);
|
||||
//print $form->select_dolusers(GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -904,8 +904,8 @@ if ($id > 0)
|
||||
if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency);
|
||||
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
|
||||
}
|
||||
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1);
|
||||
//print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1);
|
||||
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1);
|
||||
//print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'assignedtouser',1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table><br><br><table class="border" width="100%">';
|
||||
|
||||
@ -211,22 +211,43 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm","id");
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('actioncommdao'));
|
||||
$parameters=array('actcomm'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
// Now insert assignedusers
|
||||
if (! $error)
|
||||
{
|
||||
foreach($this->userassigned as $key => $val)
|
||||
{
|
||||
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", 0, ".$val['transparency'].", 0)";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
}
|
||||
//var_dump($sql);exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('actioncommdao'));
|
||||
$parameters=array('actcomm'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
|
||||
@ -656,7 +656,7 @@ jQuery(document).ready(function() {
|
||||
if (ids == \'none\') /* No event */
|
||||
{
|
||||
/* alert(\'no event\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&affectedto="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day).'"
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day).'"
|
||||
window.location.href = url;
|
||||
}
|
||||
else if (ids.indexOf(",") > -1) /* There is several events */
|
||||
|
||||
@ -131,6 +131,8 @@ ALTER TABLE llx_user ADD COLUMN weeklyhours double(16,8);
|
||||
|
||||
ALTER TABLE llx_projet_task_time ADD COLUMN task_datehour datetime after task_date;
|
||||
|
||||
ALTER TABLE llx_actioncomm_resources CHANGE COLUMN transparent transparency smallint default 1;
|
||||
|
||||
|
||||
-- Localtaxes by thirds
|
||||
ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10);
|
||||
@ -1071,11 +1073,11 @@ CREATE TABLE llx_fichinterdet_extrafields
|
||||
|
||||
ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields (fk_object);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_usergroup_extrafields (
|
||||
CREATE TABLE llx_usergroup_extrafields (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=InnoDB ;
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_usergroup_extrafields ADD INDEX idx_usergroup_extrafields (fk_object);
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
create table llx_actioncomm_resources
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_actioncomm integer NOT NULL,
|
||||
element_type varchar(50) NOT NULL,
|
||||
fk_element integer NOT NULL,
|
||||
fk_actioncomm integer NOT NULL, -- Id into llx_actioncomm
|
||||
element_type varchar(50) NOT NULL, -- Type of resource ('user', 'resource')
|
||||
fk_element integer NOT NULL, -- Id into table llx_user or llx_resource
|
||||
answer_status varchar(50) NULL,
|
||||
mandatory smallint,
|
||||
transparent smallint
|
||||
mandatory smallint,
|
||||
transparency smallint default 1 -- Used to say if event is 1=OPAQUE=busy or 0=TRANSPARENT
|
||||
) ENGINE=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user