New: Ajout champ note publique sur commandes fournisseurs
This commit is contained in:
parent
4bcc8d2afa
commit
ca7b69abd1
@ -392,11 +392,6 @@ if ($_GET["id"] > 0)
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td colspan="3"> </td></tr>';
|
||||
|
||||
if ($commande->note)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="5">'.nl2br($commande->note)."</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
@ -37,22 +37,26 @@ $user->getrights('fournisseur');
|
||||
|
||||
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->fetch($_GET["id"]);
|
||||
|
||||
$result = $commande->UpdateNote($user, $_POST["note"]);
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: note.php?id=".$_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
|
||||
|
||||
$html = new Form($db);
|
||||
@ -129,34 +133,43 @@ if ($_GET["id"] > 0)
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>';
|
||||
print '<td width="50%">';
|
||||
print " </td></tr>";
|
||||
|
||||
// Ligne de 3 colonnes
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td>';
|
||||
print '<td valign="top"> </td></tr>';
|
||||
// Auteur
|
||||
print '<tr><td>'.$langs->trans("Author").'</td><td colspan="2">'.$author->fullname.'</td>';
|
||||
print '<td width="50%">';
|
||||
print " </td></tr>";
|
||||
|
||||
// Ligne de 3 colonnes
|
||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right"><b>'.price($commande->total_ht).'</b></td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td>';
|
||||
print '<td valign="top"> </td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td align="right">'.price($commande->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
||||
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="60" rows="'.ROWS_4.'" name="note">';
|
||||
print nl2br($commande->note);
|
||||
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountVAT").'</td><td align="right">'.price($commande->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="60" rows="'.ROWS_4.'" name="note_public">';
|
||||
print nl2br($commande->note_public);
|
||||
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3"><textarea cols="60" rows="10" name="note">'.nl2br($commande->note)."</textarea></td></tr>";
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($commande->note)."</td></tr>";
|
||||
}
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button"></td></tr>';
|
||||
}
|
||||
|
||||
print "</table></form>";
|
||||
print "</table></form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 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
|
||||
@ -17,14 +18,13 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/fourn/fournisseur.class.php
|
||||
\ingroup fournisseur,societe
|
||||
\brief Fichier de la classe des fournisseurs
|
||||
\version $Revision$
|
||||
\file htdocs/fourn/fournisseur.class.php
|
||||
\ingroup fournisseur,societe
|
||||
\brief Fichier de la classe des fournisseurs
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
|
||||
@ -33,11 +33,12 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class Fournisseur
|
||||
\brief Classe permettant la gestion des fournisseur
|
||||
\class Fournisseur
|
||||
\brief Classe permettant la gestion des fournisseur
|
||||
*/
|
||||
|
||||
class Fournisseur extends Societe {
|
||||
class Fournisseur extends Societe
|
||||
{
|
||||
var $db;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -48,7 +48,7 @@ class CommandeFournisseur
|
||||
{
|
||||
$this->db = $DB;
|
||||
|
||||
$this->statuts[-1] = "Annulée";
|
||||
$this->statuts[-1]= "Annulée";
|
||||
$this->statuts[0] = "Brouillon";
|
||||
$this->statuts[1] = "Validée";
|
||||
$this->statuts[2] = "Approuvée";
|
||||
@ -67,10 +67,10 @@ class CommandeFournisseur
|
||||
*/
|
||||
function fetch ($id)
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva";
|
||||
$sql .= ", ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet, c.remise_percent, c.source, c.fk_methode_commande ";
|
||||
$sql .= ", c.note";
|
||||
$sql .= ", cm.libelle as methode_commande";
|
||||
$sql = "SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
|
||||
$sql .= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql .= " c.note, c.note_public,";
|
||||
$sql .= " cm.libelle as methode_commande";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_methode_commande_fournisseur as cm ON cm.rowid = c.fk_methode_commande";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
@ -98,7 +98,8 @@ class CommandeFournisseur
|
||||
$this->source = $obj->source;
|
||||
$this->facturee = $obj->facture;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
$this->note = stripslashes($obj->note);
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
|
||||
$this->db->free();
|
||||
|
||||
@ -242,7 +243,6 @@ class CommandeFournisseur
|
||||
/**
|
||||
* Annule la commande
|
||||
* L'annulation se fait après la validation
|
||||
*
|
||||
*/
|
||||
function Cancel($user)
|
||||
{
|
||||
@ -860,34 +860,35 @@ class CommandeFournisseur
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function UpdateNote($user, $note)
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::UpdateNote");
|
||||
$result = 0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||
|
||||
$sql .= " SET note ='".trim($note) ."'";
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
/**
|
||||
* \brief Met a jour les notes
|
||||
* \return int <0 si ko, >=0 si ok
|
||||
*/
|
||||
function UpdateNote($user, $note, $note_public)
|
||||
{
|
||||
$result = 0;
|
||||
dolibarr_syslog("CommandeFournisseur::UpdateNote");
|
||||
|
||||
$result = 0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||
$sql.= " SET note ='".trim($note) ."',";
|
||||
$sql.= " note_public ='".trim($note_public) ."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("CommandeFournisseur::UpdateNote "+$this->error);
|
||||
$result = -1;
|
||||
}
|
||||
|
||||
return $result ;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("CommandeFournisseur::UpdateNote Error -1");
|
||||
$result = -1;
|
||||
}
|
||||
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
@ -925,6 +926,7 @@ class CommandeFournisseur
|
||||
dolibarr_syslog("ReadApprobators Erreur");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
||||
@ -30,5 +30,5 @@
|
||||
ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_user_author (fk_user_author);
|
||||
|
||||
ALTER TABLE llx_contrat ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
|
||||
ALTER TABLE llx_contrat ADD FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
|
||||
ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe (idp);
|
||||
ALTER TABLE llx_contrat ADD CONSTRAINT fk_contrat_societe FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
|
||||
Loading…
Reference in New Issue
Block a user