diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 73374c409db..e2014703f92 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -21,6 +21,8 @@ */ require("./pre.inc.php"); +$langs->load("company"); + require("../../contact.class.php"); require("../../lib/webcal.class.php"); require("../../cactioncomm.class.php"); @@ -47,58 +49,38 @@ if ($_POST["action"] == 'add_action') $contact = new Contact($db); $contact->fetch($_POST["contactid"]); } - $societe = new Societe($db); - $societe->fetch($_POST["socid"]); - - if ($_POST["afaire"] <> 1) + if ($_POST["socid"]) { - $actioncomm = new ActionComm($db); - - $actioncomm->priority = 2; - $actioncomm->type = $_POST["actionid"]; - - $actioncomm->date = $db->idate(mktime($_POST["heurehour"], - $_POST["heuremin"], - 0, - $_POST["acmonth"], - $_POST["acday"], - $_POST["acyear"]) - ); - if ($_POST["actionid"] == 5) - { - $actioncomm->percent = 0; - } - else - { - $actioncomm->percent = 100; - } - - $actioncomm->contact = $_POST["contactid"]; - - $actioncomm->user = $user; - - $actioncomm->societe = $_POST["socid"]; - $actioncomm->note = $_POST["note"]; - - $actioncomm->add($user); + $societe = new Societe($db); + $societe->fetch($_POST["socid"]); } - if ($todo == 'on' ) - { + if ($_POST["actionid"]) { - $todo = new ActionComm($db); - $todo->type = $_POST["nextactionid"]; - $todo->date = $db->idate(mktime(12,0,0,$remonth, $reday, $reyear)); - $todo->libelle = $todo_label; - $todo->priority = 2; - $todo->societe = $societe->id; - $todo->contact = $contactid; - $todo->user = $user; - $todo->note = $todo_note; - $todo->percent = 0; - - $todo->add($user); - + $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"]; + + $actioncomm->add($user); + if ($conf->webcal && $todo_webcal == 'on') { $webcal = new Webcal(); @@ -106,166 +88,220 @@ if ($_POST["action"] == 'add_action') $webcal->heure = $heurehour . $heuremin . '00'; $webcal->duree = ($dureehour * 60) + $dureemin; - if ($actionid == 5) + if ($_POST["actionid"] == 5) { $libelle = "Rendez-vous avec ".$contact->fullname; - $libelle .= "\n" . $todo->libelle; + $libelle .= "\n" . $actioncomm->libelle; } else { - $libelle = $todo->libelle; + $libelle = $actioncomm->libelle; } - $webcal->add($user, $todo->date, $societe->nom, $libelle); + $webcal->add($user, $actioncomm->date, $societe->nom, $libelle); } - } + // Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=$socid"); Header("Location: ".$_POST["from"]); + + } else { + + print "Le type d'action n'a pas été choisi"; + + } + } -if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) +if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') { $actioncomm = new ActionComm($db); $actioncomm->delete($id); Header("Location: index.php"); } -if ($action=='update') +if ($_POST["action"] == 'update') { $action = new Actioncomm($db); - $action->fetch($id); + $action->fetch($_POST["id"]); $action->percent = $_POST["percent"]; - $action->contact->id = $_POST["scontactid"]; + $action->contact->id = $_POST["contactid"]; $action->update(); + + Header("Location: ".$_POST["from"]); } -/******************************************************************************/ -/* */ -/* Fin des Actions */ -/* */ -/******************************************************************************/ + + llxHeader(); + $html = new Form($db); + + /* - * - * + * Affichage fiche action vierge en mode creation * */ if ($_GET["action"] == 'create') { - $caction = new CActioncomm($db); - if ($_GET["afaire"] <> 1) + if ($_GET["contactid"]) { - $caction->fetch($db, $_GET["actionid"]); $contact = new Contact($db); $contact->fetch($_GET["contactid"]); } - $societe = new Societe($db); - $societe->get_nom($_GET["socid"]); - - print '
'; + + print ''; print ''; print ''; - print ''."\n"; - print ''; - print ''; /* - * Rendez-vous + * Si action de type Rendez-vous * */ if ($_GET["actionid"] == 5) { + print_titre ("Saisie d'une action Rendez-vous"); + print "
"; print ''."\n"; - print ''; + print '
'; + // Type d'action print ''; - print ''; - print ''; - print ''; + + // Si la societe est imposée, on propose ces contacts + if ($_GET["socid"]) { + print ''; + } + + print ''; - print ''; - print ''; print ''; - print ''; - print '
Rendez-vous
Société'; - print ''.$societe->nom.'
Contact'.$contact->fullname.'
Date'; - $html= new Form($db); + print ''; + + // Societe, contact + print '
'.$langs->trans("Action concernant la companie").''; + 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("Action concernant le contact").''; + print $html->select_contacts($_GET["socid"],'','contactid',1,1); + print '
'.$langs->trans("Date").''; $html->select_date('','ac'); print '
Heure'; + print '
'.$langs->trans("Hour").''; print_heure_select("heure",8,20); print '
Durée'; + print '
'.$langs->trans("Duration").''; print_duree_select("duree"); print '
Commentaire'; print '
'; + print ''; + print ''; } + /* - * - * Action autre que rendez-vous - * + * Si action de type autre que rendez-vous * */ else { - if ($_GET["afaire"] <> 1) - { - print_titre ("Action effectuée"); - print ''; - - print ''; - print ''; - print ''; - print ''; + } - print_titre ("Prochaine Action à faire"); - - print '
Action'.$caction->libelle.'
Société'; - print ''.$societe->nom.'
Contact'.$contact->fullname.'
Date'; - print $html->select_date('','ac',1,1); + print_titre ("Saisie d'une action"); + print "
"; + + print ''; + + // Type d'action + print ''; + + print ''; + + // Societe, contact + 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(), 0); + } + print '
'.$langs->trans("Label").'
'.$langs->trans("Action concernant la companie").''; + 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 '
Commentaire'; - print '

