Skip to content

Commit

Permalink
New: Show comment in supplier order status changement
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 2, 2009
1 parent 5428af0 commit 9a8a7b6
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 35 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
Expand Up @@ -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
Expand Down
27 changes: 9 additions & 18 deletions htdocs/fourn/commande/fiche.php
Expand Up @@ -215,7 +215,7 @@
$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
{
Expand Down Expand Up @@ -310,7 +310,7 @@
{
$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);
Expand All @@ -328,7 +328,6 @@
}
}


if ($_POST["action"] == 'confirm_cancel' && $_POST["confirm"] == yes && $user->rights->fournisseur->commande->annuler)
{
$commande = new CommandeFournisseur($db);
Expand Down Expand Up @@ -968,9 +967,9 @@
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';
Expand All @@ -986,17 +985,14 @@
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>';
Expand All @@ -1007,20 +1003,16 @@
$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">';
Expand All @@ -1033,17 +1025,16 @@

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");
$liv['can'] = $langs->trans("Canceled");

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";
Expand Down
10 changes: 7 additions & 3 deletions htdocs/fourn/commande/history.php
Expand Up @@ -126,10 +126,11 @@
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";
Expand All @@ -148,7 +149,7 @@
$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";
Expand All @@ -157,6 +158,9 @@
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++;
Expand Down
28 changes: 17 additions & 11 deletions htdocs/fourn/fournisseur.commande.class.php
Expand Up @@ -188,23 +188,29 @@ function fetch($id,$ref='')
}

/**
* \brief Ins�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;
}
}
Expand Down Expand Up @@ -1065,13 +1071,13 @@ function get_methodes_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;
Expand All @@ -1092,7 +1098,7 @@ function Livraison($user, $date, $type)
if ($resql)
{
$result = 0;
$result=$this->log($user, $statut, $date);
$result=$this->log($user, $statut, $date, $comment);

$this->db->commit();
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/lib/functions.lib.php
Expand Up @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions mysql/migration/2.5.0-2.6.0.sql
Expand Up @@ -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;

4 changes: 3 additions & 1 deletion mysql/tables/llx_commande_fournisseur_log.sql
@@ -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
Expand All @@ -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;

0 comments on commit 9a8a7b6

Please sign in to comment.