From 9a2c3419bd637f80279bbd680e700cb3adab699b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Aug 2006 14:37:56 +0000 Subject: [PATCH] Look: Ajout picto sur statut entrepot --- htdocs/product/stock/entrepot.class.php | 76 ++++++++++++++++++------- htdocs/product/stock/fiche.php | 59 ++++++++++++++----- htdocs/product/stock/index.php | 6 +- htdocs/product/stock/liste.php | 64 ++++++++++----------- 4 files changed, 138 insertions(+), 67 deletions(-) diff --git a/htdocs/product/stock/entrepot.class.php b/htdocs/product/stock/entrepot.class.php index 2f2042cb041..ef09ebb762d 100644 --- a/htdocs/product/stock/entrepot.class.php +++ b/htdocs/product/stock/entrepot.class.php @@ -311,26 +311,64 @@ class Entrepot } - /** - * \brief Retourne le libellé du statut d'un entrepot (ouvert, fermé) - * \return string Libellé - */ - function getLibStatut() - { - return $this->LibStatut($this->statut); - } + /** + * \brief Retourne le libellé du statut d'un entrepot (ouvert, ferme) + * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long + * \return string Libelle + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } - /** - * \brief Renvoi le libellé d'un statut donné - * \param statut id statut - * \return string Libellé - */ - function LibStatut($statut) - { - return $this->statuts[$statut]; - } - - + /** + * \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é du statut + */ + function LibStatut($statut,$mode=0) + { + global $langs; + $langs->load('stocks'); + + if ($mode == 0) + { + $prefix=''; + if ($statut == 0) return $langs->trans('Closed2'); + if ($statut == 1) return $langs->trans('Opened'); + } + if ($mode == 1) + { + $prefix='Short'; + if ($statut == 0) return $langs->trans('Closed2'); + if ($statut == 1) return $langs->trans('Opened'); + } + if ($mode == 2) + { + $prefix='Short'; + if ($statut == 0) return img_picto($langs->trans('Closed2'),'statut5').' '.$langs->trans('Closed2'); + if ($statut == 1) return img_picto($langs->trans('Opened'),'statut4').' '.$langs->trans('Opened'); + } + if ($mode == 3) + { + $prefix='Short'; + if ($statut == 0) return img_picto($langs->trans('Closed2'),'statut5'); + if ($statut == 1) return img_picto($langs->trans('Opened'),'statut4'); + } + if ($mode == 4) + { + if ($statut == 0) return img_picto($langs->trans('Closed2'),'statut5').' '.$langs->trans('Closed2'); + if ($statut == 1) return img_picto($langs->trans('Opened'),'statut4').' '.$langs->trans('Opened'); + } + if ($mode == 5) + { + $prefix='Short'; + if ($statut == 0) return $langs->trans('Closed2').' '.img_picto($langs->trans('Closed2'),'statut5'); + if ($statut == 1) return $langs->trans('Opened').' '.img_picto($langs->trans('Opened'),'statut4'); + } + } + /** * \brief Renvoie nom clicable (avec eventuellement le picto) diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 370022dd47b..fd97d92dae3 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -144,13 +144,27 @@ if ($_GET["action"] == 'create') } print ''; - print ''; - print '"; + + // Ref + print ''; print ''; + // Description + print ''; + print ''; @@ -164,7 +178,9 @@ if ($_GET["action"] == 'create') print ''; print ''; @@ -208,11 +224,15 @@ else dolibarr_fiche_head($head, $hselected, $langs->trans("Warehouse").': '.$entrepot->libelle); print '
'.$langs->trans("Ref").'
'.$langs->trans("Description").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("LocationSummary").'
'.$langs->trans("Description").''; + if ($conf->fckeditor->enabled) + { + // Editeur wysiwyg + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('desc',$entrepot->description,200,'dolibarr_notes','In',false); + $doleditor->Create(); + } + else + { + print ''; + } + print '
'.$langs->trans('Address').'
'.$langs->trans("Status").''; print ''; print '
'; + + // Ref print ''; - print ''; print ''; + // Description + print ''; + print ''; @@ -224,7 +244,7 @@ else print $entrepot->pays; print ''; - print ''; + print ''; print '"; + print_liste_field_titre($langs->trans("Ref"),"liste.php", "e.label","","","",$sortfield); + print_liste_field_titre($langs->trans("LocationSummary"),"liste.php", "e.lieu","","","",$sortfield); + print_liste_field_titre($langs->trans("Status"),"liste.php", "e.statut",'','','align="right"',$sortfield); + print "\n"; + + if ($num) { + $entrepot=new Entrepot($db); + + $var=True; + while ($i < min($num,$limit)) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + print ''; + print ''; + print ''; + print "\n"; + $i++; + } + } + + $db->free($result); + + print "
'.$langs->trans("Ref").''.$entrepot->libelle.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans("LocationSummary").''.$entrepot->lieu.'
'.$langs->trans("Description").''.nl2br($entrepot->description).'
'.$langs->trans('Address').''; print $entrepot->address; print '
'.$langs->trans("Status").''.$entrepot->statuts[$entrepot->statut].'
'.$langs->trans("Status").''.$entrepot->getLibStatut(4).'
'.$langs->trans("NumberOfProducts").''; print $entrepot->nb_products(); @@ -358,21 +378,34 @@ else */ if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && 1) { - print_fiche_titre('Edition de la fiche entrepot', $mesg); + print_fiche_titre($langs->trans("WarehouseEdit"), $mesg); print '
'; print ''; print ''; print ''; - print ''; - print '"; + // Ref + print ''; + print ''; + // Description + print ''; + print ''; diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 8eb52f5206c..40251450fa4 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2006 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 @@ -84,7 +84,7 @@ if ($result) $var=!$var; print ""; print "\n"; - print ''; + print ''; print "\n"; $i++; } diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index ed3aead6e6c..eeb377e5fe9 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 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 @@ -67,42 +67,42 @@ $sql .= $db->plimit($limit + 1 ,$offset); $result = $db->query($sql) ; if ($result) { - $num = $db->num_rows($result); + $num = $db->num_rows($result); - $i = 0; - - llxHeader("","",$langs->trans("ListOfWarehouses")); + $i = 0; - print_barre_liste($langs->trans("ListOfWarehouses"), $page, "liste.php", "", $sortfield, $sortorder,'',$num); + llxHeader("","",$langs->trans("ListOfWarehouses")); - print '
'.$langs->trans("Ref").'
'.$langs->trans("Description").''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("LocationSummary").'
'.$langs->trans("Description").''; + if ($conf->fckeditor->enabled) + { + // Editeur wysiwyg + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('desc',$entrepot->description,200,'dolibarr_notes','In',false); + $doleditor->Create(); + } + else + { + print ''; + } + print '
'.$langs->trans('Address').'
rowid\">".img_object($langs->trans("ShowStock"),"stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut).''.$entrepot->LibStatut($objp->statut,3).'
'; + print_barre_liste($langs->trans("ListOfWarehouses"), $page, "liste.php", "", $sortfield, $sortorder,'',$num); - print ""; - print_liste_field_titre($langs->trans("Ref"),"liste.php", "e.label","","","",$sortfield); - print_liste_field_titre($langs->trans("Status"),"liste.php", "e.statut","","","",$sortfield); - print_liste_field_titre($langs->trans("LocationSummary"),"liste.php", "e.lieu","","","",$sortfield); - print "\n"; - - if ($num) { - $entrepot=new Entrepot($db); - - $var=True; - while ($i < min($num,$limit)) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print "\n"; - $i++; - } - } - - $db->free($result); + print '
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.''.$entrepot->LibStatut($objp->statut).''.$objp->lieu.'
'; - print "
"; + print "
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.''.$objp->lieu.''.$entrepot->LibStatut($objp->statut,5).'
"; } else