Fix: Visited company not saved
This commit is contained in:
parent
1091f72a8f
commit
98e46b4011
@ -18,11 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/deplacement/fiche.php
|
* \file htdocs/compta/deplacement/fiche.php
|
||||||
\brief Page fiche d'un deplacement
|
* \brief Page fiche d'un deplacement
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
@ -51,12 +50,12 @@ if ($_POST["action"] == 'add' && $user->rights->deplacement->creer)
|
|||||||
{
|
{
|
||||||
if (! $_POST["cancel"])
|
if (! $_POST["cancel"])
|
||||||
{
|
{
|
||||||
$deplacement = new Deplacement($db);
|
$deplacement = new Deplacement($db);
|
||||||
|
|
||||||
$deplacement->date = dolibarr_mktime(12, 0, 0,
|
$deplacement->date = dolibarr_mktime(12, 0, 0,
|
||||||
$_POST["remonth"],
|
$_POST["remonth"],
|
||||||
$_POST["reday"],
|
$_POST["reday"],
|
||||||
$_POST["reyear"]);
|
$_POST["reyear"]);
|
||||||
|
|
||||||
$deplacement->km = $_POST["km"];
|
$deplacement->km = $_POST["km"];
|
||||||
$deplacement->type = $_POST["type"];
|
$deplacement->type = $_POST["type"];
|
||||||
@ -91,14 +90,13 @@ if ($_POST["action"] == 'update' && $user->rights->deplacement->creer)
|
|||||||
$result = $deplacement->fetch($_POST["id"]);
|
$result = $deplacement->fetch($_POST["id"]);
|
||||||
|
|
||||||
$deplacement->date = dolibarr_mktime(12, 0 , 0,
|
$deplacement->date = dolibarr_mktime(12, 0 , 0,
|
||||||
$_POST["remonth"],
|
$_POST["remonth"],
|
||||||
$_POST["reday"],
|
$_POST["reday"],
|
||||||
$_POST["reyear"]);
|
$_POST["reyear"]);
|
||||||
|
$deplacement->km = $_POST["km"];
|
||||||
$deplacement->km = $_POST["km"];
|
$deplacement->type = $_POST["type"];
|
||||||
$deplacement->type = $_POST["type"];
|
|
||||||
$deplacement->fk_user = $_POST["fk_user"];
|
$deplacement->fk_user = $_POST["fk_user"];
|
||||||
|
$deplacement->socid = $_POST["socid"];
|
||||||
$result = $deplacement->update($user);
|
$result = $deplacement->update($user);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -129,144 +127,163 @@ $html = new Form($db);
|
|||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("NewTrip"));
|
print_fiche_titre($langs->trans("NewTrip"));
|
||||||
|
|
||||||
if ($mesg) print $mesg."<br>";
|
if ($mesg) print $mesg."<br>";
|
||||||
|
|
||||||
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td width="25%">'.$langs->trans("CompanyVisited").'</td><td>';
|
print '<td width="25%">'.$langs->trans("CompanyVisited").'</td><td>';
|
||||||
print $html->select_societes($_GET["socid"],'socid','',1);
|
print $html->select_societes($_GET["socid"],'socid','',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("Type").'</td><td>';
|
print '<td>'.$langs->trans("Type").'</td><td>';
|
||||||
print $html->select_type_fees($_GET["type"],'type',1);
|
print $html->select_type_fees($_GET["type"],'type',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("Person").'</td><td>';
|
print '<td>'.$langs->trans("Person").'</td><td>';
|
||||||
print $html->select_users($_GET["fk_user"],'fk_user',1);
|
print $html->select_users($_GET["fk_user"],'fk_user',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("Date").'</td><td>';
|
print '<td>'.$langs->trans("Date").'</td><td>';
|
||||||
print $html->select_date('','','','','','add');
|
print $html->select_date('','','','','','add');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" size="10" value=""></td></tr>';
|
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" size="10" value=""></td></tr>';
|
||||||
print '<tr><td colspan="2" align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'"> ';
|
print '<tr><td colspan="2" align="center"><input class="button" type="submit" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
|
||||||
$deplacement = new Deplacement($db);
|
|
||||||
$result = $deplacement->fetch($id);
|
|
||||||
if ($result)
|
|
||||||
{
|
{
|
||||||
|
$deplacement = new Deplacement($db);
|
||||||
|
$result = $deplacement->fetch($id);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
|
||||||
if ($mesg) print $mesg."<br>";
|
if ($mesg) print $mesg."<br>";
|
||||||
|
|
||||||
if ($_GET["action"] == 'edit')
|
if ($_GET["action"] == 'edit')
|
||||||
{
|
{
|
||||||
$h=0;
|
$soc = new Societe($db);
|
||||||
|
$soc->fetch($deplacement->socid);
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
|
$h=0;
|
||||||
$head[$h][1] = $langs->trans("TripCard");
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Ref").' '.$deplacement->id);
|
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
|
||||||
|
$head[$h][1] = $langs->trans("Card");
|
||||||
|
|
||||||
print "<form name='update' action=\"fiche.php\" method=\"post\">\n";
|
dolibarr_fiche_head($head, $hselected, $langs->trans("TripCard"));
|
||||||
print '<input type="hidden" name="action" value="update">';
|
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print "<form name='update' action=\"fiche.php\" method=\"post\">\n";
|
||||||
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
|
||||||
$soc = new Societe($db);
|
print '<table class="border" width="100%">';
|
||||||
$soc->fetch($deplacement->socid);
|
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td width="20%">'.$langs->trans("CompanyVisited").'</td><td>';
|
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $html->select_societes($soc->id,'socid','',1);
|
print $deplacement->ref;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("Type").'</td><td>';
|
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||||
print $html->select_type_fees($deplacement->type,'type',1);
|
print $html->select_societes($soc->id,'socid','',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("Person").'</td><td>';
|
print '<td>'.$langs->trans("Type").'</td><td>';
|
||||||
print $html->select_users($deplacement->fk_user,'fk_user',1);
|
print $html->select_type_fees($deplacement->type,'type',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print "<tr>";
|
||||||
print $html->select_date($deplacement->date,'','','','','update');
|
print '<td>'.$langs->trans("Person").'</td><td>';
|
||||||
print '</td></tr>';
|
print $html->select_users($deplacement->fk_user,'fk_user',1);
|
||||||
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" class="flat" size="10" value="'.$deplacement->km.'"></td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'"></td></tr>';
|
print $html->select_date($deplacement->date,'','','','','update');
|
||||||
print '</table>';
|
print '</td></tr>';
|
||||||
print '</form>';
|
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" class="flat" size="10" value="'.$deplacement->km.'"></td></tr>';
|
||||||
|
|
||||||
print '</div>';
|
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
}
|
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
else
|
print '</table>';
|
||||||
{
|
print '</form>';
|
||||||
$h=0;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
|
print '</div>';
|
||||||
$head[$h][1] = $langs->trans("TripCard");
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$h=0;
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Ref").' '.$deplacement->id);
|
$head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id";
|
||||||
|
$head[$h][1] = $langs->trans("Card");
|
||||||
|
|
||||||
/*
|
dolibarr_fiche_head($head, $hselected, $langs->trans("TripCard"));
|
||||||
* Confirmation de la suppression du déplacement
|
|
||||||
*/
|
|
||||||
if ($_GET["action"] == 'delete')
|
|
||||||
{
|
|
||||||
|
|
||||||
$html = new Form($db);
|
/*
|
||||||
$html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete");
|
* Confirmation de la suppression du déplacement
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == 'delete')
|
||||||
|
{
|
||||||
|
|
||||||
print '<br>';
|
$html = new Form($db);
|
||||||
}
|
$html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete");
|
||||||
|
|
||||||
$soc = new Societe($db);
|
print '<br>';
|
||||||
$soc->fetch($deplacement->socid);
|
}
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
$soc = new Societe($db);
|
||||||
print '<tr><td width="20%">'.$langs->trans("CompanyVisited").'</td><td>'.$soc->getNomUrl(1).'</td></tr>';
|
if ($deplacement->socid) $soc->fetch($deplacement->socid);
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans($deplacement->type).'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
|
||||||
$userfee=new User($db,$deplacement->fk_user);
|
|
||||||
$userfee->fetch();
|
|
||||||
print $userfee->getNomUrl(1);
|
|
||||||
print '</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
|
||||||
print dolibarr_print_date($deplacement->date);
|
|
||||||
print '</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td>'.$deplacement->km.'</td></tr>';
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</div>';
|
print '<table class="border" width="100%">';
|
||||||
}
|
|
||||||
|
|
||||||
|
print "<tr>";
|
||||||
|
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
|
||||||
|
print $deplacement->ref;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">'.$langs->trans("CompanyVisited").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
if ($soc->id) print $soc->getNomUrl(1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans($deplacement->type).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||||
|
$userfee=new User($db,$deplacement->fk_user);
|
||||||
|
$userfee->fetch();
|
||||||
|
print $userfee->getNomUrl(1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
|
print dolibarr_print_date($deplacement->date);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td>'.$deplacement->km.'</td></tr>';
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -279,8 +296,8 @@ print '<div class="tabsAction">';
|
|||||||
|
|
||||||
if ($_GET["action"] != 'create' && $_GET["action"] != 'edit')
|
if ($_GET["action"] != 'create' && $_GET["action"] != 'edit')
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
print '<a class="butAction" href="fiche.php?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||||
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user