diff --git a/ChangeLog b/ChangeLog
index c2b756c9292..c557dc2a2ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 116f02f8d6a..ddc9c9dfe7e 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -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 '
| ';
print ''; // 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 ' | ';
- /*
- *
- *
- */
if ( $user->rights->fournisseur->commande->commander && $commande->statut == 2)
{
/**
- * Commander
+ * Commander (action=commande)
*/
print ' ';
print '';
}
- /*
- *
- *
- */
if ( $user->rights->fournisseur->commande->receptionner && ($commande->statut == 3 ||$commande->statut == 4 ))
{
/**
- * Receptionner
+ * Receptionner (action=livraison)
*/
print ' ';
print ' |
\n";
print "\n";
diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php
index 972195d45cd..ef5a2ec5290 100644
--- a/htdocs/fourn/commande/history.php
+++ b/htdocs/fourn/commande/history.php
@@ -126,10 +126,11 @@ if ($id > 0 || ! empty($ref))
print '| '.$langs->trans("Date").' | ';
print ''.$langs->trans("Status").' | ';
print ''.$langs->trans("Author").' | ';
+ print ''.$langs->trans("Comment").' | ';
print '
';
- $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 "";
- print '| '.dolibarr_print_date($obj->dl,"dayhour")." | \n";
+ print ''.dolibarr_print_date($db->jdate($obj->dl),"dayhour")." | \n";
// Statut
print ''.$commande->LibStatut($obj->fk_statut,4)." | \n";
@@ -157,6 +158,9 @@ if ($id > 0 || ! empty($ref))
print '';
print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.' | ';
+ // Comment
+ print ''.dolibarr_trunc($obj->comment,48)." | \n";
+
print '
';
$i++;
diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php
index 88886fb2828..39e9ccf9968 100644
--- a/htdocs/fourn/fournisseur.commande.class.php
+++ b/htdocs/fourn/fournisseur.commande.class.php
@@ -188,23 +188,29 @@ class CommandeFournisseur extends Commande
}
/**
- * \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;
}
}
@@ -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();
}
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 8cbeb22bacd..73b05692855 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -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
*/
diff --git a/mysql/migration/2.5.0-2.6.0.sql b/mysql/migration/2.5.0-2.6.0.sql
index b3d2dfd87fa..4a65edf5a4c 100644
--- a/mysql/migration/2.5.0-2.6.0.sql
+++ b/mysql/migration/2.5.0-2.6.0.sql
@@ -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;
+
diff --git a/mysql/tables/llx_commande_fournisseur_log.sql b/mysql/tables/llx_commande_fournisseur_log.sql
index 994158472b5..f12ac7418bd 100644
--- a/mysql/tables/llx_commande_fournisseur_log.sql
+++ b/mysql/tables/llx_commande_fournisseur_log.sql
@@ -1,5 +1,6 @@
-- ===================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville
+-- Copyright (C) 2009 Laurent Destailleur
--
-- 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;