Uniformisation du code des commandes fournisseurs.

Affichage du picto sur le statut
This commit is contained in:
Laurent Destailleur 2006-05-06 15:30:34 +00:00
parent b3bfe260c7
commit 654a897d58
4 changed files with 659 additions and 620 deletions

View File

@ -256,7 +256,7 @@ $html = new Form($db);
if ($_GET["id"] > 0) if ($_GET["id"] > 0)
{ {
if ($mesg) print $mesg; // if ($mesg) print $mesg;
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
if ( $commande->fetch($_GET["id"]) == 0) if ( $commande->fetch($_GET["id"]) == 0)
@ -281,7 +281,7 @@ if ($_GET["id"] > 0)
$head[$h][1] = $langs->trans("OrderFollow"); $head[$h][1] = $langs->trans("OrderFollow");
$h++; $h++;
$title=$langs->trans("Order").": $commande->ref"; $title=$langs->trans("SupplierOrder");
dolibarr_fiche_head($head, $a, $title); dolibarr_fiche_head($head, $a, $title);
/* /*
@ -347,17 +347,24 @@ if ($_GET["id"] > 0)
* Commande * Commande
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>"; print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>";
print '<td colspan="5">'; print '<td colspan="5">';
print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'; print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">';
print img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>'; print img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>';
print '</tr>'; print '</tr>';
// Statut
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Status").'</td>'; print '<td>'.$langs->trans("Status").'</td>';
print '<td width="50%" colspan="5">'; print '<td width="50%" colspan="5">';
print '<img src="statut'.$commande->statut.'.png">&nbsp;'; print $commande->getLibStatut(4);
print $commande->statuts[$commande->statut];
print "</td></tr>"; print "</td></tr>";
if ($commande->methode_commande_id > 0) if ($commande->methode_commande_id > 0)
@ -536,16 +543,16 @@ if ($_GET["id"] > 0)
if ($commande->statut == 1) if ($commande->statut == 1)
{ {
if ($user->rights->fournisseur->commande->annuler)
{
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
if ($user->rights->fournisseur->commande->approuver) if ($user->rights->fournisseur->commande->approuver)
{ {
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>'; print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=approve">'.$langs->trans("ApproveOrder").'</a>';
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>'; print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
}
if ($user->rights->fournisseur->commande->annuler)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
} }
} }
@ -564,12 +571,15 @@ if ($_GET["id"] > 0)
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
} }
} }
// Build PDF // Build PDF
if ($commande->statut > 0)
{
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=builddoc">'.$langs->trans("BuildPDF").'</a>'; print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=builddoc">'.$langs->trans("BuildPDF").'</a>';
} }
}
print "</div>"; print "</div>";
} }
@ -607,7 +617,7 @@ if ($_GET["id"] > 0)
} }
*/ */
//$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); //$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
$html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf); $html->show_documents('commande_fournisseur',$comfournref,$filedir,$urlsource,$commande->statut>0?1:0,$delallowed,$commande->modelpdf);
print '</td><td width="50%" valign="top">'; print '</td><td width="50%" valign="top">';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -77,7 +77,7 @@ if ($_GET["id"] > 0)
$h++; $h++;
$title=$langs->trans("Order").": $commande->ref"; $title=$langs->trans("SupplierOrder");
dolibarr_fiche_head($head, $a, $title); dolibarr_fiche_head($head, $a, $title);
@ -86,14 +86,20 @@ if ($_GET["id"] > 0)
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>"; print '<tr><td width="20%">'.$langs->trans("Supplier")."</td>";
print '<td colspan="3">'; print '<td colspan="3">';
print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>'; print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>';
print '</tr>'; print '</tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
print '<img src="statut'.$commande->statut.'.png">&nbsp;'; print $commande->getLibStatut(4);
print $commande->statuts[$commande->statut];
print "</td></tr>"; print "</td></tr>";
if ($commande->methode_commande_id > 0) if ($commande->methode_commande_id > 0)
@ -114,7 +120,8 @@ if ($_GET["id"] > 0)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Status").'</td><td>'.$langs->trans("Author").'</td>'; print '<td>'.$langs->trans("Status").'</td>';
print '<td align="center">'.$langs->trans("Author").'</td>';
print '</tr>'; print '</tr>';
$sql = "SELECT l.fk_statut, ".$db->pdate("l.datelog") ."as dl, u.rowid, u.code, u.firstname, u.name"; $sql = "SELECT l.fk_statut, ".$db->pdate("l.datelog") ."as dl, u.rowid, u.code, u.firstname, u.name";
@ -139,12 +146,13 @@ if ($_GET["id"] > 0)
print '<td width="20%">'.dolibarr_print_date($obj->dl,"%a %d %b %Y %H:%M:%S")."</td>\n"; print '<td width="20%">'.dolibarr_print_date($obj->dl,"%a %d %b %Y %H:%M:%S")."</td>\n";
print '<td width="100px"><img src="statut'.$obj->fk_statut.'.png">&nbsp;'; // Statut
print '<td width="100px">'.$commande->LibStatut($obj->fk_statut,4)."</td>\n";
print $commande->statuts[$obj->fk_statut]."</td>\n"; // User
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -92,7 +92,7 @@ if ($_GET["id"] > 0)
$head[$h][1] = $langs->trans("OrderFollow"); $head[$h][1] = $langs->trans("OrderFollow");
$h++; $h++;
$title=$langs->trans("Order").": $commande->ref"; $title=$langs->trans("SupplierOrder");
dolibarr_fiche_head($head, $a, $title); dolibarr_fiche_head($head, $a, $title);
@ -103,16 +103,22 @@ if ($_GET["id"] > 0)
print '<input type="hidden" name="action" value="updatenote">'; print '<input type="hidden" name="action" value="updatenote">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$commande->ref.'</td>';
print '</tr>';
// Fournisseur
print '<tr><td width="20%">'.$langs->trans("Supplier").'</td>'; print '<tr><td width="20%">'.$langs->trans("Supplier").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print '<b><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></b></td>'; print '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id.'">'.img_object($langs->trans("ShowSupplier"),'company').' '.$soc->nom.'</a></td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Status").'</td>'; print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print '<img src="statut'.$commande->statut.'.png">&nbsp;'; print $commande->getLibStatut(4);
print $commande->statuts[$commande->statut];
print "</td></tr>"; print "</td></tr>";
if ($commande->methode_commande_id > 0) if ($commande->methode_commande_id > 0)
@ -166,7 +172,7 @@ if ($_GET["id"] > 0)
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
print '<tr><td colspan="4" align="center"><input type="submit" class="button"></td></tr>'; print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
} }
print "</table></form>"; print "</table></form>";