"; - } + + // Si la societe est imposée, on propose ces contacts + if ($_GET["socid"]) { + print '

'.$langs->trans("Action concernant le contact").''; + print $html->select_contacts($_GET["socid"],'','contactid',1,1); + print '
'; - if ($_GET["afaire"] <> 1) - { - print ''; - } - else + // Avancement + if ($_GET["afaire"] == 1) { + print ''; print ''; - print ''; - print ''; + print ''; + } + elseif ($_GET["afaire"] == 2) + { + print ''; + print ''; + } else + { + print ''; } - print ''; - print ''; - print ''; - if (defined("MAIN_MODULE_WEBCALENDAR") && MAIN_MODULE_WEBCALENDAR) + + // Lien avec celendrier si module activé + if ($conf->webcal->enabled) { - print ''; + $langs->load("other"); + print ''; } - print ''; + print '
'.$langs->trans("Add").'
Société'; - print ''.$societe->nom.'
'.$langs->trans("Status").' / '.$langs->trans("Percentage").'To do / 0%
'.$langs->trans("Status").' / '.$langs->trans("Percentage").'Done / 100%
'.$langs->trans("Status").' / '.$langs->trans("Percentage").'
Date'; - print $html->select_date(); + // Date + print '
'.$langs->trans("Date").''; + if ($_GET["afaire"] == 1) + { + print $html->select_date('','ac'); + } else if ($_GET["afaire"] == 2) { + print $html->select_date('','ac',1,1); + } else { + print $html->select_date('','ac',1,1); + } print '
Action'; - $html->select_array("nextactionid", $caction->liste_array(), 0); - print '
Action
Calendrier
'.$langs->trans("AddCalendarEntry").'
Commentaire'; + + // Description + print '
'.$langs->trans("Description").''; print '
'; - print '

'; + print '

