Uniformize way of working of trip and expenses (added "validate" step
after "draft").
This commit is contained in:
parent
9af78f97a8
commit
a8ca1c721c
@ -177,7 +177,7 @@ class Deplacement extends CommonObject
|
|||||||
$sql .= " SET km = ".$this->km; // This is a distance or amount
|
$sql .= " SET km = ".$this->km; // This is a distance or amount
|
||||||
$sql .= " , dated = '".$this->db->idate($this->date)."'";
|
$sql .= " , dated = '".$this->db->idate($this->date)."'";
|
||||||
$sql .= " , type = '".$this->type."'";
|
$sql .= " , type = '".$this->type."'";
|
||||||
$sql .= " , fk_statut = '".$this->fk_statut."'";
|
$sql .= " , fk_statut = '".$this->statut."'";
|
||||||
$sql .= " , fk_user = ".$this->fk_user;
|
$sql .= " , fk_user = ".$this->fk_user;
|
||||||
$sql .= " , fk_user_modif = ".$user->id;
|
$sql .= " , fk_user_modif = ".$user->id;
|
||||||
$sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null');
|
$sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null');
|
||||||
@ -226,7 +226,7 @@ class Deplacement extends CommonObject
|
|||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->km = $obj->km;
|
$this->km = $obj->km;
|
||||||
$this->type = $obj->type;
|
$this->type = $obj->type;
|
||||||
$this->fk_statut = $obj->fk_statut;
|
$this->statut = $obj->fk_statut;
|
||||||
$this->note_private = $obj->note;
|
$this->note_private = $obj->note;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
$this->fk_project = $obj->fk_projet;
|
$this->fk_project = $obj->fk_projet;
|
||||||
@ -249,7 +249,7 @@ class Deplacement extends CommonObject
|
|||||||
function delete($id)
|
function delete($id)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".$id;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".$id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||||
@ -300,23 +300,24 @@ class Deplacement extends CommonObject
|
|||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
//if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
||||||
if ($statut==0 || $statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
//if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
||||||
if ($statut==0 || $statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
//if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
//if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||||
if ($statut==0 || $statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||||
|
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
//if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
||||||
if ($statut==0 || $statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/deplacement/fiche.php
|
* \file htdocs/compta/deplacement/fiche.php
|
||||||
@ -28,8 +28,8 @@ require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php"
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||||
if ($conf->projet->enabled)
|
if ($conf->projet->enabled)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
@ -50,176 +50,167 @@ $object = new Deplacement($db);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
if ($action == 'block' && $user->rights->deplacement->valider)
|
if ($action == 'validate' && $user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($object->fk_statut == '2') // Already blocked...
|
if ($object->statut == 0)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("Error").'</div>';
|
$result = $object->setStatut(1);
|
||||||
$action='';
|
if ($result > 0)
|
||||||
$error++;
|
{
|
||||||
}
|
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
else
|
exit;
|
||||||
{
|
}
|
||||||
$result = $object->fetch($id);
|
else
|
||||||
|
{
|
||||||
$object->fk_statut = '2';
|
$mesg=$object->error;
|
||||||
|
}
|
||||||
$result = $object->update($user);
|
}
|
||||||
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg=$object->error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if ($action == 'unblock' && $user->rights->deplacement->unvalidate)
|
if ($action == 'unblock' && $user->rights->deplacement->unvalidate)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
if ($object->fk_statut == '1') // Not blocked...
|
if ($object->fk_statut == '1') // Not blocked...
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("Error").'</div>';
|
$mesg='<div class="error">'.$langs->trans("Error").'</div>';
|
||||||
$action='';
|
$action='';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
$object->fk_statut = '1';
|
$object->fk_statut = '1';
|
||||||
|
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
|
if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
|
||||||
{
|
{
|
||||||
$result=$object->delete($id);
|
$result=$object->delete($id);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: index.php");
|
Header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->deplacement->creer)
|
if ($action == 'add' && $user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
if (! $_POST["cancel"])
|
if (! $_POST["cancel"])
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object->date = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$object->date = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
$object->km = $_POST["km"];
|
$object->km = $_POST["km"];
|
||||||
$object->type = $_POST["type"];
|
$object->type = $_POST["type"];
|
||||||
$object->socid = $_POST["socid"];
|
$object->socid = $_POST["socid"];
|
||||||
$object->fk_user = $_POST["fk_user"];
|
$object->fk_user = $_POST["fk_user"];
|
||||||
$object->note_private = $_POST["note_private"];
|
$object->note_private = $_POST["note_private"];
|
||||||
$object->note_public = $_POST["note_public"];
|
$object->note_public = $_POST["note_public"];
|
||||||
|
$object->statut = 0;
|
||||||
|
|
||||||
if (! $object->date)
|
if (! $object->date)
|
||||||
{
|
{
|
||||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date"));
|
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date"));
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if ($object->type == '-1') // Otherwise it is TF_LUNCH,...
|
if ($object->type == '-1') // Otherwise it is TF_LUNCH,...
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! ($object->fk_user > 0))
|
if (! ($object->fk_user > 0))
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'</div>';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesg=$object->error;
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Header("Location: index.php");
|
Header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update record
|
// Update record
|
||||||
if ($action == 'update' && $user->rights->deplacement->creer)
|
if ($action == 'update' && $user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
if (empty($_POST["cancel"]))
|
if (empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
$object->date = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$object->date = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
$object->km = $_POST["km"];
|
$object->km = $_POST["km"];
|
||||||
$object->type = $_POST["type"];
|
$object->type = $_POST["type"];
|
||||||
$object->fk_user = $_POST["fk_user"];
|
$object->fk_user = $_POST["fk_user"];
|
||||||
$object->socid = $_POST["socid"];
|
$object->socid = $_POST["socid"];
|
||||||
$object->note_private = $_POST["note_private"];
|
$object->note_private = $_POST["note_private"];
|
||||||
$object->note_public = $_POST["note_public"];
|
$object->note_public = $_POST["note_public"];
|
||||||
|
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg=$object->error;
|
$mesg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set into a project
|
// Set into a project
|
||||||
if ($action == 'classin')
|
if ($action == 'classin')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setProject($_POST['projectid']);
|
$result=$object->setProject($_POST['projectid']);
|
||||||
if ($result < 0) dol_print_error($db, $object->error);
|
if ($result < 0) dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set fields
|
// Set fields
|
||||||
@ -252,7 +243,7 @@ if ($action == 'setnote')
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -260,322 +251,313 @@ $form = new Form($db);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Action create
|
* Action create
|
||||||
*/
|
*/
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("NewTrip"));
|
print_fiche_titre($langs->trans("NewTrip"));
|
||||||
|
|
||||||
dol_htmloutput_errors($mesg);
|
dol_htmloutput_errors($mesg);
|
||||||
|
|
||||||
$datec = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$datec = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
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%" class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
print '<td width="25%" class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||||
print $form->select_type_fees(GETPOST("type"),'type',1);
|
print $form->select_type_fees(GETPOST("type"),'type',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
||||||
print $form->select_users(GETPOST("fk_user"),'fk_user',1);
|
print $form->select_users(GETPOST("fk_user"),'fk_user',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||||
print $form->select_date($datec?$datec:-1,'','','','','add',1,1);
|
print $form->select_date($datec?$datec:-1,'','','','','add',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km
|
// Km
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" size="10" value="' . GETPOST("km") . '"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" size="10" value="' . GETPOST("km") . '"></td></tr>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||||
print $form->select_societes(GETPOST("socid"),'socid','',1);
|
print $form->select_societes(GETPOST("socid"),'socid','',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||||
print '<td valign="top" colspan="2">';
|
print '<td valign="top" colspan="2">';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note_public',GETPOST('note_public'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100);
|
$doleditor=new DolEditor('note_public',GETPOST('note_public'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100);
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
if (! $user->societe_id)
|
if (! $user->societe_id)
|
||||||
{
|
{
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||||
print '<td valign="top" colspan="2">';
|
print '<td valign="top" colspan="2">';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note_private',GETPOST('note_private'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100);
|
$doleditor=new DolEditor('note_private',GETPOST('note_private'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100);
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> ';
|
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></center';
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></center';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else if ($id)
|
else if ($id)
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
$head = trip_prepare_head($object);
|
$head = trip_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||||
|
|
||||||
if ($action == 'edit' && $user->rights->deplacement->creer)
|
if ($action == 'edit' && $user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
if ($object->socid)
|
if ($object->socid)
|
||||||
{
|
{
|
||||||
$soc->fetch($object->socid);
|
$soc->fetch($object->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
|
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $object->ref;
|
print $object->ref;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||||
print $form->select_type_fees($_POST["type"]?$_POST["type"]:$object->type,'type',0);
|
print $form->select_type_fees($_POST["type"]?$_POST["type"]:$object->type,'type',0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Who
|
// Who
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
||||||
print $form->select_users($_POST["fk_user"]?$_POST["fk_user"]:$object->fk_user,'fk_user',0);
|
print $form->select_users($_POST["fk_user"]?$_POST["fk_user"]:$object->fk_user,'fk_user',0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||||
print $form->select_date($object->date,'','','','','update');
|
print $form->select_date($object->date,'','','','','update');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km
|
// Km
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
||||||
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Where
|
// Where
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||||
print $form->select_societes($soc->id,'socid','',1);
|
print $form->select_societes($soc->id,'socid','',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note_public',$object->note_public,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100');
|
$doleditor=new DolEditor('note_public',$object->note_public,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
if (! $user->societe_id)
|
if (! $user->societe_id)
|
||||||
{
|
{
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note_private',$object->note_private,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100');
|
$doleditor=new DolEditor('note_private',$object->note_private,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</center>';
|
print '</center>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression du deplacement
|
* Confirmation de la suppression du deplacement
|
||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete");
|
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete");
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
if ($object->socid) $soc->fetch($object->socid);
|
if ($object->socid) $soc->fetch($object->socid);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>';
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $form->showrefnav($object,'id','',1,'rowid','ref','');
|
print $form->showrefnav($object,'id','',1,'rowid','ref','');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->editfieldkey("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
print $form->editfieldkey("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
print $form->editfieldval("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Who
|
// Who
|
||||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||||
$userfee=new User($db);
|
$userfee=new User($db);
|
||||||
$userfee->fetch($object->fk_user);
|
$userfee->fetch($object->fk_user);
|
||||||
print $userfee->getNomUrl(1);
|
print $userfee->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->editfieldkey("Date",'dated',$object->date,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'datepicker');
|
print $form->editfieldkey("Date",'dated',$object->date,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'datepicker');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("Date",'dated',$object->date,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'datepicker');
|
print $form->editfieldval("Date",'dated',$object->date,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'datepicker');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km/Price
|
// Km/Price
|
||||||
print '<tr><td valign="top">';
|
print '<tr><td valign="top">';
|
||||||
print $form->editfieldkey("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
print $form->editfieldkey("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
print $form->editfieldval("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Where
|
// Where
|
||||||
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($soc->id) print $soc->getNomUrl(1);
|
if ($soc->id) print $soc->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if ($conf->projet->enabled)
|
if ($conf->projet->enabled)
|
||||||
{
|
{
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Project');
|
print $langs->trans('Project');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'classify' && $user->rights->deplacement->creer)
|
if ($action != 'classify' && $user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$object->id.'">';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$object->id.'">';
|
||||||
print img_edit($langs->trans('SetProject'),1);
|
print img_edit($langs->trans('SetProject'),1);
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
}
|
}
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'classify')
|
if ($action == 'classify')
|
||||||
{
|
{
|
||||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid');
|
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none');
|
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr><td valign="top">';
|
print '<tr><td valign="top">';
|
||||||
print $form->editfieldkey("NotePublic",'note_public',$object->note_public,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
print $form->editfieldkey("NotePublic",'note_public',$object->note_public,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("NotePublic",'note_public',$object->note_public,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
print $form->editfieldval("NotePublic",'note_public',$object->note_public,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
if (! $user->societe_id)
|
if (! $user->societe_id)
|
||||||
{
|
{
|
||||||
print '<tr><td valign="top">';
|
print '<tr><td valign="top">';
|
||||||
print $form->editfieldkey("NotePrivate",'note',$object->note_private,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
print $form->editfieldkey("NotePrivate",'note',$object->note_private,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("NotePrivate",'note',$object->note_private,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
print $form->editfieldval("NotePrivate",'note',$object->note_private,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'ckeditor:dolibarr_notes:600:180');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($object->fk_statut == '2') // if blocked...
|
if ($object->statut == 0) // if blocked...
|
||||||
{
|
{
|
||||||
if ($user->rights->deplacement->unvalidate)
|
if ($user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=unblock&id='.$id.'">'.$langs->trans('Unblock').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Validate').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Unblock').'</a>';
|
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($object->fk_statut == '1') // If not blocked...
|
|
||||||
{
|
if ($user->rights->deplacement->creer)
|
||||||
if ($user->rights->deplacement->valider)
|
{
|
||||||
{
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=block&id='.$id.'">'.$langs->trans('Block').'</a>';
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Block').'</a>';
|
}
|
||||||
}
|
if ($user->rights->deplacement->supprimer)
|
||||||
if ($user->rights->deplacement->creer)
|
{
|
||||||
{
|
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
}
|
||||||
}
|
|
||||||
if ($user->rights->deplacement->supprimer)
|
print '</div>';
|
||||||
{
|
}
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
dol_print_error($db);
|
||||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -131,7 +131,7 @@ $max=10;
|
|||||||
|
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
|
|
||||||
$sql = "SELECT u.rowid as uid, u.name, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km";
|
$sql = "SELECT u.rowid as uid, u.name, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE u.rowid = d.fk_user";
|
$sql.= " WHERE u.rowid = d.fk_user";
|
||||||
@ -164,18 +164,18 @@ if ($result)
|
|||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
while ($i < $num && $i < $max)
|
while ($i < $num && $i < $max)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$deplacementstatic->ref=$objp->rowid;
|
$deplacementstatic->ref=$obj->rowid;
|
||||||
$deplacementstatic->id=$objp->rowid;
|
$deplacementstatic->id=$obj->rowid;
|
||||||
$userstatic->id=$objp->uid;
|
$userstatic->id=$obj->uid;
|
||||||
$userstatic->nom=$objp->name;
|
$userstatic->nom=$obj->name;
|
||||||
$userstatic->prenom=$objp->firstname;
|
$userstatic->prenom=$obj->firstname;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
|
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
|
||||||
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="right">'.$objp->km.'</td>';
|
print '<td align="right">'.$obj->km.'</td>';
|
||||||
print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
|
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
|
||||||
print '<td>'.$deplacementstatic->LibStatut($objp->fk_statut,3).'</td>';
|
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut,3).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$i++;
|
$i++;
|
||||||
@ -191,7 +191,7 @@ if ($result)
|
|||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/deplacement/list.php
|
* \file htdocs/compta/deplacement/list.php
|
||||||
* \brief Page list of expenses
|
* \brief Page to list trips and expenses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
@ -60,6 +60,7 @@ llxHeader();
|
|||||||
|
|
||||||
$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
|
$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
|
||||||
$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment
|
$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment
|
||||||
|
$sql.= " d.fk_statut,";
|
||||||
$sql.= " u.name, u.firstname"; // Qui
|
$sql.= " u.name, u.firstname"; // Qui
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."deplacement as d";
|
$sql.= ", ".MAIN_DB_PREFIX."deplacement as d";
|
||||||
@ -123,21 +124,22 @@ if ($resql)
|
|||||||
$var=true;
|
$var=true;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
if ($objp->socid) $soc->fetch($objp->socid);
|
if ($obj->socid) $soc->fetch($obj->socid);
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td><a href="fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->rowid.'</a></td>';
|
print '<td><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.'</a></td>';
|
||||||
print '<td>'.$langs->trans($objp->type).'</td>';
|
print '<td>'.$langs->trans($obj->type).'</td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->dd),'day').'</td>';
|
print '<td>'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
|
||||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.'</a></td>';
|
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->firstname.' '.$obj->name.'</a></td>';
|
||||||
if ($objp->socid) print '<td>'.$soc->getNomUrl(1).'</td>';
|
if ($obj->socid) print '<td>'.$soc->getNomUrl(1).'</td>';
|
||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
print '<td align="right">'.$objp->km.'</td>';
|
print '<td align="right">'.$obj->km.'</td>';
|
||||||
|
|
||||||
|
$tripandexpense_static->statut=$obj->fk_statut;
|
||||||
print '<td align="right">'.$tripandexpense_static->getLibStatut(5).'</td>';
|
print '<td align="right">'.$tripandexpense_static->getLibStatut(5).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -192,8 +192,6 @@ foreach ($data as $val)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center" valign="top">';
|
print '<td align="center" valign="top">';
|
||||||
|
|
||||||
@ -209,7 +207,7 @@ print '</td></tr></table>';
|
|||||||
|
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -95,19 +95,19 @@ class modDeplacement extends DolibarrModules
|
|||||||
$this->rights[3][2] = 'd';
|
$this->rights[3][2] = 'd';
|
||||||
$this->rights[3][3] = 0;
|
$this->rights[3][3] = 0;
|
||||||
$this->rights[3][4] = 'supprimer';
|
$this->rights[3][4] = 'supprimer';
|
||||||
|
/*
|
||||||
$this->rights[4][0] = 174;
|
$this->rights[4][0] = 174;
|
||||||
$this->rights[4][1] = 'Bloquer les deplacements';
|
$this->rights[4][1] = 'Bloquer les deplacements';
|
||||||
$this->rights[4][2] = 'a';
|
$this->rights[4][2] = 'a';
|
||||||
$this->rights[4][3] = 0;
|
$this->rights[4][3] = 0;
|
||||||
$this->rights[4][4] = 'valider';
|
$this->rights[4][4] = 'valider';
|
||||||
|
|
||||||
$this->rights[5][0] = 175;
|
$this->rights[5][0] = 175;
|
||||||
$this->rights[5][1] = 'Debloquer les deplacements';
|
$this->rights[5][1] = 'Debloquer les deplacements';
|
||||||
$this->rights[5][2] = 'a';
|
$this->rights[5][2] = 'a';
|
||||||
$this->rights[5][3] = 0;
|
$this->rights[5][3] = 0;
|
||||||
$this->rights[5][4] = 'unvalidate';
|
$this->rights[5][4] = 'unvalidate';
|
||||||
|
*/
|
||||||
$this->rights[6][0] = 178;
|
$this->rights[6][0] = 178;
|
||||||
$this->rights[6][1] = 'Exporter les deplacements';
|
$this->rights[6][1] = 'Exporter les deplacements';
|
||||||
$this->rights[6][2] = 'd';
|
$this->rights[6][2] = 'd';
|
||||||
|
|||||||
@ -178,3 +178,4 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (23
|
|||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2323,232, '8','0','VAT 8%',1);
|
||||||
|
|
||||||
update llx_cotisation set fk_bank = null where fk_bank not in (select rowid from llx_bank);
|
update llx_cotisation set fk_bank = null where fk_bank not in (select rowid from llx_bank);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user