From 98e46b4011939cd6eaea70dc46f874897f252f21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Nov 2008 21:18:40 +0000 Subject: [PATCH] Fix: Visited company not saved --- htdocs/compta/deplacement/fiche.php | 277 +++++++++++++++------------- 1 file changed, 147 insertions(+), 130 deletions(-) diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 1997c826c79..4929641cec6 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -18,11 +18,10 @@ */ /** - \file htdocs/compta/deplacement/fiche.php - \brief Page fiche d'un deplacement - \version $Id$ -*/ - + * \file htdocs/compta/deplacement/fiche.php + * \brief Page fiche d'un deplacement + * \version $Id$ + */ require("./pre.inc.php"); $langs->load("trips"); @@ -51,18 +50,18 @@ if ($_POST["action"] == 'add' && $user->rights->deplacement->creer) { if (! $_POST["cancel"]) { - $deplacement = new Deplacement($db); + $deplacement = new Deplacement($db); $deplacement->date = dolibarr_mktime(12, 0, 0, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"]); + $_POST["remonth"], + $_POST["reday"], + $_POST["reyear"]); $deplacement->km = $_POST["km"]; $deplacement->type = $_POST["type"]; $deplacement->socid = $_POST["socid"]; $deplacement->fk_user = $_POST["fk_user"]; - + $id = $deplacement->create($user); if ($id > 0) @@ -89,18 +88,17 @@ if ($_POST["action"] == 'update' && $user->rights->deplacement->creer) { $deplacement = new Deplacement($db); $result = $deplacement->fetch($_POST["id"]); - + $deplacement->date = dolibarr_mktime(12, 0 , 0, - $_POST["remonth"], - $_POST["reday"], - $_POST["reyear"]); - - $deplacement->km = $_POST["km"]; - $deplacement->type = $_POST["type"]; + $_POST["remonth"], + $_POST["reday"], + $_POST["reyear"]); + $deplacement->km = $_POST["km"]; + $deplacement->type = $_POST["type"]; $deplacement->fk_user = $_POST["fk_user"]; - + $deplacement->socid = $_POST["socid"]; $result = $deplacement->update($user); - + if ($result > 0) { Header("Location: fiche.php?id=".$_POST["id"]); @@ -129,144 +127,163 @@ $html = new Form($db); */ if ($_GET["action"] == 'create') { - print_fiche_titre($langs->trans("NewTrip")); + print_fiche_titre($langs->trans("NewTrip")); if ($mesg) print $mesg."
"; - - print "
\n"; - print ''; - - print ''; - print ""; - print ''; + print "\n"; + print ''; - print ""; - print ''; - - print ""; - print ''; - - print ""; - print ''; + print '
'.$langs->trans("CompanyVisited").''; - print $html->select_societes($_GET["socid"],'socid','',1); - print '
'.$langs->trans("Type").''; - print $html->select_type_fees($_GET["type"],'type',1); - print '
'.$langs->trans("Person").''; - print $html->select_users($_GET["fk_user"],'fk_user',1); - print '
'.$langs->trans("Date").''; - print $html->select_date('','','','','','add'); - print '
'; - print ''; - print ''; - print '
'.$langs->trans("FeesKilometersOrAmout").'
 '; - print '
