cvsimport

This commit is contained in:
Regis Houssin 2011-07-05 17:21:19 +00:00
commit 10e395f43c
97 changed files with 1466 additions and 1254 deletions

View File

@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 3.0.0 PROJECT_NUMBER = 3.1.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.

View File

@ -1,7 +1,7 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# \file dolibarr.pl # \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro # \brief Dolibarr script install for Virtualmin Pro
# \version $Revision$ # \version $Revision: 1.20 $
# \author (c)2009-2011 Regis Houssin <regis@dolibarr.fr> # \author (c)2009-2011 Regis Houssin <regis@dolibarr.fr>
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -31,7 +31,7 @@ return "Regis Houssin";
# script_dolibarr_versions() # script_dolibarr_versions()
sub script_dolibarr_versions sub script_dolibarr_versions
{ {
return ( "3.0.0" ); return ( "3.1.0" );
} }
sub script_dolibarr_category sub script_dolibarr_category

View File

@ -23,7 +23,7 @@
* \ingroup member * \ingroup member
* \brief File of class to manage members types * \brief File of class to manage members types
* \author Rodolphe Quiedeville * \author Rodolphe Quiedeville
* \version $Id$ * \version $Id: adherent_type.class.php,v 1.11 2011/07/05 08:08:16 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -195,12 +195,12 @@ class AdherentType extends CommonObject
} }
/** /**
* \brief Return list of members' type * Return list of members' type
* \return array List of types * @return array List of types of members
*/ */
function liste_array() function liste_array()
{ {
global $conf; global $conf,$langs;
$projets = array(); $projets = array();
@ -220,7 +220,7 @@ class AdherentType extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$projets[$obj->rowid] = $obj->libelle; $projets[$obj->rowid] = $langs->trans($obj->libelle);
$i++; $i++;
} }
} }

View File

@ -22,7 +22,7 @@
* \file htdocs/adherents/class/adherentstats.class.php * \file htdocs/adherents/class/adherentstats.class.php
* \ingroup member * \ingroup member
* \brief Fichier de la classe de gestion des stats des adhérents * \brief Fichier de la classe de gestion des stats des adhérents
* \version $Id$ * \version $Id: adherentstats.class.php,v 1.2 2011/07/04 10:30:01 eldy Exp $
*/ */
include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php";
@ -90,7 +90,7 @@ class AdherentStats extends Stats
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -126,7 +126,7 @@ class AdherentStats extends Stats
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -144,7 +144,7 @@ class AdherentStats extends Stats
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');

View File

@ -23,7 +23,7 @@
* \file htdocs/adherents/document.php * \file htdocs/adherents/document.php
* \brief Tab for documents linked to third party * \brief Tab for documents linked to third party
* \ingroup societe * \ingroup societe
* \version $Id$ * \version $Id: document.php,v 1.7 2011/07/05 16:10:56 hregis Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -194,7 +194,7 @@ if ($id > 0)
print '</div>'; print '</div>';
if ($mesg) { print "$mesg<br>"; } dol_htmloutput_mesg($mesg,$mesgs);
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
@ -231,6 +231,6 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.7 $');
?> ?>

View File

