New: Ajout possibilité modifier titre action

This commit is contained in:
Laurent Destailleur 2006-05-13 14:28:31 +00:00
parent 7db087285d
commit 6641850aef
2 changed files with 8 additions and 4 deletions

View File

@ -203,10 +203,13 @@ class ActionComm
*/ */
function update() function update()
{ {
$this->label=trim($this->label);
$this->note=trim($this->note);
if ($this->percent > 100) $this->percent = 100; if ($this->percent > 100) $this->percent = 100;
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
$sql.= " SET percent='".$this->percent."'"; $sql.= " SET percent='".$this->percent."'";
if ($this->label) $sql.= ", label = '".addslashes($this->label)."'";
if ($this->percent == 100) $sql.= ", datea = now()"; if ($this->percent == 100) $sql.= ", datea = now()";
if ($this->note) $sql.= ", note = '".addslashes($this->note)."'"; if ($this->note) $sql.= ", note = '".addslashes($this->note)."'";
if ($this->contact->id) $sql.= ", fk_contact =". $this->contact->id; if ($this->contact->id) $sql.= ", fk_contact =". $this->contact->id;

View File

@ -161,9 +161,10 @@ if ($_POST["action"] == 'update')
{ {
$action = new Actioncomm($db); $action = new Actioncomm($db);
$action->fetch($_POST["id"]); $action->fetch($_POST["id"]);
$action->percent = stripslashes($_POST["percent"]); $action->label = $_POST["label"];
$action->contact->id = stripslashes($_POST["contactid"]); $action->percent = $_POST["percent"];
$action->note = stripslashes($_POST["note"]); $action->contact->id = $_POST["contactid"];
$action->note = $_POST["note"];
$action->update(); $action->update();
} }
@ -438,7 +439,7 @@ if ($_GET["id"])
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$act->id.'</td></tr>'; print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$act->id.'</td></tr>';
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>'; print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->label.'"></td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td>'; print '<tr><td>'.$langs->trans("Company").'</td>';
print '<td><a href="../fiche.php?socid='.$act->societe->id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$act->societe->nom.'</a></td>'; print '<td><a href="../fiche.php?socid='.$act->societe->id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$act->societe->nom.'</a></td>';