From d190e924b3e9ebc4fc8fc5039de13f76b4167461 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Wed, 27 Feb 2013 19:43:40 +0100 Subject: [PATCH] Fix: Update of type was not working. --- htdocs/comm/action/class/actioncomm.class.php | 3 ++- htdocs/comm/action/fiche.php | 16 +++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) 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 '<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 -- GitLab