Uniformisation code

This commit is contained in:
Laurent Destailleur 2008-02-24 14:41:07 +00:00
parent 99297fea62
commit 4c96e42021
15 changed files with 86 additions and 74 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 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
@ -15,9 +15,6 @@
* 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.
*
* $Id$
* $Source$
*/
/**
@ -25,20 +22,22 @@
\ingroup adherent
\brief Fichier de la classe gérant les types d'adhérents
\author Rodolphe Quiedeville
\version $Revision$
\version $Id$
*/
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
/**
\class AdherentType
\brief Classe gérant les types d'adhérents
*/
class AdherentType
class AdherentType extends CommonObject
{
var $error;
var $errors=array();
var $db;
var $table_element = 'adherent_type';
var $id;
var $libelle;
@ -182,6 +181,7 @@ class AdherentType
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->libelle = $obj->libelle;
$this->statut = $obj->statut;
$this->cotisation = $obj->cotisation;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 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
@ -16,16 +16,13 @@
* 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.
*
* $Id$
* $Source$
*/
/**
\file htdocs/adherents/type.php
\ingroup adherent
\brief Page de configuration des types d'adhérents
\version $Revision$
\version $Id$
*/
require("./pre.inc.php");
@ -111,6 +108,8 @@ if ($user->rights->adherent->configurer && $_GET["action"] == 'commentaire')
llxHeader();
$form=new Form($db);
/* ************************************************************************** */
/* */
/* Liste des types d'adhérents */
@ -149,7 +148,7 @@ if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShwoType"),'group').' '.$objp->rowid.'</a></td>';
print '<td><a href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
print '<td>'.$objp->libelle.'</td>';
print '<td align="center">'.yn($objp->cotisation).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
@ -261,8 +260,14 @@ if ($rowid > 0)
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
// Ref
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($adht,'rowid');
print '</td></tr>';
// Label
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($adht->cotisation);

View File

@ -107,6 +107,11 @@ if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0)
}
/*
* View
*/
$html = new Form($db);
/*
@ -124,7 +129,7 @@ if ($_GET["socid"])
*/
$soc = new Societe($db);
$result = $soc->fetch($_GET["socid"]);
llxHeader("","",$langs->trans("CardCompany".$soc->type));
llxHeader("","",$langs->trans("Category"));
/*
@ -132,7 +137,7 @@ if ($_GET["socid"])
*/
$head = societe_prepare_head($soc);
dolibarr_fiche_head($head, 'category', $soc->nom);
dolibarr_fiche_head($head, 'category', $langs->trans("ThirdParty"));
print '<table class="border" width="100%">';

View File

@ -148,7 +148,7 @@ if ($socid > 0)
$head = societe_prepare_head($objsoc);
dolibarr_fiche_head($head, 'customer', $objsoc->nom);
dolibarr_fiche_head($head, 'customer', $langs->trans("ThirdParty"));
/*

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2008 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
@ -14,15 +14,13 @@
* 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.
*
* $Id$
*/
/**
\file htdocs/commonobject.class.php
\ingroup core
\brief Fichier de la classe mere des classes metiers (facture, contrat, propal, commande, etc...)
\version $Revision$
\version $Id$
*/
@ -513,6 +511,8 @@ class CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE ".$fieldid." < '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter;
//print $sql;
$result = $this->db->query($sql) ;
if (! $result)
{
@ -521,11 +521,13 @@ class CommonObject
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE ".$fieldid." > '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{

View File

@ -113,7 +113,7 @@ if ($socid > 0)
*/
$head = societe_prepare_head($societe);
dolibarr_fiche_head($head, 'compta', $societe->nom);
dolibarr_fiche_head($head, 'compta', $langs->trans("ThirdParty"));
print '<table width="100%" class="notopnoleftnoright">';

View File

@ -84,9 +84,10 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
}
/*
* Affichage liste
*/
* View
*/
llxHeader();
@ -102,7 +103,7 @@ if ($socid > 0)
$html=new Form($db);
dolibarr_fiche_head($head, 'document', $societe->nom);
dolibarr_fiche_head($head, 'document', $langs->trans("ThirdParty"));
/*
* Confirmation de la suppression d'une ligne produit

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2008 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
@ -16,15 +16,13 @@
* 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.
*
* $Id$
*/
/**
\file htdocs/fourn/fiche.php
\ingroup fournisseur, facture
\brief Page de fiche fournisseur
\version $Revision$
\version $Id$
*/
require('./pre.inc.php');
@ -84,8 +82,9 @@ if ( $societe->fetch($socid) )
*/
$head = societe_prepare_head($societe);
dolibarr_fiche_head($head, 'supplierstat', $societe->nom);
dolibarr_fiche_head($head, 'supplierstat', $langs->trans("ThirdParty"));
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>';

View File

