diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 60cca72da8c11f90c9e1ebbd9416cd136799cb66..3e3c33039ec147402515329ea72dbbe8e9b48b05 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -496,7 +496,10 @@ if ($_GET["id"] > 0) print '</td><td valign="top" width="50%">'; - // Rien a droite + // List of actions on element + include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php'); + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($commande,'order',$socid); print "</td></tr></table>"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8f1f4492c8367190f88dbe8ce2e87680858fbd49..e5e7a117f768576c172d9e70d1354052e81bd239 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2954,6 +2954,8 @@ else print '</td><td valign="top" width="50%">'; + print '<br>'; + // List of actions on element include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php'); $formactions=new FormActions($db); diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 90d07c40be6064f9bfa2ac4a99555601c18cf5b9..3db0e76ce947f011fe4064ad4e64023688194a3a 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -594,53 +594,10 @@ if ($_GET["propalid"] > 0) print '</td><td valign="top" width="50%">'; - - /* - * Liste des actions propres a la propal - */ - if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) - { - $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; - $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; - $sql .= ' WHERE a.fk_soc = '.$societe->id.' AND a.propalrowid = '.$propal->id ; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) - { - print_titre($langs->trans('ActionsOnPropal')); - $i = 0; - $total = 0; - $var=true; - - print '<table class="border" width="100%">'; - print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>'; - print "\n"; - - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print '<tr '.$bc[$var].'>'; - print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>'; - print '<td>'.dolibarr_print_date($objp->da,'dayhour')."</td>\n"; - print '<td>'.stripslashes($objp->label).'</td>'; - $authoract = new User($db); - $authoract->id = $objp->fk_user_author; - $authoract->fetch(''); - print '<td>'.$authoract->login.'</td>'; - print "</tr>\n"; - $i++; - } - print '</table>'; - } - } - else - { - dolibarr_print_error($db); - } - } + // List of actions on element + include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php'); + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($propal,'propal',$socid); print '</td></tr></table>'; diff --git a/htdocs/html.formactions.class.php b/htdocs/html.formactions.class.php new file mode 100644 index 0000000000000000000000000000000000000000..bfbe977b95268d4d4e247f8a7df3e5f0dcfe3e8e --- /dev/null +++ b/htdocs/html.formactions.class.php @@ -0,0 +1,109 @@ +<?php +/* Copyright (c) 2008 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + \file htdocs/html.formactions.class.php + \brief Fichier de la classe des fonctions pr�d�finie de composants html actions + \version $Id$ +*/ + + +/** + \class FormActions + \brief Classe permettant la g�n�ration de composants html actions +*/ +class FormActions +{ + var $db; + var $error; + + + /** + * \brief Constructeur + * \param DB handler d'acc�s base de donn�e + */ + function FormActions($DB) + { + $this->db = $DB; + + return 1; + } + + /** + * \brief Show list of actions for element + * \param object Object + * \param typeelement 'invoice','propal','order' + * \param socid socid of user + * \return int <0 if KO, >=0 if OK + */ + function showactions($object,$typeelement,$socid=0) + { + global $langs,$conf,$user; + global $bc; + + $sql = 'SELECT a.id, '.$this->db->pdate('a.datep').' as da, a.label, a.note,'; + $sql.= ' u.login'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; + $sql.= ' WHERE a.fk_user_author = u.rowid'; + if ($socid) $sql .= ' AND a.fk_soc = '.$socid; + if ($typeelement == 'invoice') $sql.= ' AND a.fk_facture = '.$object->id; + if ($typeelement == 'propal') $sql.= ' AND a.propalrowid = '.$object->id; + if ($typeelement == 'order') $sql.= ' AND a.fk_commande = '.$object->id; + + dolibarr_syslog("FormActions::showactions sql=".$sql); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + if ($num) + { + if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill'); + if ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal'); + if ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder'); + print_titre($title); + + $i = 0; $total = 0; $var=true; + print '<table class="border" width="100%">'; + print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>'; + print "\n"; + + while ($i < $num) + { + $objp = $this->db->fetch_object($resql); + $var=!$var; + print '<tr '.$bc[$var].'>'; + print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>'; + print '<td>'.dolibarr_print_date($objp->da,'day').'</td>'; + print '<td>'.$objp->label.'</td>'; + print '<td>'.$objp->login.'</td>'; + print '</tr>'; + $i++; + } + print '</table>'; + } + + return $num; + } + else + { + dolibarr_print_error($this->db); + return -1; + } + } + +} diff --git a/mysql/migration/2.2.0-2.4.0.sql b/mysql/migration/2.2.0-2.4.0.sql index 6a2255fda7d6bab642311b69562ef34d5a119775..0e9a514eb55aba37e7f9acd49d6924512ef8e189 100644 --- a/mysql/migration/2.2.0-2.4.0.sql +++ b/mysql/migration/2.2.0-2.4.0.sql @@ -250,3 +250,4 @@ alter table llx_socpeople add priv smallint NOT NULL DEFAULT 0 after alter table llx_tva modify fk_bank integer; +delete from llx_const where name='MAIN_USE_PREVIEW_TABS';