'; - print ""; } + + print ""; } + /* * * @@ -273,6 +309,7 @@ if ($_GET["action"] == 'create') */ if ($_GET["id"]) { + // Confirmation suppression action if ($_GET["action"] == 'delete') { print '
'; @@ -299,19 +336,22 @@ if ($_GET["id"]) $act->author->fetch($act->author->id); $act->contact->fetch($act->contact->id); - + // Fiche action en mode edition if ($_GET["action"] == 'edit') { print_titre ("Edition de la fiche action"); - print ''; + print ''; print ''; - print ''; + print ''; + print ''; + + print '
'; print ''; print ''; print ''; print ''; print ''; print ''; @@ -332,6 +372,7 @@ if ($_GET["id"]) } else { + // Affichage fiche action en mode visu print_titre ("Action commerciale"); print '
Type'.$act->type.'
Société'.$act->societe->nom.'Contact'; - $html->select_array("scontactid", $act->societe->contact_array(), $act->contact->id, 1); + $html->select_array("contactid", $act->societe->contact_array(), $act->contact->id, 1); print '
'.$langs->trans("Author").''.strftime('%d %B %Y %H:%M',$act->date).''.$langs->trans("Author").''.$act->author->fullname.'
'; diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index bb358a7a15b..b86e305efe9 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -32,8 +32,16 @@ $user->getrights('commande'); $user->getrights('projet'); +$langs->load("orders"); +$langs->load("companies"); + + llxHeader(); + +$sortorder=$_GET["sortorder"]; +$sortfield=$_GET["sortfield"]; + if ($sortorder == "") { $sortorder="ASC"; } @@ -198,14 +206,14 @@ if ($_socid > 0) */ print '
'; print '
'; - print ''; + print '
'; - print ''; - print ""; - print ''; - print ""; + print ""; + print ''; + print '"; print ""; print ""; - print ""; + print ""; print "
Nom'; + print '
'.$langs->trans("FirstName").''; print $objsoc->nom; print '
Adresse".nl2br($objsoc->adresse)."
".$objsoc->cp." ".$objsoc->ville." ".$objsoc->pays."
Téléphone'.dolibarr_print_phone($objsoc->tel).' Fax'.dolibarr_print_phone($objsoc->fax).' 
Weburl\">$objsoc->url 
".$langs->trans("Address")."".nl2br($objsoc->adresse)."
".$objsoc->cp." ".$objsoc->ville." ".$objsoc->pays."
'.$langs->trans("Phone").''.dolibarr_print_phone($objsoc->tel).' Fax'.dolibarr_print_phone($objsoc->fax).' 
'.$langs->trans("Web")."url\">$objsoc->url 
Sirensiren\">$objsoc->siren prefix"; @@ -220,7 +228,7 @@ if ($_socid > 0) print "
Type $objsoc->typentEffectif$objsoc->effectif
".$langs->trans("Type")." $objsoc->typentEffectif$objsoc->effectif
"; @@ -241,7 +249,7 @@ if ($_socid > 0) * */ $var = true; - print ''; + print '
'; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " AND s.idp = ".$objsoc->id." ORDER BY p.datep DESC"; @@ -319,7 +327,7 @@ if ($_socid > 0) $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $objsoc->id"; if ( $db->query($sql) ) { - print "
"; + print "
"; $i = 0 ; $num = $db->num_rows(); if ($num > 0) { @@ -400,12 +408,14 @@ if ($_socid > 0) * Liste des contacts * */ - print '
'; + print '
'; print ''; - print ''; + print ''; print ''; - print ""; + print ""; + print ''; + print ""; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $objsoc->id ORDER by p.datec"; $result = $db->query($sql); @@ -417,9 +427,9 @@ if ($_socid > 0) print ""; print ''; print ''; print ''; - print "'; + + print ''; + print "\n"; $i++; $tag = !$tag; @@ -472,19 +488,19 @@ if ($_socid > 0) if ($oldyear == strftime("%Y",$obj->da) ) { print ''; } else { - print "\n"; + print "\n"; $oldyear = strftime("%Y",$obj->da); } if ($oldmonth == strftime("%Y%b",$obj->da) ) { print ''; } else { - print "\n"; + print "\n"; $oldmonth = strftime("%Y%b",$obj->da); } - print "\n"; - print "\n"; + print "\n"; + print "\n"; print ''; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index 0a9e2e87582..5af44c111d9 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -366,12 +366,14 @@ if ($socid > 0) * Liste des contacts * */ - print '
'.$langs->trans("Firstname").' '.$langs->trans("Lastname").'Poste'.$langs->trans("Tel").''.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'".$langs->trans("AddContact")."
".$langs->trans("AddContact")." 
'; - print ''; - print img_file(); - print ' '.$obj->firstname.' '. $obj->name.' '; + print ''; + print img_file(); + print ' '.$obj->firstname.' '. $obj->name.' '; if ($obj->note) { @@ -430,10 +440,16 @@ if ($_socid > 0) print ''.$obj->phone.' '.$obj->fax.' '.$obj->email.' "; + + print ''; print "idp\">"; print img_edit(); print ''; + print img_actions(); + print '
|" .strftime("%Y",$obj->da)."" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." 
'; + print '
'; - print ''; - print ''; - print ""; - print ""; + print ''; + print ''; + print ''; + print ""; + print ''; + print ""; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $societe->id ORDER by p.datec"; $result = $db->query($sql); @@ -385,9 +387,10 @@ if ($socid > 0) print ""; print ''; print ''; print ''; - print ""; + + print ''; + + print ''; + print "\n"; $i++; $tag = !$tag; diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 6db7981f667..ac649f8c269 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -245,6 +245,18 @@ function dolibarr_print_phone($phone) } } +/*! + \brief Affiche logo dédié aux actions +*/ +function img_actions($alt = "default") +{ + if ($alt="default") { + global $langs; + $alt=$langs->trans("Rendez-vous"); + } + return ''.$alt.''; +} + /*! \brief Affiche logo fichier */
Prénom NomPosteTélFaxEmailid."&action=create\">".$langs->trans("AddContact")."
'.$langs->trans("Firstname").' '.$langs->trans("Lastname").''.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'".$langs->trans("AddContact")." 
'; - //print ''; - //print ' '; - print ''.$obj->firstname.' '. $obj->name.''; + print ''; + print img_file(); + print ' '.$obj->firstname.' '. $obj->name.' '; + if ($obj->note) { print "
".nl2br($obj->note); @@ -397,7 +400,16 @@ if ($socid > 0) print '
'.$obj->phone.' '.$obj->fax.' '.$obj->email.' idp\">".img_edit()."'; + print "idp\">"; + print img_edit(); + print ''; + print img_actions(); + print '