New: Show comment in supplier order status changement

This commit is contained in:
Laurent Destailleur 2009-02-02 22:11:10 +00:00
parent 5428af0d07
commit 9a8a7b6a87
7 changed files with 43 additions and 35 deletions

View File

@ -24,7 +24,9 @@ For users:
- New: Can add personalised fields in emailing selectors.
- New: Customer code and supplier code can be defined automatically.
- New: Emailing feature can extract civility from contacts.
- Fix: Author, title and topic are correctly encoded i nPDF.
- New: Can creat a third party from a member of fundation module.
- Fix: Handle correctly the comment in status changing of supplier orders.
- Fix: Author, title and topic are correctly encoded in PDF.
- Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users.
- Fix: Save new model when changed on interventions.
- Fix: Failed to go on the future view of bank transaction if there is no

View File

@ -215,7 +215,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
}
else
{
@ -310,7 +310,7 @@ if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->rec
{
$date_liv = dolibarr_mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$result = $commande->Livraison($user, $date_liv, $_POST["type"]);
$result = $commande->Livraison($user, $date_liv, $_POST["type"], $_POST["comment"]);
if ($result > 0)
{
Header("Location: fiche.php?id=".$id);
@ -328,7 +328,6 @@ if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->rec
}
}
if ($_POST["action"] == 'confirm_cancel' && $_POST["confirm"] == yes && $user->rights->fournisseur->commande->annuler)
{
$commande = new CommandeFournisseur($db);
@ -968,9 +967,9 @@ if ($id > 0 || ! empty($ref))
print '<table width="100%"><tr><td width="50%" valign="top">';
print '<a name="builddoc"></a>'; // ancre
/*
* Documents generes
*
*/
$comfournref = sanitizeFileName($commande->ref);
$file = $conf->fournisseur->commande->dir_output . '/' . $comfournref . '/' . $comfournref . '.pdf';
@ -986,17 +985,14 @@ if ($id > 0 || ! empty($ref))
print '</td><td width="50%" valign="top">';
/*
*
*
*/
if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2)
{
/**
* Commander
* Commander (action=commande)
*/
print '<br>';
print '<form name="commande" action="fiche.php?id='.$commande->id.'&amp;action=commande" method="post">';
print '<input type="hidden" name="action" value="commande">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
@ -1007,20 +1003,16 @@ if ($id > 0 || ! empty($ref))
$formorder->select_methodes_commande('',"methodecommande",1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="commentaire"></td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="comment"></td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" class="button" name="'.$langs->trans("Activate").'"></td></tr>';
print '</table>';
print '</form>';
}
/*
*
*
*/
if ( $user->rights->fournisseur->commande->receptionner && ($commande->statut == 3 ||$commande->statut == 4 ))
{
/**
* Receptionner
* Receptionner (action=livraison)
*/
print '<br>';
print '<form action="fiche.php?id='.$commande->id.'" method="post">';
@ -1033,7 +1025,7 @@ if ($id > 0 || ! empty($ref))
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
$liv = array();
$liv[''] = '&nbsp;';
$liv[''] = '&nbsp;';
$liv['tot'] = $langs->trans("TotalWoman");
$liv['par'] = $langs->trans("PartialWoman");
$liv['nev'] = $langs->trans("NeverReceived");
@ -1041,9 +1033,8 @@ if ($id > 0 || ! empty($ref))
print $html->select_array("type",$liv);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="commentaire"></td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="30" type="text" name="comment"></td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" class="button" name="'.$langs->trans("Activate").'"></td></tr>';
print "</table>\n";
print "</form>\n";

View File

@ -126,10 +126,11 @@ if ($id > 0 || ! empty($ref))
print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td align="center">'.$langs->trans("Author").'</td>';
print '<td align="left">'.$langs->trans("Comment").'</td>';
print '</tr>';
$sql = "SELECT l.fk_statut, ".$db->pdate("l.datelog") ."as dl, u.rowid, u.login, u.firstname, u.name";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l ";
$sql = "SELECT l.fk_statut, l.datelog as dl, l.comment, u.rowid, u.login, u.firstname, u.name";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l";
$sql .= " , ".MAIN_DB_PREFIX."user as u ";
$sql .= " WHERE l.fk_commande = ".$commande->id." AND u.rowid = l.fk_user";
$sql .= " ORDER BY l.rowid DESC";
@ -148,7 +149,7 @@ if ($id > 0 || ! empty($ref))
$obj = $db->fetch_object($resql);
print "<tr $bc[$var]>";
print '<td width="20%">'.dolibarr_print_date($obj->dl,"dayhour")."</td>\n";
print '<td width="20%">'.dolibarr_print_date($db->jdate($obj->dl),"dayhour")."</td>\n";
// Statut
print '<td width="100px" nowrap="1">'.$commande->LibStatut($obj->fk_statut,4)."</td>\n";
@ -157,6 +158,9 @@ if ($id > 0 || ! empty($ref))
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">';
print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
// Comment
print '<td width="100px" nowrap="1" title="'.dol_escape_htmltag($obj->comment).'">'.dolibarr_trunc($obj->comment,48)."</td>\n";
print '</tr>';
$i++;

View File

@ -188,23 +188,29 @@ class CommandeFournisseur extends Commande
}
/**
* \brief Ins<EFBFBD>re ligne de log
* \param user Utilisateur qui modifie la commande
* \param statut Statut de la commande
* \param datelog Date de modification
* \return int <0 si ko, >0 si ok
* \brief Add a line in log table
* \param user User making action
* \param statut Status of order
* \param datelog Date of change
* \return int <0 if KO, >0 if OK
*/
function log($user, $statut, $datelog)
function log($user, $statut, $datelog, $comment='')
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_log (datelog, fk_commande, fk_statut, fk_user)";
$sql.= " VALUES (".$this->db->idate($datelog).",".$this->id.", $statut, ".$user->id.")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_log (datelog, fk_commande, fk_statut, fk_user, comment)";
$sql.= " VALUES (".$this->db->idate($datelog).",".$this->id.", ".$statut.", ";
$sql.= $user->id.", ";
$sql.= ($comment?"'".addslashes($comment)."'":'null');
$sql.= ")";
dolibarr_syslog("FournisseurCommande::log sql=".$sql, LOG_DEBUG);
if ( $this->db->query($sql) )
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
dolibarr_syslog("FournisseurCommande::log ".$this->error, LOG_ERR);
return -1;
}
}
@ -1065,13 +1071,13 @@ class CommandeFournisseur extends Commande
* \param date Date of reception
* \param type Type of receipt
*/
function Livraison($user, $date, $type)
function Livraison($user, $date, $type, $comment)
{
$result = 0;
dolibarr_syslog("CommandeFournisseur::Livraison");
if ($user->rights->fournisseur->commande->receptionner && $date < time())
if ($user->rights->fournisseur->commande->receptionner && $date < gmmktime())
{
if ($type == 'tot') $statut = 5;
if ($type == 'par') $statut = 4;
@ -1092,7 +1098,7 @@ class CommandeFournisseur extends Commande
if ($resql)
{
$result = 0;
$result=$this->log($user, $statut, $date);
$result=$this->log($user, $statut, $date, $comment);
$this->db->commit();
}

View File

@ -159,7 +159,7 @@ function dol_escape_js($stringtoescape)
/**
* \brief Returns text escaped for inclusion in javascript code
* \brief Returns text escaped for inclusion in HTML alt or title tags
* \param $stringtoescape String to escape
* \return string Escaped string
*/

View File

@ -56,3 +56,6 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (24
alter table llx_user_param drop column page;
alter table llx_commande_fournisseur_log add column comment varchar(255) NULL;

View File

@ -1,5 +1,6 @@
-- ===================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2009 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
@ -25,5 +26,6 @@ create table llx_commande_fournisseur_log
datelog datetime NOT NULL,
fk_commande integer NOT NULL,
fk_statut smallint NOT NULL,
fk_user integer NOT NULL
fk_user integer NOT NULL,
comment varchar(255) NULL
)type=innodb;