@ -23,7 +23,7 @@
* \file htdocs/admin/societe.php * \file htdocs/admin/societe.php
* \ingroup company * \ingroup company
* \brief Third party module setup page * \brief Third party module setup page
* \version $Id$ * \version $Id: societe.php,v 1.60 2011/07/04 07:38:22 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -166,8 +166,8 @@ if ($_GET["action"] == 'setdoc')
$form=new Form($db); $form=new Form($db);
$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
llxHeader('',$langs->trans("CompanySetup"),'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers'); llxHeader('',$langs->trans("CompanySetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup'); print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup');
@ -499,5 +499,5 @@ dol_fiche_end();
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 07:38:22 $ - $Revision: 1.60 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/admin/societe_extrafields.php * \file htdocs/admin/societe_extrafields.php
* \ingroup societe * \ingroup societe
* \brief Page to setup extra fields of third party * \brief Page to setup extra fields of third party
* \version $Id$ * \version $Id: societe_extrafields.php,v 1.4 2011/07/04 07:38:22 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -169,7 +169,7 @@ if ($action == 'delete')
$textobject=$langs->transnoentitiesnoconv("ThirdParty"); $textobject=$langs->transnoentitiesnoconv("ThirdParty");
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
llxHeader('',$langs->trans("CompanySetup"),$help_url); llxHeader('',$langs->trans("CompanySetup"),$help_url);
@ -312,5 +312,5 @@ if ($_GET["attrname"] && $action == 'edit')
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 07:38:22 $ - $Revision: 1.4 $');
?> ?>

View File

@ -27,17 +27,17 @@ include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
class Facturation { class Facturation {
/** /**
* Attributs "volatiles" : reinitialises apres chaque traitement d'un article * Attributs "volatiles" : reinitialises apres chaque traitement d'un article
* <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p> * <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p>
* @var int $id => 'rowid' du produit dans llx_product * int $id => 'rowid' du produit dans llx_product
* @var string $ref => 'ref' du produit dans llx_product * string $ref => 'ref' du produit dans llx_product
* @var int $qte => Quantite pour le produit en cours de traitement * int $qte => Quantite pour le produit en cours de traitement
* @var int $stock => Stock theorique pour le produit en cours de traitement * int $stock => Stock theorique pour le produit en cours de traitement
* @var int $remise_percent => Remise en pourcent sur le produit en cours * int $remise_percent => Remise en pourcent sur le produit en cours
* @var int $montant_remise => Remise en pourcent sur le produit en cours * int $montant_remise => Remise en pourcent sur le produit en cours
* @var int $prix => Prix HT du produit en cours * int $prix => Prix HT du produit en cours
* @var int $tva => 'rowid' du taux de tva dans llx_c_tva * int $tva => 'rowid' du taux de tva dans llx_c_tva
*/ */
var $id; var $id;
protected $ref; protected $ref;
protected $qte; protected $qte;
@ -48,17 +48,17 @@ class Facturation {
protected $tva; protected $tva;
/** /**
* Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation) * Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation)
* @var string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX) * string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX)
* @var string $mode_reglement => Mode de reglement (ESP, CB ou CHQ) * string $mode_reglement => Mode de reglement (ESP, CB ou CHQ)
* @var int $montant_encaisse => Montant encaisse en cas de reglement en especes * int $montant_encaisse => Montant encaisse en cas de reglement en especes
* @var int $montant_rendu => Monnaie rendue en cas de reglement en especes * int $montant_rendu => Monnaie rendue en cas de reglement en especes
* @var int $paiement_le => Date de paiement en cas de paiement differe * int $paiement_le => Date de paiement en cas de paiement differe
* *
* @var int $prix_total_ht => Prix total hors taxes * int $prix_total_ht => Prix total hors taxes
* @var int $montant_tva => Montant total de la TVA, tous taux confondus * int $montant_tva => Montant total de la TVA, tous taux confondus
* @var int $prix_total_ttc => Prix total TTC * int $prix_total_ttc => Prix total TTC
*/ */
protected $num_facture; protected $num_facture;
protected $mode_reglement; protected $mode_reglement;
protected $montant_encaisse; protected $montant_encaisse;
@ -82,9 +82,9 @@ class Facturation {
// Methodes de traitement des donnees // Methodes de traitement des donnees
/** /**
* \brief Ajout d'un article au panier * Ajout d'un article au panier
*/ */
public function ajoutArticle() public function ajoutArticle()
{ {
global $db; global $db;
@ -96,7 +96,7 @@ class Facturation {
dol_syslog("ajoutArticle sql=".$sql); dol_syslog("ajoutArticle sql=".$sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$vat_rate=$obj->taux; $vat_rate=$obj->taux;
@ -156,10 +156,10 @@ class Facturation {
} }
/** /**
* Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp * Suppression du panier d'un article identifie par son id dans la table llx_pos_tmp
* @param aArticle * @param aArticle
*/ */
public function supprArticle($aArticle) public function supprArticle($aArticle)
{ {
global $db; global $db;
@ -172,9 +172,9 @@ class Facturation {
} }
/** /**
* \brief Calcul du total HT, total TTC et montants TVA * \brief Calcul du total HT, total TTC et montants TVA
*/ */
public function calculTotaux() public function calculTotaux()
{ {
global $db; global $db;
@ -234,7 +234,7 @@ class Facturation {
} }
/** /**
* Reinitialisation des attributs persistants * Reinitialisation des attributs persistants
*/ */
public function raz_pers () public function raz_pers ()
{ {
@ -300,10 +300,10 @@ class Facturation {
} }
/** /**
* Getter for qte * Getter for qte
* @param $aQte * @param $aQte
* @return * @return
*/ */
public function qte ( $aQte=null ) { public function qte ( $aQte=null ) {
if ( !$aQte ) { if ( !$aQte ) {
@ -322,11 +322,11 @@ class Facturation {
} }
/** /**
* Getter for stock * Getter for stock
* @param aStock * @param aStock
* @return * @return
*/ */
public function stock ( $aStock=null ) public function stock ( $aStock=null )
{ {
@ -347,10 +347,10 @@ class Facturation {
} }
/** /**
* Getter for remise_percent * Getter for remise_percent
* @param aRemisePercent * @param aRemisePercent
* @return * @return
*/ */
public function remise_percent ( $aRemisePercent=null ) public function remise_percent ( $aRemisePercent=null )
{ {
@ -371,10 +371,10 @@ class Facturation {
} }
/** /**
* Getter for montant_remise * Getter for montant_remise
* @param aMontantRemise * @param aMontantRemise
* @return * @return
*/ */
public function montant_remise ( $aMontantRemise=null ) { public function montant_remise ( $aMontantRemise=null ) {
if ( !$aMontantRemise ) { if ( !$aMontantRemise ) {
@ -394,10 +394,10 @@ class Facturation {
} }
/** /**
* Getter for prix * Getter for prix
* @param aPrix * @param aPrix
* @return * @return
*/ */
public function prix ( $aPrix=null ) public function prix ( $aPrix=null )
{ {
@ -417,11 +417,11 @@ class Facturation {
} }
/** /**
* Getter for tva * Getter for tva
* @param aTva * @param aTva
* @return * @return
*/ */
public function tva ( $aTva=null ) public function tva ( $aTva=null )
{ {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com> * Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2008 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2006-2008 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.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
@ -25,7 +25,7 @@
* \file htdocs/categories/class/categorie.class.php * \file htdocs/categories/class/categorie.class.php
* \ingroup categorie * \ingroup categorie
* \brief File of class to manage categories * \brief File of class to manage categories
* \version $Id: categorie.class.php,v 1.16 2011/06/28 09:25:57 cdelambert Exp $ * \version $Id: categorie.class.php,v 1.17 2011/07/04 09:54:02 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -70,8 +70,8 @@ class Categorie
} }
/** /**
* Charge la categorie * Load category into memory from database
* @param id id de la categorie a charger * @param id id of category
*/ */
function fetch($id) function fetch($id)
{ {
@ -121,7 +121,7 @@ class Categorie
} }
/** /**
* Ajoute la categorie dans la base de donnees * Add category into database
* @return int -1 : erreur SQL * @return int -1 : erreur SQL
* -2 : nouvel ID inconnu * -2 : nouvel ID inconnu
* -3 : categorie invalide * -3 : categorie invalide
@ -147,14 +147,18 @@ class Categorie
{ {
$sql.= "fk_soc,"; $sql.= "fk_soc,";
} }
$sql.= "visible, type, fk_parent_id) "; $sql.= " visible,";
$sql.= "VALUES ('".$this->db->escape($this->label)."', '".$this->db->escape($this->description)."',"; $sql.= " type";
//$sql.= ", fk_parent_id";
$sql.= ")";
$sql.= " VALUES ('".$this->db->escape($this->label)."', '".$this->db->escape($this->description)."',";
if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER) if ($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
{ {
$sql.= ($this->socid != -1 ? $this->socid : 'null').","; $sql.= ($this->socid != -1 ? $this->socid : 'null').",";
} }
$sql.= "'".$this->visible."',".$this->type.",".$this->parentId .")"; $sql.= "'".$this->visible."',".$this->type;
//$sql.= ",".$this->parentId;
$sql.= ")";
$res = $this->db->query ($sql); $res = $this->db->query ($sql);
if ($res) if ($res)
@ -254,7 +258,7 @@ class Categorie
$sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null'); $sql .= ", fk_soc = ".($this->socid != -1 ? $this->socid : 'null');
} }
$sql .= ", visible = '".$this->visible."'"; $sql .= ", visible = '".$this->visible."'";
$sql .= ", fk_parent_id = ".$this->parentId; //$sql .= ", fk_parent_id = ".$this->parentId;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
dol_syslog("Categorie::update sql=".$sql); dol_syslog("Categorie::update sql=".$sql);
@ -815,8 +819,8 @@ class Categorie
} }
/** /**
* \brief Check if no category with same label already exists for this cat's parent or root and for this cat's type * Check if no category with same label already exists for this cat's parent or root and for this cat's type
* \return boolean 1 if already exist, 0 otherwise, -1 if error * @return boolean 1 if already exist, 0 otherwise, -1 if error
*/ */
function already_exists() function already_exists()
{ {
@ -830,7 +834,7 @@ class Categorie
$sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca";
$sql.= " ON c.rowid=ca.fk_categorie_fille"; $sql.= " ON c.rowid=ca.fk_categorie_fille";
$sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere; $sql.= " WHERE ca.fk_categorie_mere=".$this->id_mere;
$sql.= " AND c.label='".$this->label."'"; $sql.= " AND c.label='".$this->db->escape($this->label)."'";
} }
else // mother_id undefined (so it's root) else // mother_id undefined (so it's root)
{ {
@ -843,7 +847,7 @@ class Categorie
$sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca"; $sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca";
$sql.= " ON c.rowid!=ca.fk_categorie_fille"; $sql.= " ON c.rowid!=ca.fk_categorie_fille";
$sql.= " WHERE c.type=".$this->type; $sql.= " WHERE c.type=".$this->type;
$sql.= " AND c.label='".$this->label."'"; $sql.= " AND c.label='".$this->db->escape($this->label)."'";
} }
dol_syslog("Categorie::already_exists sql=".$sql); dol_syslog("Categorie::already_exists sql=".$sql);
$res = $this->db->query($sql); $res = $this->db->query($sql);

View File

@ -23,7 +23,7 @@
* \file htdocs/categories/fiche.php * \file htdocs/categories/fiche.php
* \ingroup category * \ingroup category
* \brief Page to create a new category * \brief Page to create a new category
* \version $Id$ * \version $Id: fiche.php,v 1.84 2011/07/04 09:54:02 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -131,7 +131,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
} }
// Confirm action // Confirm action
if ($action == 'add' && $user->rights->categorie->creer) if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->creer)
{ {
// Action confirmation de creation categorie // Action confirmation de creation categorie
if ($action == 'confirmed') if ($action == 'confirmed')
@ -235,5 +235,5 @@ if ($user->rights->categorie->creer)
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 09:54:02 $ - $Revision: 1.84 $');
?> ?>

View File

@ -23,7 +23,7 @@
* \file htdocs/comm/action/class/actioncomm.class.php * \file htdocs/comm/action/class/actioncomm.class.php
* \ingroup commercial * \ingroup commercial
* \brief File of class to manage agenda events (actions) * \brief File of class to manage agenda events (actions)
* \version $Id: actioncomm.class.php,v 1.41 2011/06/30 07:52:43 eldy Exp $ * \version $Id: actioncomm.class.php,v 1.42 2011/07/04 09:36:29 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php');
@ -391,8 +391,10 @@ class ActionComm extends CommonObject
/** /**
* Load all objects with filters * Load all objects with filters
* @param socid Filter by thirdparty * @param socid Filter by thirdparty
* @param filter Other filter * @param fk_element Id of element action is linked to
* @param elementtype Type of element action is linked to
* @param filter Other filter
*/ */
function getActions($socid=0, $fk_element=0, $elementtype='', $filter='') function getActions($socid=0, $fk_element=0, $elementtype='', $filter='')
{ {
@ -603,7 +605,7 @@ class ActionComm extends CommonObject
* Utilise $this->id, $this->code et $this->label * Utilise $this->id, $this->code et $this->label
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param maxlength Nombre de caracteres max dans libelle * @param maxlength Nombre de caracteres max dans libelle
* @param class Force style class on a link * @param classname Force style class on a link
* @param option ''=Link to action,'birthday'=Link to contact * @param option ''=Link to action,'birthday'=Link to contact
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */

View File

@ -27,7 +27,7 @@
* \file htdocs/comm/propal.php * \file htdocs/comm/propal.php
* \ingroup propale * \ingroup propale
* \brief Page of commercial proposals card and list * \brief Page of commercial proposals card and list
* \version $Id: propal.php,v 1.607 2011/07/02 16:48:32 eldy Exp $ * \version $Id: propal.php,v 1.608 2011/07/04 10:30:02 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -1805,13 +1805,13 @@ else
if ($month > 0) if ($month > 0)
{ {
if ($year > 0) if ($year > 0)
$sql.= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; $sql.= " AND date_format(p.datep, '%Y-%m') = '".$year."-".$month."'";
else else
$sql.= " AND date_format(p.datep, '%m') = '$month'"; $sql.= " AND date_format(p.datep, '%m') = '".$month."'";
} }
if ($year > 0) if ($year > 0)
{ {
$sql.= " AND date_format(p.datep, '%Y') = $year"; $sql.= " AND date_format(p.datep, '%Y') = '".$year."'";
} }
if (dol_strlen($_POST['sf_ref']) > 0) if (dol_strlen($_POST['sf_ref']) > 0)
{ {
@ -1975,6 +1975,6 @@ else
} }
$db->close(); $db->close();
llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.607 $'); llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.608 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/comm/propal/class/propalestats.class.php * \file htdocs/comm/propal/class/propalestats.class.php
* \ingroup propales * \ingroup propales
* \brief Fichier de la classe de gestion des stats des propales * \brief Fichier de la classe de gestion des stats des propales
* \version $Id$ * \version $Id: propalestats.class.php,v 1.5 2011/07/04 10:30:03 eldy Exp $
*/ */
include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php";
@ -91,7 +91,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(p.datep,'%m') as dm, count(*)"; $sql = "SELECT date_format(p.datep,'%m') as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.datep,'%Y') = ".$year; $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -127,7 +127,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.".$this->field.")"; $sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.datep,'%Y') = ".$year; $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -145,7 +145,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.".$this->field.")"; $sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(p.datep,'%Y') = ".$year; $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');

View File

@ -23,7 +23,7 @@
* \file htdocs/comm/propal/document.php * \file htdocs/comm/propal/document.php
* \ingroup propale * \ingroup propale
* \brief Page de gestion des documents attaches a une proposition commerciale * \brief Page de gestion des documents attaches a une proposition commerciale
* \version $Id$ * \version $Id: document.php,v 1.65 2011/07/05 16:10:56 hregis Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -35,14 +35,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load('compta'); $langs->load('compta');
$langs->load('other'); $langs->load('other');
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; $action = GETPOST('action');
$confirm = GETPOST('confirm');
$id = isset($_GET["id"])?$_GET["id"]:''; $id = GETPOST('id');
$ref = GETPOST('ref');
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
{ {
unset($_GET["action"]);
$action=''; $action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
@ -59,6 +59,7 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$object = new Propal($db);
/* /*
* Actions * Actions
@ -67,13 +68,11 @@ if (! $sortfield) $sortfield="name";
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); if ($object->fetch($id))
$propal = new Propal($db);
if ($propal->fetch($id))
{ {
$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref); $object->fetch_thirdparty();
$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref);
if (create_exdir($upload_dir) >= 0) if (create_exdir($upload_dir) >= 0)
{ {
@ -103,14 +102,13 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
} }
// Delete // Delete
if ($action=='delete') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
$propal = new Propal($db); if ($object->fetch($id))
$id=$_GET["id"];
if ($propal->fetch($id))
{ {
$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref); $object->fetch_thirdparty();
$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@ -126,19 +124,15 @@ llxHeader();
$html = new Form($db); $html = new Form($db);
$id = $_GET["id"];
$ref= $_GET["ref"];
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$propal = new Propal($db); if ($object->fetch($id,$ref))
if ($propal->fetch($id,$ref))
{ {
$upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($propal->ref); $object->fetch_thirdparty();
$societe = new Societe($db); $upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($object->ref);
$societe->fetch($propal->socid);
$head = propal_prepare_head($propal); $head = propal_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal');
@ -153,11 +147,11 @@ if ($id > 0 || ! empty($ref))
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
$linkback="<a href=\"".$_SERVER["PHP_SELF"]."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder\">".$langs->trans("BackToList")."</a>"; $linkback='<a href="'.$_SERVER["PHP_SELF"].'?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref',''); print $html->showrefnav($object,'ref',$linkback,1,'ref','ref','');
print '</td></tr>'; print '</td></tr>';
// Ref client // Ref client
@ -167,15 +161,13 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
print $propal->ref_client; print $object->ref_client;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Customer // Customer
if ( is_null($propal->client) )
$propal->fetch_thirdparty();
print "<tr><td>".$langs->trans("Company")."</td>"; print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$propal->client->getNomUrl(1).'</td></tr>'; print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
@ -184,16 +176,25 @@ if ($id > 0 || ! empty($ref))
print '</div>'; print '</div>';
if ($mesg) { print "$mesg<br>"; } dol_htmloutput_mesg($mesg,$mesgs);
/*
* Confirmation suppression fichier
*/
if ($action == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>';
}
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$propal->id,'',0,0,$user->rights->propale->creer); $formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer);
// List of document // List of document
$param='&id='.$propal->id; $param='&id='.$object->id;
$formfile->list_of_documents($filearray,$propal,'propal',$param); $formfile->list_of_documents($filearray,$object,'propal',$param);
} }
else else
@ -208,5 +209,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.65 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/comm/propal/index.php * \file htdocs/comm/propal/index.php
* \ingroup propal * \ingroup propal
* \brief Home page of proposal area * \brief Home page of proposal area
* \version $Id$ * \version $Id: index.php,v 1.6 2011/07/04 10:35:49 hregis Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -249,7 +249,7 @@ if ($resql)
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>'; print '</td></tr></table>';
@ -416,6 +416,6 @@ print '</td></tr></table>';
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:35:49 $ - $Revision: 1.6 $');
?> ?>

View File

@ -25,7 +25,7 @@
* \file htdocs/commande/class/commande.class.php * \file htdocs/commande/class/commande.class.php
* \ingroup commande * \ingroup commande
* \brief Fichier des classes de commandes * \brief Fichier des classes de commandes
* \version $Id: commande.class.php,v 1.116 2011/06/30 13:27:20 hregis Exp $ * \version $Id: commande.class.php,v 1.118 2011/07/04 10:35:49 hregis Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -177,7 +177,7 @@ class Commande extends CommonObject
function valid($user) function valid($user)
{ {
global $conf,$langs; global $conf,$langs;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$error=0; $error=0;
@ -239,7 +239,7 @@ class Commande extends CommonObject
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
// Loop on each line // Loop on each line
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
@ -258,6 +258,8 @@ class Commande extends CommonObject
if (! $error) if (! $error)
{ {
$this->oldref='';
// Rename directory if dir was a temporary ref // Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref)) if (preg_match('/^[\(]?PROV/i', $this->ref))
{ {
@ -273,6 +275,8 @@ class Commande extends CommonObject
if (@rename($dirsource, $dirdest)) if (@rename($dirsource, $dirdest))
{ {
$this->oldref = $comref;
dol_syslog("Rename ok"); dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep // Suppression ancien fichier PDF dans nouveau rep
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*'); dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*');
@ -347,7 +351,7 @@ class Commande extends CommonObject
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
{ {
@ -402,7 +406,7 @@ class Commande extends CommonObject
if ($this->statut != 3) if ($this->statut != 3)
{ {
return 0; return 0;
} }
$this->db->begin(); $this->db->begin();
@ -451,13 +455,13 @@ class Commande extends CommonObject
function cloture($user) function cloture($user)
{ {
global $conf; global $conf;
$error=0; $error=0;
if ($user->rights->commande->valider) if ($user->rights->commande->valider)
{ {
$this->db->begin(); $this->db->begin();
$now=dol_now(); $now=dol_now();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql.= ' SET fk_statut = 3,'; $sql.= ' SET fk_statut = 3,';
@ -476,21 +480,21 @@ class Commande extends CommonObject
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog($this->error, LOG_ERR); dol_syslog($this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
@ -523,7 +527,7 @@ class Commande extends CommonObject
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1)
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {
@ -570,9 +574,10 @@ class Commande extends CommonObject
/** /**
* Create order * Create order
* @param user Objet user that make creation * Note that this->ref can be set or empty. If empty, we will use "(PROV)"
* @return int <0 if KO, >0 if OK * @param user Objet user that make creation
* remarks this->ref can be set or empty. If empty, we will use "(PROV)" * @param notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
@ -694,7 +699,7 @@ class Commande extends CommonObject
{ {
if ($this->id) if ($this->id)
{ {
$this->ref="(PROV".$this->id.")"; $this->ref="(PROV".$this->id.")";
// Add linked object // Add linked object
if ($this->origin && $this->origin_id) if ($this->origin && $this->origin_id)
@ -825,23 +830,23 @@ class Commande extends CommonObject
if (! $error) if (! $error)
{ {
// Hook of thirdparty module // Hook of thirdparty module
if (! empty($object->hooks)) if (! empty($object->hooks))
{ {
foreach($object->hooks as $hook) foreach($object->hooks as $hook)
{ {
if (! empty($hook['modules'])) if (! empty($hook['modules']))
{ {
foreach($hook['modules'] as $module) foreach($hook['modules'] as $module)
{ {
if (method_exists($module,'createfrom')) if (method_exists($module,'createfrom'))
{ {
$result = $module->createfrom($objFrom,$result,$object->element); $result = $module->createfrom($objFrom,$result,$object->element);
if ($result < 0) $error++; if ($result < 0) $error++;
} }
} }
} }
} }
} }
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -865,103 +870,103 @@ class Commande extends CommonObject
} }
/** /**
* Load an object from a proposal and create a new order into database * Load an object from a proposal and create a new order into database
* @param object Object source * @param object Object source
* @param invertdetail Reverse sign of amounts for lines * @param invertdetail Reverse sign of amounts for lines
* @return int <0 if KO, 0 if nothing done, 1 if OK * @return int <0 if KO, 0 if nothing done, 1 if OK
*/ */
function createFromProposal($object,$invertdetail=0) function createFromProposal($object,$invertdetail=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
$error=0; $error=0;
// Signed proposal // Signed proposal
if ($object->statut == 2) if ($object->statut == 2)
{ {
$this->date_commande = dol_now(); $this->date_commande = dol_now();
$this->source = 0; $this->source = 0;
for ($i = 0 ; $i < sizeof($object->lines) ; $i++) for ($i = 0 ; $i < sizeof($object->lines) ; $i++)
{ {
$line = new OrderLine($this->db); $line = new OrderLine($this->db);
$line->libelle = $object->lines[$i]->libelle; $line->libelle = $object->lines[$i]->libelle;
$line->desc = $object->lines[$i]->desc; $line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price; $line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice; $line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx; $line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx; $line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx; $line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty; $line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except; $line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent; $line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product; $line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits; $line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type; $line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang; $line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code; $line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line; $line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$this->lines[$i] = $line; $this->lines[$i] = $line;
} }
$this->socid = $object->socid; $this->socid = $object->socid;
$this->fk_project = $object->fk_project; $this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id; $this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id;
$this->availability_id = $object->availability_id; $this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id; $this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison; $this->date_livraison = $object->date_livraison;
$this->fk_delivery_address = $object->fk_delivery_address; $this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid; $this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client; $this->ref_client = $object->ref_client;
$this->note = $object->note; $this->note = $object->note;
$this->note_public = $object->note_public; $this->note_public = $object->note_public;
$this->origin = $object->element; $this->origin = $object->element;
$this->origin_id = $object->id; $this->origin_id = $object->id;
$ret = $this->create($user); $ret = $this->create($user);
if ($ret > 0) if ($ret > 0)
{ {
// Hook of thirdparty module // Hook of thirdparty module
if (! empty($object->hooks)) if (! empty($object->hooks))
{ {
foreach($object->hooks as $hook) foreach($object->hooks as $hook)
{ {
if (! empty($hook['modules'])) if (! empty($hook['modules']))
{ {
foreach($hook['modules'] as $module) foreach($hook['modules'] as $module)
{ {
if (method_exists($module,'createfrom')) if (method_exists($module,'createfrom'))
{ {
$result = $module->createfrom($object,$ret,$this->element); $result = $module->createfrom($object,$ret,$this->element);
if ($result < 0) $error++; if ($result < 0) $error++;
} }
} }
} }
} }
} }
if (! $error) if (! $error)
{ {
// Ne pas passer par la commande provisoire // Ne pas passer par la commande provisoire
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1) if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
{ {
$this->fetch($ret); $this->fetch($ret);
$this->valid($user); $this->valid($user);
} }
return 1; return 1;
} }
else return -1; else return -1;
} }
else return -1; else return -1;
} }
else return 0; else return 0;
} }
/** /**
@ -998,13 +1003,13 @@ class Commande extends CommonObject
// Clean parameters // Clean parameters
if (empty($remise_percent)) $remise_percent=0; if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0; if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0; if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0; if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0; if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0; if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
$remise_percent=price2num($remise_percent); $remise_percent=price2num($remise_percent);
$qty=price2num($qty); $qty=price2num($qty);
@ -1124,12 +1129,12 @@ class Commande extends CommonObject
/** /**
* Add line into array * Add line into array
* $this->client doit etre charge * $this->client doit etre charge
* @param idproduct Id du produit a ajouter * @param idproduct Id du produit a ajouter
* @param qty Quantite * @param qty Quantite
* @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param remise_percent Remise relative effectuee sur le produit
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @remise_percent remise_percent Remise relative effectuee sur le produit * @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @return void * @return void
* TODO Remplacer les appels a cette fonction par generation objet Ligne * TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products * insere dans tableau $this->products
*/ */
@ -1202,7 +1207,7 @@ class Commande extends CommonObject
* @param id Id of object to load * @param id Id of object to load
* @param ref Ref of object * @param ref Ref of object
* @param ref_ext External reference of object * @param ref_ext External reference of object
* @param ref_int Internal reference of other object * @param ref_int Internal reference of other object
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function fetch($id, $ref='', $ref_ext='', $ref_int='') function fetch($id, $ref='', $ref_ext='', $ref_int='')
@ -1231,9 +1236,9 @@ class Commande extends CommonObject
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = c.rowid AND el.targettype = '".$this->element."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = c.rowid AND el.targettype = '".$this->element."'";
$sql.= " WHERE c.entity = ".$conf->entity; $sql.= " WHERE c.entity = ".$conf->entity;
if ($id) $sql.= " AND c.rowid=".$id; if ($id) $sql.= " AND c.rowid=".$id;
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG); dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
@ -1330,9 +1335,9 @@ class Commande extends CommonObject
/** /**
* \brief Ajout d'une ligne remise fixe dans la commande, en base * Ajout d'une ligne remise fixe dans la commande, en base
* \param idremise Id de la remise fixe * @param idremise Id de la remise fixe
* \return int >0 si ok, <0 si ko * @return int >0 si ok, <0 si ko
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@ -1405,9 +1410,9 @@ class Commande extends CommonObject
/** /**
* \brief Reinitialize array lignes * Load array lines
* \param only_product Return only physical products * @param only_product Return only physical products
* \return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_lines($only_product=0) function fetch_lines($only_product=0)
{ {
@ -1558,12 +1563,12 @@ class Commande extends CommonObject
*/ */
function nb_expedition() function nb_expedition()
{ {
$sql = 'SELECT count(*)'; $sql = 'SELECT count(*)';
$sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
$sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; $sql.= ', '.MAIN_DB_PREFIX.'element_element as el';
$sql.= ' WHERE el.fk_source = '.$this->id; $sql.= ' WHERE el.fk_source = '.$this->id;
$sql.= " AND el.fk_target = e.rowid"; $sql.= " AND el.fk_target = e.rowid";
$sql.= " AND el.targettype = 'shipping'"; $sql.= " AND el.targettype = 'shipping'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -1571,7 +1576,7 @@ class Commande extends CommonObject
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
return $row[0]; return $row[0];
} }
else dol_print_error($this->db); else dol_print_error($this->db);
} }
/** /**
@ -1588,10 +1593,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Renvoie un tableau avec les stocks restant par produit * Renvoie un tableau avec les stocks restant par produit
* \param filtre_statut Filtre sur statut * @param filtre_statut Filtre sur statut
* \return int 0 si OK, <0 si KO * @return int 0 si OK, <0 si KO
* \todo FONCTION NON FINIE A FINIR * TODO FONCTION NON FINIE A FINIR
*/ */
function stock_array($filtre_statut=-1) function stock_array($filtre_statut=-1)
{ {
@ -1625,9 +1630,9 @@ class Commande extends CommonObject
} }
/** /**
* \brief Supprime une ligne de la commande * Delete an order line
* \param idligne Id de la ligne a supprimer * @param lineid Id of line to delete
* \return int >0 si ok, 0 si rien a supprimer, <0 si ko * @return int >0 if OK, 0 if nothing to do, <0 if KO
*/ */
function deleteline($lineid) function deleteline($lineid)
{ {
@ -1700,10 +1705,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Applique une remise relative * Applique une remise relative
* \param user User qui positionne la remise * @param user User qui positionne la remise
* \param remise * @param remise
* \return int <0 si ko, >0 si ok * @return int <0 if KO, >0 if OK
*/ */
function set_remise($user, $remise) function set_remise($user, $remise)
{ {
@ -1733,10 +1738,10 @@ class Commande extends CommonObject
/** /**
* \brief Applique une remise absolue * Applique une remise absolue
* \param user User qui positionne la remise * @param user User qui positionne la remise
* \param remise * @param remise
* \return int <0 si ko, >0 si ok * @return int <0 if KO, >0 if OK
*/ */
function set_remise_absolue($user, $remise) function set_remise_absolue($user, $remise)
{ {
@ -1769,8 +1774,8 @@ class Commande extends CommonObject
/** /**
* Set the order date * Set the order date
* @param user Object user * @param user Object user making change
* @param date_livraison Date delivery * @param date Date
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_date($user, $date) function set_date($user, $date)
@ -1802,10 +1807,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Set the planned delivery date * Set the planned delivery date
* \param user Objet utilisateur qui modifie * @param user Objet utilisateur qui modifie
* \param date_livraison Date de livraison * @param date_livraison Date de livraison
* \return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function set_date_livraison($user, $date_livraison) function set_date_livraison($user, $date_livraison)
{ {
@ -1836,10 +1841,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Definit une adresse de livraison * Set address
* \param user Objet utilisateur qui modifie * @param user Object user making change
* \param adresse_livraison Adresse de livraison * @param fk_address Adress of delivery
* \return int <0 si ko, >0 si ok * @return int <0 ig KO, >0 if Ok
*/ */
function set_adresse_livraison($user, $fk_address) function set_adresse_livraison($user, $fk_address)
{ {
@ -1862,11 +1867,11 @@ class Commande extends CommonObject
} }
} }
/** /**
* \brief Set delivery * Set availability
* \param user Objet utilisateur qui modifie * @param user Object user making change
* \param delivery delai de livraison * @param id If of availability delay
* \return int <0 si ko, >0 si ok * @return int <0 if KO, >0 if OK
*/ */
function set_availability($user, $id) function set_availability($user, $id)
{ {
@ -1891,10 +1896,10 @@ class Commande extends CommonObject
} }
/** /**
* \brief Set source of demand * Set source of demand
* \param user Objet utilisateur qui modifie * @param user Object user making change
* \param delivery delai de livraison * @param id Id of source
* \return int <0 si ko, >0 si ok * @return int <0 if KO, >0 if OK
*/ */
function set_demand_reason($user, $id) function set_demand_reason($user, $id)
{ {
@ -1935,7 +1940,7 @@ class Commande extends CommonObject
$sql.= " WHERE c.entity = ".$conf->entity; $sql.= " WHERE c.entity = ".$conf->entity;
$sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.fk_soc = s.rowid";
if ($brouillon) $sql.= " AND c.fk_statut = 0"; if ($brouillon) $sql.= " AND c.fk_statut = 0";
if ($user) $sql.= " AND c.fk_user_author <> ".$user->id; if ($user) $sql.= " AND c.fk_user_author <> ".$user->id;
$sql .= " ORDER BY c.date_commande DESC"; $sql .= " ORDER BY c.date_commande DESC";
$result=$this->db->query($sql); $result=$this->db->query($sql);
@ -1963,9 +1968,9 @@ class Commande extends CommonObject
} }
/** /**
* \brief Change les conditions de reglement de la commande * Change les conditions de reglement de la commande
* \param cond_reglement_id Id de la nouvelle condition de reglement * @param cond_reglement_id Id de la nouvelle condition de reglement
* \return int >0 si ok, <0 si ko * @return int >0 if OK, <0 if KO
*/ */
function cond_reglement($cond_reglement_id) function cond_reglement($cond_reglement_id)
{ {
@ -2029,10 +2034,10 @@ class Commande extends CommonObject
} }
} }
/** /**
* \brief Change le delai de livraison * Change le delai de livraison
* \param mode Id du nouveau mode * @param availability_id Id du nouveau mode
* \return int >0 si ok, <0 si ko * @return int >0 if OK, <0 if KO
*/ */
function availability($availability_id) function availability($availability_id)
{ {
@ -2177,7 +2182,7 @@ class Commande extends CommonObject
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
{ {
global $conf; global $conf;
dol_syslog("CustomerOrder::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type"); dol_syslog("CustomerOrder::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type");
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
@ -2280,14 +2285,14 @@ class Commande extends CommonObject
/** /**
* \brief Delete the customer order * Delete the customer order
* \user User object * @param user User object
* \return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function delete($user) function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$err = 0; $err = 0;
@ -2380,9 +2385,9 @@ class Commande extends CommonObject
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* @param user Objet user * @param user Objet user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_board($user) function load_board($user)
{ {
@ -2515,10 +2520,12 @@ class Commande extends CommonObject
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* @param withpicto Add picto into link * @param withpicto Add picto into link
* @param option Where point the link * @param option Where point the link
* @return string String with URL * @param max Max length to show
* @param short Use short labels
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0) function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
{ {
@ -2887,9 +2894,9 @@ class OrderLine
$this->rang = $objp->rang; $this->rang = $objp->rang;
$this->ref = $objp->product_ref; // deprecated $this->ref = $objp->product_ref; // deprecated
$this->product_ref = $objp->product_ref; $this->product_ref = $objp->product_ref;
$this->libelle = $objp->product_libelle; // deprecated $this->libelle = $objp->product_libelle; // deprecated
$this->product_label = $objp->product_libelle; $this->product_label = $objp->product_libelle;
$this->product_desc = $objp->product_desc; $this->product_desc = $objp->product_desc;
$this->date_start = $this->db->jdate($objp->date_start); $this->date_start = $this->db->jdate($objp->date_start);
@ -2951,17 +2958,17 @@ class OrderLine
if (empty($this->localtax2_tx)) $this->localtax2_tx=0; if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0; if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0; if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->rang)) $this->rang=0; if (empty($this->rang)) $this->rang=0;
if (empty($this->remise)) $this->remise=0; if (empty($this->remise)) $this->remise=0;
if (empty($this->remise_percent)) $this->remise_percent=0; if (empty($this->remise_percent)) $this->remise_percent=0;
if (empty($this->info_bits)) $this->info_bits=0; if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0; if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
// Check parameters // Check parameters
if ($this->product_type < 0) return -1; if ($this->product_type < 0) return -1;
$this->db->begin(); $this->db->begin();
// Insertion dans base de la ligne // Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet'; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';

View File

@ -22,7 +22,7 @@
* \file htdocs/commande/class/commandestats.class.php * \file htdocs/commande/class/commandestats.class.php
* \ingroup commandes * \ingroup commandes
* \brief Fichier de la classe de gestion des stats des commandes * \brief Fichier de la classe de gestion des stats des commandes
* \version $Id$ * \version $Id: commandestats.class.php,v 1.5 2011/07/04 10:30:01 eldy Exp $
*/ */
include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php";
include_once DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php"; include_once DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php";
@ -102,7 +102,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb"; $sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -141,7 +141,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")"; $sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -161,7 +161,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")"; $sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -23,7 +23,7 @@
* \file htdocs/commande/document.php * \file htdocs/commande/document.php
* \ingroup order * \ingroup order
* \brief Page de gestion des documents attachees a une commande * \brief Page de gestion des documents attachees a une commande
* \version $Id$ * \version $Id: document.php,v 1.33 2011/07/05 16:10:56 hregis Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -32,20 +32,22 @@ require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php"); require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
if (!$user->rights->commande->lire) accessforbidden();
$langs->load('companies'); $langs->load('companies');
//$langs->load("bills");
$langs->load('other'); $langs->load('other');
$id=empty($_GET['id']) ? 0 : intVal($_GET['id']); $action = GETPOST('action');
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; $confirm = GETPOST('confirm');
$id = GETPOST('id');
$ref = GETPOST('ref');
// Security check // Security check
$socid=0; if ($user->societe_id)
$comid = isset($_GET["id"])?$_GET["id"]:''; {
if ($user->societe_id) $socid=$user->societe_id; $action='';
$result=restrictedArea($user,'commande',$comid,''); $socid = $user->societe_id;
}
$result=restrictedArea($user,'commande',$id,'');
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -59,13 +61,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$id = GETPOST('id','int'); $object = new Commande($db);
$ref= $_GET['ref'];
$commande = new Commande($db);
if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{
dol_print_error($db);
}
/* /*
@ -75,43 +71,51 @@ if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref); $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
if (create_exdir($upload_dir) >= 0) if (create_exdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{ {
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
} if (is_numeric($resupload) && $resupload > 0)
else
{
$langs->load("errors");
if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; $langs->load("errors");
} if ($resupload < 0) // Unknown error
else // Known error {
{ $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
}
else // Known error
{
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
}
} }
} }
} }
} }
// Delete // Delete
if ($action=='delete') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref); if ($object->fetch($id))
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). {
dol_delete_file($file); $object->fetch_thirdparty();
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
}
} }
@ -125,49 +129,62 @@ $html = new Form($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($commande->ref); if ($object->fetch($id, $ref))
{
$object->fetch_thirdparty();
$societe = new Societe($db); $upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
$societe->fetch($commande->socid);
$head = commande_prepare_head($commande); $head = commande_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order'); dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order');
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
$totalsize=0; $totalsize=0;
foreach($filearray as $key => $file) foreach($filearray as $key => $file)
{ {
$totalsize+=$file['size']; $totalsize+=$file['size'];
}
print '<table class="border"width="100%">';
// Ref
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $html->showrefnav($object,'ref','',1,'ref','ref');
print '</td></tr>';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print "</table>\n";
print "</div>\n";
dol_htmloutput_mesg($mesg,$mesgs);
/*
* Confirmation suppression fichier
*/
if ($action == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>';
}
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer);
// List of document
$param='&id='.$object->id;
$formfile->list_of_documents($filearray,$object,'commande',$param);
}
else
{
dol_print_error($db);
} }
print '<table class="border"width="100%">';
// Ref
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td></tr>';
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print "</table>\n";
print "</div>\n";
if ($mesg) { print $mesg."<br>"; }
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$commande->id,'',0,0,$user->rights->commande->creer);
// List of document
$param='&id='.$commande->id;
$formfile->list_of_documents($filearray,$commande,'commande',$param);
} }
else else
{ {
@ -176,5 +193,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.33 $');
?> ?>

View File

@ -23,7 +23,7 @@
* \file htdocs/commande/liste.php * \file htdocs/commande/liste.php
* \ingroup commande * \ingroup commande
* \brief Page to list orders * \brief Page to list orders
* \version $Id$ * \version $Id: liste.php,v 1.77 2011/07/04 10:30:02 eldy Exp $
*/ */
@ -115,19 +115,19 @@ if ($viewstatut <> '')
} }
if ($_GET['ordermonth'] > 0) if ($_GET['ordermonth'] > 0)
{ {
$sql.= " AND date_format(c.date_valid, '%Y-%m') = '$orderyear-$ordermonth'"; $sql.= " AND date_format(c.date_valid, '%Y-%m') = '".$orderyear."-".$ordermonth."'";
} }
if ($_GET['orderyear'] > 0) if ($_GET['orderyear'] > 0)
{ {
$sql.= " AND date_format(c.date_valid, '%Y') = $orderyear"; $sql.= " AND date_format(c.date_valid, '%Y') = '".$orderyear."'";
} }
if ($_GET['deliverymonth'] > 0) if ($_GET['deliverymonth'] > 0)
{ {
$sql.= " AND date_format(c.date_livraison, '%Y-%m') = '$deliveryyear-$deliverymonth'"; $sql.= " AND date_format(c.date_livraison, '%Y-%m') = '".$deliveryyear."-".$deliverymonth."'";
} }
if ($_GET['deliveryyear'] > 0) if ($_GET['deliveryyear'] > 0)
{ {
$sql.= " AND date_format(c.date_livraison, '%Y') = $deliveryyear"; $sql.= " AND date_format(c.date_livraison, '%Y') = '".$deliveryyear."'";
} }
if (!empty($snom)) if (!empty($snom))
{ {
@ -278,5 +278,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.77 $');
?> ?>

View File

@ -25,7 +25,7 @@
* \file htdocs/compta/bank/account.php * \file htdocs/compta/bank/account.php
* \ingroup banque * \ingroup banque
* \brief List of details of bank transactions for an account * \brief List of details of bank transactions for an account
* \version $Id$ * \version $Id: account.php,v 1.154 2011/07/04 11:33:22 eldy Exp $
*/ */
require("./pre.inc.php"); // We use pre.inc.php to have a dynamic menu require("./pre.inc.php"); // We use pre.inc.php to have a dynamic menu
@ -491,7 +491,7 @@ if ($account || $_GET["ref"])
if ($result) if ($result)
{ {
$now=dol_now(); $now=dol_now();
$nows=dol_date('Ymd',$now); $nows=dol_print_date($now,'%Y%m%d');
//$html->load_cache_types_paiements(); //$html->load_cache_types_paiements();
//$html->cache_types_paiements //$html->cache_types_paiements
@ -510,7 +510,7 @@ if ($account || $_GET["ref"])
$var=!$var; $var=!$var;
// Is it a transaction in future ? // Is it a transaction in future ?
$dos=dol_date('Ymd',$db->jdate($objp->do)); $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d');
//print "dos=".$dos." nows=".$nows; //print "dos=".$dos." nows=".$nows;
if ($dos > $nows && !$sep) // Yes, we show a subtotal if ($dos > $nows && !$sep) // Yes, we show a subtotal
{ {
@ -786,5 +786,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 11:33:22 $ - $Revision: 1.154 $');
?> ?>

View File

@ -24,7 +24,7 @@
* \file htdocs/compta/bank/class/account.class.php * \file htdocs/compta/bank/class/account.class.php
* \ingroup banque * \ingroup banque
* \brief File of class to manage bank accounts * \brief File of class to manage bank accounts
* \version $Id$ * \version $Id: account.class.php,v 1.32 2011/07/04 10:44:36 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -769,51 +769,54 @@ class Account extends CommonObject
} }
/** /**
* * @param rowid
* @param sign 1 or -1
*/ */
function datev_next($rowid) function datev_change($rowid,$sign=1)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET "; $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
$sql.= " datev = adddate(datev, interval 1 day)"; $resql = $this->db->query($sql);
$sql.= " WHERE rowid = ".$rowid; if ($resql)
{
$obj=$this->db->fetch_object($resql);
$newdate=$this->db->jdate($obj->datev)+(3600*24*$sign);
$result = $this->db->query($sql); $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
if ($result) $sql.= " datev = '".$this->db->idate($newdate)."'";
{ $sql.= " WHERE rowid = ".$rowid;
if ($this->db->affected_rows($result))
{ $result = $this->db->query($sql);
return 1; if ($result)
} {
} if ($this->db->affected_rows($result))
else {
{ return 1;
dol_print_error($this->db); }
return 0; }
else
{
dol_print_error($this->db);
return 0;
}
} }
else dol_print_error($this->db);
return 0;
} }
/** /**
* * @param rowid
*/
function datev_next($rowid)
{
return $this->datev_change($rowid,1);
}
/**
* @param rowid
*/ */
function datev_previous($rowid) function datev_previous($rowid)
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET "; return $this->datev_change($rowid,-1);
$sql.= " datev = adddate(datev, interval -1 day)";
$sql.= " WHERE rowid = ".$rowid;
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->affected_rows($result))
{
return 1;
}
}
else
{
dol_print_error($this->db);
return 0;
}
} }
/** /**
@ -1040,7 +1043,7 @@ class AccountLine extends CommonObject
/** /**
* Load into memory content of a bank transaction line * Load into memory content of a bank transaction line
* @param id Id of bank transaction to load * @param rowid Id of bank transaction to load
* @param ref Ref of bank transaction to load * @param ref Ref of bank transaction to load
* @param num External num to load (ex: num of transaction for paypal fee) * @param num External num to load (ex: num of transaction for paypal fee)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -1159,7 +1162,7 @@ class AccountLine extends CommonObject
* Update bank account record in database * Update bank account record in database
* @param user Object user making update * @param user Object user making update
* @param notrigger 0=Disable all triggers * @param notrigger 0=Disable all triggers
* @param int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user,$notrigger=0) function update($user,$notrigger=0)
{ {
@ -1192,7 +1195,7 @@ class AccountLine extends CommonObject
* Update conciliation field * Update conciliation field
* @param user Objet user making update * @param user Objet user making update
* @param cat Category id * @param cat Category id
* @param int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_conciliation($user,$cat) function update_conciliation($user,$cat)
{ {
@ -1237,8 +1240,8 @@ class AccountLine extends CommonObject
} }
/** /**
* Charge les informations d'ordre info dans l'objet facture * Charge les informations d'ordre info dans l'objet
* @param id Id de la facture a charger * @param rowid Id of object
*/ */
function info($rowid) function info($rowid)
{ {

View File

@ -23,7 +23,7 @@
* \file htdocs/compta/bank/pre.inc.php * \file htdocs/compta/bank/pre.inc.php
* \ingroup compta * \ingroup compta
* \brief Fichier gestionnaire du menu compta banque * \brief Fichier gestionnaire du menu compta banque
* \version $Id$ * \version $Id: pre.inc.php,v 1.51 2011/07/04 11:33:22 eldy Exp $
*/ */
require_once("../../main.inc.php"); require_once("../../main.inc.php");
@ -73,16 +73,11 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0
while ($i < $numr) while ($i < $numr)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$menu->add_submenu('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && ! $objp->clos) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != 2 && ! $objp->clos) // If not cash account and not closed and can be reconciliate
{ {
$menu->add_submenu('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }
/*
$menu->add_submenu("/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting"));
$menu->add_submenu("/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph"));
if ($objp->courant != 2) $menu->add_submenu("/compta/bank/releve.php?account=".$objp->rowid ,$langs->trans("AccountStatements"));
*/
$i++; $i++;
} }
} }

View File

@ -22,7 +22,7 @@
* \file htdocs/compta/bank/virement.php * \file htdocs/compta/bank/virement.php
* \ingroup banque * \ingroup banque
* \brief Page de saisie d'un virement * \brief Page de saisie d'un virement
* \version $Id$ * \version $Id: virement.php,v 1.48 2011/07/04 10:34:56 eldy Exp $
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -49,7 +49,7 @@ if ($_POST["action"] == 'add')
if (! $label) if (! $label)
{ {
$error=1; $error=1;
$mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"))."</div>"; $mesg.="<div class=\"error\">".$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description"))."</div>";
} }
if (! $amount) if (! $amount)
{ {
@ -138,9 +138,7 @@ $html=new Form($db);
print_fiche_titre($langs->trans("BankTransfer")); print_fiche_titre($langs->trans("BankTransfer"));
if ($mesg) { dol_htmloutput_mesg($mesg);
print "$mesg<br>";
}
print $langs->trans("TransferDesc"); print $langs->trans("TransferDesc");
print "<br><br>"; print "<br><br>";
@ -178,5 +176,5 @@ print "</form>";
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:34:56 $ - $Revision: 1.48 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/compta/deplacement/class/deplacementstats.class.php * \file htdocs/compta/deplacement/class/deplacementstats.class.php
* \ingroup factures * \ingroup factures
* \brief Fichier de la classe de gestion des stats des deplacement et notes de frais * \brief Fichier de la classe de gestion des stats des deplacement et notes de frais
* \version $Id$ * \version $Id: deplacementstats.class.php,v 1.5 2011/07/04 10:30:02 eldy Exp $
*/ */
include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php";
include_once DOL_DOCUMENT_ROOT . "/compta/deplacement/class/deplacement.class.php"; include_once DOL_DOCUMENT_ROOT . "/compta/deplacement/class/deplacement.class.php";
@ -117,7 +117,7 @@ class DeplacementStats extends Stats
{ {
$sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")"; $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(dated,'%Y') = ".$year; $sql.= " WHERE date_format(dated,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -136,7 +136,7 @@ class DeplacementStats extends Stats
{ {
$sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")"; $sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(dated,'%Y') = ".$year; $sql.= " WHERE date_format(dated,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');

View File

@ -28,7 +28,7 @@
* \file htdocs/compta/facture/class/facture.class.php * \file htdocs/compta/facture/class/facture.class.php
* \ingroup facture * \ingroup facture
* \brief Fichier de la classe des factures clients * \brief Fichier de la classe des factures clients
* \version $Id: facture.class.php,v 1.122 2011/06/30 13:27:20 hregis Exp $ * \version $Id: facture.class.php,v 1.123 2011/07/04 10:35:48 hregis Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -1664,6 +1664,8 @@ class Facture extends CommonObject
if (! $error) if (! $error)
{ {
$this->oldref = '';
// Rename directory if dir was a temporary ref // Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref)) if (preg_match('/^[\(]?PROV/i', $this->ref))
{ {
@ -1679,6 +1681,8 @@ class Facture extends CommonObject
if (@rename($dirsource, $dirdest)) if (@rename($dirsource, $dirdest))
{ {
$this->oldref = $facref;
dol_syslog("Rename ok"); dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep // Suppression ancien fichier PDF dans nouveau rep
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*'); dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*');
@ -1690,7 +1694,7 @@ class Facture extends CommonObject
// Set new ref and define current statut // Set new ref and define current statut
if (! $error) if (! $error)
{ {
$this->ref = $num; $this->ref = $num;
$this->facnumber=$num; $this->facnumber=$num;
$this->statut=1; $this->statut=1;
} }

View File

@ -22,7 +22,7 @@
* \file htdocs/compta/facture/class/facturestats.class.php * \file htdocs/compta/facture/class/facturestats.class.php
* \ingroup factures * \ingroup factures
* \brief Fichier de la classe de gestion des stats des factures * \brief Fichier de la classe de gestion des stats des factures
* \version $Id$ * \version $Id: facturestats.class.php,v 1.6 2011/07/04 10:30:01 eldy Exp $
*/ */
include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php";
include_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; include_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
@ -78,7 +78,7 @@ class FactureStats extends Stats
$this->where = " fk_statut > 0"; $this->where = " fk_statut > 0";
$this->where.= " AND entity = ".$conf->entity; $this->where.= " AND entity = ".$conf->entity;
if ($mode == 'customer') $this->where.=" AND (fk_statut != 3 OR close_code != 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons) if ($mode == 'customer') $this->where.=" AND (fk_statut <> 3 OR close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons)
if ($this->socid) if ($this->socid)
{ {
$this->where.=" AND fk_soc = ".$this->socid; $this->where.=" AND fk_soc = ".$this->socid;
@ -132,7 +132,7 @@ class FactureStats extends Stats
{ {
$sql = "SELECT date_format(datef,'%m') as dm, SUM(".$this->field.")"; $sql = "SELECT date_format(datef,'%m') as dm, SUM(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(datef,'%Y') = ".$year; $sql.= " WHERE date_format(datef,'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -23,7 +23,7 @@
* \file htdocs/compta/facture/document.php * \file htdocs/compta/facture/document.php
* \ingroup facture * \ingroup facture
* \brief Page for attached files on invoices * \brief Page for attached files on invoices
* \version $Id$ * \version $Id: document.php,v 1.43 2011/07/05 16:10:56 hregis Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -38,19 +38,19 @@ $langs->load('compta');
$langs->load('other'); $langs->load('other');
$langs->load("bills"); $langs->load("bills");
if (!$user->rights->facture->lire)
accessforbidden();
$facid=empty($_GET['facid']) ? 0 : intVal($_GET['facid']); $action = GETPOST('action');
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; $confirm = GETPOST('confirm');
$id = GETPOST('facid');
$ref = GETPOST('ref');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id)
{ {
unset($_GET["action"]);
$action=''; $action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result=restrictedArea($user,'facture',$id,'');
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -63,6 +63,8 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$object = new Facture($db);
/* /*
* Actions * Actions
@ -71,12 +73,11 @@ if (! $sortfield) $sortfield="name";
// Envoi fichier // Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); if ($object->fetch($id))
$facture = new Facture($db);
if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref); $object->fetch_thirdparty();
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
if (create_exdir($upload_dir) >= 0) if (create_exdir($upload_dir) >= 0)
{ {
@ -106,15 +107,13 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
} }
// Delete // Delete
if ($action=='delete') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); if ($object->fetch($id))
$facture = new Facture($db);
$facid=$_GET["id"];
if ($facture->fetch($facid))
{ {
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref); $object->fetch_thirdparty();
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file); dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@ -133,15 +132,13 @@ $id = $_GET['facid']?$_GET['facid']:$_GET['id'];
$ref= $_GET['ref']; $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$facture = new Facture($db); if ($object->fetch($id,$ref) > 0)
if ($facture->fetch($id,$ref) > 0)
{ {
$upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($facture->ref); $object->fetch_thirdparty();
$societe = new Societe($db); $upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($object->ref);
$societe->fetch($facture->socid);
$head = facture_prepare_head($facture); $head = facture_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill'); dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill');
@ -162,7 +159,7 @@ if ($id > 0 || ! empty($ref))
print '<td colspan="3">'; print '<td colspan="3">';
$morehtmlref=''; $morehtmlref='';
$discount=new DiscountAbsolute($db); $discount=new DiscountAbsolute($db);
$result=$discount->fetch(0,$facture->id); $result=$discount->fetch(0,$object->id);
if ($result > 0) if ($result > 0)
{ {
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
@ -171,28 +168,37 @@ if ($id > 0 || ! empty($ref))
{ {
dol_print_error('',$discount->error); dol_print_error('',$discount->error);
} }
print $html->showrefnav($facture,'ref','',1,'facnumber','ref',$morehtmlref); print $html->showrefnav($object,'ref','',1,'facnumber','ref',$morehtmlref);
print '</td></tr>'; print '</td></tr>';
// Company // Company
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
if ($mesg) { print $mesg."<br>"; } dol_htmloutput_mesg($mesg,$mesgs);
/*
* Confirmation suppression fichier
*/
if ($action == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>';
}
// Affiche formulaire upload // Affiche formulaire upload
$formfile=new FormFile($db); $formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$facture->id,'',0,0,$user->rights->facture->creer); $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer);
// List of document // List of document
$param='&facid='.$facture->id; $param='&facid='.$object->id;
$formfile->list_of_documents($filearray,$facture,'facture',$param); $formfile->list_of_documents($filearray,$object,'facture',$param);
} }
else else
@ -207,5 +213,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/05 16:10:56 $ - $Revision: 1.43 $');
?> ?>

View File

@ -24,7 +24,7 @@
* \file htdocs/compta/paiement.php * \file htdocs/compta/paiement.php
* \ingroup compta * \ingroup compta
* \brief Page to create a payment * \brief Page to create a payment
* \version $Id: paiement.php,v 1.108 2011/07/01 16:18:10 hregis Exp $ * \version $Id: paiement.php,v 1.109 2011/07/04 16:39:48 cdelambert Exp $
*/ */
require('../main.inc.php'); require('../main.inc.php');
@ -521,19 +521,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{ {
if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
{ {
print img_picto($langs->trans('AddRemind'),'rightarrow.png','id="calcRemind'.$i.'" onclick="calcRemind(\''.$i.'\');return false;"'); print img_picto($langs->trans('AddRemind'),'rightarrow.png','id="'.$objp->facid.'" "');
print '<script type="text/javascript" language="javascript">';
print 'amountInput.push(new Array("'.$namef.'","'.price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)).'","0"));'; // Push a new Array into the amountInput Array
print 'jQuery(document).ready(function () {';
print 'jQuery("#'.$namef.'").keyup(function() { changeAmount('.$i.'); });';
print '});</script>';
} }
print '<input id="'.$namef.'" type="text" size="8" name="'.$namef.'" value="'.$_POST[$namef].'">'; print '<input type=hidden name="'.$nameRemain.'" value="'.$remaintopay.'">';
print '<input type="text" size="8" name="'.$namef.'" value="'.$_POST[$namef].'">';
} }
else else
{ {
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled="true">'; print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled="true">';
print '<input id="'.$namef.'" type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">'; print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
} }
print "</td>"; print "</td>";
@ -682,5 +678,5 @@ if (! GETPOST('action'))
$db->close(); $db->close();
llxFooter('$Date: 2011/07/01 16:18:10 $ - $Revision: 1.108 $'); llxFooter('$Date: 2011/07/04 16:39:48 $ - $Revision: 1.109 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/compta/paiement/cheque/pre.inc.php * \file htdocs/compta/paiement/cheque/pre.inc.php
* \ingroup compta * \ingroup compta
* \brief Fichier gestionnaire du menu cheques * \brief Fichier gestionnaire du menu cheques
* \version $Id$ * \version $Id: pre.inc.php,v 1.19 2011/07/04 11:33:23 eldy Exp $
*/ */
require_once("../../../main.inc.php"); require_once("../../../main.inc.php");
@ -72,16 +72,11 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0
while ($i < $numr) while ($i < $numr)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$menu->add_submenu('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2) // If not cash account and can be reconciliate if ($objp->rappro && $objp->courant != 2) // If not cash account and can be reconciliate
{ {
$menu->add_submenu('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }
/*
$menu->add_submenu("/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting"));
$menu->add_submenu("/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph"));
if ($objp->courant != 2) $menu->add_submenu("/compta/bank/releve.php?account=".$objp->rowid ,$langs->trans("AccountStatements"));
*/
$i++; $i++;
} }
} }

View File

@ -25,7 +25,7 @@
* \file htdocs/compta/propal.php * \file htdocs/compta/propal.php
* \ingroup propale * \ingroup propale
* \brief Page liste des propales (vision compta) * \brief Page liste des propales (vision compta)
* \version $Id$ * \version $Id: propal.php,v 1.193 2011/07/04 10:30:00 eldy Exp $
*/ */
require('../main.inc.php'); require('../main.inc.php');
@ -561,11 +561,11 @@ else
if ($month > 0) if ($month > 0)
{ {
if ($year > 0) if ($year > 0)
$sql.= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; $sql.= " AND date_format(p.datep, '%Y-%m') = '".$year."-".$month."'";
else else
$sql.= " AND date_format(p.datep, '%m') = '$month'"; $sql.= " AND date_format(p.datep, '%m') = '".$month."'";
} }
if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = $year"; if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = '".$year."'";
if (!empty($_GET['search_ref'])) if (!empty($_GET['search_ref']))
{ {
$sql.= " AND p.ref LIKE '%".$db->escape($_GET['search_ref'])."%'"; $sql.= " AND p.ref LIKE '%".$db->escape($_GET['search_ref'])."%'";
@ -702,6 +702,6 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:30:00 $ - $Revision: 1.193 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/compta/sociales/index.php * \file htdocs/compta/sociales/index.php
* \ingroup tax * \ingroup tax
* \brief Page to list all social contributions * \brief Page to list all social contributions
* \version $Id$ * \version $Id: index.php,v 1.65 2011/07/04 10:30:01 eldy Exp $
*/ */
require('../../main.inc.php'); require('../../main.inc.php');
@ -86,8 +86,8 @@ if ($year > 0)
$sql .= " AND ("; $sql .= " AND (";
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql .= " (s.periode is not null and date_format(s.periode, '%Y') = ".$year.") "; $sql .= " (s.periode is not null and date_format(s.periode, '%Y') = '".$year."') ";
$sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = ".$year.")"; $sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = '".$year."')";
$sql .= ")"; $sql .= ")";
} }
if ($filtre) { if ($filtre) {
@ -229,5 +229,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:30:01 $ - $Revision: 1.65 $');
?> ?>

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/compta/stats/comp.php * \file htdocs/compta/stats/comp.php
* \ingroup commercial * \ingroup commercial
* \version $Id: comp.php,v 1.43 2011/06/29 11:22:36 eldy Exp $ * \version $Id: comp.php,v 1.44 2011/07/04 10:30:01 eldy Exp $
* TODO Remove or add page in menus * TODO Remove or add page in menus
*/ */
@ -47,8 +47,9 @@ function propals ($db, $year, $month)
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND p.fk_statut in (1,2,4)"; $sql.= " AND p.fk_statut in (1,2,4)";
$sql.= " AND date_format(p.datep, '%Y') = ".$year; // TODO Use between instead of date_format
$sql.= " AND round(date_format(p.datep, '%m')) = ".$month; $sql.= " AND date_format(p.datep, '%Y') = '".$year."'";
$sql.= " AND round(date_format(p.datep, '%m')) = '".$month."'";
$sql.= " ORDER BY p.fk_statut"; $sql.= " ORDER BY p.fk_statut";
$result = $db->query($sql); $result = $db->query($sql);
@ -121,7 +122,7 @@ function factures ($db, $year, $month, $paye)
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = ".$paye; if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = ".$paye;
$sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND date_format(f.datef, '%Y') = ".$year; $sql.= " AND date_format(f.datef, '%Y') = '".$year."'";
$sql.= " AND round(date_format(f.datef, '%m')) = ".$month; $sql.= " AND round(date_format(f.datef, '%m')) = ".$month;
$sql.= " ORDER BY f.datef DESC "; $sql.= " ORDER BY f.datef DESC ";
@ -271,7 +272,7 @@ function ppt ($db, $year, $socid)
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql.= " WHERE p.fk_statut in (1,2,4)"; $sql.= " WHERE p.fk_statut in (1,2,4)";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND date_format(p.datep,'%Y') = ".$year; $sql.= " AND date_format(p.datep,'%Y') = '".$year."'";
if ($socid) $sql.= " AND p.fk_soc = ".$socid; if ($socid) $sql.= " AND p.fk_soc = ".$socid;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
@ -284,7 +285,7 @@ function ppt ($db, $year, $socid)
$sql.= " WHERE f.fk_statut in (1,2)"; $sql.= " WHERE f.fk_statut in (1,2)";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = 1"; if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = 1";
$sql.= " AND date_format(f.datef,'%Y') = ".$year; $sql.= " AND date_format(f.datef,'%Y') = '".$year."'";
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
@ -350,5 +351,5 @@ if ($details == 1)
$db->close(); $db->close();
llxFooter('$Date: 2011/06/29 11:22:36 $ - $Revision: 1.43 $'); llxFooter('$Date: 2011/07/04 10:30:01 $ - $Revision: 1.44 $');
?> ?>

View File

@ -24,7 +24,7 @@
\file htdocs/compta/tva/quadri.php \file htdocs/compta/tva/quadri.php
\ingroup tax \ingroup tax
\brief Trimestrial page \brief Trimestrial page
\version $Id$ \version $Id: quadri.php,v 1.15 2011/07/04 10:30:00 eldy Exp $
\todo Deal with recurrent invoices as well \todo Deal with recurrent invoices as well
*/ */
@ -49,13 +49,12 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
/** /**
* Gets VAT to collect for the given month of the given year * Gets VAT to collect for the given month of the given year
*
* The function gets the VAT in split results, as the VAT declaration asks * The function gets the VAT in split results, as the VAT declaration asks
* to report the amounts for different VAT rates as different lines. * to report the amounts for different VAT rates as different lines.
* This function also accounts recurrent invoices * This function also accounts recurrent invoices
* @param object Database handler object * @param db Database handler
* @param integer Year * @param y Year
* @param integer Year quarter (1-4) * @param q Year quarter (1-4)
*/ */
function tva_coll($db,$y,$q) function tva_coll($db,$y,$q)
{ {
@ -71,9 +70,9 @@ function tva_coll($db,$y,$q)
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " AND f.fk_statut in (1,2)"; $sql.= " AND f.fk_statut in (1,2)";
$sql.= " AND f.rowid = d.fk_facture "; $sql.= " AND f.rowid = d.fk_facture ";
$sql.= " AND date_format(f.datef,'%Y') = ".$y; $sql.= " AND date_format(f.datef,'%Y') = '".$y."'";
$sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3); $sql.= " AND (round(date_format(f.datef,'%m') > ".(($q-1)*3);
$sql.= " AND date_format(f.datef,'%m') <= ".($q*3).")"; $sql.= " AND round(date_format(f.datef,'%m')) <= ".($q*3).")";
$sql.= " ORDER BY rate, facid"; $sql.= " ORDER BY rate, facid";
} }
@ -116,12 +115,11 @@ function tva_coll($db,$y,$q)
/** /**
* Gets VAT to pay for the given month of the given year * Gets VAT to pay for the given month of the given year
*
* The function gets the VAT in split results, as the VAT declaration asks * The function gets the VAT in split results, as the VAT declaration asks
* to report the amounts for different VAT rates as different lines. * to report the amounts for different VAT rates as different lines.
* @param object Database handler object * @param object Database handler object
* @param integer Year * @param y Year
* @param integer Year quarter (1-4) * @param q Year quarter (1-4)
*/ */
function tva_paye($db, $y,$q) function tva_paye($db, $y,$q)
{ {
@ -138,9 +136,9 @@ function tva_paye($db, $y,$q)
$sql.= " AND s.entity = ".$conf->entity; $sql.= " AND s.entity = ".$conf->entity;
$sql.= " AND f.fk_statut = 1 "; $sql.= " AND f.fk_statut = 1 ";
$sql.= " AND f.rowid = d.fk_facture_fourn "; $sql.= " AND f.rowid = d.fk_facture_fourn ";
$sql.= " AND date_format(f.datef,'%Y') = ".$y; $sql.= " AND date_format(f.datef,'%Y') = '".$y."'";
$sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3); $sql.= " AND (round(date_format(f.datef,'%m')) > ".(($q-1)*3);
$sql.= " AND date_format(f.datef,'%m') <= ".($q*3).")"; $sql.= " AND round(date_format(f.datef,'%m')) <= ".($q*3).")";
$sql.= " ORDER BY rate, facid "; $sql.= " ORDER BY rate, facid ";
} }
else else
@ -317,5 +315,5 @@ echo '</table>';
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:30:00 $ - $Revision: 1.15 $');
?> ?>

View File

@ -25,7 +25,7 @@
* \file htdocs/contact/class/contact.class.php * \file htdocs/contact/class/contact.class.php
* \ingroup societe * \ingroup societe
* \brief File of contacts class * \brief File of contacts class
* \version $Id$ * \version $Id: contact.class.php,v 1.30 2011/07/04 09:36:29 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -83,7 +83,6 @@ class Contact extends CommonObject
/** /**
* Constructor of class Contact * Constructor of class Contact
* @param DB Habler d'acces base * @param DB Habler d'acces base
* @param id Id contact
*/ */
function Contact($DB) function Contact($DB)
{ {
@ -583,7 +582,7 @@ class Contact extends CommonObject
} }
/* /**
* \brief Charge le nombre d'elements auquel est lie ce contact * \brief Charge le nombre d'elements auquel est lie ce contact
* ref_facturation * ref_facturation
* ref_contrat * ref_contrat
@ -626,9 +625,10 @@ class Contact extends CommonObject
} }
} }
/* /**
* \brief Efface le contact de la base * Efface le contact de la base
* \return int <0 si ko, >0 si ok * @param notrigger Disable all trigger
* @return int <0 if KO, >0 if OK
*/ */
function delete($notrigger=0) function delete($notrigger=0)
{ {

View File

@ -24,7 +24,7 @@
* \file htdocs/contact/fiche.php * \file htdocs/contact/fiche.php
* \ingroup societe * \ingroup societe
* \brief Card of a contact * \brief Card of a contact
* \version $Id: fiche.php,v 1.220 2011/07/02 14:53:42 eldy Exp $ * \version $Id: fiche.php,v 1.221 2011/07/04 08:00:52 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -123,7 +123,14 @@ if (method_exists($objcanvas->control,'doActions'))
if (empty($reshook)) if (empty($reshook))
{ {
// Creation utilisateur depuis contact // Cancel
if (GETPOST("cancel") && GETPOST('backtopage'))
{
header("Location: ".GETPOST('backtopage'));
exit;
}
// Creation utilisateur depuis contact
if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer) if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer)
{ {
// Recuperation contact actuel // Recuperation contact actuel
@ -162,13 +169,6 @@ if (empty($reshook))
} }
} }
// Cancel
if (GETPOST("cancel") && GETPOST('backtopage'))
{
header("Location: ".GETPOST('backtopage'));
exit;
}
// Add contact // Add contact
if (GETPOST("action") == 'add' && $user->rights->societe->contact->creer) if (GETPOST("action") == 'add' && $user->rights->societe->contact->creer)
{ {
@ -974,5 +974,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/02 14:53:42 $ - $Revision: 1.220 $'); llxFooter('$Date: 2011/07/04 08:00:52 $ - $Revision: 1.221 $');
?> ?>

View File

@ -119,50 +119,57 @@ class UploadHandler
private function create_scaled_image($file_name, $options) { private function create_scaled_image($file_name, $options) {
$file_path = $this->options['upload_dir'].$file_name; $file_path = $this->options['upload_dir'].$file_name;
$new_file_path = $options['upload_dir'].$file_name; $new_file_path = $options['upload_dir'].$file_name;
list($img_width, $img_height) = @getimagesize($file_path); if (create_exdir($options['upload_dir']) >= 0)
if (!$img_width || !$img_height) { {
return false; list($img_width, $img_height) = @getimagesize($file_path);
if (!$img_width || !$img_height) {
return false;
}
$scale = min(
$options['max_width'] / $img_width,
$options['max_height'] / $img_height
);
if ($scale > 1) {
$scale = 1;
}
$new_width = $img_width * $scale;
$new_height = $img_height * $scale;
$new_img = @imagecreatetruecolor($new_width, $new_height);
switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
case 'jpg':
case 'jpeg':
$src_img = @imagecreatefromjpeg($file_path);
$write_image = 'imagejpeg';
break;
case 'gif':
$src_img = @imagecreatefromgif($file_path);
$write_image = 'imagegif';
break;
case 'png':
$src_img = @imagecreatefrompng($file_path);
$write_image = 'imagepng';
break;
default:
$src_img = $image_method = null;
}
$success = $src_img && @imagecopyresampled(
$new_img,
$src_img,
0, 0, 0, 0,
$new_width,
$new_height,
$img_width,
$img_height
) && $write_image($new_img, $new_file_path);
// Free up memory (imagedestroy does not delete files):
@imagedestroy($src_img);
@imagedestroy($new_img);
return $success;
} }
$scale = min( else
$options['max_width'] / $img_width, {
$options['max_height'] / $img_height return false;
);
if ($scale > 1) {
$scale = 1;
} }
$new_width = $img_width * $scale;
$new_height = $img_height * $scale;
$new_img = @imagecreatetruecolor($new_width, $new_height);
switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
case 'jpg':
case 'jpeg':
$src_img = @imagecreatefromjpeg($file_path);
$write_image = 'imagejpeg';
break;
case 'gif':
$src_img = @imagecreatefromgif($file_path);
$write_image = 'imagegif';
break;
case 'png':
$src_img = @imagecreatefrompng($file_path);
$write_image = 'imagepng';
break;
default:
$src_img = $image_method = null;
}
$success = $src_img && @imagecopyresampled(
$new_img,
$src_img,
0, 0, 0, 0,
$new_width,
$new_height,
$img_width,
$img_height
) && $write_image($new_img, $new_file_path);
// Free up memory (imagedestroy does not delete files):
@imagedestroy($src_img);
@imagedestroy($new_img);
return $success;
} }
private function has_error($uploaded_file, $file, $error) { private function has_error($uploaded_file, $file, $error) {
@ -202,7 +209,7 @@ class UploadHandler
$file->size = intval($size); $file->size = intval($size);
$file->type = $type; $file->type = $type;
$error = $this->has_error($uploaded_file, $file, $error); $error = $this->has_error($uploaded_file, $file, $error);
if (!$error && $file->name) { if (!$error && $file->name && create_exdir($this->options['upload_dir']) >= 0) {
if ($file->name[0] === '.') { if ($file->name[0] === '.') {
$file->name = substr($file->name, 1); $file->name = substr($file->name, 1);
} }

View File

@ -22,7 +22,7 @@
* \file htdocs/core/class/commonobject.class.php * \file htdocs/core/class/commonobject.class.php
* \ingroup core * \ingroup core
* \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...) * \brief File of parent class of all other business classes (invoices, contracts, proposals, orders, ...)
* \version $Id: commonobject.class.php,v 1.143 2011/07/01 23:05:39 eldy Exp $ * \version $Id: commonobject.class.php,v 1.144 2011/07/04 09:36:29 eldy Exp $
*/ */
@ -78,11 +78,12 @@ class CommonObject
} }
/** /**
* \brief Add a link between element $this->element and a contact * Add a link between element $this->element and a contact
* \param fk_socpeople Id of contact to link * @param fk_socpeople Id of contact to link
* \param type_contact Type of contact (code or id) * @param type_contact Type of contact (code or id)
* \param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* \return int <0 if KO, >0 if OK * @param notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
*/ */
function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0)
{ {
@ -168,11 +169,11 @@ class CommonObject
} }
/** /**
* \brief Update a link to contact line * Update a link to contact line
* \param rowid Id of line contact-element * @param rowid Id of line contact-element
* \param statut New status of link * @param statut New status of link
* \param type_contact_id Id of contact type * @param type_contact_id Id of contact type
* \return int <0 if KO, >= 0 if OK * @return int <0 if KO, >= 0 if OK
*/ */
function update_contact($rowid, $statut, $type_contact_id) function update_contact($rowid, $statut, $type_contact_id)
{ {
@ -194,9 +195,10 @@ class CommonObject
} }
/** /**
* \brief Delete a link to contact line * Delete a link to contact line
* \param rowid Id of link line to delete * @param rowid Id of contact link line to delete
* \return statur >0 si ok, <0 si ko * @param notrigger Disable all triggers
* @return int >0 if OK, <0 if KO
*/ */
function delete_contact($rowid,$notrigger=0) function delete_contact($rowid,$notrigger=0)
{ {
@ -1321,8 +1323,8 @@ class CommonObject
/** /**
* Set statut of an object * Set statut of an object
* @param statut Statut to set * @param statut Statut to set
* @param elementid Id of element to force (use this->id by default) * @param elementId Id of element to force (use this->id by default)
* @param elementtype Type of element to force (use ->this->element by default) * @param elementType Type of element to force (use ->this->element by default)
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
function setStatut($statut,$elementId='',$elementType='') function setStatut($statut,$elementId='',$elementType='')
@ -1664,6 +1666,8 @@ class CommonObject
* TODO Edit templates to use global variables and include them directly in controller call * TODO Edit templates to use global variables and include them directly in controller call
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
* @param $dateSelector 1=Show also date range input fields * @param $dateSelector 1=Show also date range input fields
* @param $seller Object thirdparty who sell
* @param $buyer Object thirdparty who buy
*/ */
function formAddPredefinedProduct($dateSelector,$seller,$buyer) function formAddPredefinedProduct($dateSelector,$seller,$buyer)
{ {
@ -1699,10 +1703,11 @@ class CommonObject
* TODO Move this into an output class file (htmlline.class.php) * TODO Move this into an output class file (htmlline.class.php)
* If lines are into a template, title must also be into a template * If lines are into a template, title must also be into a template
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
* @param $seller Object of seller third party * @param $action Action code
* @param $buyer Object of buyer third party * @param $seller Object of seller third party
* @param $selected Object line selected * @param $buyer Object of buyer third party
* @param $dateSelector 1=Show also date range input fields * @param $selected Object line selected
* @param $dateSelector 1=Show also date range input fields
*/ */
function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0) function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0)
{ {

View File

@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php * \file htdocs/core/class/html.form.class.php
* \ingroup core * \ingroup core
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.184 2011/06/29 15:48:03 grandoc Exp $ * \version $Id: html.form.class.php,v 1.186 2011/07/04 11:33:22 eldy Exp $
*/ */
@ -134,15 +134,6 @@ class Form
return $ret; return $ret;
} }
/**
* Old version of textwithtooltip. Kept for backward compatibility with modules for 2.6.
* @deprecated
*/
function textwithhelp($text,$htmltext,$tooltipon=1)
{
return $this->textwithtooltip($text,$htmltext,$tooltipon);
}
/** /**
* Show a text and picto with tooltip on text or picto * Show a text and picto with tooltip on text or picto
* @param text Text to show * @param text Text to show
@ -163,19 +154,14 @@ class Form
if ($incbefore) $text = $incbefore.$text; if ($incbefore) $text = $incbefore.$text;
if (! $htmltext) return $text; if (! $htmltext) return $text;
$paramfortooltip ='';
// Sanitize tooltip // Sanitize tooltip
$htmltext=str_replace("\\","\\\\",$htmltext); $htmltext=str_replace("\\","\\\\",$htmltext);
//$htmltext=str_replace("'","\'",$htmltext);
//$htmltext=str_replace("&#039;","\'",$htmltext);
$htmltext=str_replace("\r","",$htmltext); $htmltext=str_replace("\r","",$htmltext);
$htmltext=str_replace("<br>\n","<br>",$htmltext);
$htmltext=str_replace("\n","",$htmltext); $htmltext=str_replace("\n","",$htmltext);
$htmltext=str_replace('"',"&quot;",$htmltext); $htmltext=str_replace('"',"&quot;",$htmltext);
$extracss = (!empty($extracss) ? ' '.$extracss : ''); $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.dol_escape_htmltag($htmltext,1).'"'; // Attribut to put on td img tag to store tooltip
$paramfortooltip.=' class="classfortooltip'.$extracss.'" title="'.$htmltext.'"'; // Attribut to put on td tag to store tooltip $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
$s=""; $s="";
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>'; if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
@ -183,18 +169,18 @@ class Form
{ {
if ($text != '') if ($text != '')
{ {
$s.='<td'.$paramfortooltip.'>'.$text; $s.='<td'.$paramfortooltiptd.'>'.$text;
if ($direction) $s.='&nbsp;'; if ($direction) $s.='&nbsp;';
$s.='</td>'; $s.='</td>';
} }
if ($direction) $s.='<td'.$paramfortooltip.' valign="top" width="14">'.$img.'</td>'; if ($direction) $s.='<td'.$paramfortooltipimg.' valign="top" width="14">'.$img.'</td>';
} }
else else
{ {
if ($direction) $s.='<td'.$paramfortooltip.' valign="top" width="14">'.$img.'</td>'; if ($direction) $s.='<td'.$paramfortooltipimg.' valign="top" width="14">'.$img.'</td>';
if ($text != '') if ($text != '')
{ {
$s.='<td'.$paramfortooltip.'>'; $s.='<td'.$paramfortooltiptd.'>';
if ($direction) $s.='&nbsp;'; if ($direction) $s.='&nbsp;';
$s.=$text.'</td>'; $s.=$text.'</td>';
} }
@ -210,6 +196,7 @@ class Form
* @param htmltooltip Content of tooltip * @param htmltooltip Content of tooltip
* @param direction 1=Icon is after text, -1=Icon is before text * @param direction 1=Icon is after text, -1=Icon is before text
* @param type Type of picto (info, help, warning, superadmin...) * @param type Type of picto (info, help, warning, superadmin...)
* @param extracss Add a CSS style to td tags
* @return string HTML code of text, picto, tooltip * @return string HTML code of text, picto, tooltip
*/ */
function textwithpicto($text,$htmltext,$direction=1,$type='help',$extracss='') function textwithpicto($text,$htmltext,$direction=1,$type='help',$extracss='')

View File

@ -22,7 +22,7 @@
* \file htdocs/core/class/html.formfile.class.php * \file htdocs/core/class/html.formfile.class.php
* \ingroup core * \ingroup core
* \brief File of class to offer components to list and upload files * \brief File of class to offer components to list and upload files
* \version $Id: html.formfile.class.php,v 1.37 2011/07/03 15:04:18 hregis Exp $ * \version $Id: html.formfile.class.php,v 1.38 2011/07/05 09:14:27 hregis Exp $
*/ */
@ -739,12 +739,27 @@ class FormFile
{ {
global $langs; global $langs;
// PHP post_max_size
$post_max_size = ini_get('post_max_size');
$mul_post_max_size = substr($post_max_size, -1);
$mul_post_max_size = ($mul_post_max_size == 'M' ? 1048576 : ($mul_post_max_size == 'K' ? 1024 : ($mul_post_max_size == 'G' ? 1073741824 : 1)));
$post_max_size = $mul_post_max_size*(int)$post_max_size;
// PHP upload_max_filesize
$upload_max_filesize = ini_get('upload_max_filesize');
$mul_upload_max_filesize = substr($upload_max_filesize, -1);
$mul_upload_max_filesize = ($mul_upload_max_filesize == 'M' ? 1048576 : ($mul_upload_max_filesize == 'K' ? 1024 : ($mul_upload_max_filesize == 'G' ? 1073741824 : 1)));
$upload_max_filesize = $mul_upload_max_filesize*(int)$upload_max_filesize;
// Max file size
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
print '<script type="text/javascript"> print '<script type="text/javascript">
$(function () { $(function () {
\'use strict\'; \'use strict\';
var max_file_size = \''.$max_file_size.'\';
// Initialize the jQuery File Upload widget: // Initialize the jQuery File Upload widget:
$("#fileupload").fileupload(); $("#fileupload").fileupload( { maxFileSize: max_file_size} );
// Load existing files: // Load existing files:
$.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'"}, function (files) { $.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'"}, function (files) {

View File

@ -29,7 +29,7 @@
* \file htdocs/core/class/html.formother.class.php * \file htdocs/core/class/html.formother.class.php
* \ingroup core * \ingroup core
* \brief Fichier de la classe des fonctions predefinie de composants html autre * \brief Fichier de la classe des fonctions predefinie de composants html autre
* \version $Id: html.formother.class.php,v 1.16 2011/06/26 09:32:13 hregis Exp $ * \version $Id: html.formother.class.php,v 1.17 2011/07/04 08:53:01 eldy Exp $
*/ */
@ -653,7 +653,8 @@ class FormOther
* @param $parent * @param $parent
* @param $lines * @param $lines
* @param $level * @param $level
* @param $selected * @param $selectedtask
* @param $selectedproject
*/ */
function PLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0) function PLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0)
{ {

View File

@ -21,7 +21,7 @@
* \file htdocs/core/class/menu.class.php * \file htdocs/core/class/menu.class.php
* \ingroup core * \ingroup core
* \brief Fichier de la classe de gestion du menu gauche * \brief Fichier de la classe de gestion du menu gauche
* \version $Id$ * \version $Id: menu.class.php,v 1.4 2011/07/04 11:33:22 eldy Exp $
*/ */
@ -76,18 +76,4 @@ class Menu {
if (sizeof($this->liste) > 1) array_pop($this->liste); if (sizeof($this->liste) > 1) array_pop($this->liste);
} }
/**
* \brief Add a menu entry
* \param url Url to follown on click
* \param titre Menu label to show
* \param level Level of menu to show (0=First level, 1=Second...)
* \param enabled Menu active or not
* \param target Target lien
* \deprecated
*/
function add_submenu($url, $titre, $level=1, $enabled=1, $target='')
{
$this->add($url, $titre, $level, $enabled, $target);
}
} }

View File

@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id: ajaxfileupload.tpl.php,v 1.4 2011/07/03 14:43:12 hregis Exp $ * $Id: ajaxfileupload.tpl.php,v 1.6 2011/07/05 09:30:11 hregis Exp $
*/ */
?> ?>
@ -26,8 +26,8 @@
<td class="preview"></td> <td class="preview"></td>
<td class="size">${sizef}</td> <td class="size">${sizef}</td>
{{if error}} {{if error}}
<td class="error" colspan="2">Error: <td class="error" colspan="2"><?php echo $langs->trans('Error'); ?>:
{{if error === 'maxFileSize'}}File is too big {{if error === 'maxFileSize'}}<?php echo $langs->trans('FileIsTooBig'); ?>
{{else error === 'minFileSize'}}File is too small {{else error === 'minFileSize'}}File is too small
{{else error === 'acceptFileTypes'}}Filetype not allowed {{else error === 'acceptFileTypes'}}Filetype not allowed
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded {{else error === 'maxNumberOfFiles'}}Max number of files exceeded
@ -36,9 +36,9 @@
</td> </td>
{{else}} {{else}}
<td class="progress"><div></div></td> <td class="progress"><div></div></td>
<td class="start"><button><?php echo $langs->trans('Start'); ?></button></td> <td align="right" class="start"><button><?php echo $langs->trans('Start'); ?></button></td>
{{/if}} {{/if}}
<td class="cancel"><button><?php echo $langs->trans('Cancel'); ?></button></td> <td align="right" class="cancel"><button><?php echo $langs->trans('Cancel'); ?></button></td>
</tr> </tr>
</script> </script>
@ -48,7 +48,7 @@
<td></td> <td></td>
<td class="name">${name}</td> <td class="name">${name}</td>
<td class="size">${sizef}</td> <td class="size">${sizef}</td>
<td class="error" colspan="2">Error: <td class="error" colspan="2"><?php echo $langs->trans('Error'); ?>:
{{if error === 1}}File exceeds upload_max_filesize (php.ini directive) {{if error === 1}}File exceeds upload_max_filesize (php.ini directive)
{{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive) {{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive)
{{else error === 3}}File was only partially uploaded {{else error === 3}}File was only partially uploaded
@ -56,7 +56,7 @@
{{else error === 5}}Missing a temporary folder {{else error === 5}}Missing a temporary folder
{{else error === 6}}Failed to write file to disk {{else error === 6}}Failed to write file to disk
{{else error === 7}}File upload stopped by extension {{else error === 7}}File upload stopped by extension
{{else error === 'maxFileSize'}}File is too big {{else error === 'maxFileSize'}}<?php echo $langs->trans('FileIsTooBig'); ?>
{{else error === 'minFileSize'}}File is too small {{else error === 'minFileSize'}}File is too small
{{else error === 'acceptFileTypes'}}Filetype not allowed {{else error === 'acceptFileTypes'}}Filetype not allowed
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded {{else error === 'maxNumberOfFiles'}}Max number of files exceeded

View File

@ -21,7 +21,7 @@
* \file htdocs/expedition/class/expeditionstats.class.php * \file htdocs/expedition/class/expeditionstats.class.php
* \ingroup expedition * \ingroup expedition
* \brief Fichier des classes expedition * \brief Fichier des classes expedition
* \version $Id$ * \version $Id: expeditionstats.class.php,v 1.4 2011/07/04 10:30:01 eldy Exp $
*/ */
/** /**
@ -78,7 +78,7 @@ class ExpeditionStats
$result = array(); $result = array();
$sql = "SELECT count(*), date_format(date_expedition,'%m') as dm"; $sql = "SELECT count(*), date_format(date_expedition,'%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition";
$sql.= " WHERE date_format(date_expedition,'%Y') = ".$year; $sql.= " WHERE date_format(date_expedition,'%Y') = '".$year."'";
$sql.= " AND fk_statut > 0"; $sql.= " AND fk_statut > 0";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " GROUP BY dm DESC"; $sql.= " GROUP BY dm DESC";

View File

@ -25,7 +25,7 @@
* \file htdocs/fourn/class/fournisseur.commande.class.php * \file htdocs/fourn/class/fournisseur.commande.class.php
* \ingroup fournisseur,commande * \ingroup fournisseur,commande
* \brief File of class to manage suppliers orders * \brief File of class to manage suppliers orders
* \version $Id$ * \version $Id: fournisseur.commande.class.php,v 1.47 2011/07/04 09:36:29 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -49,27 +49,27 @@ class CommandeFournisseur extends Commande
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $ref; // TODO deprecated var $ref; // TODO deprecated
var $product_ref; var $product_ref;
var $ref_supplier; var $ref_supplier;
var $brouillon; var $brouillon;
var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
// -> 7=Canceled/Never received -> (reopen) 3=Process runing // -> 7=Canceled/Never received -> (reopen) 3=Process runing
// -> 6=Canceled -> (reopen) 2=Approved // -> 6=Canceled -> (reopen) 2=Approved
// -> 9=Refused -> (reopen) 1=Validated // -> 9=Refused -> (reopen) 1=Validated
var $socid; var $socid;
var $fourn_id; var $fourn_id;
var $date; var $date;
var $date_commande; var $date_commande;
var $total_ht; var $total_ht;
var $total_tva; var $total_tva;
var $total_localtax1; // Total Local tax 1 var $total_localtax1; // Total Local tax 1
var $total_localtax2; // Total Local tax 2 var $total_localtax2; // Total Local tax 2
var $total_ttc; var $total_ttc;
var $source; var $source;
var $note; var $note;
var $note_public; var $note_public;
var $model_pdf; var $model_pdf;
var $fk_project; var $fk_project;
var $cond_reglement_id; var $cond_reglement_id;
var $cond_reglement_code; var $cond_reglement_code;
var $mode_reglement_id; var $mode_reglement_id;
@ -247,7 +247,7 @@ class CommandeFournisseur extends Commande
* @param user User making action * @param user User making action
* @param statut Status of order * @param statut Status of order
* @param datelog Date of change * @param datelog Date of change
* @param comment Comment * @param comment Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function log($user, $statut, $datelog, $comment='') function log($user, $statut, $datelog, $comment='')
@ -278,7 +278,7 @@ class CommandeFournisseur extends Commande
function valid($user) function valid($user)
{ {
global $langs,$conf; global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$error=0; $error=0;
@ -479,18 +479,18 @@ class CommandeFournisseur extends Commande
global $langs; global $langs;
$langs->load('orders'); $langs->load('orders');
// List of language codes for status // List of language codes for status
$statutshort[0] = 'StatusOrderDraftShort'; $statutshort[0] = 'StatusOrderDraftShort';
$statutshort[1] = 'StatusOrderValidatedShort'; $statutshort[1] = 'StatusOrderValidatedShort';
$statutshort[2] = 'StatusOrderApprovedShort'; $statutshort[2] = 'StatusOrderApprovedShort';
$statutshort[3] = 'StatusOrderOnProcessShort'; $statutshort[3] = 'StatusOrderOnProcessShort';
$statutshort[4] = 'StatusOrderReceivedPartiallyShort'; $statutshort[4] = 'StatusOrderReceivedPartiallyShort';
$statutshort[5] = 'StatusOrderReceivedAllShort'; $statutshort[5] = 'StatusOrderReceivedAllShort';
$statutshort[6] = 'StatusOrderCanceledShort'; $statutshort[6] = 'StatusOrderCanceledShort';
$statutshort[7] = 'StatusOrderCanceledShort'; $statutshort[7] = 'StatusOrderCanceledShort';
$statutshort[9] = 'StatusOrderRefusedShort'; $statutshort[9] = 'StatusOrderRefusedShort';
if ($mode == 0) if ($mode == 0)
{ {
return $langs->trans($this->statuts[$statut]); return $langs->trans($this->statuts[$statut]);
} }
@ -618,6 +618,7 @@ class CommandeFournisseur extends Commande
/** /**
* Accept an order * Accept an order
* @param user Object user * @param user Object user
* @return int <0 if KO, >0 if OK
*/ */
function approve($user) function approve($user)
{ {
@ -647,7 +648,7 @@ class CommandeFournisseur extends Commande
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
{ {
// Product with reference // Product with reference
if ($this->lines[$i]->fk_product > 0) if ($this->lines[$i]->fk_product > 0)
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We decrement stock of product (and sub-products) // We decrement stock of product (and sub-products)
@ -739,9 +740,9 @@ class CommandeFournisseur extends Commande
} }
/** /**
* Cancel an approved order * Cancel an approved order.
* L'annulation se fait apres l'approbation
* @param user User making action * @param user User making action
* @remarks L'annulation se fait apres l'approbation
*/ */
function Cancel($user) function Cancel($user)
{ {
@ -800,6 +801,11 @@ class CommandeFournisseur extends Commande
/** /**
* Send a supplier order to supplier * Send a supplier order to supplier
* @param user User making change
* @param date Date
* @param methode Method
* @param comment Comment
* @return int <0 if KO, >0 if OK
*/ */
function commande($user, $date, $methode, $comment='') function commande($user, $date, $methode, $comment='')
{ {
@ -912,14 +918,14 @@ class CommandeFournisseur extends Commande
/** /**
* Add order line * Add order line
* @param desc Description * @param desc Description
* @param pu Unit price * @param pu_ht Unit price
* @param qty Quantity * @param qty Quantity
* @param txtva Taux tva * @param txtva Taux tva
* @param txlocaltax1 Localtax1 tax * @param txlocaltax1 Localtax1 tax
* @param txlocaltax2 Localtax2 tax * @param txlocaltax2 Localtax2 tax
* @param fk_product Id produit * @param fk_product Id produit
* @param fk_prod_fourn_price Id supplier price * @param fk_prod_fourn_price Id supplier price
* @param fournref Supplier reference * @param fourn_ref Supplier reference
* @param remise_percent Remise * @param remise_percent Remise
* @param price_base_type HT or TTC * @param price_base_type HT or TTC
* @param pu_ttc Unit price TTC * @param pu_ttc Unit price TTC
@ -1117,13 +1123,13 @@ class CommandeFournisseur extends Commande
$mouv = new MouvementStock($this->db); $mouv = new MouvementStock($this->db);
if ($product > 0) if ($product > 0)
{ {
$result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment); $result=$mouv->reception($user, $product, $entrepot, $qty, $price, $comment);
if ($result < 0) if ($result < 0)
{ {
$this->error=$mouv->error; $this->error=$mouv->error;
dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR); dol_syslog("CommandeFournisseur::DispatchProduct ".$this->error, LOG_ERR);
$error++; $error++;
} }
} }
$i++; $i++;
} }
@ -1159,15 +1165,15 @@ class CommandeFournisseur extends Commande
dol_syslog("Fournisseur.commande.class::deleteline sql=".$sql); dol_syslog("Fournisseur.commande.class::deleteline sql=".$sql);
if ($resql) if ($resql)
{ {
$result=$this->update_price(); $result=$this->update_price();
return 0; return 0;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
} }
else else
{ {
@ -1176,8 +1182,8 @@ class CommandeFournisseur extends Commande
} }
/** /**
* \brief Delete an order * Delete an order
* \return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete() function delete()
{ {
@ -1229,8 +1235,7 @@ class CommandeFournisseur extends Commande
} }
/** /**
* * Return list of order methods
*
*/ */
function get_methodes_commande() function get_methodes_commande()
{ {
@ -1295,8 +1300,8 @@ class CommandeFournisseur extends Commande
/** /**
* Change le mode de reglement * Change le mode de reglement
* @param mode Id du nouveau mode * @param mode_reglement_id Id du nouveau mode
* @return int >0 si ok, <0 si ko * @return int >0 if OK, <0 if KO
*/ */
function mode_reglement($mode_reglement_id) function mode_reglement($mode_reglement_id)
{ {
@ -1331,6 +1336,7 @@ class CommandeFournisseur extends Commande
* @param user User that input data * @param user User that input data
* @param date Date of reception * @param date Date of reception
* @param type Type of receipt * @param type Type of receipt
* @param comment Comment
*/ */
function Livraison($user, $date, $type, $comment) function Livraison($user, $date, $type, $comment)
{ {
@ -1388,7 +1394,8 @@ class CommandeFournisseur extends Commande
/** /**
* Cree la commande depuis une propale existante * Cree la commande depuis une propale existante
* @param user Utilisateur qui cree * @param user Utilisateur qui cree
* @param propale_id id de la propale qui sert de modele * @param idc Id de la propale qui sert de modele
* @param comclientid Id thirdparty
*/ */
function updateFromCommandeClient($user, $idc, $comclientid) function updateFromCommandeClient($user, $idc, $comclientid)
{ {
@ -1425,8 +1432,12 @@ class CommandeFournisseur extends Commande
/** /**
* Met a jour les notes * Update notes
* @return int <0 si ko, >=0 si ok * @param user
* @param note
* @param note_public
* @return int <0 if KO, >=0 if OK
* TODO Use instead update_note_public and update_note
*/ */
function UpdateNote($user, $note, $note_public) function UpdateNote($user, $note, $note_public)
{ {
@ -1457,10 +1468,8 @@ class CommandeFournisseur extends Commande
return $result ; return $result ;
} }
/* /**
* * Get list of user that can approve an order
*
*
*/ */
function ReadApprobators() function ReadApprobators()
{ {
@ -1500,6 +1509,7 @@ class CommandeFournisseur extends Commande
/** /**
* Tag order with a particular status * Tag order with a particular status
* @param user Object user that change status * @param user Object user that change status
* @param status New status
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setStatus($user,$status) function setStatus($user,$status)
@ -1688,7 +1698,7 @@ class CommandeFournisseur extends Commande
$this->specimen=1; $this->specimen=1;
$this->socid = 1; $this->socid = 1;
$this->date = time(); $this->date = time();
$this->date_commande = time(); $this->date_commande = time();
$this->date_lim_reglement=$this->date+3600*24*30; $this->date_lim_reglement=$this->date+3600*24*30;
$this->cond_reglement_code = 'RECEP'; $this->cond_reglement_code = 'RECEP';
$this->mode_reglement_code = 'CHQ'; $this->mode_reglement_code = 'CHQ';
@ -1703,14 +1713,14 @@ class CommandeFournisseur extends Commande
$line->desc=$langs->trans("Description")." ".$xnbp; $line->desc=$langs->trans("Description")." ".$xnbp;
$line->qty=1; $line->qty=1;
$line->subprice=100; $line->subprice=100;
$line->price=100; $line->price=100;
$line->tva_tx=19.6; $line->tva_tx=19.6;
$line->localtax1_tx=0; $line->localtax1_tx=0;
$line->localtax2_tx=0; $line->localtax2_tx=0;
$line->remise_percent=10; $line->remise_percent=10;
$line->total_ht=90; $line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196 $line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64; $line->total_tva=17.64;
$line->ref_fourn='SUPPLIER_REF_'.$xnbp; $line->ref_fourn='SUPPLIER_REF_'.$xnbp;
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid]; $line->fk_product=$prodids[$prodid];
@ -1726,48 +1736,48 @@ class CommandeFournisseur extends Commande
$this->total_ttc = $xnbp*119.6; $this->total_ttc = $xnbp*119.6;
} }
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* @param user Objet user * @param user Objet user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_board($user) function load_board($user)
{ {
global $conf, $user; global $conf, $user;
$now=gmmktime(); $now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut"; $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id; $sql.= " WHERE sc.fk_user = " .$user->id;
$clause = " AND"; $clause = " AND";
} }
$sql.= $clause." c.entity = ".$conf->entity; $sql.= $clause." c.entity = ".$conf->entity;
$sql.= " AND (c.fk_statut BETWEEN 1 AND 2)"; $sql.= " AND (c.fk_statut BETWEEN 1 AND 2)";
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id; if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $this->nbtodo++;
if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; if ($obj->fk_statut != 3 && $this->db->jdate($obj->datec) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++;
} }
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
} }
} }

View File

@ -21,7 +21,7 @@
* \file htdocs/imports/import.php * \file htdocs/imports/import.php
* \ingroup import * \ingroup import
* \brief Pages of import Wizard * \brief Pages of import Wizard
* \version $Id$ * \version $Id: import.php,v 1.67 2011/07/04 11:33:23 eldy Exp $
*/ */
require_once("../main.inc.php"); require_once("../main.inc.php");
@ -195,8 +195,8 @@ if ($step == 3 && $datatoimport)
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
create_exdir($conf->import->dir_temp); dol_mkdir($conf->import->dir_temp);
$nowyearmonth=dol_date('YmdHis',dol_now(),0); $nowyearmonth=dol_print_date(dol_now(),'%Y%m%d%H%M%S');
$fullpath=$conf->import->dir_temp . "/" . $nowyearmonth . '-'.$_FILES['userfile']['name']; $fullpath=$conf->import->dir_temp . "/" . $nowyearmonth . '-'.$_FILES['userfile']['name'];
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath,1) > 0) if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath,1) > 0)
@ -1669,7 +1669,7 @@ print '<br>';
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 11:33:23 $ - $Revision: 1.67 $');
/* /*
@ -1729,8 +1729,8 @@ function show_elem($fieldssource,$i,$pos,$key,$var,$nostyle='')
/** /**
* Return not used field number * Return not used field number
* * @param $fieldssource
* @param $listofkey * @param $listofkey
* @return * @return
*/ */
function getnewkey(&$fieldssource,&$listofkey) function getnewkey(&$fieldssource,&$listofkey)

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/includes/menus/standard/eldy.lib.php * \file htdocs/includes/menus/standard/eldy.lib.php
* \brief Library for file eldy menus * \brief Library for file eldy menus
* \version $Id: eldy.lib.php,v 1.54 2011/07/03 16:00:18 eldy Exp $ * \version $Id: eldy.lib.php,v 1.55 2011/07/04 11:33:22 eldy Exp $
*/ */
@ -1012,13 +1012,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
{ {
$newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire); $newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire);
$newmenu->add_submenu("/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$newmenu->add_submenu("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
$newmenu->add_submenu("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add_submenu("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
$newmenu->add_submenu("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer); $newmenu->add("/compta/bank/virement.php",$langs->trans("BankTransfers"),1,$user->rights->banque->transfer);
} }
// Prelevements // Prelevements

View File

@ -26,7 +26,7 @@
* \ingroup commande * \ingroup commande
* \brief Fichier contenant la classe mere de generation des commandes en PDF * \brief Fichier contenant la classe mere de generation des commandes en PDF
* et la classe mere de numerotation des commandes * et la classe mere de numerotation des commandes
* \version $Id$ * \version $Id: modules_commande.php,v 1.47 2011/07/04 10:35:49 hregis Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -146,7 +146,7 @@ class ModeleNumRefCommandes
*/ */
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$langs; global $conf,$user,$langs;
$langs->load("orders"); $langs->load("orders");
$dir = "/includes/modules/commande/"; $dir = "/includes/modules/commande/";
@ -198,6 +198,14 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
$outputlangs->charset_output=$sav_charset_output; $outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
commande_delete_preview($db, $object->id); commande_delete_preview($db, $object->id);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1; return 1;
} }
else else

View File

@ -25,7 +25,7 @@
* \ingroup facture * \ingroup facture
* \brief Fichier contenant la classe mere de generation des factures en PDF * \brief Fichier contenant la classe mere de generation des factures en PDF
* et la classe mere de numerotation des factures * et la classe mere de numerotation des factures
* \version $Id$ * \version $Id: modules_facture.php,v 1.92 2011/07/04 10:35:48 hregis Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -147,7 +147,8 @@ class ModeleNumRefFactures
*/ */
function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$langs; global $conf,$user,$langs;
$langs->load("bills"); $langs->load("bills");
// Increase limit for PDF build // Increase limit for PDF build
@ -218,6 +219,14 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide
facture_delete_preview($db, $object->id); facture_delete_preview($db, $object->id);
$outputlangs->charset_output=$sav_charset_output; $outputlangs->charset_output=$sav_charset_output;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1; return 1;
} }
else else

View File

@ -24,7 +24,7 @@
* \file htdocs/includes/modules/member/cards/modules_cards.php * \file htdocs/includes/modules/member/cards/modules_cards.php
* \ingroup member * \ingroup member
* \brief File of parent class of document generator for members cards. * \brief File of parent class of document generator for members cards.
* \version $Id$ * \version $Id: modules_cards.php,v 1.10 2011/07/04 08:53:01 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -61,13 +61,12 @@ class ModelePDFCards
/** /**
* \brief Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF * Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF
* \param db objet base de donnee * @param db Database handler
* \param id id de la facture a creer * @param arrayofmembers Array of members
* \param message message * @param modele Force modele to use ('' to not force)
* \param modele force le modele a utiliser ('' to not force) * @param outputlangs Objet langs to use for translation
* \param outputlangs objet lang a utiliser pour traduction * @return int <0 if KO, >0 if OK
* \return int <0 if KO, >0 if OK
*/ */
function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs) function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
{ {

View File

@ -24,7 +24,7 @@
* \ingroup propale * \ingroup propale
* \brief Fichier contenant la classe mere de generation des propales en PDF * \brief Fichier contenant la classe mere de generation des propales en PDF
* et la classe mere de numerotation des propales * et la classe mere de numerotation des propales
* \version $Id$ * \version $Id: modules_propale.php,v 1.62 2011/07/04 10:35:49 hregis Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -132,10 +132,10 @@ class ModeleNumRefPropales
/** /**
* Cree une propale sur disque en fonction du modele de PROPALE_ADDON_PDF * Cree une propale sur disque en fonction du modele de PROPALE_ADDON_PDF
* @param db objet base de donnee * @param db Database handler
* @param id id de la propale a creer * @param object Object proposal
* @param modele force le modele a utiliser ('' to not force) * @param modele Force model to use ('' to not force)
* @param outputlangs objet lang a utiliser pour traduction * @param outputlangs Object langs to use for output
* @param hidedetails Hide details of lines * @param hidedetails Hide details of lines
* @param hidedesc Hide description * @param hidedesc Hide description
* @param hideref Hide ref * @param hideref Hide ref
@ -143,7 +143,7 @@ class ModeleNumRefPropales
*/ */
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$langs; global $conf,$user,$langs;
$langs->load("propale"); $langs->load("propale");
$dir = "/includes/modules/propale/"; $dir = "/includes/modules/propale/";
@ -197,6 +197,14 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
$outputlangs->charset_output=$sav_charset_output; $outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview // on supprime l'image correspondant au preview
propale_delete_preview($db, $object->id); propale_delete_preview($db, $object->id);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('PROPAL_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1; return 1;
} }
else else

View File

@ -28,7 +28,7 @@
* - Le nom de la classe doit etre InterfaceMytrigger * - Le nom de la classe doit etre InterfaceMytrigger
* - Le nom de la methode constructeur doit etre InterfaceMytrigger * - Le nom de la methode constructeur doit etre InterfaceMytrigger
* - Le nom de la propriete name doit etre Mytrigger * - Le nom de la propriete name doit etre Mytrigger
* \version $Id$ * \version $Id: interface_all_Demo.class.php-NORUN,v 1.27 2011/07/05 16:10:56 hregis Exp $
*/ */
@ -225,6 +225,10 @@ class InterfaceDemo
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} }
elseif ($action == 'ORDER_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SENTBYMAIL') elseif ($action == 'ORDER_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -269,6 +273,10 @@ class InterfaceDemo
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} }
elseif ($action == 'PROPAL_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_SENTBYMAIL') elseif ($action == 'PROPAL_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -341,6 +349,10 @@ class InterfaceDemo
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} }
elseif ($action == 'BILL_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SENTBYMAIL') elseif ($action == 'BILL_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -490,6 +502,16 @@ class InterfaceDemo
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} }
elseif ($action == 'SHIPPINGL_DELETE') elseif ($action == 'SHIPPINGL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// File
elseif ($action == 'FILE_UPLOAD')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'FILE_DELETE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} }

View File

@ -17,10 +17,10 @@
*/ */
/** /**
* \file /paypal/inc/triggers/interface_modPaypal_PaypalWorkflow.class.php * \file /htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php
* \ingroup paypal * \ingroup paypal
* \brief Trigger file for paypal workflow * \brief Trigger file for paypal workflow
* \version $Id$ * \version $Id: interface_modPaypal_PaypalWorkflow.class.php,v 1.6 2011/07/04 08:38:51 eldy Exp $
*/ */

View File

@ -307,7 +307,7 @@ ConnectionTimeout=Timeout de connexió
ResponseTimeout=Timeout de resposta ResponseTimeout=Timeout de resposta
SmsTestMessage=Missatge de prova de __PHONEFROM__ per __PHONETO__ SmsTestMessage=Missatge de prova de __PHONEFROM__ per __PHONETO__
ModuleMustBeEnabledFirst=Per utilitzar aquesta funció ha d'estar activat el mòdul <b>%s</b>. ModuleMustBeEnabledFirst=Per utilitzar aquesta funció ha d'estar activat el mòdul <b>%s</b>.
SecurityToken=Token de seguretat SecurityToken=Clau per encriptar urls
# Modules # Modules
Module0Name=Usuaris y grups Module0Name=Usuaris y grups
Module0Desc=Gestió d'usuaris i grups Module0Desc=Gestió d'usuaris i grups

View File

@ -18,7 +18,7 @@ BoxLastContracts=Últims contractes
BoxLastContacts=Últims contactes/adreçes BoxLastContacts=Últims contactes/adreçes
BoxLastMembers=Últims membres modificats BoxLastMembers=Últims membres modificats
BoxCurrentAccounts=Saldos comptes corrents BoxCurrentAccounts=Saldos comptes corrents
BoxSalesTurnover=Volum de negoci BoxSalesTurnover=Volum de vendes
BoxTotalUnpaidCustomerBills=Total factures a clients pendents de cobrament BoxTotalUnpaidCustomerBills=Total factures a clients pendents de cobrament
BoxTotalUnpaidSuppliersBills=Total factures de proveïdors pendents de pagament BoxTotalUnpaidSuppliersBills=Total factures de proveïdors pendents de pagament
BoxTitleLastBooks=Els %s darrers marcadors registrats BoxTitleLastBooks=Els %s darrers marcadors registrats
@ -40,7 +40,7 @@ BoxTitleLastProductsInContract=Els %s darrers productes/serveis contractats
BoxTitleOldestUnpaidCustomerBills=Les %s factures més antigues a clients pendents de cobrament BoxTitleOldestUnpaidCustomerBills=Les %s factures més antigues a clients pendents de cobrament
BoxTitleOldestUnpaidSupplierBills=Les %s factures més antigues de proveïdors pendents de pagament BoxTitleOldestUnpaidSupplierBills=Les %s factures més antigues de proveïdors pendents de pagament
BoxTitleCurrentAccounts=Saldos dels comptes corrents BoxTitleCurrentAccounts=Saldos dels comptes corrents
BoxTitleSalesTurnover=Volum de negoci realitzat BoxTitleSalesTurnover=Volum de vendes realitzades
BoxTitleTotalUnpaidCustomerBills=Pendent de clients BoxTitleTotalUnpaidCustomerBills=Pendent de clients
BoxTitleTotalUnpaidSuppliersBills=Pendent a proveïdors BoxTitleTotalUnpaidSuppliersBills=Pendent a proveïdors
BoxTitleLastModifiedContacts=Els últims %s contactes/adreçes modificades BoxTitleLastModifiedContacts=Els últims %s contactes/adreçes modificades

View File

@ -81,7 +81,7 @@ ActionAC_SUP_ORD=Enviament comanda a proveïdor per correu
ActionAC_SUP_INV=Enviament factura de proveïdor per correu ActionAC_SUP_INV=Enviament factura de proveïdor per correu
ActionAC_OTH=Altra ActionAC_OTH=Altra
Stats=Estadístiques de venda Stats=Estadístiques de venda
CAOrder=Volum de negocis (Comandes validades) CAOrder=Volum de vendes (Comandes validades)
FromTo=de %s a %s FromTo=de %s a %s
MargeOrder=Marges (Comandes validades) MargeOrder=Marges (Comandes validades)
RecapAnnee=Recapitulació de l'any RecapAnnee=Recapitulació de l'any

View File

@ -20,7 +20,7 @@ BillsForSuppliers=Factures de proveïdors
Income=Ingressos Income=Ingressos
Outcome=Despeses Outcome=Despeses
ReportInOut=Resultat / Exercici ReportInOut=Resultat / Exercici
ReportTurnover=Volum de negoci ReportTurnover=Volum de vendes
PaymentsNotLinkedToInvoice=Pagaments vinculats a cap factura, per la qual cosa sense tercer PaymentsNotLinkedToInvoice=Pagaments vinculats a cap factura, per la qual cosa sense tercer
PaymentsNotLinkedToUser=Pagaments no vinculats a un usuari PaymentsNotLinkedToUser=Pagaments no vinculats a un usuari
Profit=Benefici Profit=Benefici
@ -73,12 +73,12 @@ AlreadyPaid=Ja pagat
AccountNumberShort=Nº de compte AccountNumberShort=Nº de compte
AccountNumber=Número de compte AccountNumber=Número de compte
NewAccount=Nou compte NewAccount=Nou compte
SalesTurnover=Volum de negoci SalesTurnover=Volum de vendes
ByThirdParties=Per tercer ByThirdParties=Per tercer
ByUserAuthorOfInvoice=Per autor de la factura ByUserAuthorOfInvoice=Per autor de la factura
AccountancyExport=Exportació comptabilitat AccountancyExport=Exportació comptabilitat
ErrorWrongAccountancyCodeForCompany=Codi comptable incorrecte per a %s ErrorWrongAccountancyCodeForCompany=Codi comptable incorrecte per a %s
SuppliersProductsSellSalesTurnover=Volum de negoci generat per la venda dels productes dels proveïdors SuppliersProductsSellSalesTurnover=Volum de vendes generat per la venda dels productes dels proveïdors
CheckReceipt=Llista de remeses CheckReceipt=Llista de remeses
CheckReceiptShort=Remeses CheckReceiptShort=Remeses
NewCheckReceipt=Nova remesa NewCheckReceipt=Nova remesa

View File

@ -298,7 +298,7 @@ VAT=IVA
VATRate=Taxa IVA VATRate=Taxa IVA
Average=Mitja Average=Mitja
Sum=Suma Sum=Suma
Delta=Divergència Delta=Diferència
Module=Mòdul Module=Mòdul
Option=Opció Option=Opció
List=Llistat List=Llistat

View File

@ -109,7 +109,9 @@ ValidateMember=Validar un membre
ConfirmValidateMember=Esteu segur de voler validar a aquest membre? ConfirmValidateMember=Esteu segur de voler validar a aquest membre?
FollowingLinksArePublic=Els enllaços següents són pàgines accessibles a tothom i no protegides per cap habilitació Dolibarr. FollowingLinksArePublic=Els enllaços següents són pàgines accessibles a tothom i no protegides per cap habilitació Dolibarr.
PublicMemberList=Llistat públic de membres PublicMemberList=Llistat públic de membres
BlankSubscriptionForm=Formulari d'inscripció BlankSubscriptionForm=Formulari públic d'auto-inscripció
BlankSubscriptionFormDesc=Dolibarr pot proporcionar una URL de pàgina pública perquè els visitants externs demanin afiliar-se. Si es troba actiu un mòdul de pagament en línia, es proposarà automàticament un formulari de pagament.
EnablePublicSubscriptionForm=Activar el formulari públic d'auto-inscripció
MemberPublicLinks=Links/pàgines públiques MemberPublicLinks=Links/pàgines públiques
ExportDataset_member_1=Membres i afiliacions ExportDataset_member_1=Membres i afiliacions
ImportDataset_member_1=Membres ImportDataset_member_1=Membres
@ -165,8 +167,8 @@ SubscriptionPayment=Pagament quota
LastSubscriptionDate=Data de l'última cotització LastSubscriptionDate=Data de l'última cotització
LastSubscriptionAmount=Import de l'última cotització LastSubscriptionAmount=Import de l'última cotització
MembersStatisticsByCountries=Estadístiques de membres per país MembersStatisticsByCountries=Estadístiques de membres per país
MembersStatisticsByState=Estadístiques de membres per departament/província/regió
MembersStatisticsByState=Estadístiques de membres per població MembersStatisticsByState=Estadístiques de membres per població
MembersStatisticsByTown=Estadístiques de membres per població
NbOfMembers=Nombre de membres NbOfMembers=Nombre de membres
NoValidatedMemberYet=Cap membre validat trobat NoValidatedMemberYet=Cap membre validat trobat
MembersByCountryDesc=Aquesta pantalla presenta una estadística del nombre de membres per país. No obstant això, el gràfic utilitza el servei en línia de gràfics de Google i només és operatiu quan es troba disponible una connexió a Internet. MembersByCountryDesc=Aquesta pantalla presenta una estadística del nombre de membres per país. No obstant això, el gràfic utilitza el servei en línia de gràfics de Google i només és operatiu quan es troba disponible una connexió a Internet.
@ -183,4 +185,7 @@ NewMemberForm=Formulari d'inscripció
SubscriptionsStatistics=Estadístiques de cotitzacions SubscriptionsStatistics=Estadístiques de cotitzacions
NbOfSubscriptions=Nombre de cotitzacions NbOfSubscriptions=Nombre de cotitzacions
AmountOfSubscriptions=Import de cotitzacions AmountOfSubscriptions=Import de cotitzacions
TurnoverOrBudget=Volum de negoci (empresa) o Pressupost (associació o col.lectiu) TurnoverOrBudget=Volum de vendes (empresa) o Pressupost (associació o col.lectiu)
DefaultAmount=Import per defecte cotització
CanEditAmount=El visitant pot triar/modificar l'import de la seva cotització
MEMBER_NEWFORM_PAYONLINE=Anar a la pàgina integrada de pagament en línia

View File

@ -189,3 +189,7 @@ TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation)
DefaultAmount=Default amount of subscription DefaultAmount=Default amount of subscription
CanEditAmount=Visitor can choose/edit amount of its subscription CanEditAmount=Visitor can choose/edit amount of its subscription
MEMBER_NEWFORM_PAYONLINE=Jump on integrated online payment page MEMBER_NEWFORM_PAYONLINE=Jump on integrated online payment page
Associations=Foundations
Collectivités=Organizations
Particuliers=Personal
Entreprises=Companies

View File

@ -158,6 +158,10 @@ ClickHere=Click here
UseAdvancedPerms=Use the advanced rights permissions in modules UseAdvancedPerms=Use the advanced rights permissions in modules
FileFormat=File format FileFormat=File format
SelectAColor=Choose a color SelectAColor=Choose a color
AddFiles=Add Files
StartUpload=Start upload
CancelUpload=Cancel upload
FileIsTooBig=Files is too big
##### Bookmark ##### ##### Bookmark #####
Bookmark=Bookmark Bookmark=Bookmark

View File

@ -307,7 +307,7 @@ ConnectionTimeout=Timeout de conexión
ResponseTimeout=Timeout de respuesta ResponseTimeout=Timeout de respuesta
SmsTestMessage=Mensaje de prueba de __PHONEFROM__ para __PHONETO__ SmsTestMessage=Mensaje de prueba de __PHONEFROM__ para __PHONETO__
ModuleMustBeEnabledFirst=Para usar esta función debe estar activado el módulo <b>%s</b>. ModuleMustBeEnabledFirst=Para usar esta función debe estar activado el módulo <b>%s</b>.
SecurityToken=Token de seguridad SecurityToken=Clave para encriptar urls
# Modules # Modules
Module0Name=Usuarios y grupos Module0Name=Usuarios y grupos
Module0Desc=Gestión de usuarios y grupos Module0Desc=Gestión de usuarios y grupos

View File

@ -18,7 +18,7 @@ BoxLastContracts=Últimos contratos
BoxLastContacts=Últimos contactos/direcciones BoxLastContacts=Últimos contactos/direcciones
BoxLastMembers=Últimos miembros modificados BoxLastMembers=Últimos miembros modificados
BoxCurrentAccounts=Saldos cuentas corrientes BoxCurrentAccounts=Saldos cuentas corrientes
BoxSalesTurnover=Volumen de negocio BoxSalesTurnover=Volumen de ventas
BoxTotalUnpaidCustomerBills=Total facturas a clientes pendientes de pago BoxTotalUnpaidCustomerBills=Total facturas a clientes pendientes de pago
BoxTotalUnpaidSuppliersBills=Total facturas de proveedores pendientes de pago BoxTotalUnpaidSuppliersBills=Total facturas de proveedores pendientes de pago
BoxTitleLastBooks=Los %s últimos marcadores registrados BoxTitleLastBooks=Los %s últimos marcadores registrados
@ -40,7 +40,7 @@ BoxTitleLastProductsInContract=Los %s últimos productos/servicios contratados
BoxTitleOldestUnpaidCustomerBills=Las %s facturas más antiguas a clientes pendientes de cobro BoxTitleOldestUnpaidCustomerBills=Las %s facturas más antiguas a clientes pendientes de cobro
BoxTitleOldestUnpaidSupplierBills=Las %s facturas más antiguas de proveedores pendientes de pago BoxTitleOldestUnpaidSupplierBills=Las %s facturas más antiguas de proveedores pendientes de pago
BoxTitleCurrentAccounts=Saldos de las cuentas corrientes BoxTitleCurrentAccounts=Saldos de las cuentas corrientes
BoxTitleSalesTurnover=Volumen de negocio realizado BoxTitleSalesTurnover=Volumen de ventas realizado
BoxTitleTotalUnpaidCustomerBills=Pendiente de clientes BoxTitleTotalUnpaidCustomerBills=Pendiente de clientes
BoxTitleTotalUnpaidSuppliersBills=Pendiente a proveedores BoxTitleTotalUnpaidSuppliersBills=Pendiente a proveedores
BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificadas BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificadas

View File

@ -81,7 +81,7 @@ ActionAC_SUP_ORD=Envío pedido a proveedor por correo
ActionAC_SUP_INV=Envío factura de proveedor por correo ActionAC_SUP_INV=Envío factura de proveedor por correo
ActionAC_OTH=Otra ActionAC_OTH=Otra
Stats=Estadísticas de venta Stats=Estadísticas de venta
CAOrder=Volumen de negocios (Pedidos validados) CAOrder=Volumen de ventas (Pedidos validados)
FromTo=de %s a %s FromTo=de %s a %s
MargeOrder=Márgenes (Pedidos validados) MargeOrder=Márgenes (Pedidos validados)
RecapAnnee=Recapitulación del año RecapAnnee=Recapitulación del año

View File

@ -20,7 +20,7 @@ BillsForSuppliers=Facturas de proveedores
Income=Ingresos Income=Ingresos
Outcome=Gastos Outcome=Gastos
ReportInOut=Resultado / Ejercicio ReportInOut=Resultado / Ejercicio
ReportTurnover=Volumen de negocio ReportTurnover=Volumen de ventas
PaymentsNotLinkedToInvoice=Pagos vinculados a ninguna factura, por lo que ninguún tercero PaymentsNotLinkedToInvoice=Pagos vinculados a ninguna factura, por lo que ninguún tercero
PaymentsNotLinkedToUser=Pagos no vinculados a un usuario PaymentsNotLinkedToUser=Pagos no vinculados a un usuario
Profit=Beneficio Profit=Beneficio
@ -73,12 +73,12 @@ AlreadyPaid=Ya pagado
AccountNumberShort=Nº de cuenta AccountNumberShort=Nº de cuenta
AccountNumber=Número de cuenta AccountNumber=Número de cuenta
NewAccount=Nueva cuenta NewAccount=Nueva cuenta
SalesTurnover=Volumen de negocio SalesTurnover=Volumen de ventas
ByThirdParties=Por tercero ByThirdParties=Por tercero
ByUserAuthorOfInvoice=Por autor de la factura ByUserAuthorOfInvoice=Por autor de la factura
AccountancyExport=Exportación contabilidad AccountancyExport=Exportación contabilidad
ErrorWrongAccountancyCodeForCompany=Código contable incorrecto para %s ErrorWrongAccountancyCodeForCompany=Código contable incorrecto para %s
SuppliersProductsSellSalesTurnover=Volumen de negocio generado por la venta de los productos de los proveedores SuppliersProductsSellSalesTurnover=Volumen de ventas generado por la venta de los productos de los proveedores
CheckReceipt=Lista de remesas CheckReceipt=Lista de remesas
CheckReceiptShort=Remesas CheckReceiptShort=Remesas
NewCheckReceipt=Nueva remesa NewCheckReceipt=Nueva remesa

View File

@ -298,7 +298,7 @@ VAT=IVA
VATRate=Tasa IVA VATRate=Tasa IVA
Average=Media Average=Media
Sum=Suma Sum=Suma
Delta=Divergencia Delta=Diferencia
Module=Módulo Module=Módulo
Option=Opción Option=Opción
List=Listado List=Listado

View File

@ -109,7 +109,9 @@ ValidateMember=Validar un miembro
ConfirmValidateMember=¿Está seguro de querer validar a este miembro? ConfirmValidateMember=¿Está seguro de querer validar a este miembro?
FollowingLinksArePublic=Los vínculos siguientes son páginas accesibles a todos y no protegidas por ninguna habilitación Dolibarr. FollowingLinksArePublic=Los vínculos siguientes son páginas accesibles a todos y no protegidas por ninguna habilitación Dolibarr.
PublicMemberList=Listado público de miembros PublicMemberList=Listado público de miembros
BlankSubscriptionForm=Formulario de inscripción BlankSubscriptionForm=Formulario público de auto-inscripción
BlankSubscriptionFormDesc=Dolibarr puede proporcionar una URL de página pública para que los visitantes externos soliciten afiliarse. Si se encuentra activo un módulo de pago en línea, se propondrá automáticamente un formulario de pago.
EnablePublicSubscriptionForm=Activar el formulario público de auto-inscripción
MemberPublicLinks=Enlaces/páginas públicas MemberPublicLinks=Enlaces/páginas públicas
ExportDataset_member_1=Miembros y afiliaciones ExportDataset_member_1=Miembros y afiliaciones
ImportDataset_member_1=Miembros ImportDataset_member_1=Miembros
@ -176,11 +178,14 @@ MembersStatisticsDesc=Elija las estadísticas que desea consultar...
MenuMembersStats=Estadísticas MenuMembersStats=Estadísticas
LastMemberDate=Fecha último miembro LastMemberDate=Fecha último miembro
Nature=Naturaleza Nature=Naturaleza
Public=Público Public=Informació pública (no=privada)
Exports=Exportaciones Exports=Exportaciones
NewMemberbyWeb=Nuevo miembro añadido. En espera de validación NewMemberbyWeb=Nuevo miembro añadido. En espera de validación
NewMemberForm=Formulario de inscripción NewMemberForm=Formulario de inscripción
SubscriptionsStatistics=Estadísticas de cotizaciones SubscriptionsStatistics=Estadísticas de cotizaciones
NbOfSubscriptions=Número de cotizaciones NbOfSubscriptions=Número de cotizaciones
AmountOfSubscriptions=Importe de cotizaciones AmountOfSubscriptions=Importe de cotizaciones
TurnoverOrBudget=Volumen de negocio (empresa) o Presupuesto (asociación o colectivo) TurnoverOrBudget=Volumen de ventas (empresa) o Presupuesto (asociación o colectivo)
DefaultAmount=Importe por defecto cotización
CanEditAmount=El visitante puede elegir/modificar el importe de su cotización
MEMBER_NEWFORM_PAYONLINE=Ir a la página integrada de pago en línea

View File

@ -190,3 +190,7 @@ TurnoverOrBudget=Chiffre affaire (pour société) ou Budget (asso ou collectivit
DefaultAmount=Montant par défaut de la cotisation DefaultAmount=Montant par défaut de la cotisation
CanEditAmount=Le visiteur peut modifier/choisir le montant de sa cotisation CanEditAmount=Le visiteur peut modifier/choisir le montant de sa cotisation
MEMBER_NEWFORM_PAYONLINE=Débrancher sur la page intégrée de paiement en ligne MEMBER_NEWFORM_PAYONLINE=Débrancher sur la page intégrée de paiement en ligne
Associations=Associations
Collectivités=Collectivités
Particuliers=Particuliers
Entreprises=Entreprises

View File

@ -158,6 +158,10 @@ ClickHere=Cliquez ici
UseAdvancedPerms=Utiliser les droits avancés dans les permissions des modules UseAdvancedPerms=Utiliser les droits avancés dans les permissions des modules
FileFormat=Format de fichier FileFormat=Format de fichier
SelectAColor=Choisissez une couleur SelectAColor=Choisissez une couleur
AddFiles=Ajouter des fichiers
StartUpload=Transférer
CancelUpload=Annuler le transfert
FileIsTooBig=Le fichier est trop volumineux
##### Bookmark ##### ##### Bookmark #####
Bookmark=Marque-page Bookmark=Marque-page

View File

@ -25,7 +25,7 @@
/** /**
* \file htdocs/lib/CMailFile.class.php * \file htdocs/lib/CMailFile.class.php
* \brief File of class to send emails (with attachments or not) * \brief File of class to send emails (with attachments or not)
* \version $Id: CMailFile.class.php,v 1.142 2011/07/02 16:48:31 eldy Exp $ * \version $Id: CMailFile.class.php,v 1.143 2011/07/04 09:36:29 eldy Exp $
* \author Dan Potter. * \author Dan Potter.
* \author Eric Seigne * \author Eric Seigne
* \author Laurent Destailleur. * \author Laurent Destailleur.
@ -86,20 +86,20 @@ class CMailFile
/** /**
* \brief CMailFile * CMailFile
* \param subject Topic/Subject of mail * @param subject Topic/Subject of mail
* \param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param to Recipients emails (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
* \param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]") * @param from Sender email (RFC 2822: "Nom prenom <email>[, ...]" ou "email[, ...]" ou "<email>[, ...]")
* \param msg Message * @param msg Message
* \param filename_list List of files to attach (full path of filename on file system) * @param filename_list List of files to attach (full path of filename on file system)
* \param mimetype_list List of MIME type of attached files * @param mimetype_list List of MIME type of attached files
* \param mimefilename_list List of attached file name in message * @param mimefilename_list List of attached file name in message
* \param addr_cc Email cc * @param addr_cc Email cc
* \param addr_bcc Email bcc * @param addr_bcc Email bcc
* \param deliveryreceipt Ask a delivery receipt * @param deliveryreceipt Ask a delivery receipt
* \param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* \param error_to Email errors * @param errors_to Email errors
* \param css Css option * @param css Css option
*/ */
function CMailFile($subject,$to,$from,$msg, function CMailFile($subject,$to,$from,$msg,
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
@ -781,9 +781,8 @@ class CMailFile
/** /**
* Try to create a socket connection * Try to create a socket connection
* * @param $host Add ssl:// for SSL/TLS.
* @param $host. Add ssl:// for SSL/TLS. * @param $port Example: 25, 465
* @param $port. Example: 25, 465
* @return Socket id if ok, 0 if KO * @return Socket id if ok, 0 if KO
*/ */
function check_server_port($host,$port) function check_server_port($host,$port)
@ -939,7 +938,6 @@ class CMailFile
/** /**
* Return an address for SMTP protocol * Return an address for SMTP protocol
*
* @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com' * @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
* @param format 0=Auto, 1=emails with <>, 2=emails without <> * @param format 0=Auto, 1=emails with <>, 2=emails without <>
* @param encode 1=Encode name to RFC2822 * @param encode 1=Encode name to RFC2822

View File

@ -25,7 +25,7 @@
/** /**
* \file htdocs/lib/CSMSFile.class.php * \file htdocs/lib/CSMSFile.class.php
* \brief File of class to send sms * \brief File of class to send sms
* \version $Id$ * \version $Id: CSMSFile.class.php,v 1.4 2011/07/04 09:36:29 eldy Exp $
* \author Laurent Destailleur. * \author Laurent Destailleur.
*/ */
@ -54,6 +54,9 @@ class CSMSFile
* @param from Sender SMS * @param from Sender SMS
* @param msg Message * @param msg Message
* @param deliveryreceipt Ask a delivery receipt * @param deliveryreceipt Ask a delivery receipt
* @param deferred Deferred or not
* @param priority Priority
* @param class Class
*/ */
function CSMSFile($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1) function CSMSFile($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1)
{ {

View File

@ -20,21 +20,23 @@
/** /**
* \file htdocs/lib/accountancy.lib.php * \file htdocs/lib/accountancy.lib.php
* \brief Library of accountancy functions * \brief Library of accountancy functions
* \version $Id$ * \version $Id: accountancy.lib.php,v 1.2 2011/07/04 10:30:01 eldy Exp $
*/ */
/**
* @param $db
* @param $year
* @param $socid
*/
function get_ca_propal ($db, $year, $socid) function get_ca_propal ($db, $year, $socid)
{ {
$sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = '".$year."'";
$sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = $year ";
if ($socid) if ($socid)
{ {
$sql .= " AND f.fk_soc = $socid"; $sql .= " AND f.fk_soc = $socid";
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$res = $db->fetch_object($result); $res = $db->fetch_object($result);
@ -56,14 +58,13 @@ function get_ca ($db, $year, $socid)
if ($conf->compta->mode != 'CREANCES-DETTES') { if ($conf->compta->mode != 'CREANCES-DETTES') {
$sql .= " AND f.paye = 1"; $sql .= " AND f.paye = 1";
} }
$sql .= " AND date_format(f.datef , '%Y') = $year "; $sql .= " AND date_format(f.datef , '%Y') = '".$year."'";
if ($socid) if ($socid)
{ {
$sql .= " AND f.fk_soc = $socid"; $sql .= " AND f.fk_soc = $socid";
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$res = $db->fetch_object($result); $res = $db->fetch_object($result);

View File

@ -24,7 +24,7 @@
* \file htdocs/lib/company.lib.php * \file htdocs/lib/company.lib.php
* \brief Ensemble de fonctions de base pour le module societe * \brief Ensemble de fonctions de base pour le module societe
* \ingroup societe * \ingroup societe
* \version $Id: company.lib.php,v 1.120 2011/07/03 18:32:08 eldy Exp $ * \version $Id: company.lib.php,v 1.122 2011/07/04 08:38:51 eldy Exp $
*/ */
/** /**
@ -212,7 +212,7 @@ function societe_admin_prepare_head($object)
* @param id Id or code of country * @param id Id or code of country
* @param withcode 0=Return label, 1=Return code + label, 2=Return code from id, 3=Return id from code * @param withcode 0=Return label, 1=Return code + label, 2=Return code from id, 3=Return id from code
* @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features) * @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
* @param outputlangs Lang object for output translation * @param outputlangs Langs object for output translation
* @param entconv 0=Return value without entities and not converted to output charset * @param entconv 0=Return value without entities and not converted to output charset
* @return string String with country code or translated country name * @return string String with country code or translated country name
*/ */
@ -331,9 +331,9 @@ function currency_name($code_iso,$withcode=0)
} }
/** /**
* \brief Retourne le nom traduit de la forme juridique * Retourne le nom traduit de la forme juridique
* \param code Code de la forme juridique * @param code Code de la forme juridique
* \return string Nom traduit du pays * @return string Nom traduit du pays
*/ */
function getFormeJuridiqueLabel($code) function getFormeJuridiqueLabel($code)
{ {
@ -369,7 +369,7 @@ function getFormeJuridiqueLabel($code)
/** /**
* Show html area for list of projects * Show html area for list of projects
* @param conf Object conf * @param conf Object conf
* @param lang Object lang * @param langs Object langs
* @param db Database handler * @param db Database handler
* @param object Third party object * @param object Third party object
* @param backtopage Url to go once contact is created * @param backtopage Url to go once contact is created
@ -387,7 +387,8 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
$buttoncreate=''; $buttoncreate='';
if ($conf->projet->enabled && $user->rights->projet->creer) if ($conf->projet->enabled && $user->rights->projet->creer)
{ {
$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>'; //$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").' '.img_picto($langs->trans("AddProject"),'filenew').'</a>'."\n";
} }
print "\n"; print "\n";
@ -465,7 +466,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
/** /**
* Show html area for list of contacts * Show html area for list of contacts
* @param conf Object conf * @param conf Object conf
* @param lang Object lang * @param langs Object langs
* @param db Database handler * @param db Database handler
* @param object Third party object * @param object Third party object
* @param backtopage Url to go once contact is created * @param backtopage Url to go once contact is created
@ -487,7 +488,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$buttoncreate=''; $buttoncreate='';
if ($user->rights->societe->contact->creer) if ($user->rights->societe->contact->creer)
{ {
$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").'</a>'."\n"; //$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").'</a>'."\n";
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").' '.img_picto($langs->trans("AddContact"),'filenew').'</a>'."\n";
} }
print "\n"; print "\n";
@ -938,7 +940,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
/** /**
* Show html area for list of subsidiaries * Show html area for list of subsidiaries
* @param conf Object conf * @param conf Object conf
* @param lang Object lang * @param langs Object langs
* @param db Database handler * @param db Database handler
* @param object Third party object * @param object Third party object
*/ */

View File

@ -24,7 +24,7 @@
/** /**
* \file htdocs/lib/databases/pgsql.lib.php * \file htdocs/lib/databases/pgsql.lib.php
* \brief Fichier de la classe permettant de gerer une base pgsql * \brief Fichier de la classe permettant de gerer une base pgsql
* \version $Id$ * \version $Id: pgsql.lib.php,v 1.109 2011/07/04 07:36:30 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '../..'); if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '../..');
@ -1104,19 +1104,19 @@ class DoliDb
// ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql= "ALTER TABLE ".$table." ADD ".$field_name." "; $sql= "ALTER TABLE ".$table." ADD ".$field_name." ";
$sql .= $field_desc['type']; $sql .= $field_desc['type'];
if( preg_match("/^[^\s]/i",$field_desc['value'])) if ($field_desc['type'] != 'int' && preg_match("/^[^\s]/i",$field_desc['value']))
$sql .= "(".$field_desc['value'].")"; $sql .= "(".$field_desc['value'].")";
if( preg_match("/^[^\s]/i",$field_desc['attribute'])) if (preg_match("/^[^\s]/i",$field_desc['attribute']))
$sql .= " ".$field_desc['attribute']; $sql .= " ".$field_desc['attribute'];
if( preg_match("/^[^\s]/i",$field_desc['null'])) if (preg_match("/^[^\s]/i",$field_desc['null']))
$sql .= " ".$field_desc['null']; $sql .= " ".$field_desc['null'];
if( preg_match("/^[^\s]/i",$field_desc['default'])) if (preg_match("/^[^\s]/i",$field_desc['default']))
if(preg_match("/null/i",$field_desc['default'])) if (preg_match("/null/i",$field_desc['default']))
$sql .= " default ".$field_desc['default']; $sql .= " default ".$field_desc['default'];
else else
$sql .= " default '".$field_desc['default']."'"; $sql .= " default '".$field_desc['default']."'";
if( preg_match("/^[^\s]/i",$field_desc['extra'])) if (preg_match("/^[^\s]/i",$field_desc['extra']))
$sql .= " ".$field_desc['extra']; $sql .= " ".$field_desc['extra'];
$sql .= " ".$field_position; $sql .= " ".$field_position;
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);

View File

@ -22,7 +22,7 @@
/** /**
* \file htdocs/lib/date.lib.php * \file htdocs/lib/date.lib.php
* \brief Set of function to manipulate dates * \brief Set of function to manipulate dates
* \version $Id$ * \version $Id: date.lib.php,v 1.32 2011/07/04 08:38:51 eldy Exp $
*/ */
@ -242,6 +242,7 @@ function dol_get_next_month($month, $year)
/** Return previous week /** Return previous week
* @param day Day * @param day Day
* @param week Week * @param week Week
* @param month Month
* @param year Year * @param year Year
* @return array Previous year,month,day * @return array Previous year,month,day
*/ */
@ -258,6 +259,7 @@ function dol_get_prev_week($day, $week, $month, $year)
/** Return next week /** Return next week
* @param day Day * @param day Day
* @param week Week * @param week Week
* @param month Month
* @param year Year * @param year Year
* @return array Next year,month,day * @return array Next year,month,day
*/ */

View File

@ -20,7 +20,7 @@
/** /**
* \file htdocs/lib/files.lib.php * \file htdocs/lib/files.lib.php
* \brief Library for file managing functions * \brief Library for file managing functions
* \version $Id$ * \version $Id: files.lib.php,v 1.64 2011/07/05 16:10:57 hregis Exp $
*/ */
/** /**
@ -454,11 +454,13 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
* @param allowoverwrite 1=Overwrite target file if it already exists * @param allowoverwrite 1=Overwrite target file if it already exists
* @param disablevirusscan 1=Disable virus scan * @param disablevirusscan 1=Disable virus scan
* @param uploaderrorcode Value of upload error code ($_FILES['field']['error']) * @param uploaderrorcode Value of upload error code ($_FILES['field']['error'])
* @param notrigger Disable all triggers
* @return int >0 if OK, <0 or string if KO * @return int >0 if OK, <0 or string if KO
*/ */
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0) function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0)
{ {
global $conf; global $conf, $user, $langs;
global $object;
$file_name = $dest_file; $file_name = $dest_file;
// If an upload error has been reported // If an upload error has been reported
@ -552,6 +554,19 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
{ {
if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK)); if (! empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK));
dol_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); dol_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
if (! $notrigger)
{
$object->src_file=$dest_file;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('FILE_UPLOAD',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
}
return 1; // Success return 1; // Success
} }
else else
@ -568,10 +583,14 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
* @param file File to delete or mask of file to delete * @param file File to delete or mask of file to delete
* @param disableglob Disable usage of glob like * * @param disableglob Disable usage of glob like *
* @param nophperrors Disable all PHP output errors * @param nophperrors Disable all PHP output errors
* @param notrigger Disable all triggers
* @return boolean True if file is deleted, False if error * @return boolean True if file is deleted, False if error
*/ */
function dol_delete_file($file,$disableglob=0,$nophperrors=0) function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0)
{ {
global $conf, $user, $langs;
global $object;
//print "x".$file." ".$disableglob; //print "x".$file." ".$disableglob;
$ok=true; $ok=true;
$file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset
@ -581,7 +600,21 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0)
{ {
if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr
else $ok=unlink($filename); // The unlink encapsulated by dolibarr else $ok=unlink($filename); // The unlink encapsulated by dolibarr
if ($ok) dol_syslog("Removed file ".$filename,LOG_DEBUG); if ($ok)
{
dol_syslog("Removed file ".$filename,LOG_DEBUG);
if (! $notrigger)
{
$object->src_file=$file;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('FILE_DELETE',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
}
}
else dol_syslog("Failed to remove file ".$filename,LOG_WARNING); else dol_syslog("Failed to remove file ".$filename,LOG_WARNING);
} }
} }

View File

@ -29,7 +29,7 @@
* \file htdocs/lib/functions.lib.php * \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.534 2011/07/03 18:31:13 eldy Exp $ * \version $Id: functions.lib.php,v 1.538 2011/07/04 10:33:56 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
@ -319,19 +319,20 @@ function dol_escape_js($stringtoescape)
/** /**
* \brief Returns text escaped for inclusion in HTML alt or title tags * Returns text escaped for inclusion in HTML alt or title tags
* \param $stringtoescape String to escape * @param $stringtoescape String to escape
* \return string Escaped string * @param $keepb Do not clean b tags
* @return string Escaped string
*/ */
function dol_escape_htmltag($stringtoescape) function dol_escape_htmltag($stringtoescape,$keepb=0)
{ {
// escape quotes and backslashes, newlines, etc. // escape quotes and backslashes, newlines, etc.
$tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8'); $tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8');
$tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',"<b>"=>'','</b>'=>'')); if ($keepb) $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n'));
else $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',"<b>"=>'','</b>'=>''));
return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8'); return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8');
} }
/* For backward compatiblity */ /* For backward compatiblity */
function dolibarr_syslog($message, $level=LOG_INFO) function dolibarr_syslog($message, $level=LOG_INFO)
{ {
@ -806,6 +807,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec
* @param year Year * @param year Year
* @param gm 1=Input informations are GMT values, otherwise local to server TZ * @param gm 1=Input informations are GMT values, otherwise local to server TZ
* @param check 0=No check on parameters (Can use day 32, etc...) * @param check 0=No check on parameters (Can use day 32, etc...)
* @param isdst Dayling saving time
* @return timestamp Date as a timestamp, '' if error * @return timestamp Date as a timestamp, '' if error
* @see dol_print_date, dol_stringtotime * @see dol_print_date, dol_stringtotime
*/ */
@ -920,11 +922,11 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0)
} }
/** /**
* \brief Show Url link * Show Url link
* \param url Url to show * @param url Url to show
* \param target Target for link * @param target Target for link
* \param max Max number of characters to show * @param max Max number of characters to show
* \return string HTML Link * @return string HTML Link
*/ */
function dol_print_url($url,$target='_blank',$max=32) function dol_print_url($url,$target='_blank',$max=32)
{ {
@ -941,14 +943,14 @@ function dol_print_url($url,$target='_blank',$max=32)
} }
/** /**
* \brief Show EMail link * Show EMail link
* \param email EMail to show (only email, without <Name of recipient>) * @param email EMail to show (only email, without 'Name of recipient' before)
* \param cid Id of contact if known * @param cid Id of contact if known
* \param socid Id of third party if known * @param socid Id of third party if known
* \param addlink 0=no link to create action * @param addlink 0=no link to create action
* \param max Max number of characters to show * @param max Max number of characters to show
* \param showinvalid Show warning if syntax email is wrong * @param showinvalid Show warning if syntax email is wrong
* \return string HTML Link * @return string HTML Link
*/ */
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1) function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=1)
{ {
@ -1538,7 +1540,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8')
/** /**
* Show a picto according to module/object (generic function) * Show a picto according to module or object (generic function)
* @param alt Text of alt on image * @param alt Text of alt on image
* @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...) * @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...)
* Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module * Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module
@ -1719,6 +1721,7 @@ function img_edit_remove($alt = "default")
* Affiche logo editer/modifier fiche * Affiche logo editer/modifier fiche
* @param alt Texte sur le alt de l'image * @param alt Texte sur le alt de l'image
* @param float Si il faut y mettre le style "float: right" * @param float Si il faut y mettre le style "float: right"
* @param other Add more attributes on img
* @return string Retourne tag img * @return string Retourne tag img
*/ */
function img_edit($alt = "default", $float=0, $other='') function img_edit($alt = "default", $float=0, $other='')
@ -1736,6 +1739,7 @@ function img_edit($alt = "default", $float=0, $other='')
* Affiche logo voir fiche * Affiche logo voir fiche
* @param alt Texte sur le alt de l'image * @param alt Texte sur le alt de l'image
* @param float Si il faut y mettre le style "float: right" * @param float Si il faut y mettre le style "float: right"
* @param other Add more attributes on img
* @return string Retourne tag img * @return string Retourne tag img
*/ */
function img_view($alt = "default", $float=0, $other='') function img_view($alt = "default", $float=0, $other='')
@ -1956,6 +1960,7 @@ function img_tick($alt = "default")
/** /**
* Affiche le logo tick si allow * Affiche le logo tick si allow
* @param allow Authorise ou non * @param allow Authorise ou non
* @param alt Alt text for img
* @return string Retourne tag img * @return string Retourne tag img
*/ */
function img_allow($allow,$alt='default') function img_allow($allow,$alt='default')
@ -1999,20 +2004,20 @@ function img_mime($file,$alt='')
* @param infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto * @param infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* @return string String with info text * @return string String with info text
*/ */
function info_admin($texte,$infoonimgalt=0) function info_admin($text,$infoonimgalt=0)
{ {
global $conf,$langs; global $conf,$langs;
$s=''; $s='';
if ($infoonimgalt) if ($infoonimgalt)
{ {
$s.=img_picto($texte,'star'); $s.=img_picto($text,'star');
} }
else else
{ {
$s.='<div class="info">'; $s.='<div class="info">';
$s.=img_picto($langs->trans("InfoAdmin"),'star'); $s.=img_picto($langs->trans("InfoAdmin"),'star');
$s.=' '; $s.=' ';
$s.=$texte; $s.=$text;
$s.='</div>'; $s.='</div>';
} }
return $s; return $s;
@ -2761,7 +2766,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
* @param file Lien * @param file Lien
* @param options Autres parametres d'url a propager dans les liens ("" par defaut) * @param options Autres parametres d'url a propager dans les liens ("" par defaut)
* @param nextpage Faut-il une page suivante * @param nextpage Faut-il une page suivante
* @param betweenarraows HTML Content to show between arrows * @param betweenarrows HTML Content to show between arrows
*/ */
function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrows='') function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrows='')
{ {
@ -2782,7 +2787,7 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow
* Fonction qui retourne un taux de tva formate pour visualisation * Fonction qui retourne un taux de tva formate pour visualisation
* Utilisee dans les pdf et les pages html * Utilisee dans les pdf et les pages html
* @param rate Rate value to format (19.6 19,6 19.6% 19,6%,...) * @param rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
* @param foundpercent Add a percent % sign in output * @param addpercent Add a percent % sign in output
* @param info_bits Miscellanous information on vat * @param info_bits Miscellanous information on vat
* @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *) * @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *)
*/ */
@ -3355,7 +3360,7 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1)
/** /**
* Replace CRLF in string with a HTML BR tag. * Replace CRLF in string with a HTML BR tag.
* @param string2encode String to encode * @param stringtoencode String to encode
* @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br * @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
* @param forxml false=Use <br>, true=Use <br /> * @param forxml false=Use <br>, true=Use <br />
* @return string String encoded * @return string String encoded
@ -3415,6 +3420,7 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
/** /**
* This function is called to decode a HTML string (it decodes entities and br tags) * This function is called to decode a HTML string (it decodes entities and br tags)
* @param stringtodecode String to decode * @param stringtodecode String to decode
* @param pagecodeto Page code for result
*/ */
function dol_htmlentitiesbr_decode($stringtodecode,$pagecodeto='UTF-8') function dol_htmlentitiesbr_decode($stringtodecode,$pagecodeto='UTF-8')
{ {
@ -3517,19 +3523,19 @@ function dol_nboflines($s,$maxchar=0)
/** /**
* Return nb of lines of a formated text with \n and <br> * Return nb of lines of a formated text with \n and <br>
* @param texte Text * @param text Text
* @param maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut) * @param maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
* @param charset Give the charset used to encode the $texte variable in memory. * @param charset Give the charset used to encode the $text variable in memory.
* @return int Number of lines * @return int Number of lines
*/ */
function dol_nboflines_bis($texte,$maxlinesize=0,$charset='UTF-8') function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
{ {
//print $texte; //print $text;
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " "); $repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
$texte = strtr($texte, $repTable); $text = strtr($text, $repTable);
if ($charset == 'UTF-8') { $pattern = '/(<[^>]+>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support if ($charset == 'UTF-8') { $pattern = '/(<[^>]+>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
else $pattern = '/(<[^>]+>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. else $pattern = '/(<[^>]+>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
$a = preg_split($pattern, $texte, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$nblines = floor((count($a)+1)/2); $nblines = floor((count($a)+1)/2);
// count possible auto line breaks // count possible auto line breaks
if($maxlinesize) if($maxlinesize)
@ -3601,6 +3607,7 @@ function dol_textishtml($msg,$option=0)
* - From $substitutionarray (oldval=>newval) * - From $substitutionarray (oldval=>newval)
* - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules * - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules
* @param chaine Source string in which we must do substitution * @param chaine Source string in which we must do substitution
* @param substitutionarray Array with key->val to substitute
* @return string Output string after subsitutions * @return string Output string after subsitutions
*/ */
function make_substitutions($chaine,$substitutionarray) function make_substitutions($chaine,$substitutionarray)
@ -3655,6 +3662,7 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
* @param date_start Start date * @param date_start Start date
* @param date_end End date * @param date_end End date
* @param format Output format * @param format Output format
* @param outputlangs Output language
*/ */
function print_date_range($date_start,$date_end,$format = '',$outputlangs='') function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
{ {
@ -3666,6 +3674,7 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
* @param date_start Start date * @param date_start Start date
* @param date_end End date * @param date_end End date
* @param format Output format * @param format Output format
* @param outputlangs Output language
*/ */
function get_date_range($date_start,$date_end,$format = '',$outputlangs='') function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
{ {
@ -3871,6 +3880,7 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
if ($iserror) if ($iserror)
{ {
$mesgstring=preg_replace('/<\/div><div class="error">/','<br>',$mesgstring);
$mesgstring=preg_replace('/<div class="error">/','',$mesgstring); $mesgstring=preg_replace('/<div class="error">/','',$mesgstring);
$mesgstring=preg_replace('/<\/div>/','',$mesgstring); $mesgstring=preg_replace('/<\/div>/','',$mesgstring);
print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded);
@ -3882,7 +3892,7 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
* Print formated error messages to output (Used to show messages on html output) * Print formated error messages to output (Used to show messages on html output)
* @param mesgstring Error message * @param mesgstring Error message
* @param mesgarray Error messages array * @param mesgarray Error messages array
* @return keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify) * @param keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @see dol_print_error * @see dol_print_error
* @see dol_htmloutput_mesg * @see dol_htmloutput_mesg
*/ */
@ -3896,11 +3906,11 @@ function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)
* ascending (default) or descending output and uses optionally * ascending (default) or descending output and uses optionally
* natural case insensitive sorting (which can be optionally case * natural case insensitive sorting (which can be optionally case
* sensitive as well). * sensitive as well).
* @param array Array to sort * @param array Array to sort
* @param index * @param index
* @param order * @param order
* @param natsort * @param natsort
* @param cas_sensitive * @param case_sensitive Sort is case sensitive
* @return Sorted array * @return Sorted array
*/ */
function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive) function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive)
@ -3926,7 +3936,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive
/** /**
* Check if a string is in UTF8 * Check if a string is in UTF8
* @param $Str String to check * @param $str String to check
* @return boolean True if string is UTF8 or ISO compatible with UTF8, False if not (ISO with special char or Binary) * @return boolean True if string is UTF8 or ISO compatible with UTF8, False if not (ISO with special char or Binary)
*/ */
function utf8_check($str) function utf8_check($str)

View File

@ -22,7 +22,7 @@
* \file htdocs/lib/functions2.lib.php * \file htdocs/lib/functions2.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all rare functions. * This file contains all rare functions.
* \version $Id$ * \version $Id: functions2.lib.php,v 1.75 2011/07/04 08:38:51 eldy Exp $
*/ */
@ -632,10 +632,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
/** /**
* Check value * Check value
*
* @param $db Database handler
* @param $mask Mask to use * @param $mask Mask to use
* @param $value * @param $value Value
* @return int <0 if KO, 0 if OK * @return int <0 if KO, 0 if OK
*/ */
function check_value($mask,$value) function check_value($mask,$value)
@ -723,11 +721,11 @@ function check_value($mask,$value)
/** /**
* \brief Convert a binary data to string that represent hexadecimal value * Convert a binary data to string that represent hexadecimal value
* \param bin Value to convert * @param bin Value to convert
* \param pad Add 0 * @param pad Add 0
* \param upper Convert to tupper * @param upper Convert to tupper
* \return string x * @return string x
*/ */
function binhex($bin, $pad=false, $upper=false) function binhex($bin, $pad=false, $upper=false)
{ {
@ -741,9 +739,9 @@ function binhex($bin, $pad=false, $upper=false)
/** /**
* \brief Convertir de l'hexadecimal en binaire * Convert an hexadecimal string into a binary string
* \param string hexa * @param hexa Hexadecimal string to convert (example: 'FF')
* \return string bin * @return string bin
*/ */
function hexbin($hexa) function hexbin($hexa)
{ {
@ -757,9 +755,9 @@ function hexbin($hexa)
/** /**
* \brief Retourne le numero de la semaine par rapport a une date * Retourne le numero de la semaine par rapport a une date
* \param time Date au format 'timestamp' * @param time Date au format 'timestamp'
* \return int Numero de semaine * @return int Numero de semaine
*/ */
function numero_semaine($time) function numero_semaine($time)
{ {
@ -838,11 +836,11 @@ function numero_semaine($time)
/** /**
* \brief Convertit une masse d'une unite vers une autre unite * Convertit une masse d'une unite vers une autre unite
* \param weight float Masse a convertir * @param weight float Masse a convertir
* \param from_unit int Unite originale en puissance de 10 * @param from_unit int Unite originale en puissance de 10
* \param to_unit int Nouvelle unite en puissance de 10 * @param to_unit int Nouvelle unite en puissance de 10
* \return float Masse convertie * @return float Masse convertie
*/ */
function weight_convert($weight,&$from_unit,$to_unit) function weight_convert($weight,&$from_unit,$to_unit)
{ {
@ -872,11 +870,12 @@ function weight_convert($weight,&$from_unit,$to_unit)
/** /**
* \brief Save personnal parameter * Save personnal parameter
* \param db Handler database * @param db Handler database
* \param user Object user * @param conf Object conf
* \param tab Tableau (cle=>valeur) des parametres a sauvegarder * @param user Object user
* \return int <0 if KO, >0 if OK * @param tab Tableau (cle=>valeur) des parametres a sauvegarder
* @return int <0 if KO, >0 if OK
*/ */
function dol_set_user_param($db, $conf, &$user, $tab) function dol_set_user_param($db, $conf, &$user, $tab)
{ {
@ -936,9 +935,10 @@ function dol_set_user_param($db, $conf, &$user, $tab)
/** /**
* \brief Returns formated reduction * Returns formated reduction
* \param reduction Reduction percentage * @param reduction Reduction percentage
* \return string Formated reduction * @param langs Output language
* @return string Formated reduction
*/ */
function dol_print_reduction($reduction=0,$langs) function dol_print_reduction($reduction=0,$langs)
{ {

View File

@ -21,17 +21,16 @@
* \file htdocs/lib/functions_ch.lib.php * \file htdocs/lib/functions_ch.lib.php
* \brief A set of swiss functions for Dolibarr * \brief A set of swiss functions for Dolibarr
* This file contains rare functions. * This file contains rare functions.
* \version $Id$ * \version $Id: functions_ch.lib.php,v 1.3 2011/07/04 08:38:51 eldy Exp $
*/ */
/** /**
* Return if a BVRB number is valid or not (For switzerland) * Return if a BVRB number is valid or not (For switzerland)
* * @param bvrb BVRB number
* @param string BVRB number
* @return bool True if OK, false if KO * @return bool True if OK, false if KO
*/ */
function dol_ch_controle_bvrb ($bvrb) function dol_ch_controle_bvrb($bvrb)
{ {
// Init array for control // Init array for control
$tableau[0][0]=0; $tableau[0][0]=0;

View File

@ -25,7 +25,7 @@
* \file htdocs/lib/pdf.lib.php * \file htdocs/lib/pdf.lib.php
* \brief Set of functions used for PDF generation * \brief Set of functions used for PDF generation
* \ingroup core * \ingroup core
* \version $Id: pdf.lib.php,v 1.95 2011/06/30 13:27:21 hregis Exp $ * \version $Id: pdf.lib.php,v 1.96 2011/07/04 08:53:01 eldy Exp $
*/ */
@ -682,7 +682,7 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
* Return line description translated in outputlangs and encoded in UTF8 * Return line description translated in outputlangs and encoded in UTF8
* @param object Object * @param object Object
* @param i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hideref Hide reference * @param hideref Hide reference
* @param hidedesc Hide description * @param hidedesc Hide description
* @param issupplierline Is it a line for a supplier object ? * @param issupplierline Is it a line for a supplier object ?
@ -814,7 +814,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
* Return line num * Return line num
* @param object Object * @param object Object
* @param $i Current line number * @param $i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
*/ */
function pdf_getlinenum($object,$i,$outputlangs) function pdf_getlinenum($object,$i,$outputlangs)
{ {
@ -854,8 +854,8 @@ function pdf_getlineref($object,$i,$outputlangs)
/** /**
* Return line ref_supplier * Return line ref_supplier
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
*/ */
function pdf_getlineref_supplier($object,$i,$outputlangs) function pdf_getlineref_supplier($object,$i,$outputlangs)
{ {
@ -874,8 +874,8 @@ function pdf_getlineref_supplier($object,$i,$outputlangs)
/** /**
* Return line vat rate * Return line vat rate
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -901,8 +901,8 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line unit price excluding tax * Return line unit price excluding tax
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -928,8 +928,8 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line quantity * Return line quantity
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -958,8 +958,8 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line quantity asked * Return line quantity asked
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -988,8 +988,8 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line quantity shipped * Return line quantity shipped
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -1018,8 +1018,8 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line keep to ship quantity * Return line keep to ship quantity
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -1048,8 +1048,8 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line remise percent * Return line remise percent
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -1080,8 +1080,8 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
/** /**
* Return line total excluding tax * Return line total excluding tax
* @param object Object * @param object Object
* @param $i Current line number * @param i Current line number
* @param outputlang Object lang for output * @param outputlangs Object langs for output
* @param hidedetails Hide value * @param hidedetails Hide value
* 0 = no * 0 = no
* 1 = yes * 1 = yes
@ -1115,7 +1115,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
* Return total quantity of products and/or services * Return total quantity of products and/or services
* @param object Object * @param object Object
* @param type Type of line (all=all, 0=product, 1=service, 9=other) * @param type Type of line (all=all, 0=product, 1=service, 9=other)
* @param outputlang Object lang for output * @param outputlangs Object langs for output
*/ */
function pdf_getTotalQty($object,$type='',$outputlangs) function pdf_getTotalQty($object,$type='',$outputlangs)
{ {

View File

@ -23,7 +23,7 @@
* \file htdocs/lib/prelevement.lib.php * \file htdocs/lib/prelevement.lib.php
* \brief Ensemble de fonctions de base pour le module prelevement * \brief Ensemble de fonctions de base pour le module prelevement
* \ingroup propal * \ingroup propal
* \version $Id$ * \version $Id: prelevement.lib.php,v 1.8 2011/07/04 09:01:38 eldy Exp $
* *
* Ensemble de fonctions de base de dolibarr sous forme d'include * Ensemble de fonctions de base de dolibarr sous forme d'include
*/ */
@ -31,8 +31,8 @@
/** /**
* Prepare head for prelevement screen and return it * Prepare head for prelevement screen and return it
* @param prelevement class BonPrelevement * @param object Object BonPrelevement
* @return array head * @return array head
*/ */
function prelevement_prepare_head($object) function prelevement_prepare_head($object)
{ {

View File

@ -23,7 +23,7 @@
* \file htdocs/lib/product.lib.php * \file htdocs/lib/product.lib.php
* \brief Ensemble de fonctions de base pour le module produit et service * \brief Ensemble de fonctions de base pour le module produit et service
* \ingroup product * \ingroup product
* \version $Id$ * \version $Id: product.lib.php,v 1.43 2011/07/04 09:01:38 eldy Exp $
* *
* Ensemble de fonctions de base de dolibarr sous forme d'include * Ensemble de fonctions de base de dolibarr sous forme d'include
*/ */
@ -262,9 +262,9 @@ function show_stats_for_company($product,$socid)
/** /**
* Return translation label of a unit key * Return translation label of a unit key
* @param int Unit key (-3,0,3,98,99...) * @param unit Unit key (-3,0,3,98,99...)
* @param measuring_style Style of unit: weight, volume,... * @param measuring_style Style of unit: weight, volume,...
* @return string Unit string * @return string Unit string
* @see load_measuring_units * @see load_measuring_units
*/ */
function measuring_units_string($unit,$measuring_style='') function measuring_units_string($unit,$measuring_style='')

View File

@ -22,7 +22,7 @@
* \file htdocs/lib/project.lib.php * \file htdocs/lib/project.lib.php
* \brief Functions used by project module * \brief Functions used by project module
* \ingroup project * \ingroup project
* \version $Id$ * \version $Id: project.lib.php,v 1.68 2011/07/04 09:01:38 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
@ -98,7 +98,7 @@ function project_prepare_head($object)
* \file htdocs/lib/project.lib.php * \file htdocs/lib/project.lib.php
* \brief Ensemble de fonctions de base pour le module projet * \brief Ensemble de fonctions de base pour le module projet
* \ingroup societe * \ingroup societe
* \version $Id$ * \version $Id: project.lib.php,v 1.68 2011/07/04 09:01:38 eldy Exp $
*/ */
function task_prepare_head($object) function task_prepare_head($object)
{ {
@ -239,14 +239,14 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid')
/** /**
* Enter description here... * Output a task line
*
* @param $inc * @param $inc
* @param $parent * @param $parent
* @param $lines * @param $lines
* @param $level * @param $level
* @param $projectsrole * @param $projectsrole
* @param $mytask 0 or 1 to enable only if task is a task i am affected to * @param $tasksrole
* @param $mytask 0 or 1 to enable only if task is a task i am affected to
* @return $inc * @return $inc
*/ */
function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0) function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0)

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/lib/security.lib.php * \file htdocs/lib/security.lib.php
* \brief Set of function used for dolibarr security * \brief Set of function used for dolibarr security
* \version $Id$ * \version $Id: security.lib.php,v 1.123 2011/07/04 09:01:38 eldy Exp $
*/ */
@ -398,7 +398,7 @@ function encodedecode_dbpassconf($level=0)
/** /**
* Encode a string * Encode a string
* @param chaine chaine de caracteres a encoder * @param chain chaine de caracteres a encoder
* @return string_coded chaine de caracteres encodee * @return string_coded chaine de caracteres encodee
*/ */
function dol_encode($chain) function dol_encode($chain)

View File

@ -21,19 +21,20 @@
* \file htdocs/lib/tax.lib.php * \file htdocs/lib/tax.lib.php
* \ingroup tax * \ingroup tax
* \brief Library for tax module * \brief Library for tax module
* \version $Id$ * \version $Id: tax.lib.php,v 1.20 2011/07/04 09:01:37 eldy Exp $
*/ */
/** /**
* \brief Look for collectable VAT clients in the chosen year (and month) * Look for collectable VAT clients in the chosen year (and month)
* \param db Database handle * @param db Database handle
* \param y Year * @param y Year
* \param date_start Start date * @param date_start Start date
* \param date_end End date * @param date_end End date
* \param modetax 0 or 1 (option vat on debit) * @param modetax 0 or 1 (option vat on debit)
* \param direction 'sell' or 'buy' * @param direction 'sell' or 'buy'
* \return array List of customers third parties with vat, -1 if no accountancy module, -2 if not yet developped, -3 if error * @param m Month
* @return array List of customers third parties with vat, -1 if no accountancy module, -2 if not yet developped, -3 if error
*/ */
function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction, $m=0) function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction, $m=0)
{ {

View File

@ -21,7 +21,7 @@
* \file htdocs/lib/treeview.lib.php * \file htdocs/lib/treeview.lib.php
* \ingroup core * \ingroup core
* \brief Libraries for tree views * \brief Libraries for tree views
* \version $Id$ * \version $Id: treeview.lib.php,v 1.12 2011/07/04 09:01:38 eldy Exp $
*/ */
@ -75,9 +75,9 @@ function is_in_subtree($fulltree,$parentid,$childid)
/** /**
* Show picto of a tree view * Show picto of a tree view
*
* @param fulltree Array of entries in correct order * @param fulltree Array of entries in correct order
* @param key Key of value to show picto * @param key Key of value to show picto
* @param selected Selected value
* @return array (0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after) * @return array (0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after)
*/ */
function tree_showpad(&$fulltree,$key,$selected=0) function tree_showpad(&$fulltree,$key,$selected=0)

View File

@ -22,7 +22,7 @@
/** /**
* \file htdocs/lib/usergroups.lib.php * \file htdocs/lib/usergroups.lib.php
* \brief Ensemble de fonctions de base pour la gestion des utilisaterus et groupes * \brief Ensemble de fonctions de base pour la gestion des utilisaterus et groupes
* \version $Id$ * \version $Id: usergroups.lib.php,v 1.28 2011/07/04 09:01:38 eldy Exp $
*/ */
function user_prepare_head($object) function user_prepare_head($object)
{ {
@ -144,8 +144,9 @@ function group_prepare_head($object)
/** /**
* Show list of themes. Show all thumbs of themes * Show list of themes. Show all thumbs of themes
* @param fuser User concerned or '' for global theme * @param fuser User concerned or '' for global theme
* @param edit 1 to add edit form * @param edit 1 to add edit form
* @param foruserprofile Show for user profile view
*/ */
function show_theme($fuser,$edit=0,$foruserprofile=false) function show_theme($fuser,$edit=0,$foruserprofile=false)
{ {

View File

@ -26,7 +26,7 @@
* \file htdocs/main.inc.php * \file htdocs/main.inc.php
* \ingroup core * \ingroup core
* \brief File that defines environment for Dolibarr pages only (variables not required by scripts) * \brief File that defines environment for Dolibarr pages only (variables not required by scripts)
* \version $Id: main.inc.php,v 1.748 2011/07/03 13:16:46 hregis Exp $ * \version $Id: main.inc.php,v 1.749 2011/07/04 08:53:01 eldy Exp $
*/ */
@ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP @ini_set('memory_limit', '64M'); // This may be useless if memory is hard limited by your PHP
@ -814,22 +814,22 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY))
// Functions // Functions
/**
* Show HTML header HTML + BODY + Top menu + left menu + DIV
* @param head Add optionnal head lines
* @param title Title of web page
* @param help_url Url links to help page
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param target Target to use in menu links
* @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
* @param disablehead Do not output head section
* @param arrayofjs Array of js files to add in header
* @param arrayofcss Array of css files to add in header
* @param morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
*/
if (! function_exists("llxHeader")) if (! function_exists("llxHeader"))
{ {
/**
* Show HTML header HTML + BODY + Top menu + left menu + DIV
* @param head Add optionnal head lines
* @param title Title of web page
* @param help_url Url links to help page
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param target Target to use in menu links
* @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax)
* @param disablehead Do not output head section
* @param arrayofjs Array of js files to add in header
* @param arrayofcss Array of css files to add in header
* @param morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
*/
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='')
{ {
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers

View File

@ -23,7 +23,7 @@
* \file htdocs/product/stats/fiche.php * \file htdocs/product/stats/fiche.php
* \ingroup product * \ingroup product
* \brief Page des stats produits * \brief Page des stats produits
* \version $Id$ * \version $Id: fiche.php,v 1.109 2011/07/04 10:04:18 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@ -37,6 +37,8 @@ $langs->load("bills");
$langs->load("other"); $langs->load("other");
$mode=isset($_GET["mode"])?$_GET["mode"]:'byunit'; $mode=isset($_GET["mode"])?$_GET["mode"]:'byunit';
$error=0;
$mesg='';
// Security check // Security check
if (isset($_GET["id"]) || isset($_GET["ref"])) if (isset($_GET["id"]) || isset($_GET["ref"]))
@ -47,8 +49,6 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid); $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
$mesg = '';
/* /*
* View * View
@ -135,9 +135,10 @@ if ($_GET["id"] || $_GET["ref"])
$dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp); $dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp);
if (! file_exists($dir.'/'.$product->id)) if (! file_exists($dir.'/'.$product->id))
{ {
if (create_exdir($dir.'/'.$product->id) < 0) if (dol_mkdir($dir.'/'.$product->id) < 0)
{ {
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir); $mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
$error++;
} }
} }
@ -161,44 +162,48 @@ if ($_GET["id"] || $_GET["ref"])
); );
$px = new DolGraph(); $px = new DolGraph();
$mesg = $px->isGraphKo();
if (! $mesg) if (! $error)
{ {
foreach($graphfiles as $key => $val) $mesg = $px->isGraphKo();
if (! $mesg)
{ {
if (! $graphfiles[$key]['file']) continue; foreach($graphfiles as $key => $val)
$graph_data = array();
// TODO Test si deja existant et recent, on ne genere pas
if ($key == 'propal') $graph_data = $product->get_nb_propal($socid,$mode);
if ($key == 'orders') $graph_data = $product->get_nb_order($socid,$mode);
if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid,$mode);
if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid,$mode);
if (is_array($graph_data))
{ {
$px->SetData($graph_data); if (! $graphfiles[$key]['file']) continue;
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
$px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT);
$px->SetHorizTickIncrement(1);
$px->SetPrecisionY(0);
$px->SetShading(3);
//print 'x '.$key.' '.$graphfiles[$key]['file'];
$px->draw($dir."/".$graphfiles[$key]['file']); $graph_data = array();
}
else // TODO Test si deja existant et recent, on ne genere pas
{ if ($key == 'propal') $graph_data = $product->get_nb_propal($socid,$mode);
dol_print_error($db,'Error for calculating graph on key='.$key.' - '.$product->error); if ($key == 'orders') $graph_data = $product->get_nb_order($socid,$mode);
if ($key == 'invoices') $graph_data = $product->get_nb_vente($socid,$mode);
if ($key == 'invoicessuppliers') $graph_data = $product->get_nb_achat($socid,$mode);
if (is_array($graph_data))
{
$px->SetData($graph_data);
$px->SetMaxValue($px->GetCeilMaxValue()<0?0:$px->GetCeilMaxValue());
$px->SetMinValue($px->GetFloorMinValue()>0?0:$px->GetFloorMinValue());
$px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT);
$px->SetHorizTickIncrement(1);
$px->SetPrecisionY(0);
$px->SetShading(3);
//print 'x '.$key.' '.$graphfiles[$key]['file'];
$px->draw($dir."/".$graphfiles[$key]['file']);
}
else
{
dol_print_error($db,'Error for calculating graph on key='.$key.' - '.$product->error);
}
} }
} }
$mesg = $langs->trans("ChartGenerated");
} }
$mesg = $langs->trans("ChartGenerated"); // Show graphs
// Affichage graphs
$i=0; $i=0;
foreach($graphfiles as $key => $val) foreach($graphfiles as $key => $val)
{ {
@ -266,5 +271,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:04:18 $ - $Revision: 1.109 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/projet/activity/index.php * \file htdocs/projet/activity/index.php
* \ingroup projet * \ingroup projet
* \brief Page activite perso du module projet * \brief Page activite perso du module projet
* \version $Id$ * \version $Id: index.php,v 1.35 2011/07/04 10:56:12 eldy Exp $
*/ */
require ("../../main.inc.php"); require ("../../main.inc.php");
@ -88,7 +88,7 @@ $sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_task = t.rowid";
$sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND tt.fk_user = ".$user->id;
$sql.= " AND date_format(task_date,'%d%m%y') = ".strftime("%d%m%y",time()); $sql.= " AND date_format(task_date,'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'";
$sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid, p.ref, p.title"; $sql.= " GROUP BY p.rowid, p.ref, p.title";
@ -124,6 +124,10 @@ print '<td align="right">'.ConvertSecondToTime($total).'</td>';
print "</tr>\n"; print "</tr>\n";
print "</table>"; print "</table>";
// TODO Do not use date_add function to be compatible with all database
if ($db->type != 'pgsql')
{
/* Affichage de la liste des projets d'hier */ /* Affichage de la liste des projets d'hier */
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -139,9 +143,9 @@ $sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_task = t.rowid";
$sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND tt.fk_user = ".$user->id;
$sql.= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%d%m%y') = ".strftime("%d%m%y",time()); $sql.= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'";
$sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid"; $sql.= " GROUP BY p.rowid, p.ref, p.title";
$resql = $db->query($sql); $resql = $db->query($sql);
if ( $resql ) if ( $resql )
@ -175,8 +179,15 @@ print '<td align="right">'.ConvertSecondToTime($total).'</td>';
print "</tr>\n"; print "</tr>\n";
print "</table>"; print "</table>";
}
print '</td><td width="70%" valign="top" class="notopnoleft">'; print '</td><td width="70%" valign="top" class="notopnoleft">';
// TODO Do not use week function to be compatible with all database
if ($db->type != 'pgsql')
{
/* Affichage de la liste des projets de la semaine */ /* Affichage de la liste des projets de la semaine */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -192,9 +203,9 @@ $sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_task = t.rowid";
$sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND tt.fk_user = ".$user->id;
$sql.= " AND week(task_date) = ".strftime("%W",time()); $sql.= " AND week(task_date) = '".strftime("%W",time())."'";
$sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid"; $sql.= " GROUP BY p.rowid, p.ref, p.title";
$resql = $db->query($sql); $resql = $db->query($sql);
if ( $resql ) if ( $resql )
@ -228,6 +239,8 @@ print '<td align="right">'.ConvertSecondToTime($total).'</td>';
print "</tr>\n"; print "</tr>\n";
print "</table><br>"; print "</table><br>";
}
/* Affichage de la liste des projets du mois */ /* Affichage de la liste des projets du mois */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -243,9 +256,9 @@ $sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_task = t.rowid";
$sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND tt.fk_user = ".$user->id;
$sql.= " AND month(task_date) = ".strftime("%m",$now); $sql.= " AND date_format(task_date,'%y-%m') = '".strftime("%y-%m",$now)."'";
$sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid"; $sql.= " GROUP BY p.rowid, p.ref, p.title";
$resql = $db->query($sql); $resql = $db->query($sql);
if ( $resql ) if ( $resql )
@ -287,9 +300,9 @@ $sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND tt.fk_task = t.rowid"; $sql.= " AND tt.fk_task = t.rowid";
$sql.= " AND tt.fk_user = ".$user->id; $sql.= " AND tt.fk_user = ".$user->id;
$sql.= " AND YEAR(task_date) = ".strftime("%Y",$now); $sql.= " AND YEAR(task_date) = '".strftime("%Y",$now)."'";
$sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid"; $sql.= " GROUP BY p.rowid, p.ref, p.title";
$var=false; $var=false;
$resql = $db->query($sql); $resql = $db->query($sql);
@ -319,5 +332,5 @@ print '</td></tr></table>';
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 10:56:12 $ - $Revision: 1.35 $');
?> ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@
* \file htdocs/projet/fiche.php * \file htdocs/projet/fiche.php
* \ingroup projet * \ingroup projet
* \brief Project card * \brief Project card
* \version $Id$ * \version $Id: fiche.php,v 1.126 2011/07/04 08:00:52 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -55,6 +55,13 @@ $result = restrictedArea($user, 'projet', $projectid);
* Actions * Actions
*/ */
// Cancel
if (GETPOST("cancel") && GETPOST('backtopage'))
{
header("Location: ".GETPOST('backtopage'));
exit;
}
if ($_POST["action"] == 'add' && $user->rights->projet->creer) if ($_POST["action"] == 'add' && $user->rights->projet->creer)
{ {
$error=0; $error=0;
@ -270,8 +277,10 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage').'">';
print '<table class="border" width="100%">';
$project = new Project($db); $project = new Project($db);
@ -323,7 +332,14 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '</table>'; print '</table>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>'; print '<br><center>';
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
if (GETPOST('backtopage'))
{
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</center>';
print '</form>'; print '</form>';
} }
@ -592,5 +608,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/04 08:00:52 $ - $Revision: 1.126 $');
?> ?>

View File

@ -22,7 +22,7 @@
* \file htdocs/public/members/new.php * \file htdocs/public/members/new.php
* \ingroup member * \ingroup member
* \brief Example of form to add a new member * \brief Example of form to add a new member
* \version $Id: new.php,v 1.37 2011/07/03 18:30:48 eldy Exp $ * \version $Id: new.php,v 1.39 2011/07/05 08:33:34 eldy Exp $
* *
* Note that you can add following constant to change behaviour of page * Note that you can add following constant to change behaviour of page
* MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form * MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form
@ -64,7 +64,7 @@ if (empty($conf->adherent->enabled)) accessforbidden('',1,1,1);
if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
{ {
print $langs->trans("Auto subscription form for public visitors has no be enabled"); print $langs->trans("Auto subscription form for public visitors has no been enabled");
exit; exit;
} }
@ -159,10 +159,15 @@ if ($action == 'add')
$error+=1; $error+=1;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("MorPhy"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("MorPhy"))."<br>\n";
} }
if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]=='') if (empty($_POST["nom"]))
{ {
$error+=1; $error+=1;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Lastname"))."<br>\n";
}
if (empty($_POST["prenom"]))
{
$error+=1;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Firstname"))."<br>\n";
} }
if (GETPOST("email") && ! isValidEmail(GETPOST("email"))) if (GETPOST("email") && ! isValidEmail(GETPOST("email")))
{ {
@ -236,11 +241,13 @@ if ($action == 'add')
{ {
$urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref='.$adh->ref; $urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref='.$adh->ref;
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
} }
else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal')
{ {
$urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.$adh->ref; $urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.$adh->ref;
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
} }
else else
{ {
@ -273,7 +280,7 @@ if ($action == 'added')
print $langs->trans("NewMemberbyWeb"); print $langs->trans("NewMemberbyWeb");
print '</center>'; print '</center>';
llxFooterVierge('$Date: 2011/07/03 18:30:48 $ - $Revision: 1.37 $'); llxFooterVierge('$Date: 2011/07/05 08:33:34 $ - $Revision: 1.39 $');
exit; exit;
} }
@ -356,7 +363,7 @@ $morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral"); $morphys["mor"] = $langs->trans("Moral");
if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY))
{ {
print '<tr><td>'.$langs->trans("MorPhy").' <FONT COLOR="red">*</FONT></td><td>'."\n"; print '<tr class="morphy"><td>'.$langs->trans("MorPhy").' <FONT COLOR="red">*</FONT></td><td>'."\n";
print $html->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print $html->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
@ -450,6 +457,7 @@ if (! empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER))
print '<script type="text/javascript"> print '<script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
initturnover(); initturnover();
jQuery(".morphy").hide();
jQuery("#morphy").click(function() { jQuery("#morphy").click(function() {
initturnover(); initturnover();
}); });
@ -520,5 +528,5 @@ print "<br></form>\n";
$db->close(); $db->close();
llxFooterVierge('$Date: 2011/07/03 18:30:48 $ - $Revision: 1.37 $'); llxFooterVierge('$Date: 2011/07/05 08:33:34 $ - $Revision: 1.39 $');
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -23,7 +23,7 @@
* \ingroup paybox * \ingroup paybox
* \brief File to offer a way to make a payment for a particular Dolibarr entity * \brief File to offer a way to make a payment for a particular Dolibarr entity
* \author Laurent Destailleur * \author Laurent Destailleur
* \version $Id$ * \version $Id: newpayment.php,v 1.56 2011/07/05 08:29:53 eldy Exp $
*/ */
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
@ -105,19 +105,19 @@ $urlko=preg_replace('/&$/','',$urlko); // Remove last &
if (GETPOST("action") == 'dopayment') if (GETPOST("action") == 'dopayment')
{ {
$PRICE=price2num(GETPOST("newamount"),'MT'); $PRICE=price2num(GETPOST("newamount"),'MT');
$EMAIL=GETPOST("EMAIL"); $email=GETPOST("email");
$mesg=''; $mesg='';
if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")); if (empty($PRICE) || ! is_numeric($PRICE)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount"));
elseif (empty($EMAIL)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail")); elseif (empty($email)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("YourEMail"));
elseif (! isValidEMail($EMAIL)) $mesg=$langs->trans("ErrorBadEMail",$EMAIL); elseif (! isValidEMail($email)) $mesg=$langs->trans("ErrorBadEMail",$email);
elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode")); elseif (empty($FULLTAG)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentCode"));
if (empty($mesg)) if (empty($mesg))
{ {
dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG); dol_syslog("newpayment.php call paybox api and do redirect", LOG_DEBUG);
print_paybox_redirect($PRICE, $conf->monnaie, $EMAIL, $urlok, $urlko, $FULLTAG); print_paybox_redirect($PRICE, $conf->monnaie, $email, $urlok, $urlko, $FULLTAG);
session_destroy(); session_destroy();
exit; exit;
@ -243,7 +243,7 @@ if (! GETPOST("source"))
$var=!$var; $var=!$var;
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail"); print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')'; print ' ('.$langs->trans("ToComplete").')';
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.GETPOST("EMAIL").'"></td></tr>'."\n"; print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.GETPOST("email").'"></td></tr>'."\n";
} }
@ -325,8 +325,8 @@ if (GETPOST("source") == 'order')
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail"); print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')'; print ' ('.$langs->trans("ToComplete").')';
$email=$order->client->email; $email=$order->client->email;
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:'')); $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n"; print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
} }
@ -408,8 +408,8 @@ if (GETPOST("source") == 'invoice')
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail"); print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')'; print ' ('.$langs->trans("ToComplete").')';
$email=$invoice->client->email; $email=$invoice->client->email;
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:'')); $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n"; print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
} }
// Payment on contract line // Payment on contract line
@ -579,8 +579,8 @@ if (GETPOST("source") == 'contractline')
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail"); print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')'; print ' ('.$langs->trans("ToComplete").')';
$email=$contract->client->email; $email=$contract->client->email;
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:'')); $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n"; print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
} }
@ -680,8 +680,8 @@ if (GETPOST("source") == 'membersubscription')
print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail"); print '<tr><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("YourEMail");
print ' ('.$langs->trans("ToComplete").')'; print ' ('.$langs->trans("ToComplete").')';
$email=$member->client->email; $email=$member->client->email;
$email=(GETPOST("EMAIL")?GETPOST("EMAIL"):(isValidEmail($email)?$email:'')); $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:''));
print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="EMAIL" size="48" value="'.$email.'"></td></tr>'."\n"; print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n";
} }
@ -716,5 +716,5 @@ html_print_paybox_footer($mysoc,$langs);
$db->close(); $db->close();
llxFooterPayBox('$Date$ - $Revision$'); llxFooterPayBox('$Date: 2011/07/05 08:29:53 $ - $Revision: 1.56 $');
?> ?>

View File

@ -27,7 +27,7 @@
* \file htdocs/societe/class/societe.class.php * \file htdocs/societe/class/societe.class.php
* \ingroup societe * \ingroup societe
* \brief File for third party class * \brief File for third party class
* \version $Id: societe.class.php,v 1.88 2011/07/03 22:07:24 eldy Exp $ * \version $Id: societe.class.php,v 1.89 2011/07/04 11:41:05 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -2105,6 +2105,13 @@ class Societe extends CommonObject
} }
/**
* Add permissions
* @param user_id
* @param read
* @param write
* @param perms
*/
function AddPerms($user_id, $read, $write, $perms) function AddPerms($user_id, $read, $write, $perms)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perms"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perms";
@ -2120,7 +2127,7 @@ class Societe extends CommonObject
/** /**
* Charge les informations d'ordre info dans l'objet societe * Charge les informations d'ordre info dans l'objet societe
* @param id id de la societe a charger * @param id Id de la societe a charger
*/ */
function info($id) function info($id)
{ {
@ -2183,7 +2190,7 @@ class Societe extends CommonObject
/** /**
* Return if a country is inside the EEC (European Economic Community) * Return if a country is inside the EEC (European Economic Community)
* @param boolean true = pays inside EEC, false= pays outside EEC * @return boolean true = pays inside EEC, false= pays outside EEC
*/ */
function isInEEC() function isInEEC()
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -23,7 +23,7 @@
* \file htdocs/societe/document.php * \file htdocs/societe/document.php
* \brief Tab for documents linked to third party * \brief Tab for documents linked to third party
* \ingroup societe * \ingroup societe
* \version $Id: document.php,v 1.31 2011/07/03 13:16:46 hregis Exp $ * \version $Id: document.php,v 1.33 2011/07/05 17:21:19 hregis Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -35,10 +35,13 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load("companies"); $langs->load("companies");
$langs->load('other'); $langs->load('other');
$mesg = ""; $mesg='';
$action = GETPOST('action');
$confirm = GETPOST('confirm');
$socid = (GETPOST('socid') ? GETPOST('socid') : GETPOST('id'));
// Security check // Security check
$socid = (GETPOST('socid') ? GETPOST('socid') : GETPOST('id'));
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
unset($_GET["action"]); unset($_GET["action"]);
@ -70,48 +73,54 @@ $object = new Societe($db);
// Envoie fichier // Envoie fichier
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if (create_exdir($upload_dir) >= 0) if ($object->fetch($socid))
{ {
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']); if (create_exdir($upload_dir) >= 0)
if (is_numeric($resupload) && $resupload > 0)
{ {
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
{ if (is_numeric($resupload) && $resupload > 0)
// Create small thumbs for company (Ratio is near 16/9) {
// Used on logon for example if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); {
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
// Create mini thumbs for company (Ratio is near 16/9) // Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example // Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
} }
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
$langs->load("errors");
if (is_numeric($resupload) && $resupload < 0) // Unknown error
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus else
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>'; $langs->load("errors");
} if (is_numeric($resupload) && $resupload < 0) // Unknown error
else // Known error {
{ $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; }
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
{
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
}
else // Known error
{
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
}
} }
} }
} }
} }
// Suppression fichier // Suppression fichier
if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes') if ($action == 'confirm_deletefile' && $confirm == 'yes')
{ {
$file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). if ($object->fetch($socid))
dol_delete_file($file); {
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
}
} }
@ -195,9 +204,9 @@ if ($socid > 0)
/* /*
* Confirmation suppression fichier * Confirmation suppression fichier
*/ */
if ($_GET['action'] == 'delete') if ($action == 'delete')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -280,6 +289,6 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/03 13:16:46 $ - $Revision: 1.31 $'); llxFooter('$Date: 2011/07/05 17:21:19 $ - $Revision: 1.33 $');
?> ?>

View File

@ -26,7 +26,7 @@
* \file htdocs/societe/soc.php * \file htdocs/societe/soc.php
* \ingroup societe * \ingroup societe
* \brief Third party card page * \brief Third party card page
* \version $Id: soc.php,v 1.120 2011/07/02 14:51:27 eldy Exp $ * \version $Id: soc.php,v 1.121 2011/07/04 08:00:53 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@ -1903,17 +1903,6 @@ else
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} }
/*if ($user->rights->societe->contact->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>'."\n";
}
*/
/*if ($conf->projet->enabled && $user->rights->projet->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProject").'</a>'."\n";
}*/
if ($user->rights->societe->supprimer) if ($user->rights->societe->supprimer)
{ {
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
@ -1972,5 +1961,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/02 14:51:27 $ - $Revision: 1.120 $'); llxFooter('$Date: 2011/07/04 08:00:53 $ - $Revision: 1.121 $');
?> ?>

View File

@ -25,7 +25,7 @@
/** /**
* \file htdocs/user/class/user.class.php * \file htdocs/user/class/user.class.php
* \brief Fichier de la classe utilisateur * \brief Fichier de la classe utilisateur
* \version $Id: user.class.php,v 1.43 2011/06/29 10:23:32 eldy Exp $ * \version $Id: user.class.php,v 1.44 2011/07/04 11:41:02 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -1482,7 +1482,10 @@ class User extends CommonObject
/** /**
* Add user into a group * Add user into a group
* @param group id du groupe * @param group Id of group
* @param entity Entity
* @param notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/ */
function SetInGroup($group, $entity, $notrigger=0) function SetInGroup($group, $entity, $notrigger=0)
{ {
@ -1539,7 +1542,10 @@ class User extends CommonObject
/** /**
* Remove a user from a group * Remove a user from a group
* @param group id du groupe * @param group Id of group
* @param entity Entity
* @param notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/ */
function RemoveFromGroup($group, $entity, $notrigger=0) function RemoveFromGroup($group, $entity, $notrigger=0)
{ {

View File

@ -22,7 +22,7 @@
* \file htdocs/user/class/usergroup.class.php * \file htdocs/user/class/usergroup.class.php
* \brief Fichier de la classe des groupes d'utilisateur * \brief Fichier de la classe des groupes d'utilisateur
* \author Rodolphe Qiedeville * \author Rodolphe Qiedeville
* \version $Id$ * \version $Id: usergroup.class.php,v 1.10 2011/07/04 11:41:04 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -55,9 +55,8 @@ class UserGroup extends CommonObject
/** /**
* \brief Constructeur de la classe * Constructor
* \param DB Handler acces base de donnees * @param DB Handler acces base de donnees
* \param id Id du groupe (0 par defaut)
*/ */
function UserGroup($DB) function UserGroup($DB)
{ {
@ -68,9 +67,9 @@ class UserGroup extends CommonObject
/** /**
* \brief Charge un objet group avec toutes ces caracteristiques (excpet ->members array) * Charge un objet group avec toutes ces caracteristiques (excpet ->members array)
* \param id id du groupe a charger * @param id id du groupe a charger
* \return int <0 si KO, >0 si OK * @return int <0 si KO, >0 si OK
*/ */
function fetch($id) function fetch($id)
{ {
@ -117,8 +116,8 @@ class UserGroup extends CommonObject
/** /**
* Return array of groups objects for a particular user * Return array of groups objects for a particular user
* @param usertosearch * @param userid User id to search
* @return array of groups objects * @return array Array of groups objects
*/ */
function listGroupsForUser($userid) function listGroupsForUser($userid)
{ {