Uniformize log of supplier order. Now use the generic log feature.
This commit is contained in:
parent
f14b03a230
commit
b9ffc18c27
@ -158,8 +158,8 @@ function ordersupplier_prepare_head($object)
|
|||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/history.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("OrderFollow");
|
$head[$h][1] = $langs->trans("Info");
|
||||||
$head[$h][2] = 'info';
|
$head[$h][2] = 'info';
|
||||||
$h++;
|
$h++;
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove');
|
||||||
|
|||||||
@ -660,6 +660,32 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
|||||||
|
|
||||||
$object->sendtoid=0;
|
$object->sendtoid=0;
|
||||||
}
|
}
|
||||||
|
elseif($action == 'PROJECT_CREATE') {
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("projects");
|
||||||
|
|
||||||
|
$object->actiontypecode='AC_OTH_AUTO';
|
||||||
|
|
||||||
|
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
|
||||||
|
$object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
|
||||||
|
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
|
||||||
|
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||||
|
|
||||||
|
$object->sendtoid=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif($action == 'PROJECT_MODIFY') {
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("projects");
|
||||||
|
|
||||||
|
$object->actiontypecode='AC_OTH_AUTO';
|
||||||
|
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref);
|
||||||
|
$object->actionmsg=$langs->transnoentities("ProjectModifieddInDolibarr",$object->ref);
|
||||||
|
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
|
||||||
|
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||||
|
|
||||||
|
$object->sendtoid=0;
|
||||||
|
}
|
||||||
|
|
||||||
// Project tasks
|
// Project tasks
|
||||||
elseif($action == 'TASK_CREATE') {
|
elseif($action == 'TASK_CREATE') {
|
||||||
|
|||||||
@ -2362,6 +2362,70 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge les informations d'ordre info dans l'objet facture
|
||||||
|
*
|
||||||
|
* @param int $id Id de la facture a charger
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function info($id)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT c.rowid, date_creation as datec, tms as datem, date_valid as date_validation, date_approve as datea, date_approve2 as datea2,';
|
||||||
|
$sql.= ' fk_user_author, fk_user_modif, fk_user_valid, fk_user_approve, fk_user_approve2';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseur as c';
|
||||||
|
$sql.= ' WHERE c.rowid = '.$id;
|
||||||
|
|
||||||
|
$result=$this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($result))
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
if ($obj->fk_user_author)
|
||||||
|
{
|
||||||
|
$cuser = new User($this->db);
|
||||||
|
$cuser->fetch($obj->fk_user_author);
|
||||||
|
$this->user_creation = $cuser;
|
||||||
|
}
|
||||||
|
if ($obj->fk_user_valid)
|
||||||
|
{
|
||||||
|
$vuser = new User($this->db);
|
||||||
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
|
$this->user_validation = $vuser;
|
||||||
|
}
|
||||||
|
if ($obj->fk_user_modif)
|
||||||
|
{
|
||||||
|
$muser = new User($this->db);
|
||||||
|
$muser->fetch($obj->fk_user_modif);
|
||||||
|
$this->user_modification = $muser;
|
||||||
|
}
|
||||||
|
if ($obj->fk_user_approve)
|
||||||
|
{
|
||||||
|
$auser = new User($this->db);
|
||||||
|
$auser->fetch($obj->fk_user_approve);
|
||||||
|
$this->user_approve = $auser;
|
||||||
|
}
|
||||||
|
if ($obj->fk_user_approve2)
|
||||||
|
{
|
||||||
|
$a2user = new User($this->db);
|
||||||
|
$a2user->fetch($obj->fk_user_approve2);
|
||||||
|
$this->user_approve2 = $a2user;
|
||||||
|
}
|
||||||
|
$this->date_creation = $this->db->idate($obj->datec);
|
||||||
|
$this->date_modification = $this->db->idate($obj->datem);
|
||||||
|
$this->date_approve = $this->db->idate($obj->datea);
|
||||||
|
$this->date_approve2 = $this->db->idate($obj->datea2);
|
||||||
|
$this->date_validation = $this->db->idate($obj->date_validation);
|
||||||
|
}
|
||||||
|
$this->db->free($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Charge indicateurs this->nb de tableau de bord
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1428,7 +1428,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
function info($id)
|
function info($id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT c.rowid, datec, tms as datem, ';
|
$sql = 'SELECT c.rowid, datec, tms as datem, ';
|
||||||
$sql.= ' fk_user_author, fk_user_valid';
|
$sql.= ' fk_user_author, fk_user_modif, fk_user_valid';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c';
|
||||||
$sql.= ' WHERE c.rowid = '.$id;
|
$sql.= ' WHERE c.rowid = '.$id;
|
||||||
|
|
||||||
@ -1451,8 +1451,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$vuser->fetch($obj->fk_user_valid);
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
$this->date_creation = $obj->datec;
|
if ($obj->fk_user_modif)
|
||||||
$this->date_modification = $obj->datem;
|
{
|
||||||
|
$muser = new User($this->db);
|
||||||
|
$muser->fetch($obj->fk_user_modif);
|
||||||
|
$this->user_modification = $muser;
|
||||||
|
}
|
||||||
|
$this->date_creation = $this->db->idate($obj->datec);
|
||||||
|
$this->date_modification = $this->db->idate($obj->datem);
|
||||||
//$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders)
|
//$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders)
|
||||||
}
|
}
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
|
|||||||
@ -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-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -18,13 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/fourn/commande/history.php
|
* \file htdocs/fourn/commande/info.php
|
||||||
* \ingroup commande
|
* \ingroup commande
|
||||||
* \brief Fiche commande
|
* \brief Fiche commande
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||||
|
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
@ -52,19 +53,18 @@ $now=dol_now();
|
|||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$commande = new CommandeFournisseur($db);
|
$object = new CommandeFournisseur($db);
|
||||||
|
|
||||||
$result=$commande->fetch($id,$ref);
|
$result=$object->fetch($id,$ref);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$soc->fetch($commande->socid);
|
$object->info($object->id);
|
||||||
|
|
||||||
$author = new User($db);
|
$soc->fetch($object->socid);
|
||||||
$author->fetch($commande->user_author_id);
|
|
||||||
|
|
||||||
llxHeader('',$langs->trans("History"),"CommandeFournisseur");
|
llxHeader('',$langs->trans("History"),"CommandeFournisseur");
|
||||||
|
|
||||||
$head = ordersupplier_prepare_head($commande);
|
$head = ordersupplier_prepare_head($object);
|
||||||
|
|
||||||
$title=$langs->trans("SupplierOrder");
|
$title=$langs->trans("SupplierOrder");
|
||||||
dol_fiche_head($head, 'info', $title, 0, 'order');
|
dol_fiche_head($head, 'info', $title, 0, 'order');
|
||||||
@ -79,9 +79,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $form->showrefnav($commande, 'ref', $linkback, 1, 'ref', 'ref');
|
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -94,89 +94,32 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("Status").'</td>';
|
print '<td>'.$langs->trans("Status").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $commande->getLibStatut(4);
|
print $object->getLibStatut(4);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
if ($commande->methode_commande_id > 0)
|
if ($object->methode_commande_id > 0)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
||||||
if ($commande->date_commande)
|
if ($object->date_commande)
|
||||||
{
|
{
|
||||||
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
|
print dol_print_date($object->date_commande,"dayhourtext")."\n";
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
if ($commande->methode_commande)
|
if ($object->methode_commande)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->getInputMethod().'</td></tr>';
|
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auteur
|
|
||||||
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
|
|
||||||
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
/*
|
print '<table width="100%"><tr><td>';
|
||||||
* Suivi historique
|
dol_print_object_info($object, 1);
|
||||||
* Date - Statut - Auteur
|
print '</td></tr></table>';
|
||||||
*/
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Date").'</td>';
|
|
||||||
print '<td class="liste_titre">'.$langs->trans("Status").'</td>';
|
|
||||||
print '<td class="liste_titre" align="center">'.$langs->trans("Author").'</td>';
|
|
||||||
print '<td class="liste_titre" align="left">'.$langs->trans("Comment").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$sql = "SELECT l.fk_statut, l.datelog as dl, l.comment, u.rowid, u.login, u.firstname, u.lastname";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_log as l";
|
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."user as u ";
|
|
||||||
$sql.= " WHERE l.fk_commande = ".$commande->id;
|
|
||||||
$sql.= " AND u.rowid = l.fk_user";
|
|
||||||
$sql.= " ORDER BY l.rowid DESC";
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$var=True;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
print "<tr ".$bc[$var].">";
|
|
||||||
|
|
||||||
print '<td width="20%">'.dol_print_date($db->jdate($obj->dl),"dayhour")."</td>\n";
|
|
||||||
|
|
||||||
// Statut
|
|
||||||
print '<td class="nowrap">'.$commande->LibStatut($obj->fk_statut,4)."</td>\n";
|
|
||||||
|
|
||||||
// User
|
|
||||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">';
|
|
||||||
print img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
|
||||||
|
|
||||||
// Comment
|
|
||||||
print '<td class="nowrap" title="'.dol_escape_htmltag($obj->comment).'">'.dol_trunc($obj->comment,48)."</td>\n";
|
|
||||||
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$db->free($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user