diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3e0a9043149c0e24b868b66161e17be7a6080283..e39221921b0bcd254a830d2f4bd7365ac67d5458 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 8940b1adfeda6777d47aaf5d7479bd19f455969a..3e6d71752dd357944ea407ac731230ae74e93a04 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 '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>'; - if (GETPOST("actioncode") && ! GETPOST('actioncode')) // Force selection only if not a post that fails - { - print '<input type="hidden" name="actioncode" value="'.GETPOST("actioncode").'">'."\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 '</td></tr>'; } else print '<input type="hidden" name="actioncode" value="AC_OTH">'; @@ -739,7 +731,9 @@ if ($id > 0) // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>'; + print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">'; + $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$act->type_code, "actioncode","systemauto"); + print '</td></tr>'; } // Title