This commit is contained in:
Laurent Destailleur 2009-03-09 23:46:39 +00:00
parent d930a0dd32
commit 8a12e715dd
8 changed files with 59 additions and 49 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -17,17 +17,16 @@
*/ */
/** /**
\file htdocs/accountancy/accountancyaccount.class.php * \file htdocs/accountancy/accountancyaccount.class.php
\ingroup comptaexpert * \ingroup comptaexpert
\brief Fichier de la classe des comptes comptables * \brief Fichier de la classe des comptes comptables
\version $Id$ * \version $Id$
*/ */
/** \class AccountancyAccount /** \class AccountancyAccount
\brief Classe permettant la gestion des comptes \brief Classe permettant la gestion des comptes
*/ */
class AccountancyAccount class AccountancyAccount
{ {
var $db; var $db;
@ -63,7 +62,7 @@ class AccountancyAccount
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount";
$sql.= " (date_creation, fk_user_author, numero,intitule)"; $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); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -79,14 +78,14 @@ class AccountancyAccount
{ {
$result = -2; $result = -2;
$this->error="AccountancyAccount::Create Erreur $result"; $this->error="AccountancyAccount::Create Erreur $result";
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
} }
} }
else else
{ {
$result = -1; $result = -1;
$this->error="AccountancyAccount::Create Erreur $result"; $this->error="AccountancyAccount::Create Erreur $result";
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
} }
return $result; return $result;

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -17,17 +17,16 @@
*/ */
/** /**
\file htdocs/accountancy/accountancysystem.class.php * \file htdocs/accountancy/accountancysystem.class.php
\ingroup comptaexpert * \ingroup comptaexpert
\brief Fichier de la classe des plans de comptes comptables * \brief Fichier de la classe des plans de comptes comptables
\version $Id$ * \version $Id$
*/ */
/** \class AccountancySystem /** \class AccountancySystem
\brief Classe permettant la gestion des plans de comptes * \brief Classe permettant la gestion des plans de comptes
*/ */
class AccountancySystem class AccountancySystem
{ {
var $db; var $db;
@ -79,14 +78,14 @@ class AccountancySystem
{ {
$result = -2; $result = -2;
$this->error="AccountancySystem::Create Erreur $result"; $this->error="AccountancySystem::Create Erreur $result";
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
} }
} }
else else
{ {
$result = -1; $result = -1;
$this->error="AccountancySystem::Create Erreur $result"; $this->error="AccountancySystem::Create Erreur $result";
dol_syslog($this->error); dol_syslog($this->error, LOG_ERR);
} }
return $result; return $result;

View File

