Deplace la fonction facture_prepare_head dans lib/invoice.lib.php de manire a ne l'avoir qu'une seule fois est centralise.

This commit is contained in:
Laurent Destailleur 2005-12-03 17:18:35 +00:00
parent bffc2d4db3
commit 0ef09f1a80
8 changed files with 115 additions and 43 deletions

View File

@ -33,6 +33,7 @@ require('./pre.inc.php');
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
require_once(DOL_DOCUMENT_ROOT.'/facture.class.php');
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT.'/propal.class.php');

View File

@ -30,6 +30,7 @@
require ("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
$langs->load("facture");
// $langs->load("orders");

View File

@ -28,6 +28,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
$langs->load("bills");

View File

@ -27,8 +27,9 @@
\version $Revision$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
$user->getrights('facture');
if (!$user->rights->facture->lire)
@ -74,10 +75,12 @@ if ($_GET["facid"])
{
$soc = new Societe($db, $fac->socidp);
$soc->fetch($fac->socidp);
$head = facture_prepare_head($fac);
$head = facture_prepare_head($fac);
$hselected = 2;
if ($conf->use_preview_tabs) $hselected++;
if ($fac->mode_reglement_code == 'PRE') $hselected++;
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");

View File

@ -56,44 +56,4 @@ function llxHeader($head = "", $title="", $help_url='') {
left_menu($menu->liste, $help_url);
}
function facture_prepare_head($fac)
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('CardBill');
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Contact');
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Preview');
$h++;
}
if ($fac->mode_reglement_code == 'PRE')
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('StandingOrders');
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Note');
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Info');
$h++;
return $head;
}
?>

View File

@ -1,4 +1,4 @@
<?PHP
<?php
/* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -0,0 +1,70 @@
<?php
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*
* $Id$
* $Source$
*/
/**
\file htdocs/lib/invoice.lib.php
\brief Ensemble de fonctions de base pour le module factures
\version $Revision$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function facture_prepare_head($fac)
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('CardBill');
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('BillContacts');
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Preview');
$h++;
}
if ($fac->mode_reglement_code == 'PRE')
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('StandingOrders');
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Note');
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
$head[$h][1] = $langs->trans('Info');
$h++;
return $head;
}
?>

View File

@ -23,6 +23,42 @@ function autofilltownfromzip_save_refresh_create()
}
// Pour les tooltips
//******************
function ShowTip(fArg)
{
var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
if (tooltipOBJ != null) {
var tooltipLft = (document.body.offsetwidth?document.body.offsetwidth:document.body.style.pixelWidth) - (tooltipOBJ.offsetWidth?tooltipOBJ.offsetWidth:(tooltipOBJ.style.pixelWidth?tooltipOBJ.style.pixelWidth:300)) - 30;
var tooltipTop = 10;
if (navigator.appName == 'Netscape') {
tooltipTop = (document.body.scrolltop>=0?document.body.scrolltop+10:event.clientY+10);
tooltipOBJ.style.top = tooltipTop+"px";
tooltipOBJ.style.left = tooltipLft+"px";
}
else {
tooltipTop = (document.body.scrolltop>=0?document.body.scrolltop+10:event.clientY+10);
tooltipTop = (document.body.scrollTop>=0?document.body.scrollTop+10:event.clientY+10);
if ((event.clientX > tooltipLft) && (event.clientY < (tooltipOBJ.scrollHeight?tooltipOBJ.scrollHeight:tooltipOBJ.style.pixelHeight) + 10)) {
tooltipTop = (document.body.scrolltop?document.body.scrolltop:document.body.offsetTop) + event.clientY + 20;
}
tooltipOBJ.style.left = tooltipLft;
tooltipOBJ.style.top = tooltipTop;
}
tooltipOBJ.style.visibility = "visible";
}
}
function HideTip(fArg)
{
var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
if (tooltipOBJ != null) {
tooltipOBJ.style.visibility = "hidden";
}
}
// Pour la saisie des dates par calendrier
// ***************************************