From 4352bd3240122d2a838cb7216b45150da84eb4f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Sep 2006 23:36:07 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Gestion=20erreur=20sur=20cr=E9ation=20ac?= =?UTF-8?q?tion=20Fix:=20Page=20suivante=20sur=20liste=20actions=20incompl?= =?UTF-8?q?etes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/action/fiche.php | 77 +++++++++++++++++++++++------------- htdocs/comm/action/index.php | 19 ++++----- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 17e6f1d67eb..a8532d3e581 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -59,13 +59,22 @@ if ($_POST["action"] == 'add_action') $contact = new Contact($db); $contact->fetch($_POST["contactid"]); } - if ($_POST["socid"]) - { - $societe = new Societe($db); - $societe->fetch($_POST["socid"]); - } - if ($_POST["actionid"]) + if (! $_POST["actionid"]) + { + $error=1; + $_GET["action"] = 'create'; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'
'; + } + + if (! $_POST["apyear"] && ! $_POST["adyear"]) + { + $error=1; + $_GET["action"] = 'create'; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
'; + } + + if (! $error) { $db->begin(); @@ -125,7 +134,12 @@ if ($_POST["action"] == 'add_action') $actioncomm->user = $user; $actioncomm->note = trim($_POST["note"]); if (isset($_POST["contactid"])) $actioncomm->contact = $contact; - if (isset($_POST["socid"])) $actioncomm->societe = $societe; + if (isset($_REQUEST["socid"]) && $_REQUEST["socid"] > 0) + { + $societe = new Societe($db); + $societe->fetch($_REQUEST["socid"]); + $actioncomm->societe = $societe; + } if ($_POST["todo_webcal"] == 'on') $actioncomm->use_webcal=1; // On crée l'action @@ -136,8 +150,19 @@ if ($_POST["action"] == 'add_action') if (! $actioncomm->error) { $db->commit(); - if ($_POST["from"]) Header("Location: ".$_POST["from"]); - else Header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction); + if ($_POST["from"]) + { + dolibarr_syslog("Back to ".$_POST["from"]); + Header("Location: ".$_POST["from"]); + } + elseif($idaction) + { + Header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction); + } + else + { + Header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'); + } exit; } else @@ -154,12 +179,8 @@ if ($_POST["action"] == 'add_action') $error='
'.$actioncomm->error.'
'; } } - else - { - $_GET["action"] = 'create'; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'
'; - } - + +// print $_REQUEST["from"]."rr"; } /* @@ -252,7 +273,7 @@ if ($_GET["action"] == 'create') } print '
'; - print ''; + print ''; print ''; /* @@ -275,12 +296,12 @@ if ($_GET["action"] == 'create') // Societe, contact print ''.$langs->trans("ActionOnCompany").''; - if ($_GET["socid"]) + if ($_REQUEST["socid"]) { $societe = new Societe($db); - $societe->fetch($_GET["socid"]); + $societe->fetch($_REQUEST["socid"]); print $societe->getNomUrl(1); - print ''; + print ''; } else { @@ -289,10 +310,10 @@ if ($_GET["action"] == 'create') print ''; // Si la societe est imposée, on propose ces contacts - if ($_GET["socid"]) + if ($_REQUEST["socid"]) { print ''.$langs->trans("ActionOnContact").''; - $html->select_contacts($_GET["socid"],'','contactid',1,1); + $html->select_contacts($_REQUEST["socid"],'','contactid',1,1); print ''; } @@ -414,12 +435,12 @@ if ($_GET["action"] == 'create') // Societe, contact print ''.$langs->trans("ActionOnCompany").''; - if ($_GET["socid"]) + if ($_REQUEST["socid"]) { $societe = new Societe($db); - $societe->fetch($_GET["socid"]); + $societe->fetch($_REQUEST["socid"]); print $societe->getNomUrl(1); - print ''; + print ''; } else { @@ -438,10 +459,10 @@ if ($_GET["action"] == 'create') print ''; // Si la societe est imposée, on propose ces contacts - if ($_GET["socid"]) + if ($_REQUEST["socid"]) { print ''.$langs->trans("ActionOnContact").''; - $html->select_contacts($_GET["socid"],'','contactid',1,1); + $html->select_contacts($_REQUEST["socid"],'','contactid',1,1); print ''; } @@ -567,14 +588,14 @@ if ($_GET["id"]) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print '
'.$langs->trans("Ref").''.$act->id.'
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Title").'
'.$langs->trans("Company").''.img_object($langs->trans("ShowCompany"),'company').' '.$act->societe->nom.''.img_object($langs->trans("ShowCompany"),'company').' '.$act->societe->nom.''.$langs->trans("Contact").''; $html->select_array("contactid", $act->societe->contact_array(), $act->contact->id, 1); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 9cdbe010dc3..87f8aa12438 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -99,29 +99,30 @@ if ($resql) $title="DoneAndToDoActions"; if ($status == 'done') $title="DoneActions"; if ($status == 'todo') $title="ToDoActions"; + $param="&status=$status"; if ($socidp) { $societe = new Societe($db); $societe->fetch($socidp); - print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",'',$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",$param,$sortfield,$sortorder,'',$num); } else { - print_barre_liste($langs->trans($title), $page, "index.php",'',$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans($title), $page, "index.php",$param,$sortfield,$sortorder,'',$num); } $i = 0; print ""; print ''; -// print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.datep","&status=$status",'','colspan="4"',$sortfield); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.datep","&status=$status",'','',$sortfield); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode","&status=$status","","",$sortfield); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","&status=$status","","",$sortfield); - print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact","&status=$status","","",$sortfield); +// print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.datep",$param,'','colspan="4"',$sortfield); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.datep",$param,'','',$sortfield); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield); + print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield); print ''; - print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.code","&status=$status","","",$sortfield); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent","&status=$status","","",$sortfield); + print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.code",$param,"","",$sortfield); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"","",$sortfield); print "\n"; $var=true; while ($i < min($num,$limit))
'.$langs->trans("Comments").'