View File

@ -28,6 +28,7 @@
*/ */
require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
/** /**
@ -35,7 +36,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
\brief Classe de gestion de commande fournisseur \brief Classe de gestion de commande fournisseur
*/ */
class CommandeFournisseur class CommandeFournisseur extends Commande
{ {
var $db ; var $db ;
var $id ; var $id ;
@ -48,7 +49,6 @@ class CommandeFournisseur
{ {
$this->db = $DB; $this->db = $DB;
$this->statuts[-1]= "Annulée";
$this->statuts[0] = "Brouillon"; $this->statuts[0] = "Brouillon";
$this->statuts[1] = "Validée"; $this->statuts[1] = "Validée";
$this->statuts[2] = "Approuvée"; $this->statuts[2] = "Approuvée";
@ -314,11 +314,25 @@ class CommandeFournisseur
} }
if ($mode == 4) if ($mode == 4)
{ {
return $this->statuts[$statut]; if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$this->statuts[$statut];
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$this->statuts[$statut];
if ($statut==2) return img_picto($langs->trans('StatusOrderApproved'),'statut3').' '.$this->statuts[$statut];
if ($statut==3) return img_picto($langs->trans('StatusOrderOnProcess'),'statut3').' '.$this->statuts[$statut];
if ($statut==4) return img_picto($langs->trans('StatusOrderReceivedPartially'),'statut3').' '.$this->statuts[$statut];
if ($statut==5) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$this->statuts[$statut];
if ($statut==6) return img_picto($langs->trans('StatusOrderCanceled'),'statut5').' '.$this->statuts[$statut];
if ($statut==9) return img_picto($langs->trans('StatusOrderRefused'),'statut5').' '.$this->statuts[$statut];
} }
if ($mode == 5) if ($mode == 5)
{ {
return $this->statuts[$statut]; if ($statut==0) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==1) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==2) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderApproved'),'statut3');
if ($statut==3) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderOnProcess'),'statut3');
if ($statut==4) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderReceivedPartially'),'statut3');
if ($statut==5) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
if ($statut==6) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderCanceled'),'statut5');
if ($statut==9) return $this->statuts[$statut].' '.img_picto($langs->trans('StatusOrderRefused'),'statut5');
} }
} }
@ -1029,7 +1043,7 @@ class CommandeFournisseur
} }
} }
class CommandeLigne class CommandeFournisseurLigne extends CommandeLigne
{ {
// From llx_propaldet // From llx_propaldet
var $qty; var $qty;
@ -1044,7 +1058,8 @@ class CommandeLigne
var $libelle; // Label produit var $libelle; // Label produit
var $product_desc; // Description produit var $product_desc; // Description produit
var $ref; var $ref;
function CommandeLigne()
function CommandeFournisseurLigne()
{ {
} }