diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 4606f5ebe96..e8d73269490 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -21,10 +21,10 @@ */ /** - \file htdocs/comm/action/fiche.php - \ingroup commercial - \brief Page de la fiche action commercial - \version $Revision$ + \file htdocs/comm/action/fiche.php + \ingroup commercial + \brief Page de la fiche action commercial + \version $Revision$ */ require("./pre.inc.php"); @@ -67,89 +67,96 @@ if ($_POST["action"] == 'add_action') $societe->fetch($_POST["socid"]); } - if ($_POST["actionid"]) { - - $actioncomm = new ActionComm($db); - - $actioncomm->type = $_POST["actionid"]; - $actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0; - $actioncomm->libelle = $_POST["label"]; - - $actioncomm->date = $db->idate(mktime($_POST["heurehour"], - $_POST["heuremin"], - 0, - $_POST["acmonth"], - $_POST["acday"], - $_POST["acyear"]) - ); - - $actioncomm->percent = isset($_POST["percentage"])?$_POST["percentage"]:0; - - $actioncomm->user = $user; - - $actioncomm->societe = isset($_POST["socid"])?$_POST["socid"]:0; - $actioncomm->contact = isset($_POST["contactid"])?$_POST["contactid"]:0; - $actioncomm->note = $_POST["note"]; - - // On definit la ressource webcal si le module webcal est actif - $webcal=0; - if ($conf->webcal->enabled && $_POST["todo_webcal"] == 'on') + if ($_POST["actionid"]) { - $webcal = new Webcal(); - - if (! $webcal->localdb->ok) { - // Si la creation de l'objet n'as pu se connecter - $error="Dolibarr n'a pu se connecter à la base Webcalendar avec les identifiants définis (host=".$conf->webcal->db->host." dbname=".$conf->webcal->db->name." user=".$conf->webcal->db->user."). L'option de mise a jour Webcalendar a été ignorée."; - $webcal=-1; - } - else - { - $webcal->heure = $_POST["heurehour"] . $_POST["heuremin"] . '00'; - $webcal->duree = ($_POST["dureehour"] * 60) + $_POST["dureemin"]; - - if ($_POST["actionid"] == 5) - { - $libelle = "Rendez-vous avec ".$contact->fullname; - $libelle .= "\n" . $actioncomm->libelle; - } - else - { - $libelle = $actioncomm->libelle; - } - - $webcal->date=mktime($_POST["heurehour"], - $_POST["heuremin"], - 0, - $_POST["acmonth"], - $_POST["acday"], - $_POST["acyear"]); - $webcal->texte=$societe->nom; - $webcal->desc=$libelle; - } + + $actioncomm = new ActionComm($db); + + $actioncomm->type = $_POST["actionid"]; + $actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0; + $actioncomm->libelle = $_POST["label"]; + + $actioncomm->date = $db->idate(mktime($_POST["heurehour"], + $_POST["heuremin"], + 0, + $_POST["acmonth"], + $_POST["acday"], + $_POST["acyear"]) + ); + + $actioncomm->percent = isset($_POST["percentage"])?$_POST["percentage"]:0; + + $actioncomm->user = $user; + + $actioncomm->societe = isset($_POST["socid"])?$_POST["socid"]:0; + $actioncomm->contact = isset($_POST["contactid"])?$_POST["contactid"]:0; + $actioncomm->note = $_POST["note"]; + + // On definit la ressource webcal si le module webcal est actif + $webcal=0; + if ($conf->webcal->enabled && $_POST["todo_webcal"] == 'on') + { + $webcal = new Webcal(); + + if (! $webcal->localdb->ok) + { + // Si la creation de l'objet n'as pu se connecter + $error="Dolibarr n'a pu se connecter à la base Webcalendar avec les identifiants définis (host=".$conf->webcal->db->host." dbname=".$conf->webcal->db->name." user=".$conf->webcal->db->user."). L'option de mise a jour Webcalendar a été ignorée."; + $webcal=-1; + } + else + { + $webcal->heure = $_POST["heurehour"] . $_POST["heuremin"] . '00'; + $webcal->duree = ($_POST["dureehour"] * 60) + $_POST["dureemin"]; + + if ($_POST["actionid"] == 5) + { + $libelle = "Rendez-vous avec ".$contact->fullname; + $libelle .= "\n" . $actioncomm->libelle; + } + else + { + $libelle = $actioncomm->libelle; + } + + $webcal->date=mktime($_POST["heurehour"], + $_POST["heuremin"], + 0, + $_POST["acmonth"], + $_POST["acday"], + $_POST["acyear"]); + $webcal->texte=$societe->nom; + $webcal->desc=$libelle; + } + } + + // On crée l'action (avec ajout eventuel dans webcal si défini) + $idaction=$actioncomm->add($user, $webcal); + + if ($idaction > 0) + { + if (! $actioncomm->error) + { + // Si pas d'erreur + Header("Location: ".$_POST["from"]); + } + else + { + // Si erreur + $_GET["id"]=$idaction; + $error=$actioncomm->error; + } + } + else + { + dolibarr_print_error($db); + } } - - // On crée l'action (avec ajout eventuel dans webcal si défini) - $idaction=$actioncomm->add($user, $webcal); - - if ($idaction > 0) { - if (! $actioncomm->error) { - // Si pas d'erreur - Header("Location: ".$_POST["from"]); - } - else { - // Si erreur - $_GET["id"]=$idaction; - $error=$actioncomm->error; - } - } else { - dolibarr_print_error($db); + else + { + print "Le type d'action n'a pas été choisi"; } - } else { - - print "Le type d'action n'a pas été choisi"; - - } - + } /* @@ -179,15 +186,10 @@ if ($_POST["action"] == 'update') Header("Location: ".$_POST["from"]); } - - - llxHeader(); $html = new Form($db); - - /* ************************************************************************** */ /* */ /* Affichage fiche en mode création */ @@ -199,8 +201,7 @@ if ($_GET["action"] == 'create') $caction = new CActioncomm($db); if ($_GET["contactid"]) - { - + { $contact = new Contact($db); $contact->fetch($_GET["contactid"]); } @@ -215,7 +216,7 @@ if ($_GET["action"] == 'create') */ if ($_GET["actionid"] == 5) { - print_titre ($langs->trans("AddActionRendezVous")); + print_titre ($langs->trans("AddActionRendezVous")); print "
"; print ''."\n"; @@ -228,23 +229,26 @@ if ($_GET["action"] == 'create') // Societe, contact print ''.$langs->trans("ActionOnCompany").''; - if ($_GET["socid"]) { + if ($_GET["socid"]) + { $societe = new Societe($db); $nomsoc=$societe->get_nom($_GET["socid"]); print ''.$nomsoc.''; print ''; - } - else { - print $html->select_societes('','socid',1,1); - } - print ''; - + } + else + { + print $html->select_societes('','socid',1,1); + } + print ''; + // Si la societe est imposée, on propose ces contacts - if ($_GET["socid"]) { - print ''.$langs->trans("ActionOnContact").''; + if ($_GET["socid"]) + { + print ''.$langs->trans("ActionOnContact").''; print $html->select_contacts($_GET["socid"],'','contactid',1,1); print ''; - } + } print ''.$langs->trans("Date").''; $html->select_date('','ac'); @@ -259,7 +263,7 @@ if ($_GET["action"] == 'create') add_row_for_webcal_link(); print ''.$langs->trans("Comment").''; - print ''; + print ''; print ''; print ''; } @@ -270,43 +274,49 @@ if ($_GET["action"] == 'create') */ else { - print_titre ($langs->trans("AddAction")); + print_titre ($langs->trans("AddAction")); print "
"; print ''; // Type d'action actifs print ''; - + print ''; - + // Societe, contact - print ''; - + print ''; + // Si la societe est imposée, on propose ces contacts - if ($_GET["socid"]) { - print ''; - } - + } + // Avancement if ($_GET["afaire"] == 1) { @@ -318,49 +328,46 @@ if ($_GET["action"] == 'create') { print ''; print ''; - } else - { - print ''; - } - + } else + { + print ''; + } + // Date print ''; - } - else if ($_GET["afaire"] == 2) - { - $html->select_date('','ac',1,1); - print ''; - } + { + $html->select_date('','ac'); + print ''; + } + else if ($_GET["afaire"] == 2) + { + $html->select_date('','ac',1,1); + print ''; + } else - { - $html->select_date('','ac',1,1); - print ''; - } + { + $html->select_date('','ac',1,1); + print ''; + } print ''; - + add_row_for_webcal_link(); - + // Description print ''; + print ''; - - print '
'.$langs->trans("Action").''; - if ($_GET["actionid"]) { - print ''."\n"; - print $caction->get_nom($_GET["actionid"]); - } else { - $html->select_array("actionid", $caction->liste_array(1), 0); - } + if ($_GET["actionid"]) + { + print ''."\n"; + print $caction->get_nom($_GET["actionid"]); + } + else + { + $html->select_array("actionid", $caction->liste_array(1), 0); + } print '
'.$langs->trans("Label").'
'.$langs->trans("ActionOnCompany").''; - if ($_GET["socid"]) { - $societe = new Societe($db); - $nomsoc=$societe->get_nom($_GET["socid"]); - print ''.$nomsoc.''; - print ''; - } - else { - print $html->select_societes('','socid',1,1); - } - print '
'.$langs->trans("ActionOnCompany").''; + if ($_GET["socid"]) + { + $societe = new Societe($db); + $nomsoc=$societe->get_nom($_GET["socid"]); + print ''.$nomsoc.''; + print ''; + } + else + { + print $html->select_societes('','socid',1,1); + } + print '
'.$langs->trans("ActionOnContact").''; + if ($_GET["socid"]) + { + print '
'.$langs->trans("ActionOnContact").''; print $html->select_contacts($_GET["socid"],'','contactid',1,1); print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").'Done / 100%
'.$langs->trans("Status").' / '.$langs->trans("Percentage").'
'.$langs->trans("Status").' / '.$langs->trans("Percentage").'
'.$langs->trans("Date").''; if ($_GET["afaire"] == 1) - { - $html->select_date('','ac'); - print '
'.$langs->trans("Hour").''; - print_heure_select("heure",8,20); - print '
'.$langs->trans("Hour").''; - print_heure_select("heure",8,20); - print '
'.$langs->trans("Hour").''; + print_heure_select("heure",8,20); + print '
'.$langs->trans("Hour").''; + print_heure_select("heure",8,20); + print '
'.$langs->trans("Hour").''; - print_heure_select("heure",8,20); - print '
'.$langs->trans("Hour").''; + print_heure_select("heure",8,20); + print '
'.$langs->trans("Description").''; - print '
'; - + print ''; print '

'; } - print ""; }