diff --git a/htdocs/accountancy/accountancyaccount.class.php b/htdocs/accountancy/accountancyaccount.class.php index 5b4dd0f3e79..690de107d0a 100644 --- a/htdocs/accountancy/accountancyaccount.class.php +++ b/htdocs/accountancy/accountancyaccount.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,17 +17,16 @@ */ /** - \file htdocs/accountancy/accountancyaccount.class.php - \ingroup comptaexpert - \brief Fichier de la classe des comptes comptables - \version $Id$ -*/ + * \file htdocs/accountancy/accountancyaccount.class.php + * \ingroup comptaexpert + * \brief Fichier de la classe des comptes comptables + * \version $Id$ + */ /** \class AccountancyAccount \brief Classe permettant la gestion des comptes */ - class AccountancyAccount { var $db; @@ -63,7 +62,7 @@ class AccountancyAccount { $sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount"; $sql.= " (date_creation, fk_user_author, numero,intitule)"; - $sql.= " VALUES (".$this->db->idate(mktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')"; + $sql.= " VALUES (".$this->db->idate(gmmktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')"; $resql = $this->db->query($sql); if ($resql) @@ -79,18 +78,18 @@ class AccountancyAccount { $result = -2; $this->error="AccountancyAccount::Create Erreur $result"; - dol_syslog($this->error); + dol_syslog($this->error, LOG_ERR); } } else { $result = -1; $this->error="AccountancyAccount::Create Erreur $result"; - dol_syslog($this->error); + dol_syslog($this->error, LOG_ERR); } return $result; } - + } ?> diff --git a/htdocs/accountancy/accountancysystem.class.php b/htdocs/accountancy/accountancysystem.class.php index 838c76662b8..46565ae5c77 100644 --- a/htdocs/accountancy/accountancysystem.class.php +++ b/htdocs/accountancy/accountancysystem.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,17 +17,16 @@ */ /** - \file htdocs/accountancy/accountancysystem.class.php - \ingroup comptaexpert - \brief Fichier de la classe des plans de comptes comptables - \version $Id$ -*/ + * \file htdocs/accountancy/accountancysystem.class.php + * \ingroup comptaexpert + * \brief Fichier de la classe des plans de comptes comptables + * \version $Id$ + */ /** \class AccountancySystem - \brief Classe permettant la gestion des plans de comptes -*/ - + * \brief Classe permettant la gestion des plans de comptes + */ class AccountancySystem { var $db; @@ -79,14 +78,14 @@ class AccountancySystem { $result = -2; $this->error="AccountancySystem::Create Erreur $result"; - dol_syslog($this->error); + dol_syslog($this->error, LOG_ERR); } } else { $result = -1; $this->error="AccountancySystem::Create Erreur $result"; - dol_syslog($this->error); + dol_syslog($this->error, LOG_ERR); } return $result; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 113a31f8eef..88900e176e4 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2973,14 +2973,14 @@ else } /* - * Ajouter une ligne + * Form to add new line */ if ($fac->statut == 0 && $user->rights->facture->creer && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline') { print ''; print ''; print ''; // ancre - print $langs->trans('Description').''; + print $langs->trans('AddNewLine').''; print ''.$langs->trans('VAT').''; print ''.$langs->trans('PriceUHT').''; print ''.$langs->trans('Qty').''; @@ -3036,6 +3036,7 @@ else { print ''; print ''; + print $langs->trans("AddNewLine").' - '; if ($conf->service->enabled) { print $langs->trans('RecordedProductsAndServices'); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index fb44ae32663..5f5e6c1afce 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -2964,7 +2964,7 @@ class FactureLigne if ($discount->fk_facture) { $this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); - dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERROR); + dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -2974,7 +2974,7 @@ class FactureLigne if ($result < 0) { $this->error=$discount->error; - dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERROR); + dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -2983,7 +2983,7 @@ class FactureLigne else { $this->error=$langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); - dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERROR); + dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -2991,7 +2991,7 @@ class FactureLigne else { $this->error=$discount->error; - dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERROR); + dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -3014,7 +3014,7 @@ class FactureLigne else { $this->error=$this->db->error(); - dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERROR); + dol_syslog("FactureLigne::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index c4a0f9a2784..ff589ed0c39 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2007 Regis Houssin @@ -69,6 +69,7 @@ class FactureFournisseur extends Facture var $note; var $note_public; var $propalid; + var $lignes; var $fournisseur; @@ -516,7 +517,7 @@ class FactureFournisseur extends Facture else { $this->error=$this->db->error(); - dol_syslog("Error sql=$sql, error=".$this->error); + dol_syslog("Error sql=$sql, error=".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -530,26 +531,28 @@ class FactureFournisseur extends Facture } /** - * \brief Update line - * \param id Id de la ligne de facture - * \param label Description de la ligne - * \param pu Prix unitaire (HT ou TTC selon price_base_type) - * \param tauxtva Taux tva - * \param qty Quantity - * \param idproduct Id produit - * \param price_base_type HT ou TTC - * \param info_bits Miscellanous informations of line - * \return int <0 si ko, >0 si ok + * \brief Update line + * \param id Id of line invoice + * \param label Description of line + * \param pu Prix unitaire (HT ou TTC selon price_base_type) + * \param tauxtva VAT Rate + * \param qty Quantity + * \param idproduct Id produit + * \param price_base_type HT or TTC + * \param info_bits Miscellanous informations of line + * \param type Type of line (0=product, 1=service) + * \return int <0 if KO, >0 if OK */ - function updateline($id, $label, $pu, $tauxtva, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0) + function updateline($id, $label, $pu, $tauxtva, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0) { include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); $pu = price2num($pu); $qty = price2num($qty); - // Validation + // Check parameters if (! is_numeric($pu) || ! is_numeric($qty)) return -1; + if ($type < 0) return -1; // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva @@ -562,13 +565,17 @@ class FactureFournisseur extends Facture $pu_ht = $tabprice[3]; $pu_tva = $tabprice[4]; $pu_ttc = $tabprice[5]; - $product_type = 0; + if ($idproduct) { $product=new Product($this->db); $result=$product->fetch($idproduct); $product_type=$product->type; } + else + { + $product_type = $type; + } $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det '; $sql.= 'SET '; @@ -733,7 +740,7 @@ class FactureFournisseur extends Facture { global $user,$langs; - // Charge tableau des id de soci�t� socids + // Charge tableau des id de societe socids $socids = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE fournisseur=1 LIMIT 10"; $resql = $this->db->query($sql); @@ -766,7 +773,7 @@ class FactureFournisseur extends Facture } } - // Initialise param�tres + // Initialise parametres $this->id=0; $this->ref = 'SPECIMEN'; $this->specimen=1; @@ -789,6 +796,8 @@ class FactureFournisseur extends Facture $ligne->tva_tx=19.6; $prodid = rand(1, $num_prods); $ligne->produit_id=$prodids[$prodid]; + $ligne->product_type=0; + $this->lignes[$xnbp]=$ligne; $xnbp++; } @@ -799,7 +808,7 @@ class FactureFournisseur extends Facture $this->total_ttc = $xnbp*119.6; } - /** + /** * \brief Load an object from its id and create a new one in database * \param fromid Id of object to clone * \param invertdetail Reverse sign of amounts for lines diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 4417e150b30..04894411086 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -500,6 +500,7 @@ Root=Root Informations=Informations Page=Page Notes=Notes +AddNewLine=Add new line # Week day Day1=Monday Day2=Tuesday diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index aa3d2b1f022..c52226ad862 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -499,6 +499,7 @@ Root=Racine Informations=Informations Page=Page Notes=Notes +AddNewLine=Ajout nouvelle ligne # Week day Day1=Lundi Day2=Mardi diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index f32e1d20326..0d357366318 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -922,7 +922,7 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("Propal::set_date Erreur SQL".$this->error, LOG_ERROR); + dol_syslog("Propal::set_date Erreur SQL".$this->error, LOG_ERR); return -1; } } @@ -948,7 +948,7 @@ class Propal extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("Propal::set_echeance Erreur SQL".$this->error, LOG_ERROR); + dol_syslog("Propal::set_echeance Erreur SQL".$this->error, LOG_ERR); return -1; } }