autorise la modification de la note d'une commande
This commit is contained in:
parent
f605fcf3e1
commit
c119bf86d2
@ -422,7 +422,7 @@ class Commande
|
||||
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.facture";
|
||||
$sql .= ", ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet, c.remise_percent, c.source, c.facture, c.note";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
|
||||
@ -445,6 +445,7 @@ class Commande
|
||||
|
||||
$this->source = $obj->source;
|
||||
$this->facturee = $obj->facture;
|
||||
$this->note = $obj->note;
|
||||
$this->projet_id = $obj->fk_projet;
|
||||
|
||||
$this->db->free();
|
||||
@ -622,6 +623,33 @@ class Commande
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function set_note($user, $note)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET note = '".addslashes($note)."'";
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->note = $note;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Classe la facture comme facturée
|
||||
*
|
||||
|
||||
@ -96,11 +96,18 @@ if ($_POST["action"] == 'add' && $user->rights->commande->creer)
|
||||
if ($_POST["action"] == 'setremise' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($id);
|
||||
$commande->fetch($_GET["id"]);
|
||||
|
||||
$commande->set_remise($user, $_POST["remise"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$commande->set_note($user, $_POST['note']);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'addligne' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
@ -482,11 +489,6 @@ else
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
if ($commande->brouillon == 1 && $user->rights->commande->creer)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans("Order")."</td>";
|
||||
@ -532,33 +534,44 @@ else
|
||||
print '<td width="50%">';
|
||||
print $langs->trans("Author").' : '.$author->fullname.'</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>'.$conf->monnaie.'</td>';
|
||||
print '<td rowspan="4" valign="top">'.$langs->trans("Note").' :</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>'.$conf->monnaie.'</td>';
|
||||
print '<td rowspan="4" valign="top">'.$langs->trans("Note").' :<br>';
|
||||
if ($commande->brouillon == 1 && $user->rights->commande->creer)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setnote">';
|
||||
print '<textarea name="note" style="width:95%;height:"80%">'.$commande->note.'</textarea><br><input type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print nl2br($commande->note);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td><td align="right">';
|
||||
print '<tr><td>'.$langs->trans("GlobalDiscount").'</td><td align="right">';
|
||||
|
||||
if ($commande->brouillon == 1 && $user->rights->commande->creer)
|
||||
if ($commande->brouillon == 1 && $user->rights->commande->creer)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
print '<input type="text" name="remise" size="3" value="'.$commande->remise_percent.'">%';
|
||||
print '</td><td><input type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print $commande->remise_percent.' %</td><td> ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VAT").'</td><td align="right">'.price($commande->total_tva).'</td>';
|
||||
print '<td>'.$conf->monnaie.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalTTC").'</td><td align="right">'.price($commande->total_ttc).'</td>';
|
||||
print '<td>'.$conf->monnaie.'</td></tr>';
|
||||
if ($commande->note)
|
||||
{
|
||||
print '<tr><td colspan="5">'.$langs->trans("Note").' : '.nl2br($commande->note)."</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user