From 9e09b162194dd7fa4c71935d9885c3c0b7cf1de0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Sep 2011 23:42:31 +0000 Subject: [PATCH] Qual: Uniformize code --- htdocs/fourn/commande/note.php | 178 +++++++++++++++++---------------- htdocs/fourn/facture/note.php | 4 +- 2 files changed, 92 insertions(+), 90 deletions(-) diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 8951011775b..d0bd737f374 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -44,15 +44,15 @@ $result = restrictedArea($user, 'commande_fournisseur', $id,''); if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer) { - $commande = new CommandeFournisseur($db); - $commande->fetch($_GET["id"]); + $commande = new CommandeFournisseur($db); + $commande->fetch($_GET["id"]); - $result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]); - if ($result >= 0) - { - Header("Location: note.php?id=".$_GET["id"]); - exit; - } + $result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]); + if ($result >= 0) + { + Header("Location: note.php?id=".$_GET["id"]); + exit; + } } @@ -76,103 +76,105 @@ $id = $_GET['id']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { - $commande = new CommandeFournisseur($db); - $result=$commande->fetch($_GET["id"],$_GET['ref']); - if ($result >= 0) - { - $soc = new Societe($db); - $soc->fetch($commande->socid); + $commande = new CommandeFournisseur($db); + $result=$commande->fetch($_GET["id"],$_GET['ref']); + if ($result >= 0) + { + $soc = new Societe($db); + $soc->fetch($commande->socid); - $author = new User($db); - $author->fetch($commande->user_author_id); + $author = new User($db); + $author->fetch($commande->user_author_id); - $head = ordersupplier_prepare_head($commande); + $head = ordersupplier_prepare_head($commande); - $title=$langs->trans("SupplierOrder"); - dol_fiche_head($head, 'note', $title, 0, 'order'); + $title=$langs->trans("SupplierOrder"); + dol_fiche_head($head, 'note', $title, 0, 'order'); - /* - * Commande - */ - print '
'; - print ''; - print ''; + /* + * Commande + */ + print ''; + print ''; + print ''; - print ''; + print '
'; - // Ref - print ''; - print ''; - print ''; + // Ref + print ''; + print ''; + print ''; - // Fournisseur - print '"; - print ''; - print ''; + // Fournisseur + print '"; + print ''; + print ''; - // Statut - print ''; - print ''; - print '"; + // Statut + print ''; + print ''; + print '"; - // Date - if ($commande->methode_commande_id > 0) - { - print '"; + // Date + if ($commande->methode_commande_id > 0) + { + print '"; - if ($commande->methode_commande) - { - print ''; - } - } + if ($commande->methode_commande) + { + print ''; + } + } - // Auteur - print ''; - print ''; - print ''; + // Auteur + print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - if (! $user->societe_id) - { - print ''; - print ''; - } + if (! $user->societe_id) + { + print ''; + print ''; + } - if ($user->rights->fournisseur->commande->creer) - { - print ''; - } + print "
'.$langs->trans("Ref").''; - print $html->showrefnav($commande,'ref','',1,'ref','ref'); - print '
'.$langs->trans("Ref").''; + print $html->showrefnav($commande,'ref','',1,'ref','ref'); + print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $commande->getLibStatut(4); - print "
'.$langs->trans("Status").''; + print $commande->getLibStatut(4); + print "
'.$langs->trans("Date").''; - if ($commande->date_commande) - { - print dol_print_date($commande->date_commande,"dayhourtext")."\n"; - } - print "
'.$langs->trans("Date").''; + if ($commande->date_commande) + { + print dol_print_date($commande->date_commande,"dayhourtext")."\n"; + } + print "
'.$langs->trans("Method").''.$commande->methode_commande.'
'.$langs->trans("Method").''.$commande->methode_commande.'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("NotePublic").''; - if ($user->rights->fournisseur->commande->creer) print ''; - print '
'.$langs->trans("NotePublic").''; + if ($user->rights->fournisseur->commande->creer) print ''; + print '
'.$langs->trans("NotePrivate").''; - if ($user->rights->fournisseur->commande->creer) print ''; - print '
'.$langs->trans("NotePrivate").''; + if ($user->rights->fournisseur->commande->creer) print ''; + print '
"; - print "
"; + if ($user->rights->fournisseur->commande->creer) + { + print '

'; + } - print "\n"; - } - else - { - /* Order not found */ - $langs->load("errors"); - print $langs->trans("ErrorRecordNotFound"); - } + print ""; + + dol_fiche_end(); + } + else + { + /* Order not found */ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + } } diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 724edb40c91..e8af8fe7fc1 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -130,7 +130,7 @@ if ($_GET["facid"]) } print ""; - // Note priv�e + // Note private if (! $user->societe_id) { print ''.$langs->trans("NotePrivate").' :'; @@ -153,11 +153,11 @@ if ($_GET["facid"]) print ""; + dol_fiche_end(); /* * Actions */ - print ''; print '
'; if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit')