Work on expensereport module
This commit is contained in:
parent
e5b401c8f2
commit
2e0b2fb012
@ -1792,7 +1792,8 @@ abstract class CommonObject
|
|||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->error[]=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
61
htdocs/core/lib/expensereport.lib.php
Normal file
61
htdocs/core/lib/expensereport.lib.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/lib/expensereport.lib.php
|
||||||
|
* \brief Functions for module expensereport
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of tabs
|
||||||
|
*
|
||||||
|
* @param Object $object Object related to tabs
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function expensereport_prepare_head($object)
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/expensereport/card.php?id=' . $object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Card");
|
||||||
|
$head[$h][2] = 'card';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport');
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Documents");
|
||||||
|
$head[$h][2] = 'documents';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT . '/expensereport/info.php?id=' . $object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Info");
|
||||||
|
$head[$h][2] = 'info';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport','remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
@ -29,17 +29,20 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formprojet.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formprojet.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/trip.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/expensereport.lib.php");
|
||||||
dol_include_once('/expensereport/core/modules/expensereport/modules_expensereport.php');
|
dol_include_once('/expensereport/core/modules/expensereport/modules_expensereport.php');
|
||||||
dol_include_once("/expensereport/class/expensereport.class.php");
|
dol_include_once("/expensereport/class/expensereport.class.php");
|
||||||
|
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
|
|
||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
|
$cancel=GETPOST('cancel');
|
||||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debutday'), GETPOST('date_debutyear'));
|
$date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth'), GETPOST('date_debutday'), GETPOST('date_debutyear'));
|
||||||
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear'));
|
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth'), GETPOST('date_finday'), GETPOST('date_finyear'));
|
||||||
|
$date = dol_mktime(0, 0, 0, GETPOST('datemonth'), GETPOST('dateday'), GETPOST('dateyear'));
|
||||||
|
$fk_projet=GETPOST('fk_projet');
|
||||||
|
|
||||||
// If socid provided by ajax company selector
|
// If socid provided by ajax company selector
|
||||||
if (! empty($_REQUEST['socid_id']))
|
if (! empty($_REQUEST['socid_id']))
|
||||||
@ -54,8 +57,6 @@ $id=GETPOST("id",'int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'expensereport', 0, 'expensereport');
|
$result = restrictedArea($user, 'expensereport', 0, 'expensereport');
|
||||||
|
|
||||||
$mesg="";
|
|
||||||
|
|
||||||
|
|
||||||
// Hack to use expensereport dir
|
// Hack to use expensereport dir
|
||||||
$rootfordata = DOL_DATA_ROOT;
|
$rootfordata = DOL_DATA_ROOT;
|
||||||
@ -74,6 +75,8 @@ $conf->expensereport->dir_output = $rootfordata.'/expensereport';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($cancel) $action='';
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $_GET["confirm"] == "yes" && $id > 0 && $user->rights->expensereport->supprimer)
|
if ($action == 'confirm_delete' && $_GET["confirm"] == "yes" && $id > 0 && $user->rights->expensereport->supprimer)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
@ -103,10 +106,12 @@ if ($action == 'add' && $user->rights->expensereport->creer)
|
|||||||
|
|
||||||
if ($object->periode_existe($user,dol_print_date($object->date_debut, 'dayrfc'),dol_print_date($object->date_fin, 'dayrfc')))
|
if ($object->periode_existe($user,dol_print_date($object->date_debut, 'dayrfc'),dol_print_date($object->date_fin, 'dayrfc')))
|
||||||
{
|
{
|
||||||
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorDoubleDeclaration"),'errors');
|
setEventMessage($langs->trans("ErrorDoubleDeclaration"),'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -130,7 +135,7 @@ if ($action == 'add' && $user->rights->expensereport->creer)
|
|||||||
if ($action == 'update' && $user->rights->expensereport->creer)
|
if ($action == 'update' && $user->rights->expensereport->creer)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($_POST['id'],$user);
|
$object->fetch($id);
|
||||||
|
|
||||||
$object->date_debut = $date_start;
|
$object->date_debut = $date_start;
|
||||||
$object->date_fin = $date_end;
|
$object->date_fin = $date_end;
|
||||||
@ -158,7 +163,7 @@ if ($action == 'update' && $user->rights->expensereport->creer)
|
|||||||
if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer)
|
if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->creer)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
$result = $object->set_save($user);
|
$result = $object->set_save($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -195,8 +200,8 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
|
|||||||
if($resultPDF):
|
if($resultPDF):
|
||||||
// ATTACHMENT
|
// ATTACHMENT
|
||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
array_push($filename,dol_sanitizeFileName($object->ref_number).".pdf");
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref_number) . "/" . dol_sanitizeFileName($object->ref_number).".pdf");
|
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref).".pdf");
|
||||||
array_push($mimetype,"application/pdf");
|
array_push($mimetype,"application/pdf");
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
@ -232,7 +237,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
|
|||||||
if ($action == "confirm_save_from_refuse" && $_GET["confirm"] == "yes" && $id > 0 && $user->rights->expensereport->creer)
|
if ($action == "confirm_save_from_refuse" && $_GET["confirm"] == "yes" && $id > 0 && $user->rights->expensereport->creer)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
$result = $object->set_save_from_refuse($user);
|
$result = $object->set_save_from_refuse($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -256,7 +261,7 @@ if ($action == "confirm_save_from_refuse" && $_GET["confirm"] == "yes" && $id >
|
|||||||
$dateRefusEx = explode(" ",$object->date_refuse);
|
$dateRefusEx = explode(" ",$object->date_refuse);
|
||||||
|
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
$message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref_number}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n";
|
$message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n";
|
||||||
$message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n";
|
$message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n";
|
||||||
$message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n";
|
$message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||||
$message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n";
|
$message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n";
|
||||||
@ -270,8 +275,8 @@ if ($action == "confirm_save_from_refuse" && $_GET["confirm"] == "yes" && $id >
|
|||||||
if($resultPDF):
|
if($resultPDF):
|
||||||
// ATTACHMENT
|
// ATTACHMENT
|
||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
array_push($filename,dol_sanitizeFileName($object->ref_number).".pdf");
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref_number) . "/" . dol_sanitizeFileName($object->ref_number).".pdf");
|
array_push($filedir,$conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref) . "/" . dol_sanitizeFileName($object->ref_number).".pdf");
|
||||||
array_push($mimetype,"application/pdf");
|
array_push($mimetype,"application/pdf");
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
@ -308,16 +313,13 @@ if ($action == "confirm_save_from_refuse" && $_GET["confirm"] == "yes" && $id >
|
|||||||
if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->to_validate)
|
if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->to_validate)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
|
|
||||||
$result = $object->set_valide($user);
|
$result = $object->set_valide($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
|
||||||
$object->fetch($id,$user);
|
|
||||||
|
|
||||||
// Send mail
|
// Send mail
|
||||||
|
|
||||||
// TO
|
// TO
|
||||||
@ -338,7 +340,7 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
|
|||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
$message.= "Votre note de frais \"{$object->ref_number}\" vient d'être approuvé!\n";
|
$message.= "Votre note de frais \"{$object->ref}\" vient d'être approuvé!\n";
|
||||||
$message.= "- Approbateur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
$message.= "- Approbateur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
||||||
$message.= "Bien cordialement,\n' SI";
|
$message.= "Bien cordialement,\n' SI";
|
||||||
@ -350,12 +352,12 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
|
|||||||
if($resultPDF):
|
if($resultPDF):
|
||||||
// ATTACHMENT
|
// ATTACHMENT
|
||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
array_push($filename,dol_sanitizeFileName($object->ref_number).".pdf");
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
array_push($filedir, $conf->expensereport->dir_output.
|
array_push($filedir, $conf->expensereport->dir_output.
|
||||||
"/".
|
"/".
|
||||||
dol_sanitizeFileName($object->ref_number) .
|
dol_sanitizeFileName($object->ref) .
|
||||||
"/".
|
"/".
|
||||||
dol_sanitizeFileName($object->ref_number).
|
dol_sanitizeFileName($object->ref).
|
||||||
".pdf"
|
".pdf"
|
||||||
);
|
);
|
||||||
array_push($mimetype,"application/pdf");
|
array_push($mimetype,"application/pdf");
|
||||||
@ -394,16 +396,13 @@ if ($action == "confirm_validate" && GETPOST("confirm") == "yes" && $id > 0 && $
|
|||||||
if ($action == "confirm_refuse" && $_POST['confirm']=="yes" && !empty($_POST['detail_refuse']) && $id > 0 && $user->rights->expensereport->to_validate)
|
if ($action == "confirm_refuse" && $_POST['confirm']=="yes" && !empty($_POST['detail_refuse']) && $id > 0 && $user->rights->expensereport->to_validate)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
|
|
||||||
$result = $object->set_refuse($user,$_POST['detail_refuse']);
|
$result = $object->set_refuse($user,$_POST['detail_refuse']);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
|
||||||
$object->fetch($id,$user);
|
|
||||||
|
|
||||||
// Send mail
|
// Send mail
|
||||||
|
|
||||||
// TO
|
// TO
|
||||||
@ -421,7 +420,7 @@ if ($action == "confirm_refuse" && $_POST['confirm']=="yes" && !empty($_POST['de
|
|||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
$message.= "Votre note de frais \"{$object->ref_number}\" vient d'être refusée.\n";
|
$message.= "Votre note de frais \"{$object->ref}\" vient d'être refusée.\n";
|
||||||
$message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
$message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||||
$message.= "- Motif de refus : {$_POST['detail_refuse']}\n";
|
$message.= "- Motif de refus : {$_POST['detail_refuse']}\n";
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
||||||
@ -458,7 +457,8 @@ if ($action == "confirm_refuse" && $_POST['confirm']=="yes" && !empty($_POST['de
|
|||||||
if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && !empty($_POST['detail_cancel']) && $id > 0 && $user->rights->expensereport->to_validate)
|
if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && !empty($_POST['detail_cancel']) && $id > 0 && $user->rights->expensereport->to_validate)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
|
|
||||||
if($user->id == $object->fk_user_validator)
|
if($user->id == $object->fk_user_validator)
|
||||||
{
|
{
|
||||||
$result = $object->set_cancel($user,$_POST['detail_cancel']);
|
$result = $object->set_cancel($user,$_POST['detail_cancel']);
|
||||||
@ -467,8 +467,6 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && !empty($_POST['d
|
|||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
|
||||||
$object->fetch($id,$user);
|
|
||||||
|
|
||||||
// Send mail
|
// Send mail
|
||||||
|
|
||||||
@ -487,7 +485,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && !empty($_POST['d
|
|||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
$message.= "Votre note de frais \"{$object->ref_number}\" vient d'être annulée.\n";
|
$message.= "Votre note de frais \"{$object->ref}\" vient d'être annulée.\n";
|
||||||
$message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
$message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||||
$message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n";
|
$message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n";
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
||||||
@ -532,14 +530,12 @@ if ($action == "confirm_paid" && $_GET['confirm']=="yes" && $id > 0 && $user->ri
|
|||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id,$user);
|
||||||
|
|
||||||
$result = $object->set_paid($user);
|
$result = $object->set_paid($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
|
||||||
$object->fetch($id,$user);
|
|
||||||
|
|
||||||
// Send mail
|
// Send mail
|
||||||
|
|
||||||
// TO
|
// TO
|
||||||
@ -557,7 +553,7 @@ if ($action == "confirm_paid" && $_GET['confirm']=="yes" && $id > 0 && $user->ri
|
|||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
$message.= "Votre note de frais \"{$object->ref_number}\" vient d'être payée.\n";
|
$message.= "Votre note de frais \"{$object->ref}\" vient d'être payée.\n";
|
||||||
$message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
$message.= "- Payeur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
||||||
$message.= "Bien cordialement,\n' SI";
|
$message.= "Bien cordialement,\n' SI";
|
||||||
@ -579,13 +575,13 @@ if ($action == "confirm_paid" && $_GET['confirm']=="yes" && $id > 0 && $user->ri
|
|||||||
$idAccount = 1;
|
$idAccount = 1;
|
||||||
|
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($idTrip,$user);
|
$object->fetch($idTrip);
|
||||||
|
|
||||||
$datePaiement = explode("-",$object->date_paiement);
|
$datePaiement = explode("-",$object->date_paiement);
|
||||||
|
|
||||||
$dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]);
|
$dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]);
|
||||||
$operation = $object->code_paiement;
|
$operation = $object->code_paiement;
|
||||||
$label = "Règlement ".$object->ref_number;
|
$label = "Règlement ".$object->ref;
|
||||||
$amount = - price2num($object->total_ttc);
|
$amount = - price2num($object->total_ttc);
|
||||||
$num_chq = '';
|
$num_chq = '';
|
||||||
$cat1 = '';
|
$cat1 = '';
|
||||||
@ -629,7 +625,7 @@ if ($action == "confirm_paid" && $_GET['confirm']=="yes" && $id > 0 && $user->ri
|
|||||||
if ($action == "confirm_brouillonner" && $_GET['confirm']=="yes" && $id > 0 && $user->rights->expensereport->creer)
|
if ($action == "confirm_brouillonner" && $_GET['confirm']=="yes" && $id > 0 && $user->rights->expensereport->creer)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
if($user->id == $object->fk_user_author OR $user->id == $object->fk_user_validator)
|
if($user->id == $object->fk_user_author OR $user->id == $object->fk_user_validator)
|
||||||
{
|
{
|
||||||
$result = $object->set_draft($user);
|
$result = $object->set_draft($user);
|
||||||
@ -651,133 +647,107 @@ if ($action == "confirm_brouillonner" && $_GET['confirm']=="yes" && $id > 0 && $
|
|||||||
|
|
||||||
if ($action == "addline")
|
if ($action == "addline")
|
||||||
{
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$object_ligne = new ExpenseReportLigne($db);
|
$object_ligne = new ExpenseReportLine($db);
|
||||||
|
|
||||||
$object_ligne->comments = empty($_POST['comments'])?"Aucun commentaire.":$_POST['comments'];
|
$object_ligne->comments = GETPOST('comments');
|
||||||
$object_ligne->qty = empty($_POST['qty'])?1:$_POST['qty'];
|
$object_ligne->qty = empty($_POST['qty'])?1:$_POST['qty'];
|
||||||
|
|
||||||
// Convertion de "," en "." dans le nombre entré dans le champ
|
$object_ligne->value_unit = price2num(GETPOST('value_unit'));
|
||||||
if(preg_match("#,#",$_POST['value_unit']))
|
$object_ligne->value_unit = price2num($object_ligne->value_unit,'MU');
|
||||||
{
|
|
||||||
$object_ligne->value_unit = preg_replace("#,#",".",$_POST['value_unit']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$object_ligne->value_unit = $_POST['value_unit'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$object_ligne->value_unit = number_format($object_ligne->value_unit,3,'.','');
|
$object_ligne->date = $date;
|
||||||
|
|
||||||
$date = explode("/",$_POST['date']);
|
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||||
$object_ligne->date = $date[2]."-".$date[1]."-".$date[0];
|
|
||||||
|
|
||||||
$object_ligne->fk_c_type_fees = empty($_POST['fk_c_type_fees'])?1:$_POST['fk_c_type_fees'];
|
$tva=GETPOST('vatrate');
|
||||||
|
|
||||||
// Get tax id from rate
|
|
||||||
$tva_tx=GETPOST('fk_c_tva');
|
|
||||||
$sql = "SELECT t.rowid, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as p";
|
|
||||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'";
|
|
||||||
$sql .= " AND t.taux = ".$db->escape($tva_tx)." AND t.active = 1";
|
|
||||||
|
|
||||||
dol_syslog("get_localtax sql=".$sql);
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
$tva=$obj->rowid;
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
|
|
||||||
// Force la TVA à 0% lorsque c'est du transport
|
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
|
||||||
{
|
|
||||||
if ($object_ligne->fk_c_type_fees==10)
|
|
||||||
{
|
|
||||||
$tva = 15; // TODO A virer le hardcoding
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$object_ligne->fk_c_tva = $tva;
|
$object_ligne->fk_c_tva = $tva;
|
||||||
|
|
||||||
$object_ligne->fk_projet = $_POST['fk_projet'];
|
$object_ligne->fk_projet = $fk_projet;
|
||||||
|
|
||||||
// Tests des données rentrées
|
if (! GETPOST('fk_c_type_fees') > 0)
|
||||||
$error = false;
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")),'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Vat")),'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
// Si aucun projet n'est défini
|
// Si aucun projet n'est défini
|
||||||
if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1)
|
if ($conf->projet->enabled)
|
||||||
{
|
{
|
||||||
$error = true;
|
if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1)
|
||||||
$text_error[] = "NO_PROJECT";
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Project")), 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si aucune date n'est rentrée
|
// Si aucune date n'est rentrée
|
||||||
if($object_ligne->date=="--"):
|
if (empty($object_ligne->date) || $object_ligne->date=="--")
|
||||||
$error = true;
|
{
|
||||||
$text_error[] = "NO_DATE";
|
$error++;
|
||||||
endif;
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
// Si aucun prix n'est rentré
|
// Si aucun prix n'est rentré
|
||||||
if($object_ligne->value_unit==0):
|
if($object_ligne->value_unit==0)
|
||||||
$error = true;
|
{
|
||||||
$text_error[] = "NO_PRICE";
|
$error++;
|
||||||
endif;
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UP")), 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
// S'il y'a eu au moins une erreur
|
// S'il y'a eu au moins une erreur
|
||||||
if($error)
|
if (! $error)
|
||||||
{
|
|
||||||
$mesg = implode(",",$text_error);
|
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['fk_expensereport']."&mesg=$mesg");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
$object_ligne->fk_expensereport = $_POST['fk_expensereport'];
|
||||||
|
|
||||||
$object_ligne->fetch_taux($object_ligne->fk_c_tva);
|
|
||||||
|
|
||||||
// Calculs des totos
|
// Calculs des totos
|
||||||
$object_ligne->total_ttc = $object_ligne->value_unit * $object_ligne->qty;
|
$object_ligne->total_ttc = $object_ligne->value_unit * $object_ligne->qty;
|
||||||
$object_ligne->total_ttc = number_format($object_ligne->total_ttc,2,'.','');
|
$object_ligne->total_ttc = price2num($object_ligne->total_ttc,'MT');
|
||||||
|
|
||||||
$tx_tva = $object_ligne->tva_taux/100;
|
$object_ligne->tva_taux = GETPOST('vatrate');
|
||||||
|
|
||||||
|
$tx_tva = $object_ligne->tva_taux / 100;
|
||||||
$tx_tva = $tx_tva + 1;
|
$tx_tva = $tx_tva + 1;
|
||||||
|
|
||||||
$object_ligne->total_ht = $object_ligne->total_ttc / $tx_tva;
|
$object_ligne->total_ht = $object_ligne->total_ttc / $tx_tva;
|
||||||
$object_ligne->total_ht = price2num($object_ligne->total_ht,'MT');
|
$object_ligne->total_ht = price2num($object_ligne->total_ht,'MT');
|
||||||
|
|
||||||
$object_ligne->total_tva = $object_ligne->total_ttc - $object_ligne->total_ht;
|
$object_ligne->total_tva = $object_ligne->total_ttc - $object_ligne->total_ht;
|
||||||
// Fin calculs des totos
|
|
||||||
|
|
||||||
$result = $object_ligne->insert();
|
$result = $object_ligne->insert();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
|
||||||
$object->fetch($_POST['fk_expensereport'],$user);
|
|
||||||
$object->update_totaux_add($object_ligne->total_ht,$object_ligne->total_tva);
|
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['fk_expensereport']);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_GET['id']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db,$object->error);
|
dol_print_error($db,$object->error);
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete_line' && $_POST["confirm"] == "yes")
|
if ($action == 'confirm_delete_line' && $_POST["confirm"] == "yes")
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($_GET["id"],$user);
|
$object->fetch($id);
|
||||||
|
|
||||||
$object_ligne = new ExpenseReportLigne($db);
|
$object_ligne = new ExpenseReportLine($db);
|
||||||
$object_ligne->fetch($_GET["rowid"]);
|
$object_ligne->fetch($_GET["rowid"]);
|
||||||
$total_ht = $object_ligne->total_ht;
|
$total_ht = $object_ligne->total_ht;
|
||||||
$total_tva = $object_ligne->total_tva;
|
$total_tva = $object_ligne->total_tva;
|
||||||
@ -798,60 +768,43 @@ if ($action == 'confirm_delete_line' && $_POST["confirm"] == "yes")
|
|||||||
if ($action == "updateligne" )
|
if ($action == "updateligne" )
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
|
$object->fetch($id);
|
||||||
$object_id = GETPOST('id','int');
|
|
||||||
$object->fetch($object_id,$user);
|
|
||||||
|
|
||||||
$rowid = $_POST['rowid'];
|
$rowid = $_POST['rowid'];
|
||||||
$type_fees_id = empty($_POST['fk_c_type_fees'])?1:$_POST['fk_c_type_fees'];
|
$type_fees_id = GETPOST('fk_c_type_fees');
|
||||||
|
$c_tva=GETPOST('vatrate');
|
||||||
// Get tax id from rate
|
|
||||||
$tva_tx=GETPOST('fk_c_tva');
|
|
||||||
$sql = "SELECT t.rowid, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as p";
|
|
||||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'";
|
|
||||||
$sql .= " AND t.taux = ".$db->escape($tva_tx)." AND t.active = 1";
|
|
||||||
|
|
||||||
dol_syslog("get_localtax sql=".$sql);
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
$c_tva=$obj->rowid;
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
|
|
||||||
// Force la TVA à 0% lorsque c'est du transport
|
|
||||||
if ($type_fees_id==10)
|
|
||||||
{
|
|
||||||
$c_tva = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
$object_ligne->fk_c_tva = $c_tva;
|
$object_ligne->fk_c_tva = $c_tva;
|
||||||
$projet_id = $_POST['fk_projet'];
|
$projet_id = $fk_projet;
|
||||||
$comments = $_POST['comments'];
|
$comments = GETPOST('comments');
|
||||||
$qty = $_POST['qty'];
|
$qty = GETPOST('qty');
|
||||||
|
$value_unit = GETPOST('value_unit');
|
||||||
|
|
||||||
// Convertion de "," en "." dans le nombre entré dans le champ
|
if (! GETPOST('fk_c_type_fees') > 0)
|
||||||
if(preg_match("#,#",$_POST['value_unit'])):
|
|
||||||
$value_unit = preg_replace("#,#",".",$_POST['value_unit']);
|
|
||||||
else:
|
|
||||||
$value_unit = $_POST['value_unit'];
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$date = explode("/",$_POST['date']);
|
|
||||||
$date = $date[2]."-".$date[1]."-".$date[0];
|
|
||||||
|
|
||||||
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $c_tva, $comments, $qty, $value_unit, $date, $object_id);
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
{
|
||||||
$object->recalculer($object_id);
|
$error++;
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object_id);
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")),'errors');
|
||||||
exit;
|
$action='';
|
||||||
}
|
}
|
||||||
else
|
if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '')
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
$error++;
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Vat")),'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $c_tva, $comments, $qty, $value_unit, $date, $object_id);
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
$object->recalculer($object_id);
|
||||||
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object_id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,7 +829,7 @@ if ($action == "recalc" && $id > 0)
|
|||||||
if ($action == 'builddoc') // En get ou en post
|
if ($action == 'builddoc') // En get ou en post
|
||||||
{
|
{
|
||||||
$depl = new ExpenseReport($db, 0, $_GET['id']);
|
$depl = new ExpenseReport($db, 0, $_GET['id']);
|
||||||
$depl->fetch($_GET['id'],$user);
|
$depl->fetch($id);
|
||||||
|
|
||||||
if ($_REQUEST['model'])
|
if ($_REQUEST['model'])
|
||||||
{
|
{
|
||||||
@ -929,10 +882,10 @@ else if ($action == 'remove_file')
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReport"));
|
llxHeader('', $langs->trans("ExpenseReport"));
|
||||||
|
|
||||||
$html = new Form($db);
|
|
||||||
$formfile = new FormFile($db);
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
$formproject = new FormProjets($db);
|
$formproject = new FormProjets($db);
|
||||||
|
$projecttmp = new Project($db);
|
||||||
|
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
|
||||||
{
|
{
|
||||||
@ -976,13 +929,13 @@ if ($action == 'create')
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("DateStart").'</td>';
|
print '<td>'.$langs->trans("DateStart").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1);
|
$form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("DateEnd").'</td>';
|
print '<td>'.$langs->trans("DateEnd").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1);
|
$form->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -990,8 +943,8 @@ if ($action == 'create')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$include_users = $object->fetch_users_approver_expensereport();
|
$include_users = $object->fetch_users_approver_expensereport();
|
||||||
$s=$html->select_dolusers((GETPOST('fk_user_validator')?GETPOST('fk_user_validator'):$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR), "fk_user_validator", 1, "", 0, $include_users);
|
$s=$form->select_dolusers((GETPOST('fk_user_validator')?GETPOST('fk_user_validator'):$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR), "fk_user_validator", 1, "", 0, $include_users);
|
||||||
print $html->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION))
|
if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION))
|
||||||
@ -999,7 +952,7 @@ if ($action == 'create')
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ModePaiement").'</td>';
|
print '<td>'.$langs->trans("ModePaiement").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_types_paiements(2,'fk_c_paiement');
|
$form->select_types_paiements(2,'fk_c_paiement');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -1026,9 +979,9 @@ else
|
|||||||
if($id > 0)
|
if($id > 0)
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$result = $object->fetch($id,$user);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if ($object->fk_user_author != $user->id)
|
if ($object->fk_user_author != $user->id)
|
||||||
{
|
{
|
||||||
@ -1048,19 +1001,20 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$head = trip_prepare_head($object);
|
$head = expensereport_prepare_head($object);
|
||||||
|
/*
|
||||||
$head[0][0] = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
$head[0][0] = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||||
$head[0][1] = $langs->trans('Card');
|
$head[0][1] = $langs->trans('Card');
|
||||||
$head[0][2] = 'card';
|
$head[0][2] = 'card';
|
||||||
$h++;
|
$h++;*/
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
|
||||||
|
|
||||||
if ($action == 'edit' && ($object->fk_c_expensereport_statuts < 3 || $object->fk_c_expensereport_statuts==99))
|
if ($action == 'edit' && ($object->fk_c_expensereport_statuts < 3 || $object->fk_c_expensereport_statuts==99))
|
||||||
{
|
{
|
||||||
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="id" value="'.$id.'">';
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||||
|
|
||||||
if($object->fk_c_expensereport_statuts==99)
|
if($object->fk_c_expensereport_statuts==99)
|
||||||
{
|
{
|
||||||
@ -1071,7 +1025,6 @@ else
|
|||||||
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 '<table class="border" style="width:100%;">';
|
print '<table class="border" style="width:100%;">';
|
||||||
@ -1086,13 +1039,13 @@ else
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("DateStart").'</td>';
|
print '<td>'.$langs->trans("DateStart").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_date($object->date_debut,'date_debut');
|
$form->select_date($object->date_debut,'date_debut');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("DateEnd").'</td>';
|
print '<td>'.$langs->trans("DateEnd").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_date($object->date_fin,'date_fin');
|
$form->select_date($object->date_fin,'date_fin');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -1101,7 +1054,7 @@ else
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("ModePaiement").'</td>';
|
print '<td>'.$langs->trans("ModePaiement").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_types_paiements($object->fk_c_paiement,'fk_c_paiement');
|
$form->select_types_paiements($object->fk_c_paiement,'fk_c_paiement');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -1112,8 +1065,8 @@ else
|
|||||||
print '<td>'.$langs->trans("VALIDATOR").'</td>';
|
print '<td>'.$langs->trans("VALIDATOR").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$include_users = $object->fetch_users_approver_expensereport();
|
$include_users = $object->fetch_users_approver_expensereport();
|
||||||
$s=$html->select_dolusers($object->fk_user_validator,"fk_user_validator",0,"",0,$include_users);
|
$s=$form->select_dolusers($object->fk_user_validator,"fk_user_validator",0,"",0,$include_users);
|
||||||
print $html->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -1149,67 +1102,69 @@ else
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("Note").'</td>';
|
print '<td>'.$langs->trans("Note").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<textarea name="note" class="flat" rows="1" cols="70">'.$object->note.'</textarea>';
|
print '<textarea name="note" class="flat" rows="'.ROWS_2.'" cols="70">'.$object->note.'</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><div class="center">';
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<div class="center">';
|
||||||
print '<input type="submit" value="'.$langs->trans("Modify").'" name="bouton" class="button"> ';
|
print '<input type="submit" value="'.$langs->trans("Modify").'" name="bouton" class="button"> ';
|
||||||
print '<input type="button" value="'.$langs->trans("CancelAddTrip").'" class="button" onclick="history.go(-1)" />';
|
print '<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||||
|
|
||||||
if ($action == 'save'):
|
if ($action == 'save'):
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'save_from_refuse'):
|
if ($action == 'save_from_refuse'):
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'delete'):
|
if ($action == 'delete'):
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'validate'):
|
if ($action == 'validate'):
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_validate","","",1);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_validate","","",1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'paid'):
|
if ($action == 'paid'):
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'cancel'):
|
if ($action == 'cancel'):
|
||||||
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif d'annulation :",'name'=>"detail_cancel",'size'=>"50",'value'=>""));
|
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif d'annulation :",'name'=>"detail_cancel",'size'=>"50",'value'=>""));
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ConfirmCancelTrip"),"","confirm_cancel",$array_input,"",0);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ConfirmCancelTrip"),"","confirm_cancel",$array_input,"",0);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'brouillonner'):
|
if ($action == 'brouillonner'):
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'refuse'):
|
if ($action == 'refuse'):
|
||||||
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ConfirmRefuseTrip"),"","confirm_refuse",$array_input,"yes",0);
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ConfirmRefuseTrip"),"","confirm_refuse",$array_input,"yes",0);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($action == 'delete_line')
|
if ($action == 'delete_line')
|
||||||
{
|
{
|
||||||
$ret=$html->form_confirm($_SEVER["PHP_SELF"]."?id=".$_GET['id']."&rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line");
|
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$_GET['id']."&rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line");
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1219,11 +1174,11 @@ else
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
|
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
print $form->showrefnav($object, 'id', $linkback, 1, 'ref', 'ref', '');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("Periode").'</td>';
|
print '<td>'.$langs->trans("Period").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print get_date_range($object->date_debut,$object->date_fin,'',$langs,0);
|
print get_date_range($object->date_debut,$object->date_fin,'',$langs,0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1313,9 +1268,10 @@ else
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if ($object->fk_user_author > 0)
|
if ($object->fk_user_author > 0)
|
||||||
{
|
{
|
||||||
$userfee=new User($db);
|
$userauthor=new User($db);
|
||||||
$userfee->fetch($object->fk_user_author);
|
$result=$userauthor->fetch($object->fk_user_author);
|
||||||
print $userfee->getNomUrl(1);
|
if ($result < 0) dol_print_error('',$userauthor->error);
|
||||||
|
print $userauthor->getNomUrl(1);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -1387,7 +1343,7 @@ else
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if ($action != 'editline') print '<td style="text-align:center;width:9%;">'.$langs->trans('Piece').'</td>';
|
if ($action != 'editline') print '<td style="text-align:center;">'.$langs->trans('Piece').'</td>';
|
||||||
print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
|
print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
|
||||||
print '<td style="text-align:center;">'.$langs->trans('Project').'</td>';
|
print '<td style="text-align:center;">'.$langs->trans('Project').'</td>';
|
||||||
print '<td style="text-align:center;">'.$langs->trans('Type').'</td>';
|
print '<td style="text-align:center;">'.$langs->trans('Type').'</td>';
|
||||||
@ -1418,17 +1374,21 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td style="text-align:center;width:9%;">';
|
print '<td style="text-align:center;width:9%;">';
|
||||||
print img_picto("Document", "generic");
|
print img_picto($langs->trans("Document"), "object_generic");
|
||||||
print ' <span style="color:red;font-weight:bold;font-size:14px;">'.$piece_comptable.'</span></td>';
|
print ' <span style="color:red;font-weight:bold;font-size:14px;">'.$piece_comptable.'</span></td>';
|
||||||
print '<td style="text-align:center;">'.$objp->date.'</td>';
|
print '<td style="text-align:center;">'.$objp->date.'</td>';
|
||||||
print '<td style="text-align:center;">'.$objp->projet_ref.'</td>';
|
print '<td style="text-align:center;">';
|
||||||
|
$projecttmp->id=$objp->projet_id;
|
||||||
|
$projecttmp->ref=$objp->projet_ref;
|
||||||
|
print $projecttmp->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper($objp->type_fees_libelle)).'</td>';
|
print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper($objp->type_fees_libelle)).'</td>';
|
||||||
print '<td style="text-align:left;">'.$objp->comments.'</td>';
|
print '<td style="text-align:left;">'.$objp->comments.'</td>';
|
||||||
print '<td style="text-align:right;">'.vatrate($objp->tva_taux,true).'</td>';
|
print '<td style="text-align:right;">'.vatrate($objp->tva_taux,true).'</td>';
|
||||||
print '<td style="text-align:right;">'.price($objp->value_unit).'</td>';
|
print '<td style="text-align:right;">'.price($objp->value_unit).'</td>';
|
||||||
print '<td style="text-align:right;">'.$objp->qty.'</td>';
|
print '<td style="text-align:right;">'.$objp->qty.'</td>';
|
||||||
print '<td style="text-align:right;">'.$objp->total_ht.'</td>';
|
print '<td style="text-align:right;">'.price($objp->total_ht).'</td>';
|
||||||
print '<td style="text-align:right;">'.$objp->total_ttc.'</td>';
|
print '<td style="text-align:right;">'.price($objp->total_ttc).'</td>';
|
||||||
|
|
||||||
// Ajout des boutons de modification/suppression
|
// Ajout des boutons de modification/suppression
|
||||||
if($object->fk_c_expensereport_statuts<2 OR $object->fk_c_expensereport_statuts==99)
|
if($object->fk_c_expensereport_statuts<2 OR $object->fk_c_expensereport_statuts==99)
|
||||||
@ -1452,7 +1412,7 @@ else
|
|||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
// Sélection date
|
// Sélection date
|
||||||
print '<td style="text-align:center;width:10%;">';
|
print '<td style="text-align:center;width:10%;">';
|
||||||
$html->select_date($objp->date,'date');
|
$form->select_date($objp->date,'date');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Sélection projet
|
// Sélection projet
|
||||||
@ -1512,12 +1472,13 @@ else
|
|||||||
}
|
}
|
||||||
//print '</div>';
|
//print '</div>';
|
||||||
|
|
||||||
// Ajouter une ligne
|
// Add a line
|
||||||
if (($object->fk_c_expensereport_statuts==0 || $object->fk_c_expensereport_statuts==99) && $action != 'editline')
|
if (($object->fk_c_expensereport_statuts==0 || $object->fk_c_expensereport_statuts==99) && $action != 'editline')
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("AddLine"),'','');
|
print_fiche_titre($langs->trans("AddLine"),'','');
|
||||||
|
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="addline">';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="addline">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '<input type="hidden" name="fk_expensereport" value="'.$id.'" />';
|
print '<input type="hidden" name="fk_expensereport" value="'.$id.'" />';
|
||||||
print '<input type="hidden" name="action" value="addline" />';
|
print '<input type="hidden" name="action" value="addline" />';
|
||||||
|
|
||||||
@ -1528,7 +1489,7 @@ else
|
|||||||
print '<td>'.$langs->trans('Type').'</td>';
|
print '<td>'.$langs->trans('Type').'</td>';
|
||||||
print '<td>'.$langs->trans('Description').'</td>';
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
|
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
|
||||||
print '<td style="text-align:right;">'.$langs->trans('UnitPriceTTC').'</td>';
|
print '<td style="text-align:right;">'.$langs->trans('PriceUTTC').'</td>';
|
||||||
print '<td style="text-align:right;">'.$langs->trans('Qty').'</td>';
|
print '<td style="text-align:right;">'.$langs->trans('Qty').'</td>';
|
||||||
print '<td style="text-align:center;"></td>';
|
print '<td style="text-align:center;"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -1537,43 +1498,42 @@ else
|
|||||||
|
|
||||||
// Sélection date
|
// Sélection date
|
||||||
print '<td style="text-align:center;">';
|
print '<td style="text-align:center;">';
|
||||||
$html->select_date(-1,'date');
|
$form->select_date($date?$date:-1,'date');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Sélection projet
|
// Sélection projet
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print select_projet('','','fk_projet');
|
$formproject->select_projects('', GETPOST('fk_projet'), 'fk_projet', 0, 0, 1, 1);
|
||||||
//$formproject->select_projects('','','fk_projet');
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Sélection type
|
// Sélection type
|
||||||
print '<td>';
|
print '<td>';
|
||||||
select_type_fees_id('TF_TRAIN','fk_c_type_fees');
|
select_type_fees_id(GETPOST('fk_c_type_fees'),'fk_c_type_fees',1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Add comments
|
// Add comments
|
||||||
print '<td style="text-align:left;">';
|
print '<td style="text-align:left;">';
|
||||||
print '<textarea class="flat_ndf centpercent" name="comments"></textarea>';
|
print '<textarea class="flat_ndf centpercent" name="comments">'.GETPOST('comments').'</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Sélection TVA
|
// Sélection TVA
|
||||||
print '<td style="text-align:right;">';
|
print '<td style="text-align:right;">';
|
||||||
$defaultvat=-1;
|
$defaultvat=-1;
|
||||||
if (! empty($conf->global->DEPLACEMENT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
||||||
print '<select class="flat" name="fk_c_tva">';
|
print '<select class="flat" name="vatrate">';
|
||||||
print '<option name="none" value="" selected="selected">';
|
print '<option name="none" value="" selected="selected">';
|
||||||
print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$defaultvat), $mysoc, '', 0, 0, '', true);
|
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$defaultvat), $mysoc, '', 0, 0, '', true);
|
||||||
print '</select>';
|
print '</select>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Prix unitaire
|
// Prix unitaire
|
||||||
print '<td style="text-align:right;">';
|
print '<td style="text-align:right;">';
|
||||||
print '<input type="text" size="10" name="value_unit" />';
|
print '<input type="text" size="10" name="value_unit" value="'.GETPOST('value_unit').'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Quantité
|
// Quantité
|
||||||
print '<td style="text-align:right;">';
|
print '<td style="text-align:right;">';
|
||||||
print '<input type="text" size="4" name="qty" />';
|
print '<input type="text" size="4" name="qty" value="'.GETPOST('qty').'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td style="text-align:center;"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>';
|
print '<td style="text-align:center;"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>';
|
||||||
@ -1589,9 +1549,10 @@ else
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
} // end edit or not edit
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
} // end edit or not edit
|
||||||
|
|
||||||
} // end of if result
|
} // end of if result
|
||||||
else
|
else
|
||||||
@ -1614,22 +1575,26 @@ print '<div class="tabsAction">';
|
|||||||
if ($action != 'create' && $action != 'edit')
|
if ($action != 'create' && $action != 'edit')
|
||||||
{
|
{
|
||||||
$object = new ExpenseReport($db);
|
$object = new ExpenseReport($db);
|
||||||
$object->fetch($id,$user);
|
$object->fetch($id);
|
||||||
|
|
||||||
|
|
||||||
/* Si l'état est "Brouillon"
|
/* Si l'état est "Brouillon"
|
||||||
* ET user à droit "creer/supprimer"
|
* ET user à droit "creer/supprimer"
|
||||||
* ET fk_user_author == user courant
|
* ET fk_user_author == user courant
|
||||||
* Afficher : "Enregistrer" / "Modifier" / "Supprimer"
|
* Afficher : "Enregistrer" / "Modifier" / "Supprimer"
|
||||||
*/
|
*/
|
||||||
if ($user->rights->expensereport->creer AND $object->fk_c_expensereport_statuts==0)
|
if ($user->rights->expensereport->creer && $object->fk_c_expensereport_statuts==0)
|
||||||
{
|
{
|
||||||
if ($object->fk_user_author == $user->id)
|
if ($object->fk_user_author == $user->id)
|
||||||
{
|
{
|
||||||
// Modifier
|
// Modifier
|
||||||
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('ModifyInfoGen').'</a>';
|
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('ModifyInfoGen').'</a>';
|
||||||
|
|
||||||
// Enregistrer
|
// Validate
|
||||||
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=save&id='.$id.'">'.$langs->trans('Validate').'</a>';
|
if (count($object->lines) > 0 || count($object->lignes) > 0)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=save&id='.$id.'">'.$langs->trans('Validate').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->rights->expensereport->supprimer)
|
if ($user->rights->expensereport->supprimer)
|
||||||
{
|
{
|
||||||
@ -1694,13 +1659,13 @@ if ($action != 'create' && $action != 'edit')
|
|||||||
// Valider
|
// Valider
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Approve').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Approve').'</a>';
|
||||||
// Refuser
|
// Refuser
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=refuse&id='.$id.'">'.$langs->trans('REFUSE').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=refuse&id='.$id.'">'.$langs->trans('Refuse').'</a>';
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if ($object->fk_user_author==$user->id)
|
if ($object->fk_user_author==$user->id)
|
||||||
{
|
{
|
||||||
// Annuler
|
// Annuler
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$id.'">'.$langs->trans('CANCEL').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$id.'">'.$langs->trans('Cancel').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($user->rights->expensereport->supprimer)
|
if($user->rights->expensereport->supprimer)
|
||||||
@ -1777,8 +1742,8 @@ print '<div style="width:50%">';
|
|||||||
*/
|
*/
|
||||||
if($user->rights->expensereport->export && $object->fk_c_expensereport_statuts>0 && $action != 'edit')
|
if($user->rights->expensereport->export && $object->fk_c_expensereport_statuts>0 && $action != 'edit')
|
||||||
{
|
{
|
||||||
$filename = dol_sanitizeFileName($object->ref_number);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref_number);
|
$filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
$genallowed = 1;
|
$genallowed = 1;
|
||||||
$delallowed = 1;
|
$delallowed = 1;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class ExpenseReport extends CommonObject
|
|||||||
var $fk_element = 'fk_expensereport';
|
var $fk_element = 'fk_expensereport';
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $ref_number;
|
var $ref;
|
||||||
var $lignes=array();
|
var $lignes=array();
|
||||||
var $total_ht;
|
var $total_ht;
|
||||||
var $total_tva;
|
var $total_tva;
|
||||||
@ -94,11 +94,11 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->statuts_short[6]='Paid';
|
$this->statuts_short[6]='Paid';
|
||||||
$this->statuts_short[99]='Refused';
|
$this->statuts_short[99]='Refused';
|
||||||
$this->statuts_logo[0]='statut0';
|
$this->statuts_logo[0]='statut0';
|
||||||
$this->statuts_logo[2]='statut4';
|
$this->statuts_logo[2]='statut1';
|
||||||
$this->statuts_logo[4]='statut3';
|
$this->statuts_logo[4]='statut5';
|
||||||
$this->statuts_logo[5]='statut5';
|
$this->statuts_logo[5]='statut3';
|
||||||
$this->statuts_logo[6]='statut6';
|
$this->statuts_logo[6]='statut6';
|
||||||
$this->statuts_logo[99]='statutx';
|
$this->statuts_logo[99]='statut8';
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
|
||||||
$sql.= "ref_number";
|
$sql.= "ref";
|
||||||
$sql.= ",total_ht";
|
$sql.= ",total_ht";
|
||||||
$sql.= ",total_ttc";
|
$sql.= ",total_ttc";
|
||||||
$sql.= ",total_tva";
|
$sql.= ",total_tva";
|
||||||
@ -150,16 +150,16 @@ class ExpenseReport extends CommonObject
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||||
$this->ref_number='(PROV'.$this->id.')';
|
$this->ref='(PROV'.$this->id.')';
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref_number='".$this->ref_number."' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref='".$this->ref."' WHERE rowid=".$this->id;
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (!$resql) $error++;
|
if (!$resql) $error++;
|
||||||
|
|
||||||
foreach ($this->lignes as $i => $val)
|
foreach ($this->lignes as $i => $val)
|
||||||
{
|
{
|
||||||
$newndfline=new ExpenseReportLigne($this->db);
|
$newndfline=new ExpenseReportLine($this->db);
|
||||||
$newndfline=$this->lignes[$i];
|
$newndfline=$this->lignes[$i];
|
||||||
$newndfline->fk_expensereport=$this->id;
|
$newndfline->fk_expensereport=$this->id;
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
@ -217,13 +217,13 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql.= " total_ht = ".$this->total_ht;
|
$sql.= " total_ht = ".$this->total_ht;
|
||||||
$sql.= " , total_ttc = ".$this->total_ttc;
|
$sql.= " , total_ttc = ".$this->total_ttc;
|
||||||
$sql.= " , total_tva = ".$this->total_tva;
|
$sql.= " , total_tva = ".$this->total_tva;
|
||||||
$sql.= " , date_debut = '".$this->date_debut."'";
|
$sql.= " , date_debut = '".$this->db->idate($this->date_debut)."'";
|
||||||
$sql.= " , date_fin = '".$this->date_fin."'";
|
$sql.= " , date_fin = '".$this->db->idate($this->date_fin)."'";
|
||||||
$sql.= " , fk_user_author = ".($user->id > 0 ? "'".$user->id."'":"null");
|
$sql.= " , fk_user_author = ".($user->id > 0 ? "'".$user->id."'":"null");
|
||||||
$sql.= " , fk_user_validator = ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null");
|
$sql.= " , fk_user_validator = ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null");
|
||||||
$sql.= " , fk_user_valid = ".($this->fk_user_valid > 0 ? $this->fk_user_valid:"null");
|
$sql.= " , fk_user_valid = ".($this->fk_user_valid > 0 ? $this->fk_user_valid:"null");
|
||||||
$sql.= " , fk_user_paid = ".($this->fk_user_paid > 0 ? $this->fk_user_paid:"null");
|
$sql.= " , fk_user_paid = ".($this->fk_user_paid > 0 ? $this->fk_user_paid:"null");
|
||||||
$sql.= " , fk_c_expensereport_statuts = ".($this->fk_c_expensereport_statuts > 0 ? $this->fk_c_expensereport_statuts:"null");
|
$sql.= " , fk_c_expensereport_statuts = ".($this->fk_c_expensereport_statuts >= 0 ? $this->fk_c_expensereport_statuts:'0');
|
||||||
$sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null");
|
$sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null");
|
||||||
$sql.= " , note = ".(!empty($this->note)?"'".$this->db->escape($this->note)."'":"''");
|
$sql.= " , note = ".(!empty($this->note)?"'".$this->db->escape($this->note)."'":"''");
|
||||||
$sql.= " , detail_refuse = ".(!empty($this->detail_refuse)?"'".$this->db->escape($this->detail_refuse)."'":"''");
|
$sql.= " , detail_refuse = ".(!empty($this->detail_refuse)?"'".$this->db->escape($this->detail_refuse)."'":"''");
|
||||||
@ -246,19 +246,14 @@ class ExpenseReport extends CommonObject
|
|||||||
* Load an object from database
|
* Load an object from database
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @param User $user User we want expense report for
|
* @param string $ref Ref
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id,$user='')
|
function fetch($id, $ref='')
|
||||||
{
|
{
|
||||||
global $conf,$db;
|
global $conf,$db;
|
||||||
|
|
||||||
if (!$user->rights->expensereport->lire):
|
$sql = "SELECT d.rowid, d.ref, d.note,"; // DEFAULT
|
||||||
$restrict = " AND fk_user_author = ".$user->id;
|
|
||||||
else:
|
|
||||||
$restrict = "";
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.ref_number, d.note,"; // DEFAULT
|
|
||||||
$sql.= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
|
$sql.= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
|
||||||
$sql.= " d.date_refuse, d.date_cancel,"; // ACTIONS
|
$sql.= " d.date_refuse, d.date_cancel,"; // ACTIONS
|
||||||
$sql.= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
|
$sql.= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
|
||||||
@ -267,7 +262,8 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql.= " d.fk_user_valid, d.fk_user_paid,"; // FOREING KEY 2 (int)
|
$sql.= " d.fk_user_valid, d.fk_user_paid,"; // FOREING KEY 2 (int)
|
||||||
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
|
$sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." d LEFT JOIN ".MAIN_DB_PREFIX."c_paiement dp ON d.fk_c_paiement = dp.id";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." d LEFT JOIN ".MAIN_DB_PREFIX."c_paiement dp ON d.fk_c_paiement = dp.id";
|
||||||
$sql.= " WHERE d.rowid = ".$id;
|
if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'";
|
||||||
|
else $sql.= " WHERE d.rowid = ".$id;
|
||||||
$sql.= $restrict;
|
$sql.= $restrict;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||||
@ -278,8 +274,7 @@ class ExpenseReport extends CommonObject
|
|||||||
if ($obj)
|
if ($obj)
|
||||||
{
|
{
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->ref_number;
|
$this->ref = $obj->ref;
|
||||||
$this->ref_number = $obj->ref_number;
|
|
||||||
$this->total_ht = $obj->total_ht;
|
$this->total_ht = $obj->total_ht;
|
||||||
$this->total_tva = $obj->total_tva;
|
$this->total_tva = $obj->total_tva;
|
||||||
$this->total_ttc = $obj->total_ttc;
|
$this->total_ttc = $obj->total_ttc;
|
||||||
@ -303,11 +298,12 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->fk_user_cancel = $obj->fk_user_cancel;
|
$this->fk_user_cancel = $obj->fk_user_cancel;
|
||||||
|
|
||||||
$user_author = new User($this->db);
|
$user_author = new User($this->db);
|
||||||
$user_author->fetch($this->fk_user_author);
|
if ($this->fk_user_author > 0) $user_author->fetch($this->fk_user_author);
|
||||||
|
|
||||||
$this->user_author_infos = dolGetFirstLastname($user_author->firstname, $user_author->lastname);
|
$this->user_author_infos = dolGetFirstLastname($user_author->firstname, $user_author->lastname);
|
||||||
|
|
||||||
$user_approver = new User($this->db);
|
$user_approver = new User($this->db);
|
||||||
$user_approver->fetch($this->fk_user_validator);
|
if ($this->fk_user_validator > 0) $user_approver->fetch($this->fk_user_validator);
|
||||||
$this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname);
|
$this->user_validator_infos = dolGetFirstLastname($user_approver->firstname, $user_approver->lastname);
|
||||||
|
|
||||||
$this->fk_c_expensereport_statuts = $obj->status;
|
$this->fk_c_expensereport_statuts = $obj->status;
|
||||||
@ -317,14 +313,14 @@ class ExpenseReport extends CommonObject
|
|||||||
if ($this->fk_c_expensereport_statuts==5 || $this->fk_c_expensereport_statuts==6)
|
if ($this->fk_c_expensereport_statuts==5 || $this->fk_c_expensereport_statuts==6)
|
||||||
{
|
{
|
||||||
$user_valid = new User($this->db);
|
$user_valid = new User($this->db);
|
||||||
$user_valid->fetch($this->fk_user_valid);
|
if ($this->fk_user_valid > 0) $user_valid->fetch($this->fk_user_valid);
|
||||||
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
|
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->fk_c_expensereport_statuts==6)
|
if ($this->fk_c_expensereport_statuts==6)
|
||||||
{
|
{
|
||||||
$user_paid = new User($this->db);
|
$user_paid = new User($this->db);
|
||||||
$user_paid->fetch($this->fk_user_paid);
|
if ($this->fk_user_paid > 0) $user_paid->fetch($this->fk_user_paid);
|
||||||
$this->user_paid_infos = dolGetFirstLastname($user_paid->firstname, $user_paid->lastname);
|
$this->user_paid_infos = dolGetFirstLastname($user_paid->firstname, $user_paid->lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,6 +391,66 @@ class ExpenseReport extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load information on object
|
||||||
|
*
|
||||||
|
* @param int $id Id of object
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function info($id)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$sql = "SELECT f.rowid,";
|
||||||
|
$sql.= " f.date_create as datec,";
|
||||||
|
$sql.= " f.tms as date_modification,";
|
||||||
|
$sql.= " f.date_valide as datev,";
|
||||||
|
$sql.= " f.fk_user_author,";
|
||||||
|
$sql.= " f.fk_user_modif as fk_user_modification,";
|
||||||
|
$sql.= " f.fk_user_validator";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as f";
|
||||||
|
$sql.= " WHERE f.rowid = ".$id;
|
||||||
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($resql))
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
|
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||||
|
$this->date_validation = $this->db->jdate($obj->datev);
|
||||||
|
|
||||||
|
$cuser = new User($this->db);
|
||||||
|
$cuser->fetch($obj->fk_user_author);
|
||||||
|
$this->user_creation = $cuser;
|
||||||
|
|
||||||
|
if ($obj->fk_user_valid)
|
||||||
|
{
|
||||||
|
$vuser = new User($this->db);
|
||||||
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
|
$this->user_validation = $vuser;
|
||||||
|
}
|
||||||
|
if ($obj->fk_user_modification)
|
||||||
|
{
|
||||||
|
$muser = new User($this->db);
|
||||||
|
$muser->fetch($obj->fk_user_modification);
|
||||||
|
$this->user_modification = $muser;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch_line_by_project
|
* fetch_line_by_project
|
||||||
@ -429,7 +485,7 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$sql2 = "SELECT d.rowid, d.fk_user_author, d.ref_number, d.fk_c_expensereport_statuts";
|
$sql2 = "SELECT d.rowid, d.fk_user_author, d.ref, d.fk_c_expensereport_statuts";
|
||||||
$sql2.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
$sql2.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
||||||
$sql2.= " WHERE d.rowid = '".$objp->fk_expensereport."'";
|
$sql2.= " WHERE d.rowid = '".$objp->fk_expensereport."'";
|
||||||
|
|
||||||
@ -437,7 +493,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$obj = $db->fetch_object($result2);
|
$obj = $db->fetch_object($result2);
|
||||||
|
|
||||||
$objp->fk_user_author = $obj->fk_user_author;
|
$objp->fk_user_author = $obj->fk_user_author;
|
||||||
$objp->ref_num = $obj->ref_number;
|
$objp->ref = $obj->ref;
|
||||||
$objp->fk_c_expensereport_status = $obj->fk_c_expensereport_statuts;
|
$objp->fk_c_expensereport_status = $obj->fk_c_expensereport_statuts;
|
||||||
$objp->rowid = $obj->rowid;
|
$objp->rowid = $obj->rowid;
|
||||||
|
|
||||||
@ -561,15 +617,15 @@ class ExpenseReport extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch_lines()
|
function fetch_lines()
|
||||||
{
|
{
|
||||||
|
$this->lines=array();
|
||||||
|
|
||||||
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
|
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
|
||||||
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva,';
|
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva,';
|
||||||
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
|
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||||
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||||
$sql.= ' ctv.taux as taux_tva,';
|
|
||||||
$sql.= ' p.ref as ref_projet, p.title as title_projet';
|
$sql.= ' p.ref as ref_projet, p.title as title_projet';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
|
||||||
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees ctf ON de.fk_c_type_fees = ctf.id';
|
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees ctf ON de.fk_c_type_fees = ctf.id';
|
||||||
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_tva ctv ON de.fk_c_tva = ctv.rowid';
|
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet p ON de.fk_projet = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet p ON de.fk_projet = p.rowid';
|
||||||
$sql.= ' WHERE de.'.$this->fk_element.' = '.$this->id;
|
$sql.= ' WHERE de.'.$this->fk_element.' = '.$this->id;
|
||||||
|
|
||||||
@ -582,7 +638,7 @@ class ExpenseReport extends CommonObject
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$deplig = new ExpenseReportLigne($this->db);
|
$deplig = new ExpenseReportLine($this->db);
|
||||||
|
|
||||||
$deplig->rowid = $objp->rowid;
|
$deplig->rowid = $objp->rowid;
|
||||||
$deplig->comments = $objp->comments;
|
$deplig->comments = $objp->comments;
|
||||||
@ -606,6 +662,8 @@ class ExpenseReport extends CommonObject
|
|||||||
$deplig->projet_title = $objp->title_projet;
|
$deplig->projet_title = $objp->title_projet;
|
||||||
|
|
||||||
$this->lignes[$i] = $deplig;
|
$this->lignes[$i] = $deplig;
|
||||||
|
$this->lines[$i] = $deplig;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
@ -613,7 +671,7 @@ class ExpenseReport extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog('ExpenseReport::fetch_lines: Error '.$this->error,LOG_ERR);
|
dol_syslog('ExpenseReport::fetch_lines: Error '.$this->error,LOG_ERR);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
@ -673,7 +731,7 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
// Sélection du numéro de ref suivant
|
// Sélection du numéro de ref suivant
|
||||||
$ref_next = $this->getNextNumRef();
|
$ref_next = $this->getNextNumRef();
|
||||||
$ref_number_int = ($this->ref_number+1)-1;
|
$ref_number_int = ($this->ref+1)-1;
|
||||||
|
|
||||||
// Sélection de la date de début de la NDF
|
// Sélection de la date de début de la NDF
|
||||||
$sql = 'SELECT date_debut';
|
$sql = 'SELECT date_debut';
|
||||||
@ -688,13 +746,13 @@ class ExpenseReport extends CommonObject
|
|||||||
// Création du ref_number suivant
|
// Création du ref_number suivant
|
||||||
if($ref_next)
|
if($ref_next)
|
||||||
{
|
{
|
||||||
$this->ref_number = strtoupper($user->login).$expld_car."NDF".$this->ref_number.$expld_car.$this->date_debut;
|
$this->ref = strtoupper($user->login).$expld_car."NDF".$this->ref.$expld_car.$this->date_debut;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->fk_c_expensereport_statuts != 2)
|
if ($this->fk_c_expensereport_statuts != 2)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql.= " SET ref_number = '".$this->ref_number."', fk_c_expensereport_statuts = 2";
|
$sql.= " SET ref = '".$this->ref."', fk_c_expensereport_statuts = 2";
|
||||||
$sql.= " ,ref_number_int = $ref_number_int";
|
$sql.= " ,ref_number_int = $ref_number_int";
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
@ -776,7 +834,7 @@ class ExpenseReport extends CommonObject
|
|||||||
if ($this->fk_c_expensereport_statuts != 5)
|
if ($this->fk_c_expensereport_statuts != 5)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql.= " SET ref_number = '".$this->ref_number."', fk_c_expensereport_statuts = 5, fk_user_valid = ".$user->id;
|
$sql.= " SET ref = '".$this->ref."', fk_c_expensereport_statuts = 5, fk_user_valid = ".$user->id;
|
||||||
$sql.= ', date_valide='.$this->date_valide;
|
$sql.= ', date_valide='.$this->date_valide;
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
@ -808,7 +866,7 @@ class ExpenseReport extends CommonObject
|
|||||||
if ($this->fk_c_expensereport_statuts != 99)
|
if ($this->fk_c_expensereport_statuts != 99)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql.= " SET ref_number = '".$this->ref_number."', fk_c_expensereport_statuts = 99, fk_user_refuse = ".$user->id;
|
$sql.= " SET ref = '".$this->ref."', fk_c_expensereport_statuts = 99, fk_user_refuse = ".$user->id;
|
||||||
$sql.= ', date_refuse='.$this->date_refuse;
|
$sql.= ', date_refuse='.$this->date_refuse;
|
||||||
$sql.= ", detail_refuse='".addslashes($details)."'";
|
$sql.= ", detail_refuse='".addslashes($details)."'";
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
@ -903,7 +961,7 @@ class ExpenseReport extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql.= " SET fk_c_deplacement_statuts = 1,";
|
$sql.= " SET fk_c_deplacement_statuts = 1,";
|
||||||
//$sql.= " , ref_number = '(PROV".$this->id.")', ref_number_int = 0";
|
//$sql.= " , ref = '(PROV".$this->id.")', ref_number_int = 0";
|
||||||
$sql.= " ref_number_int = 0";
|
$sql.= " ref_number_int = 0";
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
@ -1005,15 +1063,15 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
if($this->db->num_rows($result) > 0):
|
if($this->db->num_rows($result) > 0):
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$this->ref_number = $objp->ref_number_int;
|
$this->ref = $objp->ref_number_int;
|
||||||
$this->ref_number++;
|
$this->ref++;
|
||||||
while(strlen($this->ref_number) < $num_car):
|
while(strlen($this->ref) < $num_car):
|
||||||
$this->ref_number = "0".$this->ref_number;
|
$this->ref = "0".$this->ref;
|
||||||
endwhile;
|
endwhile;
|
||||||
else:
|
else:
|
||||||
$this->ref_number = 1;
|
$this->ref = 1;
|
||||||
while(strlen($this->ref_number) < $num_car):
|
while(strlen($this->ref) < $num_car):
|
||||||
$this->ref_number = "0".$this->ref_number;
|
$this->ref = "0".$this->ref;
|
||||||
endwhile;
|
endwhile;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
@ -1119,7 +1177,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$total_tva = $total_ttc - $total_ht;
|
$total_tva = $total_ttc - $total_ht;
|
||||||
// fin calculs
|
// fin calculs
|
||||||
|
|
||||||
$ligne = new ExpenseReportLigne($this->db);
|
$ligne = new ExpenseReportLine($this->db);
|
||||||
$ligne->comments = $comments;
|
$ligne->comments = $comments;
|
||||||
$ligne->qty = $qty;
|
$ligne->qty = $qty;
|
||||||
$ligne->value_unit = $value_unit;
|
$ligne->value_unit = $value_unit;
|
||||||
@ -1295,7 +1353,7 @@ class ExpenseReport extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Class of expense report details lines
|
* Class of expense report details lines
|
||||||
*/
|
*/
|
||||||
class ExpenseReportLigne
|
class ExpenseReportLine
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
@ -1328,7 +1386,7 @@ class ExpenseReportLigne
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Handlet database
|
* @param DoliDB $db Handlet database
|
||||||
*/
|
*/
|
||||||
function ExpenseReportLigne($db)
|
function ExpenseReportLine($db)
|
||||||
{
|
{
|
||||||
$this->db= $db;
|
$this->db= $db;
|
||||||
}
|
}
|
||||||
@ -1354,7 +1412,8 @@ class ExpenseReportLigne
|
|||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
if($result) {
|
if($result)
|
||||||
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$this->rowid = $objp->rowid;
|
$this->rowid = $objp->rowid;
|
||||||
@ -1391,7 +1450,9 @@ class ExpenseReportLigne
|
|||||||
{
|
{
|
||||||
global $langs,$user,$conf;
|
global $langs,$user,$conf;
|
||||||
|
|
||||||
dol_syslog("ExpenseReportLigne::Insert rang=".$this->rang, LOG_DEBUG);
|
$error=0;
|
||||||
|
|
||||||
|
dol_syslog("ExpenseReportLine::Insert rang=".$this->rang, LOG_DEBUG);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->comments=trim($this->comments);
|
$this->comments=trim($this->comments);
|
||||||
@ -1413,23 +1474,39 @@ class ExpenseReportLigne
|
|||||||
$sql.= " ".$this->total_ht.",";
|
$sql.= " ".$this->total_ht.",";
|
||||||
$sql.= " ".$this->total_tva.",";
|
$sql.= " ".$this->total_tva.",";
|
||||||
$sql.= " ".$this->total_ttc.",";
|
$sql.= " ".$this->total_ttc.",";
|
||||||
$sql.= "'".$this->date."'";
|
$sql.= "'".$this->db->idate($this->date)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("ExpenseReportLigne::insert sql=".$sql);
|
dol_syslog("ExpenseReportLine::insert sql=".$sql);
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
if ($resql):
|
{
|
||||||
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'expensereport_det');
|
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'expensereport_det');
|
||||||
|
|
||||||
|
$tmpparent=new ExpenseReport($this->db);
|
||||||
|
$tmpparent->fetch($this->fk_expensereport);
|
||||||
|
$result = $tmpparent->update_price();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->error = $tmpparent->error;
|
||||||
|
$this->errors = $tmpparent->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->rowid;
|
return $this->rowid;
|
||||||
else:
|
}
|
||||||
$this->error=$this->db->error();
|
else
|
||||||
dol_syslog("ExpenseReportLigne::insert Error ".$this->error, LOG_ERR);
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
dol_syslog("ExpenseReportLine::insert Error ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
endif;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1442,6 +1519,8 @@ class ExpenseReportLigne
|
|||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
global $user,$langs,$conf;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->comments=trim($this->comments);
|
$this->comments=trim($this->comments);
|
||||||
|
|
||||||
@ -1465,18 +1544,31 @@ class ExpenseReportLigne
|
|||||||
else $sql.= ",fk_c_tva=null";
|
else $sql.= ",fk_c_tva=null";
|
||||||
$sql.= " WHERE rowid = ".$this->rowid;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
dol_syslog("ExpenseReportLigne::update sql=".$sql);
|
dol_syslog("ExpenseReportLine::update sql=".$sql);
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
{
|
||||||
|
$tmpparent=new ExpenseReport($db);
|
||||||
|
$tmpparent->fetch($this->fk_expensereport);
|
||||||
|
$result = $tmpparent->update_price();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->error = $tmpparent->error;
|
||||||
|
$this->errors = $tmpparent->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog("ExpenseReportLigne::update Error ".$this->error, LOG_ERR);
|
dol_syslog("ExpenseReportLine::update Error ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -1503,7 +1595,7 @@ function select_expensereport_statut($selected='',$htmlname='fk_c_expensereport_
|
|||||||
if ($useempty) print '<option value="-1"> </option>';
|
if ($useempty) print '<option value="-1"> </option>';
|
||||||
foreach ($tmpep->statuts as $key => $val)
|
foreach ($tmpep->statuts as $key => $val)
|
||||||
{
|
{
|
||||||
if ($selected == $key)
|
if ($selected != '' && $selected == $key)
|
||||||
{
|
{
|
||||||
print '<option value="'.$key.'" selected="true">';
|
print '<option value="'.$key.'" selected="true">';
|
||||||
}
|
}
|
||||||
@ -1597,7 +1689,7 @@ function select_type_fees_id($selected='',$htmlname='type',$showempty=0)
|
|||||||
print '> </option>';
|
print '> </option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT c.code, c.label as type,c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
$sql = "SELECT c.id, c.code, c.label as type FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
||||||
$sql.= " ORDER BY c.label ASC";
|
$sql.= " ORDER BY c.label ASC";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1609,7 +1701,7 @@ function select_type_fees_id($selected='',$htmlname='type',$showempty=0)
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
print '<option value="'.$obj->id.'"';
|
print '<option value="'.$obj->id.'"';
|
||||||
if ($obj->code == $selected) print ' selected="true"';
|
if ($obj->code == $selected || $obj->id == $selected) print ' selected="selected"';
|
||||||
print '>';
|
print '>';
|
||||||
if ($obj->code != $langs->trans($obj->code)) print $langs->trans($obj->code);
|
if ($obj->code != $langs->trans($obj->code)) print $langs->trans($obj->code);
|
||||||
else print $langs->trans($obj->type);
|
else print $langs->trans($obj->type);
|
||||||
|
|||||||
@ -23,12 +23,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/expensereport/document.php
|
* \file htdocs/expensereport/document.php
|
||||||
* \ingroup expensereport
|
* \ingroup expensereport
|
||||||
* \brief Page of linked files onto trip and expenses
|
* \brief Page of linked files onto trip and expenses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
@ -84,7 +86,7 @@ if ($object->id)
|
|||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$head=trip_prepare_head($object);
|
$head=expensereport_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip');
|
dol_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip');
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ if (isset($_POST['action']))
|
|||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$outputlangs->charset_output = 'UTF-8';
|
$outputlangs->charset_output = 'UTF-8';
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.ref_number, d.date_paiement, d.total_ht, d.total_tva, d.total_ttc";
|
$sql = "SELECT d.rowid, d.ref, d.date_paiement, d.total_ht, d.total_tva, d.total_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
||||||
$sql.= " WHERE date_paiement LIKE '".$select_date."%'";
|
$sql.= " WHERE date_paiement LIKE '".$select_date."%'";
|
||||||
$sql.= " ORDER BY d.rowid";
|
$sql.= " ORDER BY d.rowid";
|
||||||
@ -144,8 +144,8 @@ if (isset($_POST['action']))
|
|||||||
$objet->total_ht = number_format($objet->total_ht,2);
|
$objet->total_ht = number_format($objet->total_ht,2);
|
||||||
$objet->total_tva = number_format($objet->total_tva,2);
|
$objet->total_tva = number_format($objet->total_tva,2);
|
||||||
$objet->total_ttc = number_format($objet->total_ttc,2);
|
$objet->total_ttc = number_format($objet->total_ttc,2);
|
||||||
$objet->ref_number = trim($objet->ref_number);
|
$objet->ref = trim($objet->ref);
|
||||||
$ligne.= "{$objet->rowid}, {$objet->ref_number}, ----, {$objet->date_paiement}, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n";
|
$ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->date_paiement}, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n";
|
||||||
|
|
||||||
$ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n";
|
$ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n";
|
||||||
|
|
||||||
|
|||||||
@ -24,9 +24,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/expensereport/class/expensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
|
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ if ($id)
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->info($id);
|
$object->info($id);
|
||||||
|
|
||||||
$head = trip_prepare_head($object);
|
$head = expensereport_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip');
|
dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip');
|
||||||
|
|
||||||
|
|||||||
@ -53,25 +53,22 @@ llxHeader();
|
|||||||
$max_year = 5;
|
$max_year = 5;
|
||||||
$min_year = 5;
|
$min_year = 5;
|
||||||
|
|
||||||
$sortorder = $_GET["sortorder"];
|
|
||||||
$sortfield = $_GET["sortfield"];
|
|
||||||
$page = $_GET["page"];
|
|
||||||
|
|
||||||
$search_ref = $_GET['search_ref'];
|
|
||||||
|
|
||||||
$month_start = $_GET['month_start'];
|
$month_start = $_GET['month_start'];
|
||||||
$year_start = $_GET['year_start'];
|
$year_start = $_GET['year_start'];
|
||||||
$month_end = $_GET['month_end'];
|
$month_end = $_GET['month_end'];
|
||||||
$year_end = $_GET['year_end'];
|
$year_end = $_GET['year_end'];
|
||||||
|
|
||||||
$search_user = $_GET['search_user'];
|
$search_ref = GETPOST('search_ref');
|
||||||
|
$search_user = GETPOST('search_user','int');
|
||||||
$search_state = $_GET['search_state'];
|
$search_state = GETPOST('search_state','int');
|
||||||
|
|
||||||
|
|
||||||
|
$sortorder = $_GET["sortorder"];
|
||||||
|
$sortfield = $_GET["sortfield"];
|
||||||
|
$page = $_GET["page"];
|
||||||
if (!$sortorder) $sortorder="DESC";
|
if (!$sortorder) $sortorder="DESC";
|
||||||
if (!$sortfield) $sortfield="d.date_debut";
|
if (!$sortfield) $sortfield="d.date_debut";
|
||||||
|
|
||||||
|
|
||||||
if ($page == -1) {
|
if ($page == -1) {
|
||||||
$page = 0 ;
|
$page = 0 ;
|
||||||
}
|
}
|
||||||
@ -81,7 +78,7 @@ $offset = $limit * $page;
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.ref_number, d.total_ht, d.total_tva, d.total_ttc, d.fk_c_expensereport_statuts as status,";
|
$sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc, d.fk_c_expensereport_statuts as status,";
|
||||||
$sql.= " d.date_debut, d.date_fin,";
|
$sql.= " d.date_debut, d.date_fin,";
|
||||||
$sql.= " u.rowid as id_user, u.firstname, u.lastname";
|
$sql.= " u.rowid as id_user, u.firstname, u.lastname";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport d\n";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport d\n";
|
||||||
@ -89,7 +86,7 @@ $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user u ON d.fk_user_author = u.rowid\n";
|
|||||||
|
|
||||||
// WHERE
|
// WHERE
|
||||||
if(!empty($search_ref)){
|
if(!empty($search_ref)){
|
||||||
$sql.= " WHERE d.ref_number LIKE '%".$db->escape($search_ref)."%'\n";
|
$sql.= " WHERE d.ref LIKE '%".$db->escape($search_ref)."%'\n";
|
||||||
}else{
|
}else{
|
||||||
$sql.= " WHERE 1 = 1\n";
|
$sql.= " WHERE 1 = 1\n";
|
||||||
}
|
}
|
||||||
@ -152,27 +149,17 @@ if ($month_start > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($search_user) && $search_user != -1) {
|
if (!empty($search_user) && $search_user != -1) $sql.= " AND d.fk_user_author = '$search_user'\n";
|
||||||
$sql.= " AND d.fk_user_author = '$search_user'\n";
|
if($search_state != '') $sql.= " AND d.fk_c_expensereport_statuts = '$search_state'\n";
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($search_state)) {
|
|
||||||
$sql.= " AND d.fk_c_expensereport_statuts = '$search_state'\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// RESTRICT RIGHTS
|
// RESTRICT RIGHTS
|
||||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)){
|
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)){
|
||||||
$sql.= " AND d.fk_user_author = '{$user->id}'\n";
|
$sql.= " AND d.fk_user_author = '{$user->id}'\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ORDER
|
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
if($_GET['debug']=='ok'){
|
|
||||||
var_dump("<pre>",$sql,"</pre>"); exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -254,7 +241,7 @@ if ($resql)
|
|||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td><a href="card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->ref_number.'</a></td>';
|
print '<td><a href="card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->ref.'</a></td>';
|
||||||
print '<td align="center">'.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').'</td>';
|
print '<td align="center">'.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').'</td>';
|
||||||
print '<td align="center">'.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').'</td>';
|
print '<td align="center">'.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').'</td>';
|
||||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->id_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).'</a></td>';
|
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->id_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).'</a></td>';
|
||||||
|
|||||||
@ -38,7 +38,7 @@ if ($_GET["action"] == 'confirm_ndf_to_account' && $_GET["confirm"] == "yes"):
|
|||||||
|
|
||||||
$dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]);
|
$dateop = dol_mktime(12,0,0,$datePaiement[1],$datePaiement[2],$datePaiement[0]);
|
||||||
$operation = $expensereport->code_paiement;
|
$operation = $expensereport->code_paiement;
|
||||||
$label = "Règlement ".$expensereport->ref_number;
|
$label = "Règlement ".$expensereport->ref;
|
||||||
$amount = - price2num($expensereport->total_ttc);
|
$amount = - price2num($expensereport->total_ttc);
|
||||||
$num_chq = '';
|
$num_chq = '';
|
||||||
$cat1 = '';
|
$cat1 = '';
|
||||||
@ -73,7 +73,7 @@ if ($_GET["action"] == 'confirm_account_to_ndf' && $_GET["confirm"] == "yes"):
|
|||||||
$expensereport->fetch($idTrip,$user);
|
$expensereport->fetch($idTrip,$user);
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank";
|
||||||
$sql.= " WHERE label LIKE '%".$expensereport->ref_number."%'";
|
$sql.= " WHERE label LIKE '%".$expensereport->ref."%'";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql > 0):
|
if ($resql > 0):
|
||||||
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport d";
|
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport d";
|
||||||
@ -137,7 +137,7 @@ else:
|
|||||||
print ' <input type="submit" class="button" value="'.$langs->trans("ViewAccountSynch").'">';
|
print ' <input type="submit" class="button" value="'.$langs->trans("ViewAccountSynch").'">';
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|
||||||
$sql = "SELECT d.fk_bank_account, d.ref_number, d.rowid, d.date_valide, d.fk_user_author, d.total_ttc, d.integration_compta, d.fk_c_expensereport_statuts";
|
$sql = "SELECT d.fk_bank_account, d.ref, d.rowid, d.date_valide, d.fk_user_author, d.total_ttc, d.integration_compta, d.fk_c_expensereport_statuts";
|
||||||
$sql.= " ,CONCAT(u.firstname,' ',u.lastname) as declarant_NDF";
|
$sql.= " ,CONCAT(u.firstname,' ',u.lastname) as declarant_NDF";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport d";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user u ON d.fk_user_author = u.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user u ON d.fk_user_author = u.rowid";
|
||||||
@ -169,24 +169,30 @@ else:
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td>'.$objp->ref_number.'</td>';
|
print '<td>'.$objp->ref.'</td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->date_valide),'day').'</td>';
|
print '<td>'.dol_print_date($db->jdate($objp->date_valide),'day').'</td>';
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_author.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->declarant_NDF.'</a></td>';
|
print '<td><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_author.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->declarant_NDF.'</a></td>';
|
||||||
print '<td align="center">'.$objp->total_ttc.' '.$langs->trans("EURO").'</td>';
|
print '<td align="center">'.$objp->total_ttc.' '.$langs->trans("EURO").'</td>';
|
||||||
|
|
||||||
if($objp->integration_compta):
|
if($objp->integration_compta)
|
||||||
|
{
|
||||||
print '<td align="center"><a href="synchro_compta.php?action=accountTOndf&idTrip='.$objp->rowid.'&account='.$idAccount.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow.png" style="border:0px;" alt="Compte vers NDF" title="Compte vers NDF"/></a></td>';
|
print '<td align="center"><a href="synchro_compta.php?action=accountTOndf&idTrip='.$objp->rowid.'&account='.$idAccount.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1leftarrow.png" style="border:0px;" alt="Compte vers NDF" title="Compte vers NDF"/></a></td>';
|
||||||
else:
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print '<td align="center"><a href="synchro_compta.php?action=ndfTOaccount&idTrip='.$objp->rowid.'&account='.$idAccount.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow.png" style="border:0px;" alt="NDF vers Compte" title="NDF vers Compte"/></a></td>';
|
print '<td align="center"><a href="synchro_compta.php?action=ndfTOaccount&idTrip='.$objp->rowid.'&account='.$idAccount.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/1rightarrow.png" style="border:0px;" alt="NDF vers Compte" title="NDF vers Compte"/></a></td>';
|
||||||
endif;
|
}
|
||||||
|
|
||||||
print '<td>'.$account->label.'</td>';
|
print '<td>'.$account->label.'</td>';
|
||||||
|
|
||||||
if($objp->integration_compta):
|
if($objp->integration_compta)
|
||||||
|
{
|
||||||
print '<td align="center"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" style="border:0px;" alt="Intégration OK" /></td>';
|
print '<td align="center"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" style="border:0px;" alt="Intégration OK" /></td>';
|
||||||
else:
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print '<td align="center"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/off.png" style="border:0px;" alt="Intégration Non OK" /></td>';
|
print '<td align="center"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/off.png" style="border:0px;" alt="Intégration Non OK" /></td>';
|
||||||
endif;
|
}
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -31,5 +31,5 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
insert into llx_c_type_fees (code,label,active) values ('TF_OTHER', 'Other', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_OTHER', 'Other', 1);
|
||||||
insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Trip', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Transportation', 1);
|
||||||
insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1);
|
||||||
|
|||||||
@ -117,7 +117,7 @@ ALTER TABLE llx_stock_mouvement ADD COLUMN sellby date DEFAULT NULL;
|
|||||||
|
|
||||||
CREATE TABLE llx_expensereport (
|
CREATE TABLE llx_expensereport (
|
||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
ref_number varchar(50) NOT NULL,
|
ref varchar(50) NOT NULL,
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
ref_number_int integer DEFAULT NULL,
|
ref_number_int integer DEFAULT NULL,
|
||||||
ref_ext integer,
|
ref_ext integer,
|
||||||
@ -131,6 +131,7 @@ CREATE TABLE llx_expensereport (
|
|||||||
date_paiement datetime,
|
date_paiement datetime,
|
||||||
date_valide datetime,
|
date_valide datetime,
|
||||||
date_create datetime NOT NULL,
|
date_create datetime NOT NULL,
|
||||||
|
tms timestamp,
|
||||||
fk_user_author integer NOT NULL,
|
fk_user_author integer NOT NULL,
|
||||||
fk_user_modif integer DEFAULT NULL,
|
fk_user_modif integer DEFAULT NULL,
|
||||||
fk_user_validator integer DEFAULT NULL,
|
fk_user_validator integer DEFAULT NULL,
|
||||||
@ -151,12 +152,9 @@ CREATE TABLE llx_expensereport (
|
|||||||
model_pdf varchar(50) DEFAULT NULL
|
model_pdf varchar(50) DEFAULT NULL
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE llx_expensereport_det
|
CREATE TABLE llx_expensereport_det
|
||||||
(
|
(
|
||||||
rowid integer PRIMARY KEY NOT NULL,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_expensereport integer NOT NULL,
|
fk_expensereport integer NOT NULL,
|
||||||
fk_c_type_fees integer NOT NULL,
|
fk_c_type_fees integer NOT NULL,
|
||||||
fk_projet integer NOT NULL,
|
fk_projet integer NOT NULL,
|
||||||
@ -184,4 +182,3 @@ CREATE TABLE llx_expensereport_det
|
|||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
CREATE TABLE llx_expensereport (
|
CREATE TABLE llx_expensereport (
|
||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
ref_number varchar(50) NOT NULL,
|
ref varchar(50) NOT NULL,
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
ref_number_int integer DEFAULT NULL,
|
ref_number_int integer DEFAULT NULL,
|
||||||
ref_ext integer,
|
ref_ext integer,
|
||||||
@ -32,6 +32,7 @@ CREATE TABLE llx_expensereport (
|
|||||||
date_paiement datetime,
|
date_paiement datetime,
|
||||||
date_valide datetime,
|
date_valide datetime,
|
||||||
date_create datetime NOT NULL,
|
date_create datetime NOT NULL,
|
||||||
|
tms timestamp,
|
||||||
fk_user_author integer NOT NULL,
|
fk_user_author integer NOT NULL,
|
||||||
fk_user_modif integer DEFAULT NULL,
|
fk_user_modif integer DEFAULT NULL,
|
||||||
fk_user_validator integer DEFAULT NULL,
|
fk_user_validator integer DEFAULT NULL,
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
CREATE TABLE llx_expensereport_det
|
CREATE TABLE llx_expensereport_det
|
||||||
(
|
(
|
||||||
rowid integer PRIMARY KEY NOT NULL,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_expensereport integer NOT NULL,
|
fk_expensereport integer NOT NULL,
|
||||||
fk_c_type_fees integer NOT NULL,
|
fk_c_type_fees integer NOT NULL,
|
||||||
fk_projet integer NOT NULL,
|
fk_projet integer NOT NULL,
|
||||||
|
|||||||
@ -67,7 +67,7 @@ ListSupplierOrdersAssociatedProject=List of supplier's orders associated with th
|
|||||||
ListSupplierInvoicesAssociatedProject=List of supplier's invoices associated with the project
|
ListSupplierInvoicesAssociatedProject=List of supplier's invoices associated with the project
|
||||||
ListContractAssociatedProject=List of contracts associated with the project
|
ListContractAssociatedProject=List of contracts associated with the project
|
||||||
ListFichinterAssociatedProject=List of interventions associated with the project
|
ListFichinterAssociatedProject=List of interventions associated with the project
|
||||||
ListTripAssociatedProject=List of trips and expenses associated with the project
|
ListExpenseReportsAssociatedProject=List of expense reports associated with the project
|
||||||
ListActionsAssociatedProject=List of events associated with the project
|
ListActionsAssociatedProject=List of events associated with the project
|
||||||
ActivityOnProjectThisWeek=Activity on project this week
|
ActivityOnProjectThisWeek=Activity on project this week
|
||||||
ActivityOnProjectThisMonth=Activity on project this month
|
ActivityOnProjectThisMonth=Activity on project this month
|
||||||
|
|||||||
@ -424,6 +424,10 @@ class Project extends CommonObject
|
|||||||
if (empty($datefieldname)) return 'Error this object has no date field defined';
|
if (empty($datefieldname)) return 'Error this object has no date field defined';
|
||||||
$sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)";
|
$sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)";
|
||||||
}
|
}
|
||||||
|
if ($type == 'expensereport')
|
||||||
|
{
|
||||||
|
$sql ='eeee';
|
||||||
|
}
|
||||||
if (! $sql) return -1;
|
if (! $sql) return -1;
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn
|
|||||||
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||||
if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
|
if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
|
||||||
|
if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||||
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||||
|
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
@ -225,13 +226,22 @@ $listofreferent=array(
|
|||||||
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
|
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
|
||||||
'trip'=>array(
|
'trip'=>array(
|
||||||
'name'=>"TripsAndExpenses",
|
'name'=>"TripsAndExpenses",
|
||||||
'title'=>"ListTripAssociatedProject",
|
'title'=>"ListExpenseReportsAssociatedProject",
|
||||||
'class'=>'Deplacement',
|
'class'=>'Deplacement',
|
||||||
'table'=>'deplacement',
|
'table'=>'deplacement',
|
||||||
'datefieldname'=>'dated',
|
'datefieldname'=>'dated',
|
||||||
'margin'=>'minus',
|
'margin'=>'minus',
|
||||||
'disableamount'=>1,
|
'disableamount'=>1,
|
||||||
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
|
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
|
||||||
|
'expensereport'=>array(
|
||||||
|
'name'=>"ExpenseReports",
|
||||||
|
'title'=>"ListExpenseReportsAssociatedProject",
|
||||||
|
'class'=>'ExpenseReportLine',
|
||||||
|
'table'=>'expensereport',
|
||||||
|
'datefieldname'=>'date',
|
||||||
|
'margin'=>'minus',
|
||||||
|
'disableamount'=>1,
|
||||||
|
'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire),
|
||||||
'agenda'=>array(
|
'agenda'=>array(
|
||||||
'name'=>"Agenda",
|
'name'=>"Agenda",
|
||||||
'title'=>"ListActionsAssociatedProject",
|
'title'=>"ListActionsAssociatedProject",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user