Qual: Uniformisation du code: Suppression de la fonction img_statut au profit des methodes getLibStatut plus completes
This commit is contained in:
parent
897f40d763
commit
93089e1482
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2006 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Destailleur Laurent <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
|
||||
@ -205,14 +205,16 @@ if ($_GET["action"] == 'deleteline' && $user->rights->propale->creer)
|
||||
llxHeader('', $langs->trans("Proposal"), "Propal");
|
||||
|
||||
$html = new Form($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
if ( isset($mesg))
|
||||
print $mesg;
|
||||
if (isset($mesg)) print $mesg;
|
||||
|
||||
$id = $_GET["propalid"];
|
||||
if ($id > 0)
|
||||
{
|
||||
@ -397,12 +399,9 @@ if ($id > 0)
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($propal->statut >= 0)
|
||||
print '<a href="contact.php?propalid='.$propal->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print img_statut($tab[$i]['status']);
|
||||
|
||||
if ($propal->statut >= 0)
|
||||
print '</a>';
|
||||
if ($propal->statut >= 0) print '<a href="contact.php?propalid='.$propal->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($propal->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2006 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Destailleur Laurent <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
|
||||
@ -205,6 +205,8 @@ if ($_GET["action"] == 'deleteline' && $user->rights->commande->creer)
|
||||
llxHeader('', $langs->trans("Order"), "Commande");
|
||||
|
||||
$html = new Form($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
@ -408,12 +410,9 @@ if ($id > 0)
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($commande->statut >= 0)
|
||||
print '<a href="contact.php?id='.$commande->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print img_statut($tab[$i]['status']);
|
||||
|
||||
if ($commande->statut >= 0)
|
||||
print '</a>';
|
||||
if ($commande->statut >= 0) print '<a href="contact.php?id='.$commande->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($commande->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2006 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Destailleur Laurent <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
|
||||
@ -206,6 +206,8 @@ if ($_GET["action"] == 'deleteline' && $user->rights->facture->creer)
|
||||
llxHeader('', $langs->trans("Bill"), "Facture");
|
||||
|
||||
$html = new Form($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
@ -391,12 +393,9 @@ if ($id > 0)
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($facture->statut >= 0)
|
||||
print '<a href="contact.php?facid='.$facture->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print img_statut($tab[$i]['status']);
|
||||
|
||||
if ($facture->statut >= 0)
|
||||
print '</a>';
|
||||
if ($facture->statut >= 0) print '<a href="contact.php?facid='.$facture->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($facture->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
|
||||
*
|
||||
@ -55,7 +55,8 @@ class Contact
|
||||
var $ville;
|
||||
var $fk_pays;
|
||||
var $socid; // fk_soc
|
||||
|
||||
var $status; // 0=brouillon, 1=4=actif, 5=inactif
|
||||
|
||||
var $code;
|
||||
var $email;
|
||||
var $birthday;
|
||||
@ -670,6 +671,71 @@ class Contact
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut du contact
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \param statut Id statut
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé
|
||||
*/
|
||||
function LibStatut($statut,$mode)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut==0) return $langs->trans('StatusContactDraft');
|
||||
if ($statut==1) return $langs->trans('StatusContactValidated');
|
||||
if ($statut==4) return $langs->trans('StatusContactValidated');
|
||||
if ($statut==5) return $langs->trans('StatusContactValidated');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut==0) return $langs->trans('StatusContactDraftShort');
|
||||
if ($statut==1) return $langs->trans('StatusContactValidatedShort');
|
||||
if ($statut==4) return $langs->trans('StatusContactValidatedShort');
|
||||
if ($statut==5) return $langs->trans('StatusContactValidatedShort');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans('StatusContactDraftShort'),'statut0').' '.$langs->trans('StatusContactDraft');
|
||||
if ($statut==1) return img_picto($langs->trans('StatusContactValidatedShort'),'statut1').' '.$langs->trans('StatusContactValidated');
|
||||
if ($statut==4) return img_picto($langs->trans('StatusContactValidatedShort'),'statut4').' '.$langs->trans('StatusContactValidated');
|
||||
if ($statut==5) return img_picto($langs->trans('StatusContactValidatedShort'),'statut5').' '.$langs->trans('StatusContactValidated');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans('StatusContactDraft'),'statut0');
|
||||
if ($statut==1) return img_picto($langs->trans('StatusContactValidated'),'statut1');
|
||||
if ($statut==4) return img_picto($langs->trans('StatusContactValidated'),'statut4');
|
||||
if ($statut==5) return img_picto($langs->trans('StatusContactValidated'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans('StatusContactDraft'),'statut0').' '.$langs->trans('StatusContactDraft');
|
||||
if ($statut==1) return img_picto($langs->trans('StatusContactValidated'),'statut1').' '.$langs->trans('StatusContactValidated');
|
||||
if ($statut==4) return img_picto($langs->trans('StatusContactValidated'),'statut4').' '.$langs->trans('StatusContactValidated');
|
||||
if ($statut==5) return img_picto($langs->trans('StatusContactValidated'),'statut5').' '.$langs->trans('StatusContactValidated');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return $langs->trans('StatusContactDraftShort').' '.img_picto($langs->trans('StatusContactDraftShort'),'statut0');
|
||||
if ($statut==1) return $langs->trans('StatusContactValidatedShort').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut1');
|
||||
if ($statut==4) return $langs->trans('StatusContactValidatedShort').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut4');
|
||||
if ($statut==5) return $langs->trans('StatusContactValidatedShort').' '.img_picto($langs->trans('StatusContactValidatedShort'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Initialise le contact avec valeurs fictives aléatoire
|
||||
*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2006 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Destailleur Laurent <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
|
||||
@ -187,22 +187,27 @@ if ($_GET["action"] == 'swapstatut' && $user->rights->contrat->creer)
|
||||
$contrat = new Contrat($db);
|
||||
if ($contrat->fetch($_GET["id"]))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$contact = $contrat->detail_contact($_GET["ligne"]);
|
||||
$id_type_contact = $contact->fk_c_type_contact;
|
||||
|
||||
$statut = ($contact->statut == 4) ? 5 : 4;
|
||||
|
||||
$result = $contrat->update_contact($_GET["ligne"], $statut, $id_type_contact);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db, "result=$result");
|
||||
$db->rollback();
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
dolibarr_print_error($db,$contrat->error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,6 +230,8 @@ if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer)
|
||||
llxHeader('', $langs->trans("ContractCard"), "Contrat");
|
||||
|
||||
$html = new Form($db);
|
||||
$contactstatic=new Contact($db);
|
||||
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
@ -429,11 +436,9 @@ if ($id > 0)
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($contrat->statut >= 0)
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/contact.php?id='.$contrat->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print img_statut($tab[$i]['status']);
|
||||
if ($contrat->statut >= 0)
|
||||
print '</a>';
|
||||
if ($contrat->statut >= 0) print '<a href="'.DOL_URL_ROOT.'/contrat/contact.php?id='.$contrat->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
print $contactstatic->LibStatut($tab[$i]['status'],3);
|
||||
if ($contrat->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2004-2007 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* 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
|
||||
@ -1200,10 +1200,10 @@ class ContratLigne
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \param statut id statut
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto
|
||||
* \return string Libellé
|
||||
* \brief Renvoi le libellé d'un statut donné
|
||||
* \param statut id statut
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé
|
||||
*/
|
||||
function LibStatut($statut,$mode)
|
||||
{
|
||||
|
||||
@ -304,7 +304,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
||||
llxHeader('',$langs->trans("ContractCard"),"Contrat");
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
$contratlignestatic=new ContratLigne($db);
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
@ -748,9 +748,10 @@ else
|
||||
|
||||
// Statut
|
||||
print '<td align="center">';
|
||||
// Activation desativation du contact
|
||||
if ($contrat->statut > 0) print '<a href="'.DOL_URL_ROOT.'/contrat/ligne.php?id='.$contrat->id.'&ligne='.$objp->rowid.'">';;
|
||||
print img_statut($objp->statut);
|
||||
if ($contrat->statut > 0) print '</a>';
|
||||
print $contratlignestatic->LibStatut($objp->statut,3);
|
||||
if ($contrat->statut >= 0) print '</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2007 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
|
||||
@ -255,6 +255,9 @@ if ($id > 0)
|
||||
print '<td width="30" align="center">'.$langs->trans("Status").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$contratlignestatic = new ContratLigne($db);
|
||||
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -297,7 +300,9 @@ if ($id > 0)
|
||||
print '<td> </td>';
|
||||
|
||||
// Statut
|
||||
print '<td align="center">'.img_statut($objp->statut,$langs->trans("ServiceStatusInitial")).'</td>';
|
||||
print '<td align="center">';
|
||||
print $contratlignestatic->LibStatut($objp->statut,3);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -743,24 +743,6 @@ function img_action($alt = "default", $numaction)
|
||||
return '<img align="absmiddle" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/stcomm'.$numaction.'.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche logo statut
|
||||
\param num Numéro statut
|
||||
\param alt Texte a afficher sur alt
|
||||
\return string Retourne tag img
|
||||
\todo A virer et remplacer par entitestatic->LibStatut
|
||||
*/
|
||||
function img_statut($num,$alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
if ($alt=="default") {
|
||||
if ($num == 0) $alt=$langs->trans("Draft");
|
||||
if ($num == 1) $alt=$langs->trans("Late");
|
||||
if ($num == 4) $alt=$langs->trans("Running");
|
||||
if ($num == 5) $alt=$langs->trans("Closed");
|
||||
}
|
||||
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/statut'.$num.'.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Affiche logo fichier
|
||||
|
||||
@ -40,7 +40,7 @@ class Webcal {
|
||||
var $localdb;
|
||||
|
||||
var $date;
|
||||
var $duree = 0; // Secondes
|
||||
var $duree = 0; /* Secondes */
|
||||
var $texte;
|
||||
var $desc;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user