Qual: Uniformize code

This commit is contained in:
Laurent Destailleur 2011-09-24 23:42:31 +00:00
parent ab017e0a72
commit 9e09b16219
2 changed files with 92 additions and 90 deletions

View File

@ -44,15 +44,15 @@ $result = restrictedArea($user, 'commande_fournisseur', $id,'');
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer) if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]); $commande->fetch($_GET["id"]);
$result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]); $result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]);
if ($result >= 0) if ($result >= 0)
{ {
Header("Location: note.php?id=".$_GET["id"]); Header("Location: note.php?id=".$_GET["id"]);
exit; exit;
} }
} }
@ -76,103 +76,105 @@ $id = $_GET['id'];
$ref= $_GET['ref']; $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$result=$commande->fetch($_GET["id"],$_GET['ref']); $result=$commande->fetch($_GET["id"],$_GET['ref']);
if ($result >= 0) if ($result >= 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
$author = new User($db); $author = new User($db);
$author->fetch($commande->user_author_id); $author->fetch($commande->user_author_id);
$head = ordersupplier_prepare_head($commande); $head = ordersupplier_prepare_head($commande);
$title=$langs->trans("SupplierOrder"); $title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'note', $title, 0, 'order'); dol_fiche_head($head, 'note', $title, 0, 'order');
/* /*
* Commande * Commande
*/ */
print '<form action="note.php?id='.$commande->id.'" method="post">'; print '<form action="note.php?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
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 // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref'); print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Fournisseur // Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>"; print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>'; print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>'; print '</tr>';
// Statut // Statut
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Status").'</td>'; print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $commande->getLibStatut(4); print $commande->getLibStatut(4);
print "</td></tr>"; print "</td></tr>";
// Date // Date
if ($commande->methode_commande_id > 0) if ($commande->methode_commande_id > 0)
{ {
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande) if ($commande->date_commande)
{ {
print dol_print_date($commande->date_commande,"dayhourtext")."\n"; print dol_print_date($commande->date_commande,"dayhourtext")."\n";
} }
print "</td></tr>"; print "</td></tr>";
if ($commande->methode_commande) if ($commande->methode_commande)
{ {
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>'; print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
} }
} }
// Auteur // Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>'; print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>'; print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>'; print '</tr>';
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>'; print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">'; if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">';
print $commande->note_public; print $commande->note_public;
if ($user->rights->fournisseur->commande->creer) print '</textarea>'; if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>'; print '</td></tr>';
if (! $user->societe_id) if (! $user->societe_id)
{ {
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>'; print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_8.'" name="note">'; if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_8.'" name="note">';
print $commande->note; print $commande->note;
if ($user->rights->fournisseur->commande->creer) print '</textarea>'; if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>'; print '</td></tr>';
} }
if ($user->rights->fournisseur->commande->creer) print "</table>";
{
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
}
print "</table></form>"; if ($user->rights->fournisseur->commande->creer)
{
print '<center><br><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';
}
print "</div>\n"; print "</form>";
}
else dol_fiche_end();
{ }
/* Order not found */ else
$langs->load("errors"); {
print $langs->trans("ErrorRecordNotFound"); /* Order not found */
} $langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
}
} }

View File

@ -130,7 +130,7 @@ if ($_GET["facid"])
} }
print "</td></tr>"; print "</td></tr>";
// Note priv<EFBFBD>e // Note private
if (! $user->societe_id) if (! $user->societe_id)
{ {
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>'; print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
@ -153,11 +153,11 @@ if ($_GET["facid"])
print "</table>"; print "</table>";
dol_fiche_end();
/* /*
* Actions * Actions
*/ */
print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit') if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit')