Fix: Mauvaise récupération paramètre des actions.

This commit is contained in:
Laurent Destailleur 2005-07-07 21:50:14 +00:00
parent 0bb3b59df5
commit beff6c9b2d
2 changed files with 110 additions and 99 deletions

View File

@ -84,7 +84,7 @@ class ActionComm
$sql.= "fk_facture,propalrowid)"; $sql.= "fk_facture,propalrowid)";
$sql.= " VALUES (now(), '".$this->type_code."', '".$this->societe->id."' ,'".addslashes($this->note)."',"; $sql.= " VALUES (now(), '".$this->type_code."', '".$this->societe->id."' ,'".addslashes($this->note)."',";
$sql.= ($this->contact->id?$this->contact->id:"null").","; $sql.= ($this->contact->id?$this->contact->id:"null").",";
$sql.= "'$author->id', '".$this->user->id ."', '".$this->label."',100,'".$this->priority."',"; $sql.= "'$author->id', '".$this->user->id ."', '".addslashes($this->label)."','".$this->percent."','".$this->priority."',";
$sql.= ($this->facid?$this->facid:"null").","; $sql.= ($this->facid?$this->facid:"null").",";
$sql.= ($this->propalrowid?$this->propalrowid:"null"); $sql.= ($this->propalrowid?$this->propalrowid:"null");
$sql.= ");"; $sql.= ");";

View File

@ -70,17 +70,18 @@ if ($_POST["action"] == 'add_action')
if ($_POST["actionid"]) if ($_POST["actionid"])
{ {
$db->begin();
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->type = $_POST["actionid"]; $actioncomm->type_code = $_POST["actionid"];
$actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0; $actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0;
if ($_POST["actionid"] == 5) if ($_POST["actionid"] == 5)
{ {
if ($contact->fullname) { $actioncomm->libelle = $langs->trans("TaskRDVWith",$contact->fullname); } if ($contact->fullname) { $actioncomm->label = $langs->trans("TaskRDVWith",$contact->fullname); }
else { $actioncomm->libelle = $langs->trans("TaskRDV"); } else { $actioncomm->label = $langs->trans("TaskRDV"); }
} else { } else {
$actioncomm->libelle = $_POST["label"]; $actioncomm->label = $_POST["label"];
} }
$actioncomm->date = $db->idate(mktime($_POST["heurehour"], $actioncomm->date = $db->idate(mktime($_POST["heurehour"],
$_POST["heuremin"], $_POST["heuremin"],
@ -94,8 +95,14 @@ if ($_POST["action"] == 'add_action')
$actioncomm->user = $user; $actioncomm->user = $user;
$actioncomm->societe = isset($_POST["socid"])?$_POST["socid"]:0; if (isset($_POST["contactid"]))
$actioncomm->contact = isset($_POST["contactid"])?$_POST["contactid"]:0; {
$actioncomm->contact = $contact;
}
if (isset($_POST["socid"]))
{
$actioncomm->societe = $societe;
}
$actioncomm->note = $_POST["note"]; $actioncomm->note = $_POST["note"];
// On definit la ressource webcal si le module webcal est actif // On definit la ressource webcal si le module webcal est actif
@ -144,17 +151,21 @@ if ($_POST["action"] == 'add_action')
if (! $actioncomm->error) if (! $actioncomm->error)
{ {
// Si pas d'erreur // Si pas d'erreur
$db->commit();
Header("Location: ".$_POST["from"]); Header("Location: ".$_POST["from"]);
} }
else else
{ {
// Si erreur // Si erreur
$db->rollback();
$_GET["id"]=$idaction; $_GET["id"]=$idaction;
$error=$actioncomm->error; $error=$actioncomm->error;
} }
} }
else else
{ {
$db->rollback();
$_GET["id"]=$idaction;
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }