From a7deb7c23adaaa3ddea2f89bb27570bfda0e9eb3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 23 Oct 2011 14:55:37 +0200 Subject: [PATCH] Fix: uniformize code --- htdocs/compta/deplacement/fiche.php | 147 ++++++++---------- htdocs/compta/deplacement/index.php | 10 +- htdocs/compta/deplacement/info.php | 49 ++---- htdocs/compta/deplacement/list.php | 10 +- htdocs/compta/deplacement/note.php | 89 ++++------- .../install/mysql/migration/3.1.0-3.2.0.sql | 2 + .../install/mysql/tables/llx_deplacement.sql | 12 +- htdocs/lib/trip.lib.php | 61 ++++++++ 8 files changed, 195 insertions(+), 185 deletions(-) create mode 100644 htdocs/lib/trip.lib.php diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index f8bb30cff04..12cfd81ac65 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin * * 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 @@ -23,6 +23,7 @@ */ require("../../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/trip.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); if ($conf->projet->enabled) @@ -35,21 +36,23 @@ $langs->load("trips"); // Security check -$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"]; +$id = GETPOST('id'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'deplacement', $id,''); +$action = GETPOST('action'); +$confirm = GETPOST('confirm'); + $mesg = ''; - +$object = new Deplacement($db); /* * Actions */ -if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->deplacement->supprimer) +if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { - $deplacement = new Deplacement($db); - $result=$deplacement->delete($_GET["id"]); + $result=$object->delete($id); if ($result >= 0) { Header("Location: index.php"); @@ -57,11 +60,11 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user- } else { - $mesg=$deplacement->error; + $mesg=$object->error; } } -if ($_POST["action"] == 'add' && $user->rights->deplacement->creer) +if ($action == 'add' && $user->rights->deplacement->creer) { if (! $_POST["cancel"]) { @@ -72,26 +75,25 @@ if ($_POST["action"] == 'add' && $user->rights->deplacement->creer) $_POST["reday"], $_POST["reyear"]); - $deplacement = new Deplacement($db); - $deplacement->date = $dated; - $deplacement->km = $_POST["km"]; - $deplacement->type = $_POST["type"]; - $deplacement->socid = $_POST["socid"]; - $deplacement->fk_user = $_POST["fk_user"]; - $deplacement->note = $_POST["note"]; - $deplacement->note_public = $_POST["note_public"]; + $object->date = $dated; + $object->km = $_POST["km"]; + $object->type = $_POST["type"]; + $object->socid = $_POST["socid"]; + $object->fk_user = $_POST["fk_user"]; + $object->note = $_POST["note"]; + $object->note_public = $_POST["note_public"]; - if (! $deplacement->date) + if (! $object->date) { $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")); $error++; } - if ($deplacement->type == '-1') // Otherwise it is TF_LUNCH,... + if ($object->type == '-1') // Otherwise it is TF_LUNCH,... { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; $error++; } - if (! ($deplacement->fk_user > 0)) + if (! ($object->fk_user > 0)) { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")).'
'; $error++; @@ -99,22 +101,22 @@ if ($_POST["action"] == 'add' && $user->rights->deplacement->creer) if (! $error) { - $id = $deplacement->create($user); + $id = $object->create($user); if ($id > 0) { - Header("Location: fiche.php?id=".$id); + Header("Location: " . $_SERVER["PHP_SELF"] . "?id=".$id); exit; } else { - $mesg=$deplacement->error; - $_GET["action"]='create'; + $mesg=$object->error; + $action='create'; } } else { - $_GET["action"]='create'; + $action='create'; } } else @@ -124,45 +126,44 @@ if ($_POST["action"] == 'add' && $user->rights->deplacement->creer) } } -if ($_POST["action"] == 'update' && $user->rights->deplacement->creer) +if ($action == 'update' && $user->rights->deplacement->creer) { if (empty($_POST["cancel"])) { - $deplacement = new Deplacement($db); - $result = $deplacement->fetch($_POST["id"]); + $result = $object->fetch($id); - $deplacement->date = dol_mktime(12, 0 , 0, + $object->date = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); - $deplacement->km = $_POST["km"]; - $deplacement->type = $_POST["type"]; - $deplacement->fk_user = $_POST["fk_user"]; - $deplacement->socid = $_POST["socid"]; - $result = $deplacement->update($user); + $object->km = $_POST["km"]; + $object->type = $_POST["type"]; + $object->fk_user = $_POST["fk_user"]; + $object->socid = $_POST["socid"]; + $result = $object->update($user); if ($result > 0) { - Header("Location: fiche.php?id=".$_POST["id"]); + Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit; } else { - $mesg=$deplacement->error; + $mesg=$object->error; } } else { - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST["id"]); + Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit; } } // Set into a project -if ($_POST['action'] == 'classin') +if ($action == 'classin') { $trip = new Deplacement($db); - $trip->fetch($_GET['id']); + $trip->fetch($id); $result=$trip->setProject($_POST['projectid']); if ($result < 0) dol_print_error($db,$trip->error); } @@ -180,7 +181,7 @@ $html = new Form($db); /* * Action create */ -if ($_GET["action"] == 'create') +if ($action == 'create') { print_fiche_titre($langs->trans("NewTrip")); @@ -191,7 +192,7 @@ if ($_GET["action"] == 'create') $_POST["reday"], $_POST["reyear"]); - print "
\n"; + print '' . "\n"; print ''; print ''; @@ -257,40 +258,24 @@ else { if ($id) { - $deplacement = new Deplacement($db); - $result = $deplacement->fetch($id); + $result = $object->fetch($id); if ($result > 0) { - if ($mesg) print $mesg."
"; + dol_htmloutput_mesg($mesg); - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$deplacement->id"; - $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'card'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/note.php?id=$deplacement->id"; - $head[$h][1] = $langs->trans("Note"); - $head[$h][2] = 'note'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/info.php?id=$deplacement->id"; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; + $head = trip_prepare_head($object); dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); if ($_GET["action"] == 'edit') { $soc = new Societe($db); - if ($deplacement->socid) + if ($object->socid) { - $soc->fetch($deplacement->socid); + $soc->fetch($object->socid); } - print "\n"; + print '' . "\n"; print ''; print ''; print ''; @@ -300,28 +285,28 @@ else // Ref print ""; print ''.$langs->trans("Ref").''; - print $deplacement->ref; + print $object->ref; print ''; // Type print ""; print ''.$langs->trans("Type").''; - print $html->select_type_fees($_POST["type"]?$_POST["type"]:$deplacement->type,'type',0); + print $html->select_type_fees($_POST["type"]?$_POST["type"]:$object->type,'type',0); print ''; // Who print ""; print ''.$langs->trans("Person").''; - print $html->select_users($_POST["fk_user"]?$_POST["fk_user"]:$deplacement->fk_user,'fk_user',0); + print $html->select_users($_POST["fk_user"]?$_POST["fk_user"]:$object->fk_user,'fk_user',0); print ''; // Date print ''.$langs->trans("Date").''; - print $html->select_date($deplacement->date,'','','','','update'); + print $html->select_date($object->date,'','','','','update'); print ''; // Km - print ''.$langs->trans("FeesKilometersOrAmout").''; + print ''.$langs->trans("FeesKilometersOrAmout").''; // Where print ""; @@ -344,40 +329,40 @@ else /* * Confirmation de la suppression du deplacement */ - if ($_GET["action"] == 'delete') + if ($action == 'delete') { $ret=$html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); if ($ret == 'html') print '
'; } $soc = new Societe($db); - if ($deplacement->socid) $soc->fetch($deplacement->socid); + if ($object->socid) $soc->fetch($object->socid); print ''; // Ref print ""; print ''; // Type - print ''; + print ''; // Who print ''; // Date print ''; // Km/Price - print ''; + print ''; // Where print ''; @@ -397,7 +382,7 @@ else print ''; if ($_GET['action'] != 'classify') { - print ''; } @@ -405,18 +390,18 @@ else print ''; print ''; } // Statut - print ''; + print ''; print "
'.$langs->trans("Ref").''; - print $html->showrefnav($deplacement,'id','',1,'rowid','ref',''); + print $html->showrefnav($object,'id','',1,'rowid','ref',''); print '
'.$langs->trans("Type").''.$langs->trans($deplacement->type).'
'.$langs->trans("Type").''.$langs->trans($object->type).'
'.$langs->trans("Person").''; $userfee=new User($db); - $userfee->fetch($deplacement->fk_user); + $userfee->fetch($object->fk_user); print $userfee->getNomUrl(1); print '
'.$langs->trans("Date").''; - print dol_print_date($deplacement->date,'day'); + print dol_print_date($object->date,'day'); print '
'.$langs->trans("FeesKilometersOrAmout").''.$deplacement->km.'
'.$langs->trans("FeesKilometersOrAmout").''.$object->km.'
'.$langs->trans("CompanyVisited").'id.'">'; + print 'id.'">'; print img_edit($langs->trans('SetProject'),1); print ''; if ($_GET['action'] == 'classify') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$deplacement->id, $deplacement->socid, $deplacement->fk_project,'projectid'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$deplacement->id, $deplacement->socid, $deplacement->fk_project,'none'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none'); } print '
'.$langs->trans("Status").''.$deplacement->getLibStatut(4).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
"; @@ -439,7 +424,7 @@ else print '
'; -if ($_GET["action"] != 'create' && $_GET["action"] != 'edit') +if ($action != 'create' && $action != 'edit') { if ($user->rights->deplacement->creer) { diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 46220223823..995ae8966c4 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2011 Regis Houssin * * 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 @@ -32,7 +32,7 @@ $langs->load("users"); $langs->load("trips"); // Security check -$socid = $_GET["socid"]?$_GET["socid"]:''; +$socid = GETPOST('socid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'deplacement','',''); diff --git a/htdocs/compta/deplacement/info.php b/htdocs/compta/deplacement/info.php index 60b5e199bd8..788759148e9 100644 --- a/htdocs/compta/deplacement/info.php +++ b/htdocs/compta/deplacement/info.php @@ -17,60 +17,45 @@ */ /** - * \file htdocs/compta/deplacement/info.php - * \ingroup facture - * \brief Page to show a trip information + * \file htdocs/compta/deplacement/info.php + * \ingroup trip + * \brief Page to show a trip information */ require("../../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/trip.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php"); $langs->load("trips"); +// Security check +$id = GETPOST('id'); +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'deplacement', $id, ''); + + /* * View */ + llxHeader(); if ($id) { - $deplacement = new Deplacement($db); - $deplacement->fetch($_GET["id"], $user); - $deplacement->info($_GET["id"]); - if ($deplacement > 0) - { - if ($mesg) print $mesg."
"; - - $h=0; - - $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/fiche.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'card'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/note.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Note"); - $head[$h][2] = 'note'; - $h++; + $object = new Deplacement($db); + $object->fetch($id); + $object->info($id); - $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/info.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; + $head = trip_prepare_head($object); - dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip'); + dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip'); print '
'; - dol_print_object_info($deplacement); + dol_print_object_info($object); print '
'; print '
'; - } - else - { - dol_print_error($db); - } } $db->close(); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 8ac93658241..5a74877adc3 100755 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2011 Regis Houssin * * 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 @@ -32,7 +32,7 @@ $langs->load("users"); $langs->load("trips"); // Security check -$socid = $_GET["socid"]?$_GET["socid"]:''; +$socid = GETPOST('socid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'deplacement','',''); diff --git a/htdocs/compta/deplacement/note.php b/htdocs/compta/deplacement/note.php index 1aaf5005f5f..cb0ef37b83d 100644 --- a/htdocs/compta/deplacement/note.php +++ b/htdocs/compta/deplacement/note.php @@ -23,42 +23,38 @@ */ require("../../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/trip.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php"); -$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; - -if (!$user->rights->deplacement->lire) - accessforbidden(); - $langs->load("companies"); -$langs->load("bills"); $langs->load("trips"); -// Securiy check -if ($user->societe_id > 0) -{ - unset($_GET["action"]); - $socid = $user->societe_id; -} +$id = GETPOST('id'); +$ref = GETPOST('ref'); +$action = GETPOST('action'); +$confirm = GETPOST('confirm'); +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'deplacement', $id, ''); -$trip = new Deplacement($db); +$object = new Deplacement($db); /******************************************************************************/ /* Actions */ /******************************************************************************/ -if ($_POST["action"] == 'update_public' && $user->rights->deplacement->creer) +if ($action == 'update_public' && $user->rights->deplacement->creer) { $db->begin(); - $trip->fetch($_GET["id"]); + $object->fetch($id); - $res=$trip->update_note_public($_POST["note_public"],$user); + $res=$object->update_note_public($_POST["note_public"]); if ($res < 0) { - $mesg='
'.$fac->error.'
'; + $mesg='
'.$object->error.'
'; $db->rollback(); } else @@ -67,16 +63,16 @@ if ($_POST["action"] == 'update_public' && $user->rights->deplacement->creer) } } -if ($_POST["action"] == 'update' && $user->rights->deplacement->creer) +if ($action == 'update' && $user->rights->deplacement->creer) { $db->begin(); - $trip->fetch($_GET["id"]); + $object->fetch($id); - $res=$trip->update_note($_POST["note"],$user); + $res=$object->update_note($_POST["note"]); if ($res < 0) { - $mesg='
'.$fac->error.'
'; + $mesg='
'.$object->error.'
'; $db->rollback(); } else @@ -95,53 +91,34 @@ llxHeader(); $html = new Form($db); -$id = $_GET['id']; -$ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { - $trip = new Deplacement($db); - $trip->fetch($id,$ref); + $object->fetch($id, $ref); $soc = new Societe($db); - $soc->fetch($trip->socid); + $soc->fetch($object->socid); - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$trip->id"; - $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'card'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/note.php?id=$trip->id"; - $head[$h][1] = $langs->trans("Note"); - $head[$h][2] = 'note'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/info.php?id=$deplacement->id"; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; + $head = trip_prepare_head($object); dol_fiche_head($head, 'note', $langs->trans("TripCard"), 0, 'trip'); - print ''; // Ref print ''; print ''; // Type - print ''; + print ''; // Who print ""; print ''; @@ -153,18 +130,18 @@ if ($id > 0 || ! empty($ref)) // Note publique print ''; print '"; @@ -173,18 +150,18 @@ if ($id > 0 || ! empty($ref)) { print ''; print '"; } @@ -198,9 +175,9 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'; - if ($user->rights->deplacement->creer && $_GET["action"] <> 'edit') + if ($action <> 'edit' && $user->rights->deplacement->creer) { - print "id&action=edit\">".$langs->trans('Modify').""; + print '' . $langs->trans('Modify') . ''; } print "
"; diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 60bf0d26d74..db1a3928437 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -67,3 +67,5 @@ ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseu DROP TABLE IF EXISTS llx_pos_tmp; +ALTER TABLE llx_deplacement ADD COLUMN fk_user_modif integer AFTER fk_user_author; + diff --git a/htdocs/install/mysql/tables/llx_deplacement.sql b/htdocs/install/mysql/tables/llx_deplacement.sql index 02560f47ab2..46f240e18d5 100644 --- a/htdocs/install/mysql/tables/llx_deplacement.sql +++ b/htdocs/install/mysql/tables/llx_deplacement.sql @@ -1,7 +1,7 @@ -- ============================================================================ --- Copyright (C) 2003 Rodolphe Quiedeville --- Copyright (C) 2009 Regis Houssin --- Copyright (C) 2010 Laurent Destailleur +-- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2009-2011 Regis Houssin +-- Copyright (C) 2010 Laurent Destailleur -- -- 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 @@ -21,14 +21,14 @@ create table llx_deplacement ( rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(30) DEFAULT NULL, -- Ref donation (TODO change to NOT NULL) - entity integer DEFAULT 1 NOT NULL, -- multi company id + ref varchar(30) DEFAULT NULL, -- Ref donation (TODO change to NOT NULL) + entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime NOT NULL, tms timestamp, dated datetime, fk_user integer NOT NULL, fk_user_author integer, - fk_user_modif integer, -- utilisateur qui a modifie l'info + fk_user_modif integer, -- utilisateur qui a modifie l'info type varchar(12) NOT NULL, fk_statut integer DEFAULT 1 NOT NULL, km real, diff --git a/htdocs/lib/trip.lib.php b/htdocs/lib/trip.lib.php new file mode 100644 index 00000000000..726f1575b8e --- /dev/null +++ b/htdocs/lib/trip.lib.php @@ -0,0 +1,61 @@ + + * + * 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 2 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/lib/trip.lib.php + * \brief Ensemble de fonctions de base pour les deplacements + */ + +/** + * Enter description here... + * + * @param $object + * @return array + */ +function trip_prepare_head($object) +{ + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/fiche.php?id=' . $object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/note.php?id=' . $object->id; + $head[$h][1] = $langs->trans("Note"); + $head[$h][2] = 'note'; + $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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'trip'); + + $head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + return $head; +} + +?> \ No newline at end of file
'.$langs->trans('Ref').''; $morehtmlref=''; - print $html->showrefnav($trip,'ref','',1,'ref','ref',$morehtmlref); + print $html->showrefnav($object,'ref','',1,'ref','ref',$morehtmlref); print '
'.$langs->trans("Type").''.$langs->trans($trip->type).'
'.$langs->trans("Type").''.$langs->trans($object->type).'
'.$langs->trans("Person").''; $userfee=new User($db); - $userfee->fetch($trip->fk_user); + $userfee->fetch($object->fk_user); print $userfee->getNomUrl(1); print '
'.$langs->trans("NotePublic").''; - if ($_GET["action"] == 'edit') + if ($action == 'edit') { - print ''; + print ''; print ''; print ''; - print '
"; + print '
"; print ''; print ''; } else { - print ($trip->note_public?nl2br($trip->note_public):" "); + print ($object->note_public?nl2br($object->note_public):" "); } print "
'.$langs->trans("NotePrivate").''; - if ($_GET["action"] == 'edit') + if ($action == 'edit') { - print '
'; + print ''; print ''; print ''; - print '
"; + print '
"; print ''; print '
'; } else { - print ($trip->note?nl2br($trip->note):" "); + print ($object->note?nl2br($object->note):" "); } print "