'; - print '
'; + print ""; + print ''.$langs->trans("CompanyVisited").''; + print $html->select_societes($_GET["socid"],'socid','',1); + print ''; + + print ""; + print ''.$langs->trans("Type").''; + print $html->select_type_fees($_GET["type"],'type',1); + print ''; + + print ""; + print ''.$langs->trans("Person").''; + print $html->select_users($_GET["fk_user"],'fk_user',1); + print ''; + + print ""; + print ''.$langs->trans("Date").''; + print $html->select_date('','','','','','add'); + print ''; + + print ''.$langs->trans("FeesKilometersOrAmout").''; + print ' '; + print ''; + print ''; + print ''; } else { - if ($id) - { - $deplacement = new Deplacement($db); - $result = $deplacement->fetch($id); - if ($result) + if ($id) { + $deplacement = new Deplacement($db); + $result = $deplacement->fetch($id); + if ($result) + { - if ($mesg) print $mesg."
"; - - if ($_GET["action"] == 'edit') - { - $h=0; + if ($mesg) print $mesg."
"; - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id"; - $head[$h][1] = $langs->trans("TripCard"); + if ($_GET["action"] == 'edit') + { + $soc = new Societe($db); + $soc->fetch($deplacement->socid); - dolibarr_fiche_head($head, $hselected, $langs->trans("Ref").' '.$deplacement->id); + $h=0; - print "
\n"; - print ''; - print ''; + $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id"; + $head[$h][1] = $langs->trans("Card"); - print ''; + dolibarr_fiche_head($head, $hselected, $langs->trans("TripCard")); - $soc = new Societe($db); - $soc->fetch($deplacement->socid); + print "\n"; + print ''; + print ''; - print ""; - print ''; + print '
'.$langs->trans("CompanyVisited").''; - print $html->select_societes($soc->id,'socid','',1); - print '
'; - print ""; - print ''; - - print ""; - print ''; - - print ''; - print ''; + print ""; + print ''; - print ''; - print '
'.$langs->trans("Type").''; - print $html->select_type_fees($deplacement->type,'type',1); - print '
'.$langs->trans("Person").''; - print $html->select_users($deplacement->fk_user,'fk_user',1); - print '
'.$langs->trans("Date").''; - print $html->select_date($deplacement->date,'','','','','update'); - print '
'.$langs->trans("FeesKilometersOrAmout").'
'.$langs->trans("Ref").''; + print $deplacement->ref; + print '
  '; - print '
'; - print '
'; + print ""; + print ''.$langs->trans("CompanyVisited").''; + print $html->select_societes($soc->id,'socid','',1); + print ''; - print ''; - } - else - { - $h=0; + print ""; + print ''.$langs->trans("Type").''; + print $html->select_type_fees($deplacement->type,'type',1); + print ''; - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id"; - $head[$h][1] = $langs->trans("TripCard"); + print ""; + print ''.$langs->trans("Person").''; + print $html->select_users($deplacement->fk_user,'fk_user',1); + print ''; - dolibarr_fiche_head($head, $hselected, $langs->trans("Ref").' '.$deplacement->id); + print ''.$langs->trans("Date").''; + print $html->select_date($deplacement->date,'','','','','update'); + print ''; + print ''.$langs->trans("FeesKilometersOrAmout").''; - /* - * Confirmation de la suppression du déplacement - */ - if ($_GET["action"] == 'delete') - { + print '   '; + print ''; + print ''; + print ''; - $html = new Form($db); - $html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); + print ''; + } + else + { + $h=0; - print '
'; - } + $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id"; + $head[$h][1] = $langs->trans("Card"); - $soc = new Societe($db); - $soc->fetch($deplacement->socid); + dolibarr_fiche_head($head, $hselected, $langs->trans("TripCard")); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "
'.$langs->trans("CompanyVisited").''.$soc->getNomUrl(1).'
'.$langs->trans("Type").''.$langs->trans($deplacement->type).'
'.$langs->trans("Person").''; - $userfee=new User($db,$deplacement->fk_user); - $userfee->fetch(); - print $userfee->getNomUrl(1); - print '
'.$langs->trans("Date").''; - print dolibarr_print_date($deplacement->date); - print '
'.$langs->trans("FeesKilometersOrAmout").''.$deplacement->km.'
"; + /* + * Confirmation de la suppression du déplacement + */ + if ($_GET["action"] == 'delete') + { - print ''; - } + $html = new Form($db); + $html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); + print '
'; + } + + $soc = new Societe($db); + if ($deplacement->socid) $soc->fetch($deplacement->socid); + + print ''; + + print ""; + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print "
'.$langs->trans("Ref").''; + print $deplacement->ref; + print '
'.$langs->trans("CompanyVisited").''; + if ($soc->id) print $soc->getNomUrl(1); + print '
'.$langs->trans("Type").''.$langs->trans($deplacement->type).'
'.$langs->trans("Person").''; + $userfee=new User($db,$deplacement->fk_user); + $userfee->fetch(); + print $userfee->getNomUrl(1); + print '
'.$langs->trans("Date").''; + print dolibarr_print_date($deplacement->date); + print '
'.$langs->trans("FeesKilometersOrAmout").''.$deplacement->km.'
"; + + print ''; + } + + } + else + { + dolibarr_print_error($db); + } } - else - { - dolibarr_print_error($db); - } - } } @@ -279,8 +296,8 @@ print '
'; if ($_GET["action"] != 'create' && $_GET["action"] != 'edit') { - print ''.$langs->trans('Modify').''; - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Delete').''; } print '
';