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 '<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>';
|
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>";
|
print "</table>";
|
||||||
|
|
||||||
if ($mesg) print $mesg;
|
if ($mesg) print $mesg;
|
||||||
|
|||||||
@ -37,8 +37,9 @@ $user->getrights('fournisseur');
|
|||||||
|
|
||||||
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
|
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
|
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
|
||||||
@ -46,13 +47,16 @@ if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->cr
|
|||||||
$commande = new CommandeFournisseur($db);
|
$commande = new CommandeFournisseur($db);
|
||||||
$commande->fetch($_GET["id"]);
|
$commande->fetch($_GET["id"]);
|
||||||
|
|
||||||
$result = $commande->UpdateNote($user, $_POST["note"]);
|
$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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
|
llxHeader('',$langs->trans("OrderCard"),"CommandeFournisseur");
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
@ -146,15 +150,24 @@ if ($_GET["id"] > 0)
|
|||||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td></tr>';
|
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 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)
|
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>';
|
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>";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</table></form>";
|
print "</table></form>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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
|
* 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
|
||||||
@ -17,7 +18,6 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,8 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
|||||||
\brief Classe permettant la gestion des fournisseur
|
\brief Classe permettant la gestion des fournisseur
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Fournisseur extends Societe {
|
class Fournisseur extends Societe
|
||||||
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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
|
||||||
@ -67,10 +67,10 @@ class CommandeFournisseur
|
|||||||
*/
|
*/
|
||||||
function fetch ($id)
|
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 = "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 .= " ".$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 .= " c.note, c.note_public,";
|
||||||
$sql .= ", cm.libelle as methode_commande";
|
$sql .= " cm.libelle as methode_commande";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
$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 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_methode_commande_fournisseur as cm ON cm.rowid = c.fk_methode_commande";
|
||||||
$sql .= " WHERE c.rowid = ".$id;
|
$sql .= " WHERE c.rowid = ".$id;
|
||||||
@ -98,7 +98,8 @@ class CommandeFournisseur
|
|||||||
$this->source = $obj->source;
|
$this->source = $obj->source;
|
||||||
$this->facturee = $obj->facture;
|
$this->facturee = $obj->facture;
|
||||||
$this->projet_id = $obj->fk_projet;
|
$this->projet_id = $obj->fk_projet;
|
||||||
$this->note = stripslashes($obj->note);
|
$this->note = $obj->note;
|
||||||
|
$this->note_public = $obj->note_public;
|
||||||
|
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
|
||||||
@ -242,7 +243,6 @@ class CommandeFournisseur
|
|||||||
/**
|
/**
|
||||||
* Annule la commande
|
* Annule la commande
|
||||||
* L'annulation se fait après la validation
|
* L'annulation se fait après la validation
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function Cancel($user)
|
function Cancel($user)
|
||||||
{
|
{
|
||||||
@ -861,28 +861,29 @@ class CommandeFournisseur
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* \brief Met a jour les notes
|
||||||
*
|
* \return int <0 si ko, >=0 si ok
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function UpdateNote($user, $note)
|
function UpdateNote($user, $note, $note_public)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("CommandeFournisseur::UpdateNote");
|
dolibarr_syslog("CommandeFournisseur::UpdateNote");
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||||
|
$sql.= " SET note ='".trim($note) ."',";
|
||||||
$sql .= " SET note ='".trim($note) ."'";
|
$sql.= " note_public ='".trim($note_public) ."'";
|
||||||
|
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
{
|
{
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog("CommandeFournisseur::UpdateNote Error -1");
|
$this->error=$this->db->error();
|
||||||
|
dolibarr_syslog("CommandeFournisseur::UpdateNote "+$this->error);
|
||||||
$result = -1;
|
$result = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -925,6 +926,7 @@ class CommandeFournisseur
|
|||||||
dolibarr_syslog("ReadApprobators Erreur");
|
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_soc (fk_soc);
|
||||||
ALTER TABLE llx_contrat ADD INDEX idx_contrat_fk_user_author (fk_user_author);
|
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 CONSTRAINT fk_contrat_societe 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_user_author) REFERENCES llx_user (rowid);
|
||||||
Loading…
Reference in New Issue
Block a user