@ -16,14 +16,13 @@
* 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.
*
* $Id$
*/
/**
\file htdocs/fourn/fiche.php
\ingroup fournisseur, facture
\brief Page de fiche fournisseur
\version $Id$
*/
require('./pre.inc.php');
@ -84,7 +83,7 @@ if ( $societe->fetch($socid) )
*/
$head = societe_prepare_head($societe);
dolibarr_fiche_head($head, 'supplier', $societe->nom);
dolibarr_fiche_head($head, 'supplier', $langs->trans("ThirdParty"));
print '<table width="100%" class="notopnoleftnoright">';

View File

@ -2794,14 +2794,14 @@ class Form
/**
* \brief Affiche tableau avec ref et bouton navigation pour un objet metier
* \param object Objet a afficher
* \param object Object to show
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
* \param morehtml Code html supplementaire a afficher avant barre nav
* \param shownav Show Condition
* \param fieldid Nom du champ a utiliser pour select next et previous
* \return string Portion HTML avec ref + boutons nav
*/
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid')
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref')
{
$ret='';
@ -2809,11 +2809,13 @@ class Form
$previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).'">'.img_previous().'</a>':'';
$next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).'">'.img_next().'</a>':'';
//print "xx".$previous_ref."x".$next_ref;
if ($previous_ref || $next_ref || $morehtml) {
$ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
}
//$ret.=$object->getNomUrl(0);
$ret.=$object->ref;
$ret.=$object->$fieldref;
if ($morehtml) {
$ret.='</td><td class="nobordernopadding" align="right">'.$morehtml;
}

View File

@ -17,17 +17,13 @@
* 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$
*/
/**
\file htdocs/lib/company.lib.php
\brief Ensemble de fonctions de base pour le module societe
\ingroup societe
\version $Revision$
Ensemble de fonctions de base de dolibarr sous forme d'include
\version $Id$
*/
function societe_prepare_head($objsoc)
@ -37,7 +33,7 @@ function societe_prepare_head($objsoc)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id;
$head[$h][1] = $langs->trans("Company");
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'company';
$h++;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
*
@ -212,10 +212,10 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' &&
}
}
/**
*
*
*/
/*
* View
*/
llxHeader();
@ -899,7 +899,7 @@ else
$head = societe_prepare_head($soc);
dolibarr_fiche_head($head, 'company', $soc->nom);
dolibarr_fiche_head($head, 'company', $langs->trans("ThirdParty"));
// Confirmation de la suppression de la facture
@ -921,7 +921,11 @@ else
print '<form name="formsoc" method="post">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$soc->nom.'</td></tr>';
//
print '<tr><td width="20%">'.$langs->trans('Name').'</td>';
print '<td colspan="3">';
print $form->showrefnav($soc,'socid','',1,'rowid','nom');
print '</td></tr>';
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';

View File

@ -19,28 +19,29 @@
* 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.
*
* $Id$
*/
/**
\file htdocs/societe.class.php
\ingroup societe
\brief Fichier de la classe des societes
\version $Revision$
\version $Id$
*/
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
/**
\class Societe
\brief Classe permettant la gestion des societes
*/
class Societe
class Societe extends CommonObject
{
var $db;
var $error;
var $errors=array();
var $table_element = 'societe';
var $id;
var $nom;
var $nom_particulier;
@ -484,15 +485,16 @@ class Societe
}
/**
* \brief Charge depuis la base l'objet societe
* \param socid Id de la soci<EFBFBD>t<EFBFBD> <EFBFBD> charger en m<EFBFBD>moire
* \param user Objet de l'utilisateur
* \brief Load a third party from database into memory
* \param socid Id third party to load
* \param user User object
* \return int >0 si ok, <0 si ko
*/
function fetch($socid, $user=0)
{
global $langs;
global $conf;
/* Lecture des permissions */
if ($user <> 0)
{
@ -545,6 +547,7 @@ class Societe
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->date_update = $obj->date_update;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2008 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
@ -14,16 +14,13 @@
* 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.
*
* $Id$
* $Source$
*/
/**
\file htdocs/societe/info.php
\ingroup societe
\brief Page des informations d'une societe
\version $Revision$
\version $Id$
*/
require("./pre.inc.php");
@ -55,13 +52,12 @@ if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0
}
}
llxHeader();
/*
* Visualisation de la fiche
*
*/
* View
*/
llxHeader();
$soc = new Societe($db);
$soc->id = $socid;
@ -73,7 +69,7 @@ $soc->info($socid);
*/
$head = societe_prepare_head($soc);
dolibarr_fiche_head($head, 'info', $soc->nom);
dolibarr_fiche_head($head, 'info', $langs->trans("ThirdParty"));

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2003,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -64,7 +64,7 @@ if ($socid > 0)
*/
$head = societe_prepare_head($societe);
dolibarr_fiche_head($head, 'note', $societe->nom);
dolibarr_fiche_head($head, 'note', $langs->trans("ThirdParty"));
print "<form method=\"post\" action=\"socnote.php\">";