@ -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') if ($fac->statut == 0 && $user->rights->facture->creer && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
print '<a name="add"></a>'; // ancre print '<a name="add"></a>'; // ancre
print $langs->trans('Description').'</td>'; print $langs->trans('AddNewLine').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>'; print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>'; print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>'; print '<td align="right">'.$langs->trans('Qty').'</td>';
@ -3036,6 +3036,7 @@ else
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'; print '<td colspan="3">';
print $langs->trans("AddNewLine").' - ';
if ($conf->service->enabled) if ($conf->service->enabled)
{ {
print $langs->trans('RecordedProductsAndServices'); print $langs->trans('RecordedProductsAndServices');

View File

@ -2964,7 +2964,7 @@ class FactureLigne
if ($discount->fk_facture) if ($discount->fk_facture)
{ {
$this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id); $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(); $this->db->rollback();
return -3; return -3;
} }
@ -2974,7 +2974,7 @@ class FactureLigne
if ($result < 0) if ($result < 0)
{ {
$this->error=$discount->error; $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(); $this->db->rollback();
return -3; return -3;
} }
@ -2983,7 +2983,7 @@ class FactureLigne
else else
{ {
$this->error=$langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); $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(); $this->db->rollback();
return -3; return -3;
} }
@ -2991,7 +2991,7 @@ class FactureLigne
else else
{ {
$this->error=$discount->error; $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(); $this->db->rollback();
return -3; return -3;
} }
@ -3014,7 +3014,7 @@ class FactureLigne
else else
{ {
$this->error=$this->db->error(); $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(); $this->db->rollback();
return -2; return -2;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
@ -69,6 +69,7 @@ class FactureFournisseur extends Facture
var $note; var $note;
var $note_public; var $note_public;
var $propalid; var $propalid;
var $lignes; var $lignes;
var $fournisseur; var $fournisseur;
@ -516,7 +517,7 @@ class FactureFournisseur extends Facture
else else
{ {
$this->error=$this->db->error(); $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(); $this->db->rollback();
return -1; return -1;
} }
@ -530,26 +531,28 @@ class FactureFournisseur extends Facture
} }
/** /**
* \brief Update line * \brief Update line
* \param id Id de la ligne de facture * \param id Id of line invoice
* \param label Description de la ligne * \param label Description of line
* \param pu Prix unitaire (HT ou TTC selon price_base_type) * \param pu Prix unitaire (HT ou TTC selon price_base_type)
* \param tauxtva Taux tva * \param tauxtva VAT Rate
* \param qty Quantity * \param qty Quantity
* \param idproduct Id produit * \param idproduct Id produit
* \param price_base_type HT ou TTC * \param price_base_type HT or TTC
* \param info_bits Miscellanous informations of line * \param info_bits Miscellanous informations of line
* \return int <0 si ko, >0 si ok * \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'); include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
$pu = price2num($pu); $pu = price2num($pu);
$qty = price2num($qty); $qty = price2num($qty);
// Validation // Check parameters
if (! is_numeric($pu) || ! is_numeric($qty)) return -1; 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 // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
@ -562,13 +565,17 @@ class FactureFournisseur extends Facture
$pu_ht = $tabprice[3]; $pu_ht = $tabprice[3];
$pu_tva = $tabprice[4]; $pu_tva = $tabprice[4];
$pu_ttc = $tabprice[5]; $pu_ttc = $tabprice[5];
$product_type = 0;
if ($idproduct) if ($idproduct)
{ {
$product=new Product($this->db); $product=new Product($this->db);
$result=$product->fetch($idproduct); $result=$product->fetch($idproduct);
$product_type=$product->type; $product_type=$product->type;
} }
else
{
$product_type = $type;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det '; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det ';
$sql.= 'SET '; $sql.= 'SET ';
@ -733,7 +740,7 @@ class FactureFournisseur extends Facture
{ {
global $user,$langs; global $user,$langs;
// Charge tableau des id de soci<EFBFBD>t<EFBFBD> socids // Charge tableau des id de societe socids
$socids = array(); $socids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE fournisseur=1 LIMIT 10"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE fournisseur=1 LIMIT 10";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -766,7 +773,7 @@ class FactureFournisseur extends Facture
} }
} }
// Initialise param<EFBFBD>tres // Initialise parametres
$this->id=0; $this->id=0;
$this->ref = 'SPECIMEN'; $this->ref = 'SPECIMEN';
$this->specimen=1; $this->specimen=1;
@ -789,6 +796,8 @@ class FactureFournisseur extends Facture
$ligne->tva_tx=19.6; $ligne->tva_tx=19.6;
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$ligne->produit_id=$prodids[$prodid]; $ligne->produit_id=$prodids[$prodid];
$ligne->product_type=0;
$this->lignes[$xnbp]=$ligne; $this->lignes[$xnbp]=$ligne;
$xnbp++; $xnbp++;
} }
@ -799,7 +808,7 @@ class FactureFournisseur extends Facture
$this->total_ttc = $xnbp*119.6; $this->total_ttc = $xnbp*119.6;
} }
/** /**
* \brief Load an object from its id and create a new one in database * \brief Load an object from its id and create a new one in database
* \param fromid Id of object to clone * \param fromid Id of object to clone
* \param invertdetail Reverse sign of amounts for lines * \param invertdetail Reverse sign of amounts for lines

View File

@ -500,6 +500,7 @@ Root=Root
Informations=Informations Informations=Informations
Page=Page Page=Page
Notes=Notes Notes=Notes
AddNewLine=Add new line
# Week day # Week day
Day1=Monday Day1=Monday
Day2=Tuesday Day2=Tuesday

View File

@ -499,6 +499,7 @@ Root=Racine
Informations=Informations Informations=Informations
Page=Page Page=Page
Notes=Notes Notes=Notes
AddNewLine=Ajout nouvelle ligne
# Week day # Week day
Day1=Lundi Day1=Lundi
Day2=Mardi Day2=Mardi

View File

@ -922,7 +922,7 @@ class Propal extends CommonObject
else else
{ {
$this->error=$this->db->error(); $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; return -1;
} }
} }
@ -948,7 +948,7 @@ class Propal extends CommonObject
else else
{ {
$this->error=$this->db->error(); $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; return -1;
} }
} }