diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3e0a9043149..e39221921b0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -459,7 +459,8 @@ class ActionComm extends CommonObject //print 'eeea'.$this->datep.'-'.(strval($this->datep) != '').'-'.$this->db->idate($this->datep); $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; - $sql.= " SET percent='".$this->percentage."'"; + $sql.= " SET percent = '".$this->percentage."'"; + if ($this->fk_action > 0) $sql.= ", fk_action = '".$this->fk_action."'"; $sql.= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'":"null"); $sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 8940b1adfed..3e6d71752dd 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -311,6 +311,7 @@ if ($action == 'update') $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + $actioncomm->fk_action = dol_getIdFromCode($db, $_POST["actioncode"], 'c_actioncomm'); $actioncomm->label = $_POST["label"]; $actioncomm->datep = $datep; $actioncomm->datef = $datef; @@ -467,16 +468,7 @@ if ($action == 'create') if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("Type").''; - if (GETPOST("actioncode") && ! GETPOST('actioncode')) // Force selection only if not a post that fails - { - print ''."\n"; - $cactioncomm->fetch(GETPOST("actioncode")); - print $cactioncomm->getNomUrl(); - } - else - { - $htmlactions->select_type_actions($actioncomm->type_code, "actioncode","systemauto"); - } + $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$actioncomm->type_code, "actioncode","systemauto"); print ''; } else print ''; @@ -739,7 +731,9 @@ if ($id > 0) // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''.$langs->trans("Type").''.$act->type.''; + print ''.$langs->trans("Type").''; + $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$act->type_code, "actioncode","systemauto"); + print ''; } // Title