';
+
+// Left area
+print '';
+
+
+
+print '';
+print '';
+print '| '.$langs->trans("Statistics").' | ';
+print " \n";
+
+$listoftype=$tripandexpense_static->listOfTypes();
+foreach ($listoftype as $typefee)
+{
+ $dataseries[]=array('label'=>$typefee['label'],'values'=>array(0=>(isset($nb[$typefee['code']])?$nb[$typefee['code']]:0)));
+}
+
+if ($conf->use_javascript_ajax)
+{
+ print '| ';
+ $data=array('series'=>$dataseries);
+ dol_print_graph('stats',300,180,$data,1,'pie',1);
+ print ' | ';
+}
+
+print '';
+print '| '.$langs->trans("Total").' | ';
+print ''.$totalnb.' | ';
+print ' ';
+
+print ' ';
+
+
+// Right area
+print ' | ';
+
+$max=10;
+
+$langs->load("boxes");
+
+$sql = "SELECT u.rowid as uid, u.name, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km";
+$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
+if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+$sql.= " WHERE u.rowid = d.fk_user";
+$sql.= " AND d.entity = ".$conf->entity;
+if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+if ($socid) $sql.= " AND d.fk_soc = ".$socid;
+$sql.= $db->order("d.tms","DESC");
+$sql.= $db->plimit($max, 0);
+
+$result = $db->query($sql);
+if ($result)
+{
+ $var=false;
+ $num = $db->num_rows($result);
+
+ $i = 0;
+
+ print '';
+ print '';
+ print '| '.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).' | ';
+ print ''.$langs->trans("FeesKilometersOrAmout").' | ';
+ print ''.$langs->trans("DateModificationShort").' | ';
+ print ' | ';
+ print ' ';
+ if ($num)
+ {
+ $total_ttc = $totalam = $total = 0;
+
+ $deplacementstatic=new Deplacement($db);
+ $userstatic=new User($db);
+ while ($i < $num && $i < $max)
+ {
+ $objp = $db->fetch_object($result);
+ $deplacementstatic->ref=$objp->rowid;
+ $deplacementstatic->id=$objp->rowid;
+ $userstatic->id=$objp->uid;
+ $userstatic->nom=$objp->name;
+ $userstatic->prenom=$objp->firstname;
+ print '';
+ print '| '.$deplacementstatic->getNomUrl(1).' | ';
+ print ''.$userstatic->getNomUrl(1).' | ';
+ print ''.$objp->km.' | ';
+ print ''.dol_print_date($db->jdate($objp->dm),'day').' | ';
+ print ''.$deplacementstatic->LibStatut($objp->fk_statut,3).' | ';
+ print ' ';
+ $var=!$var;
+ $i++;
+ }
+
+ }
+ else
+ {
+ print '| '.$langs->trans("None").' | ';
+ }
+ print ' ';
+}
+else dol_print_error($db);
+
+
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/29 17:55:33 $ - $Revision: 1.44 $');
?>
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
new file mode 100755
index 00000000000..404e0afb5f4
--- /dev/null
+++ b/htdocs/compta/deplacement/list.php
@@ -0,0 +1,129 @@
+
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2004 Eric Seigne
+ * Copyright (C) 2005-2009 Regis Houssin
+ *
+ * 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/compta/deplacement/list.php
+ * \brief Page list of expenses
+ * \version $Id: list.php,v 1.1 2011/06/29 17:55:33 eldy Exp $
+ */
+
+require("../../main.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/tva/class/tva.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php");
+
+$langs->load("companies");
+$langs->load("users");
+$langs->load("trips");
+
+// Security check
+$socid = $_GET["socid"]?$_GET["socid"]:'';
+if ($user->societe_id) $socid=$user->societe_id;
+$result = restrictedArea($user, 'deplacement','','');
+
+$sortfield = GETPOST("sortfield",'alpha');
+$sortorder = GETPOST("sortorder",'alpha');
+$page = GETPOST("page",'int');
+if ($page == -1) { $page = 0; }
+$offset = $conf->liste_limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (! $sortorder) $sortorder="DESC";
+if (! $sortfield) $sortfield="d.dated";
+$limit = $conf->liste_limit;
+
+
+/*
+ * View
+ */
+
+$tripandexpense_static=new Deplacement($db);
+
+llxHeader();
+
+$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
+$sql.= " d.rowid, d.type, d.dated as dd, d.km, "; // Comment
+$sql.= " u.name, u.firstname"; // Qui
+$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
+$sql.= ", ".MAIN_DB_PREFIX."deplacement as d";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
+if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
+$sql.= " WHERE d.fk_user = u.rowid";
+$sql.= " AND d.entity = ".$conf->entity;
+if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
+if ($socid) $sql.= " AND s.rowid = ".$socid;
+$sql.= $db->order($sortfield,$sortorder);
+$sql.= $db->plimit($limit + 1 ,$offset);
+
+//print $sql;
+$resql=$db->query($sql);
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+
+ print_barre_liste($langs->trans("ListOfFees"), $page, $_SERVER["PHP_SELF"],"&socid=$socid",$sortfield,$sortorder,'',$num);
+
+ $i = 0;
+ print '';
+ print "";
+ print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.name","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre('',$_SERVER["PHP_SELF"], '');
+ print " \n";
+
+ $var=true;
+ while ($i < min($num,$limit))
+ {
+ $objp = $db->fetch_object($resql);
+
+ $soc = new Societe($db);
+ if ($objp->socid) $soc->fetch($objp->socid);
+
+ $var=!$var;
+ print '';
+ print '| '.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->rowid.' | ';
+ print ''.$langs->trans($objp->type).' | ';
+ print ''.dol_print_date($db->jdate($objp->dd),'day').' | ';
+ print ''.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.' | ';
+ if ($objp->socid) print ''.$soc->getNomUrl(1).' | ';
+ else print ' | ';
+ print ''.$objp->km.' | ';
+
+ print ''.$tripandexpense_static->getLibStatut(5).' | ';
+ print " \n";
+
+ $i++;
+ }
+
+ print " ";
+ $db->free($resql);
+}
+else
+{
+ dol_print_error($db);
+}
+$db->close();
+
+llxFooter('$Date: 2011/06/29 17:55:33 $ - $Revision: 1.1 $');
+?>
diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php
index 47aa79c1060..94ea39a56b2 100644
--- a/htdocs/compta/dons/class/don.class.php
+++ b/htdocs/compta/dons/class/don.class.php
@@ -22,7 +22,7 @@
* \file htdocs/compta/dons/class/don.class.php
* \ingroup don
* \brief Fichier de la classe des dons
- * \version $Id$
+ * \version $Id: don.class.php,v 1.10 2011/06/29 17:55:34 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -310,6 +310,8 @@ class Don extends CommonObject
$sql.= ", fk_user_valid";
$sql.= ", datedon";
$sql.= ", email";
+ $sql.= ", phone";
+ $sql.= ", phone_mobile";
$sql.= ") VALUES (";
$sql.= " '".$this->db->idate($now)."'";
$sql.= ", ".$conf->entity;
@@ -328,7 +330,9 @@ class Don extends CommonObject
$sql.= ", ".$user->id;
$sql.= ", null";
$sql.= ", '".$this->db->idate($this->date)."'";
- $sql.= ", '".$this->email."'";
+ $sql.= ", '".$this->db->escape($this->email)."'";
+ $sql.= ", '".$this->db->escape($this->phone)."'";
+ $sql.= ", '".$this->db->escape($this->phone_mobile)."'";
$sql.= ")";
dol_syslog("Don::create sql=".$sql, LOG_DEBUG);
@@ -367,6 +371,8 @@ class Don extends CommonObject
$sql .= ",note='".$this->db->escape($this->note)."'";
$sql .= ",datedon='".$this->db->idate($this->date)."'";
$sql .= ",email='".$this->email."'";
+ $sql .= ",phone='".$this->phone."'";
+ $sql .= ",phone_mobile='".$this->phone_mobile."'";
$sql .= ",fk_statut=".$this->statut;
$sql .= " WHERE rowid = $this->id";
@@ -383,9 +389,9 @@ class Don extends CommonObject
}
}
- /*
- * Suppression du don de la base
- * @param rowid id du don a supprimer
+ /**
+ * Delete a donation
+ * @param rowid Id of donation to delete
*/
function delete($rowid)
{
@@ -413,7 +419,8 @@ class Don extends CommonObject
/**
* Load donation from database
- * @param rowid Id of donation toload
+ * @param rowid Id of donation to load
+ * @param ref Ref of donation to load
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid,$ref='')
@@ -421,7 +428,7 @@ class Don extends CommonObject
global $conf;
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
- $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet,";
+ $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.phone, d.phone_mobile, d.fk_don_projet,";
$sql.= " p.title as project_label";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_don_projet";
@@ -451,6 +458,8 @@ class Don extends CommonObject
$this->zip = $obj->cp;
$this->town = $obj->ville;
$this->email = $obj->email;
+ $this->phone = $obj->phone;
+ $this->phone_mobile = $obj->phone_mobile;
$this->pays = $obj->pays;
$this->projet = $obj->project_label;
$this->fk_project = $obj->fk_don_projet;
diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php
index 972d21b33f3..eded37ea345 100644
--- a/htdocs/compta/dons/index.php
+++ b/htdocs/compta/dons/index.php
@@ -21,7 +21,7 @@
* \file htdocs/compta/dons/index.php
* \ingroup don
* \brief Home page of donation module
- * \version $Id$
+ * \version $Id: index.php,v 1.28 2011/06/29 17:55:33 eldy Exp $
*/
require("../../main.inc.php");
@@ -43,10 +43,11 @@ $donation_static=new Don($db);
* View
*/
-llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Subvenciones');
-
$donstatic=new Don($db);
+$help_url='EN:Module_Donations|FR:Module_Dons|ES:Módulo_Subvenciones';
+llxHeader('',$langs->trans("Donations"),$help_url);
+
$sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " GROUP BY d.fk_statut";
@@ -133,8 +134,7 @@ print " |
";
print '| '.$langs->trans('Type').' | ';
@@ -2557,14 +2608,23 @@ else
$object->formAddPredefinedProduct(1,$mysoc,$soc);
}
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $var=!$var;
- $module->formAddObject($object);
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'formAddObject'))
+ {
+ $var=!$var;
+ $module->formAddObject($object);
+ }
+ }
+ }
+ }
}
}
@@ -2801,7 +2861,7 @@ else
$delallowed=$user->rights->facture->supprimer;
print ' ';
- $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks['objectcard']);
+ $somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$object->hooks);
/*
* Linked object block
@@ -3174,5 +3234,5 @@ else
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.841 $');
?>
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 175b455bc2e..f8f946d3065 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -28,7 +28,7 @@
* \file htdocs/compta/facture/class/facture.class.php
* \ingroup facture
* \brief Fichier de la classe des factures clients
- * \version $Id$
+ * \version $Id: facture.class.php,v 1.122 2011/06/30 13:27:20 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -534,9 +534,9 @@ class Facture extends CommonObject
$object->fetch($fromid);
// Instantiate hooks of thirdparty module
- if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
+ if (is_array($conf->hooks_modules) && ! empty($conf->hooks_modules))
{
- $object->callHooks('objectcard');
+ $object->callHooks('invoicecard');
}
$this->db->begin();
@@ -577,14 +577,23 @@ class Facture extends CommonObject
if (! $error)
{
- // Hook of thirdparty module
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($objFrom,$result,$object->element);
- if ($result < 0) $error++;
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($objFrom,$result,$object->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
}
// Appel des triggers
@@ -667,14 +676,23 @@ class Facture extends CommonObject
if ($ret > 0)
{
- // Hooks
- if (! empty($object->hooks['objectcard']))
+ // Hook for external modules
+ if (! empty($object->hooks))
{
- foreach($object->hooks['objectcard'] as $module)
- {
- $result = $module->createfrom($object,$ret,$this->element);
- if ($result < 0) $error++;
- }
+ foreach($object->hooks as $hook)
+ {
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'createfrom'))
+ {
+ $result = $module->createfrom($objFrom,$result,$object->element);
+ if ($result < 0) $error++;
+ }
+ }
+ }
+ }
}
if (! $error)
@@ -2002,9 +2020,13 @@ class Facture extends CommonObject
// Update line into database
$this->line=new FactureLigne($this->db);
- $this->line->rowid=$rowid;
- $this->line->fetch($rowid);
-
+
+ // Stock previous line records
+ $staticline=new FactureLigne($this->db);
+ $staticline->fetch($rowid);
+ $this->line->oldline = $staticline;
+
+ $this->line->rowid = $rowid;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->tva_tx = $txtva;
@@ -3250,6 +3272,8 @@ class FactureLigne
{
var $db;
var $error;
+
+ var $oldline;
//! From llx_facturedet
var $rowid;
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index e869addf1cd..9fe60087f10 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -22,7 +22,7 @@
* \file htdocs/compta/facture/fiche-rec.php
* \ingroup facture
* \brief Page to show predefined invoice
- * \version $Id$
+ * \version $Id: fiche-rec.php,v 1.74 2011/06/30 13:27:21 hregis Exp $
*/
require("../../main.inc.php");
@@ -113,7 +113,7 @@ if ($_GET["action"] == 'create')
// Instantiate hooks of thirdparty module
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
{
- $facture->callHooks('objectcard');
+ $facture->callHooks('invoicecard');
}
if ($facture->fetch($_GET["facid"]) > 0)
@@ -576,5 +576,5 @@ else
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.74 $');
?>
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 69946ae386d..2b7d3eaa2d2 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -22,7 +22,7 @@
* \file htdocs/compta/index.php
* \ingroup compta
* \brief Main page of accountancy area
- * \version $Id$
+ * \version $Id: index.php,v 1.181 2011/06/29 17:55:34 eldy Exp $
*/
require('../main.inc.php');
@@ -474,20 +474,17 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
-// Last customers
-if ($conf->societe->enabled && $user->rights->societe->lire)
+// Last donations
+if ($conf->don->enabled && $user->rights->societe->lire)
{
- include_once(DOL_DOCUMENT_ROOT.'/societe/class/client.class.php');
+ include_once(DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php');
$langs->load("boxes");
+ $donationstatic=new Don($db);
- $sql = "SELECT s.nom, s.rowid, s.datec as dc, s.tms as dm";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE s.client IN (1, 3)";
- $sql.= " AND s.entity = ".$conf->entity;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($socid) $sql.= " AND s.rowid = ".$socid;
+ $sql = "SELECT s.rowid, s.nom, s.prenom, s.societe, s.datedon as date, s.tms as dm, s.amount, s.fk_statut";
+ $sql.= " FROM ".MAIN_DB_PREFIX."don as s";
+ $sql.= " WHERE s.entity = ".$conf->entity;
$sql.= $db->order("s.tms","DESC");
$sql.= $db->plimit($max, 0);
@@ -500,25 +497,32 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
$i = 0;
print '';
- print '| '.$langs->trans("BoxTitleLastModifiedCustomers",min($max,$num)).' | ';
+ print ' | '.$langs->trans("BoxTitleLastModifiedDonations",min($max,$num)).' | ';
+ print ''.$langs->trans("AmountTTC").' | ';
print ''.$langs->trans("DateModificationShort").' | ';
+ print ' | ';
print ' ';
if ($num)
{
$var = True;
$total_ttc = $totalam = $total = 0;
- $customerstatic=new Client($db);
$var=true;
while ($i < $num && $i < $max)
{
$objp = $db->fetch_object($result);
- $customerstatic->id=$objp->rowid;
- $customerstatic->nom=$objp->nom;
$var=!$var;
print '';
- print '| '.$customerstatic->getNomUrl(1).' | ';
+ $donationstatic->id=$objp->rowid;
+ $donationstatic->nom=$objp->nom;
+ $donationstatic->prenom=$objp->prenom;
+ $label=$donationstatic->getFullName($langs);
+ if ($objp->societe) $label.=($label?' - ':'').$objp->societe;
+ $donationstatic->ref=$label;
+ print ''.$donationstatic->getNomUrl(1).' | ';
+ print ''.price($objp->amount).' | ';
print ''.dol_print_date($db->jdate($objp->dm),'day').' | ';
+ print ''.$donationstatic->LibStatut($objp->fk_statut,3).' | ';
print ' ';
$i++;
@@ -531,22 +535,25 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
}
print ' ';
}
+ else dol_print_error($db);
}
-// Last suppliers
-if ($conf->fournisseur->enabled && $user->rights->societe->lire)
+// Last trips and expenses
+if ($conf->deplacement->enabled && $user->rights->deplacement->lire)
{
- $langs->load("boxes");
+ include_once(DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php');
- $sql = "SELECT s.nom, s.rowid, s.datec as dc, s.tms as dm";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE s.fournisseur = 1";
- $sql.= " AND s.entity = ".$conf->entity;
- if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($socid) $sql.= " AND s.rowid = ".$socid;
- $sql.= $db->order("s.tms","DESC");
+ $langs->load("boxes");
+
+ $sql = "SELECT u.rowid as uid, u.name, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km";
+ $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql.= " WHERE u.rowid = d.fk_user";
+ $sql.= " AND d.entity = ".$conf->entity;
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ if ($socid) $sql.= " AND d.fk_soc = ".$socid;
+ $sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
@@ -558,22 +565,32 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire)
$i = 0;
print '';
- print '| '.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).' | ';
+ print ' ';
+ print '| '.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).' | ';
+ print ''.$langs->trans("FeesKilometersOrAmout").' | ';
print ''.$langs->trans("DateModificationShort").' | ';
+ print ' | ';
print ' ';
if ($num)
{
$total_ttc = $totalam = $total = 0;
- $customerstatic=new Client($db);
+ $deplacementstatic=new Deplacement($db);
+ $userstatic=new User($db);
while ($i < $num && $i < $max)
{
$objp = $db->fetch_object($result);
- $customerstatic->id=$objp->rowid;
- $customerstatic->nom=$objp->nom;
+ $deplacementstatic->ref=$objp->rowid;
+ $deplacementstatic->id=$objp->rowid;
+ $userstatic->id=$objp->uid;
+ $userstatic->nom=$objp->name;
+ $userstatic->prenom=$objp->firstname;
print '';
- print '| '.$customerstatic->getNomUrl(1).' | ';
+ print ''.$deplacementstatic->getNomUrl(1).' | ';
+ print ''.$userstatic->getNomUrl(1).' | ';
+ print ''.$objp->km.' | ';
print ''.dol_print_date($db->jdate($objp->dm),'day').' | ';
+ print ''.$deplacementstatic->LibStatut($objp->fk_statut,3).' | ';
print ' ';
$var=!$var;
$i++;
@@ -586,6 +603,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire)
}
print ' ';
}
+ else dol_print_error($db);
}
@@ -991,5 +1009,5 @@ print '';
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/29 17:55:34 $ - $Revision: 1.181 $');
?>
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 4f59a16eb91..47e6e549c7d 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -24,7 +24,7 @@
* \file htdocs/contact/fiche.php
* \ingroup societe
* \brief Card of a contact
- * \version $Id$
+ * \version $Id: fiche.php,v 1.215 2011/06/30 13:25:32 hregis Exp $
*/
require("../main.inc.php");
@@ -950,5 +950,5 @@ else
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/30 13:25:32 $ - $Revision: 1.215 $');
?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index a2ef308ba91..dba9a784f4d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -22,7 +22,7 @@
* \file htdocs/core/class/commonobject.class.php
* \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
- * \version $Id$
+ * \version $Id: commonobject.class.php,v 1.140 2011/06/30 13:27:20 hregis Exp $
*/
@@ -585,15 +585,21 @@ class CommonObject
{
global $conf;
- $result=false;
-
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
$sql.= $field." = '".$value."'";
$sql.= " WHERE rowid = ".$id;
dol_syslog("CommonObject::updateObjectField sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
- if (! $resql) dol_print_error($this->db);
+ if ($resql)
+ {
+ return 1;
+ }
+ else
+ {
+ dol_print_error($this->db);
+ return -1;
+ }
}
/**
@@ -1432,6 +1438,8 @@ class CommonObject
global $conf;
if (! is_array($arraytype)) $arraytype=array($arraytype);
+
+ $i=0;
foreach($conf->hooks_modules as $module => $hooks)
{
@@ -1445,6 +1453,8 @@ class CommonObject
$actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php';
$pathroot = '';
+
+ $this->hooks[$i]['type']=$type;
// Include actions class (controller)
$resaction=dol_include_once($path.$actionfile);
@@ -1457,15 +1467,17 @@ class CommonObject
{
$controlclassname = 'Actions'.ucfirst($module);
$objModule = new $controlclassname($this->db);
- $this->hooks[$type][$objModule->module_number] = $objModule;
+ $this->hooks[$i]['modules'][$objModule->module_number] = $objModule;
}
if ($resdao)
{
// Instantiate dataservice class (model)
$modelclassname = 'Dao'.ucfirst($module);
- $this->hooks[$type][$objModule->module_number]->object = new $modelclassname($this->db);
+ $this->hooks[$i]['modules'][$objModule->module_number]->object = new $modelclassname($this->db);
}
+
+ $i++;
}
}
}
@@ -1731,9 +1743,18 @@ class CommonObject
{
$var=!$var;
- if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))
+ if (! empty($this->hooks) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) )
{
- if (empty($line->fk_parent_line)) $this->hooks['objectcard'][$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ if (empty($line->fk_parent_line))
+ {
+ foreach($this->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$line->special_code],'printObjectLine'))
+ {
+ $hook['modules'][$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ }
+ }
+ }
}
else
{
@@ -1829,7 +1850,7 @@ class CommonObject
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*/
- function printOriginLinesList($object)
+ function printOriginLinesList()
{
global $langs;
@@ -1849,9 +1870,15 @@ class CommonObject
{
$var=!$var;
- if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))
+ if (! empty($this->hooks) && ( ($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line) ) )
{
- if (empty($line->fk_parent_line)) $object->hooks['objectcard'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
+ if (empty($line->fk_parent_line))
+ {
+ foreach($this->hooks as $hook)
+ {
+ if (method_exists($hook['modules'][$line->special_code],'printOriginObjectLine')) $hook['modules'][$line->special_code]->printOriginObjectLine($this,$line,$var,$i);
+ }
+ }
}
else
{
@@ -1899,7 +1926,7 @@ class CommonObject
$this->tpl['label'].= $productstatic->getNomUrl(1);
$this->tpl['label'].= $line->label?' - '.$line->label:'';
// Dates
- if ($date_start || $date_end)
+ if ($line->product_type == 1 && ($date_start || $date_end))
{
$this->tpl['label'].= get_date_range($date_start,$date_end);
}
@@ -1909,7 +1936,7 @@ class CommonObject
$this->tpl['label'].= ($line->product_type == -1 ? ' ' : ($line->product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product')));
$this->tpl['label'].= ($line->label ? ' '.$line->label : '');
// Dates
- if ($date_start || $date_end)
+ if ($line->product_type == 1 && ($date_start || $date_end))
{
$this->tpl['label'].= get_date_range($date_start,$date_end);
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 771c5b471bc..5f47437f830 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php
* \ingroup core
* \brief File of class with all html predefined components
- * \version $Id: html.form.class.php,v 1.183 2011/06/29 11:22:36 eldy Exp $
+ * \version $Id: html.form.class.php,v 1.184 2011/06/29 15:48:03 grandoc Exp $
*/
@@ -2511,6 +2511,42 @@ class Form
}
}
}
+
+/**
+ * \brief Affiche formulaire de selection des tiers
+ * \param page Page
+ * \param selected Id contact pre-selectionne
+ * \param htmlname Nom du formulaire select
+ */
+ function form_thirdparty($page, $selected='', $htmlname='socid')
+ {
+ global $langs;
+
+ if ($htmlname != "none")
+ {
+ print '';
+ }
+ else
+ {
+ if ($selected)
+ {
+ require_once(DOL_DOCUMENT_ROOT ."/societe/class/societe.class.php");
+ $soc = new Societe($this->db);
+ $soc->fetch($selected);
+ print $soc->getNomUrl($langs);
+ } else {
+ print " ";
+ }
+ }
+ }
/**
* \brief Affiche formulaire de selection de l'adresse
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 959080b1379..7c054b43622 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1,6 +1,7 @@
- * Copyright (c) 2010 Juanjo Menent
+/* Copyright (c) 2008-2010 Laurent Destailleur
+ * Copyright (C) 2010-2011 Regis Houssin
+ * Copyright (c) 2010 Juanjo Menent
*
* 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
@@ -21,7 +22,7 @@
* \file htdocs/core/class/html.formfile.class.php
* \ingroup core
* \brief File of class to offer components to list and upload files
- * \version $Id$
+ * \version $Id: html.formfile.class.php,v 1.34 2011/06/30 13:27:20 hregis Exp $
*/
@@ -446,12 +447,17 @@ class FormFile
$out.= ' |
';
// Execute hooks
- // $hooks must be array('key'=>$instanceofclass)
if (! empty($hooks) && is_array($hooks))
{
- foreach($hooks as $module)
+ foreach($hooks as $hook)
{
- if (method_exists($module,'formBuilddocOptions')) $out.= $module->formBuilddocOptions();
+ if (! empty($hook['modules']))
+ {
+ foreach($hook['modules'] as $module)
+ {
+ if (method_exists($module,'formBuilddocOptions')) $out.= $module->formBuilddocOptions();
+ }
+ }
}
}
}
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index 9e8747584c8..44635256716 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
+ * $Id: freeproductline_create.tpl.php,v 1.14 2011/06/30 13:27:20 hregis Exp $
*
* Need to have following variables defined:
* $conf
@@ -48,11 +48,17 @@
echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '