cvsimport

This commit is contained in:
Regis Houssin 2011-09-21 06:14:29 +00:00
commit a4a4c1dae8
76 changed files with 980 additions and 1547 deletions

View File

@ -22,8 +22,9 @@
*/ */
/** \class AccountancyAccount /**
\brief Classe permettant la gestion des comptes * \class AccountancyAccount
* \brief Classe permettant la gestion des comptes
*/ */
class AccountancyAccount class AccountancyAccount
{ {
@ -42,7 +43,7 @@ class AccountancyAccount
/** /**
* Constructor * Constructor
* *
* @param $DoliDB $DB Database handler * @param DoliDB $DB Database handler
*/ */
function AccountancyAccount($DB) function AccountancyAccount($DB)
{ {

View File

@ -38,12 +38,9 @@ require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
*/ */
class Adherent extends CommonObject class Adherent extends CommonObject
{ {
var $db; public $element='member';
var $error; public $table_element='adherent';
var $errors=array(); protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $element='member';
var $table_element='adherent';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $ref; var $ref;
@ -1938,7 +1935,11 @@ class Adherent extends CommonObject
/** /**
* Initialise le membre avec valeurs fictives aleatoire * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -33,10 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/ */
class AdherentType extends CommonObject class AdherentType extends CommonObject
{ {
var $error; public $table_element = 'adherent_type';
var $errors=array();
var $db;
var $table_element = 'adherent_type';
var $id; var $id;
var $libelle; var $libelle;

View File

@ -33,12 +33,11 @@ include_once DOL_DOCUMENT_ROOT . "/adherents/class/cotisation.class.php";
*/ */
class AdherentStats extends Stats class AdherentStats extends Stats
{ {
var $db; public $table_element;
var $socid; var $socid;
var $userid; var $userid;
var $table_element;
var $from; var $from;
var $field; var $field;
var $where; var $where;

View File

@ -31,13 +31,10 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/ */
class Cotisation extends CommonObject class Cotisation extends CommonObject
{ {
var $id; public $element='subscription';
var $db; public $table_element='cotisation';
var $error;
var $errors;
var $element='subscription';
var $table_element='cotisation';
var $id;
var $datec; var $datec;
var $datem; var $datem;
var $dateh; // Subscription start date var $dateh; // Subscription start date

View File

@ -33,15 +33,22 @@ class BoutiqueClient
var $id ; var $id ;
var $nom; var $nom;
function BoutiqueClient($DB, $id=0)
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function BoutiqueClient($DB)
{ {
$this->db = $DB; $this->db = $DB;
$this->id = $id ;
} }
/** /**
* \brief Fonction permettant de recuperer les informations d'un clients de la boutique * Fonction permettant de recuperer les informations d'un clients de la boutique
* \param id Id du client *
* @param int $id Id du client
* @return int <0 if KO, >0 if OK
*/ */
function fetch($id) function fetch($id)
{ {

View File

@ -37,7 +37,13 @@ class BoutiqueCommande
var $id; var $id;
var $nom; var $nom;
function BoutiqueCommande($DB, $id=0)
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function BoutiqueCommande($DB)
{ {
$this->db = $DB; $this->db = $DB;
$this->id = $id; $this->id = $id;
@ -50,10 +56,11 @@ class BoutiqueCommande
} }
/** /**
* \brief Get object and lines from database * Get object and lines from database
* \param rowid id of object to load *
* \param ref Ref of order * @param int $id id of object to load
* \return int >0 si ok, <0 si ko * @param string $ref Ref of order
* @return int >0 if OK, <0 if KO
*/ */
function fetch($id,$ref='') function fetch($id,$ref='')
{ {

View File

@ -16,7 +16,17 @@
* *
*/ */
class Promotion { /**
* \file htdocs/boutique/promotion/class/promotion.class.php
* \brief File of class to manage discounts on online shop
*/
/**
* \class Promotion
* \brief Class to manage discounts on online shop
*/
class Promotion
{
var $db; var $db;
var $id; var $id;
@ -28,16 +38,27 @@ class Promotion {
var $price; var $price;
var $status; var $status;
function Promotion($DB, $id=0) { /**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Promotion($DB)
{
$this->db = $DB; $this->db = $DB;
$this->id = $id; $this->id = $id;
} }
/*
* /**
* * Create promotion
* *
* @param User $user Object user
* @param int $pid Pid
* @param int $percent Percent
* @return int <0 if KO, >0 if OK
*/ */
function create($user, $pid, $percent) { function create($user, $pid, $percent)
{
global $conf; global $conf;
$sql = "SELECT products_price "; $sql = "SELECT products_price ";
@ -51,13 +72,13 @@ class Promotion {
$this->price_init = $result["products_price"]; $this->price_init = $result["products_price"];
} }
$newprice = 0.95 * $this->price_init; $newprice = $percent * $this->price_init;
$date_exp = "2003-05-01"; $date_exp = "2003-05-01";
$sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials "; $sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials ";
$sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) "; $sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
$sql .= " VALUES ($pid, $newprice, ".$this->db->idate(mktime()).", NULL, '$date_exp',NULL,1)"; $sql .= " VALUES ($pid, $newprice, '".$this->db->idate(mktime())."', NULL, '".$this->db->idate(mktime()+3600*24*365)."', NULL, 1)";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
@ -70,10 +91,13 @@ class Promotion {
print $this->db->error() . ' in ' . $sql; print $this->db->error() . ' in ' . $sql;
} }
} }
/*
* /**
* * Update
* *
* @param int $id id
* @param User $user Object user
* @return int <0 if KO, >0 if OK
*/ */
function update($id, $user) function update($id, $user)
{ {
@ -89,10 +113,12 @@ class Promotion {
print $this->db->error() . ' in ' . $sql; print $this->db->error() . ' in ' . $sql;
} }
} }
/*
* /**
* * Set active
* *
* @param int $id id
* @return int <0 if KO, >0 if OK
*/ */
function set_active($id) function set_active($id)
{ {
@ -109,8 +135,12 @@ class Promotion {
print $this->db->error() . ' in ' . $sql; print $this->db->error() . ' in ' . $sql;
} }
} }
/*
/**
* Set inactive
* *
* @param int $id id
* @return int <0 if KO, >0 if OK
*/ */
function set_inactive($id) function set_inactive($id)
{ {
@ -127,12 +157,15 @@ class Promotion {
print $this->db->error() . ' in ' . $sql; print $this->db->error() . ' in ' . $sql;
} }
} }
/*
* /**
* * Fetch datas
* *
* @param int $id id
* @return int <0 if KO, >0 if OK
*/ */
function fetch ($id) { function fetch($id)
{
global $conf; global $conf;
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id"; $sql = "SELECT c.categories_id, cd.categories_name, c.parent_id";
@ -157,12 +190,14 @@ class Promotion {
} }
/* /**
* * Delete object
* *
* @param User $user Object user
* @return int <0 if KO, >0 if OK
*/ */
function delete($user) { function delete($user)
{
global $conf; global $conf;
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc "; $sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc ";

View File

@ -36,11 +36,8 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php");
*/ */
class Categorie class Categorie
{ {
var $error; public $element='category';
var $db; public $table_element='category';
var $element='category';
var $table_element='category';
var $id; var $id;
var $id_mere; var $id_mere;
@ -1344,8 +1341,9 @@ class Categorie
/** /**
* Initialise an example of instance with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */

View File

@ -32,12 +32,9 @@ require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php');
*/ */
class ActionComm extends CommonObject class ActionComm extends CommonObject
{ {
var $db; public $element='action';
var $error; public $table_element = 'actioncomm';
var $errors=array(); protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $element='action';
var $table_element = 'actioncomm';
var $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $type_id; var $type_id;
var $type_code; var $type_code;

View File

@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Mailing extends CommonObject class Mailing extends CommonObject
{ {
var $db; public $element='mailing';
var $error; public $table_element='mailing';
var $element='mailing';
var $table_element='mailing';
var $id; var $id;
var $statut; var $statut;

View File

@ -42,13 +42,11 @@ require_once(DOL_DOCUMENT_ROOT ."/contact/class/contact.class.php");
*/ */
class Propal extends CommonObject class Propal extends CommonObject
{ {
var $db; public $element='propal';
var $error; public $table_element='propal';
var $element='propal'; public $table_element_line='propaldet';
var $table_element='propal'; public $fk_element='fk_propal';
var $table_element_line='propaldet'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $fk_element='fk_propal';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
@ -2128,8 +2126,11 @@ class Propal extends CommonObject
/** /**
* Initialise an example of instance with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -33,12 +33,11 @@ include_once DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php";
*/ */
class PropaleStats extends Stats class PropaleStats extends Stats
{ {
var $db; public $table_element;
var $socid; var $socid;
var $userid; var $userid;
var $table_element;
var $from; var $from;
var $field; var $field;
var $where; var $where;

View File

@ -17,9 +17,9 @@
*/ */
/** /**
* \file htdocs/fourn/recap-fourn.php * \file htdocs/comm/prospect/recap-prospect.php
* \ingroup fournisseur * \ingroup societe
* \brief Page de fiche recap fournisseur * \brief Page with prospect summary
*/ */
require("../../main.inc.php"); require("../../main.inc.php");

View File

@ -35,14 +35,12 @@ require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
*/ */
class Commande extends CommonObject class Commande extends CommonObject
{ {
var $db; public $element='commande';
var $error; public $table_element='commande';
var $element='commande'; public $table_element_line = 'commandedet';
var $table_element='commande'; public $class_element_line = 'OrderLine';
var $table_element_line = 'commandedet'; public $fk_element = 'fk_commande';
var $class_element_line = 'OrderLine'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $fk_element = 'fk_commande';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
@ -2598,8 +2596,11 @@ class Commande extends CommonObject
/** /**
* Initialise an example of instance with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -33,12 +33,11 @@ include_once DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php";
*/ */
class CommandeStats extends Stats class CommandeStats extends Stats
{ {
var $db ; public $table_element;
var $socid; var $socid;
var $userid; var $userid;
var $table_element;
var $from; var $from;
var $field; var $field;
var $where; var $where;

View File

@ -34,10 +34,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Account extends CommonObject class Account extends CommonObject
{ {
var $db; public $element='bank_account';
var $error; public $table_element='bank_account';
var $element='bank_account';
var $table_element='bank_account';
var $rowid; var $rowid;
var $ref; var $ref;
@ -987,7 +985,11 @@ class Account extends CommonObject
} }
/** /**
* Initialize properties with test values * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -36,14 +36,10 @@
*/ */
class BankCateg // extends CommonObject class BankCateg // extends CommonObject
{ {
var $db; //!< To store db handler //public $element='bank_categ'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) //public $table_element='bank_categ'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
//var $element='bank_categ'; //!< Id that identify managed objects
//var $table_element='bank_categ'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $label; var $label;
@ -345,16 +341,17 @@ class BankCateg // extends CommonObject
/** /**
* \brief Initialise object with example values * Initialise an instance with random values.
* \remarks id must be 0 if object instance is a specimen. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
$this->label=''; $this->label='';
} }
} }

View File

@ -1,115 +0,0 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/class/comptacompte.class.php
* \ingroup compta
* \brief Fichier de la classe des comptes comptable
*/
/** \class ComptaCompte
* \brief Classe permettant la gestion des comptes generaux de compta
*/
class ComptaCompte
{
var $db ;
var $id ;
var $num;
var $intitule;
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
* \param id id compte (0 par defaut)
*/
function ComptaCompte($DB, $id=0)
{
$this->db = $DB;
$this->id = $id ;
}
/**
* \brief Insere le produit en base
* \param user utilisateur qui effectue l'insertion
*/
function create($user)
{
if (dol_strlen(trim($this->numero)) && dol_strlen(trim($this->intitule)))
{
$sql = "SELECT count(*)";
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux ";
$sql .= " WHERE numero = '" .trim($this->numero)."'";
$resql = $this->db->query($sql);
if ( $resql )
{
$row = $this->db->fetch_array($resql);
if ($row[0] == 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."compta_compte_generaux (date_creation, fk_user_author, numero,intitule)";
$sql .= " VALUES (".$this->db->idate(mktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')";
$resql = $this->db->query($sql);
if ( $resql )
{
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."compta_compte_generaux");
if ($id > 0)
{
$this->id = $id;
$result = 0;
}
else
{
$result = -2;
dol_syslog("ComptaCompte::Create Erreur $result lecture ID");
}
}
else
{
$result = -1;
dol_syslog("ComptaCompte::Create Erreur $result INSERT Mysql");
}
}
else
{
$result = -3;
dol_syslog("ComptaCompte::Create Erreur $result SELECT Mysql");
}
}
else
{
$result = -5;
dol_syslog("ComptaCompte::Create Erreur $result SELECT Mysql");
}
}
else
{
$result = -4;
dol_syslog("ComptaCompte::Create Erreur $result Valeur Manquante");
}
return $result;
}
}
?>

View File

@ -31,13 +31,11 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Deplacement extends CommonObject class Deplacement extends CommonObject
{ {
var $db; public $element='deplacement';
var $error; public $table_element='deplacement';
var $element='deplacement'; public $table_element_line = '';
var $table_element='deplacement'; public $fk_element = '';
var $table_element_line = ''; protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $fk_element = '';
var $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;

View File

@ -31,12 +31,11 @@ include_once DOL_DOCUMENT_ROOT . "/compta/deplacement/class/deplacement.class.ph
*/ */
class DeplacementStats extends Stats class DeplacementStats extends Stats
{ {
var $db; public $table_element;
var $socid; var $socid;
var $userid; var $userid;
var $table_element;
var $from; var $from;
var $field; var $field;
var $where; var $where;

View File

@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Don extends CommonObject class Don extends CommonObject
{ {
var $db; public $element='don';
var $error; public $table_element='don';
var $element='don';
var $table_element='don';
var $id; var $id;
var $date; var $date;
@ -142,8 +140,11 @@ class Don extends CommonObject
/** /**
* \brief Initialise le don avec valeurs fictives alaatoire * Initialise an instance with random values.
* Sert a generer un recu de don pour l'aperu des modeles ou demo * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -35,11 +35,10 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
*/ */
class FactureRec extends Facture class FactureRec extends Facture
{ {
var $db ; public $element='facturerec';
var $element='facturerec'; public $table_element='facture_rec';
var $table_element='facture_rec'; public $table_element_line='facturedet_rec';
var $table_element_line='facturedet_rec'; public $fk_element='fk_facture';
var $fk_element='fk_facture';
var $id; var $id;

View File

@ -40,14 +40,11 @@ require_once(DOL_DOCUMENT_ROOT ."/societe/class/client.class.php");
*/ */
class Facture extends CommonObject class Facture extends CommonObject
{ {
var $db; public $element='facture';
var $error; public $table_element='facture';
var $errors=array(); public $table_element_line = 'facturedet';
var $element='facture'; public $fk_element = 'fk_facture';
var $table_element='facture'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $table_element_line = 'facturedet';
var $fk_element = 'fk_facture';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
//! Id client //! Id client
@ -3062,8 +3059,11 @@ class Facture extends CommonObject
/** /**
* Initialise an example of invoice with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -33,12 +33,10 @@ include_once DOL_DOCUMENT_ROOT . "/lib/date.lib.php";
*/ */
class FactureStats extends Stats class FactureStats extends Stats
{ {
var $db;
var $socid; var $socid;
var $userid; var $userid;
var $table_element; public $table_element;
var $from; var $from;
var $field; var $field;
var $where; var $where;

View File

@ -33,8 +33,8 @@ class PaymentTerm // extends CommonObject
var $db; //!< To store db handler var $db; //!< To store db handler
var $error; //!< To return error code (or message) var $error; //!< To return error code (or message)
var $errors=array(); //!< To return several error codes (or messages) var $errors=array(); //!< To return several error codes (or messages)
//var $element='c_payment_term'; //!< Id that identify managed objects //public $element='c_payment_term'; //!< Id that identify managed objects
//var $table_element='c_payment_term'; //!< Name of table without prefix where object is stored //public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored
var $id; var $id;
@ -455,8 +455,9 @@ class PaymentTerm // extends CommonObject
/** /**
* Initialise object with example values * Initialise an instance with random values.
* id must be 0 if object instance is a specimen * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */

View File

@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/compta/journal/purchasesjournal.php
* \ingroup societe, fournisseur, facture
* \brief Page with purchases journal
*/
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");

View File

@ -17,6 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/compta/journal/sellsjournal.php
* \ingroup societe, facture
* \brief Page with sells journal
*/
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");

View File

@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class RemiseCheque extends CommonObject class RemiseCheque extends CommonObject
{ {
var $db; public $element='chequereceipt';
var $error; public $table_element='bordereau_cheque';
var $element='chequereceipt';
var $table_element='bordereau_cheque';
var $id; var $id;
var $num; var $num;

View File

@ -30,10 +30,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Paiement extends CommonObject class Paiement extends CommonObject
{ {
var $db; public $element='payment';
var $error; public $table_element='paiement';
var $element='payment';
var $table_element='paiement';
var $id; var $id;
var $ref; var $ref;

View File

@ -1,103 +0,0 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/compta/param/comptes/fiche.php
* \ingroup compta
* \brief Page de la fiche des comptes comptables
*/
require("../../../main.inc.php");
$mesg = '';
if ($_POST["action"] == 'add' && $user->rights->compta->ventilation->parametrer)
{
$compte = new ComptaCompte($db);
$compte->numero = $_POST["numero"];
$compte->intitule = $_POST["intitule"];
$e_compte = $compte;
$res = $compte->create($user);
if ($res == 0)
{
Header("Location: liste.php");
}
else
{
if ($res == -3)
{
$_error = 1;
$_GET["action"] = "create";
$_GET["type"] = $_POST["type"];
}
if ($res == -4)
{
$_error = 2;
$_GET["action"] = "create";
$_GET["type"] = $_POST["type"];
}
}
}
llxHeader("","Nouveau compte");
/*
* Creation d'un compte
*
*/
if ($_GET["action"] == 'create' && $user->rights->compta->ventilation->parametrer)
{
$html = new Form($db);
$nbligne=0;
print_fiche_titre($langs->trans("NewAccount"));
print '<form action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
print '<table class="border" width="100%">';
print '<tr>';
print '<td>'.$langs->trans("AccountNumber").'</td><td><input name="numero" size="20" value="'.$compte->numero.'">';
if ($_error == 1)
{
print "Ce numéro de compte existe déjà";
}
if ($_error == 2)
{
print "Valeur(s) manquante(s)";
}
print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="intitule" size="40" value="'.$compte->intitule.'"></td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
print '</table>';
print '</form>';
}
$db->close();
llxFooter();
?>

View File

@ -1,78 +0,0 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/compta/param/comptes/index.php
* \ingroup compta
* \brief Page acceuil zone parametrages
*/
require("../../../main.inc.php");
$langs->load("compta");
$langs->load("bills");
/*
* Securite acces client
*/
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
llxHeader("","Accueil Compta");
/*
* Affichage page
*
*/
print_fiche_titre($langs->trans("AccountancySetup"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Zone recherche facture
*/
print '<form method="post" action="facture.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<td colspan="3">'.$langs->trans("SearchABill").'</td></tr>';
print "<tr $bc[0]>";
print '<td>'.$langs->trans("Ref").':</td><td><input type="text" class="flat" size="18" name="sf_ref"></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "</table></form><br>";
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</td></tr>';
print '</table>';
$db->close();
llxFooter();
?>

View File

@ -1,126 +0,0 @@
<?PHP
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/compta/param/comptes/liste.php
* \ingroup compta
* \brief Onglet de gestion de parametrages des ventilations
*/
require("../../../main.inc.php");
llxHeader('','Compta - Liste des comptes');
$page = $_GET["page"];
$sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"];
if ($sortorder == "") $sortorder="ASC";
if ($sortfield == "") $sortfield="cg.numero";
$offset = $conf->liste_limit * $page ;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT cg.rowid, cg.numero, cg.intitule, cg.date_creation as dc";
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux as cg";
if (dol_strlen(trim($_GET["search_numero"])) )
{
$sql .= " WHERE cg.numero LIKE '%".$_GET["search_numero"]."%'";
if ( dol_strlen(trim($_GET["search_intitule"])))
{
$sql .= " AND cg.intitule LIKE '%".$_GET["search_intitule"]."%'";
}
}
else
{
if ( dol_strlen(trim($_GET["search_intitule"])))
{
$sql .= " WHERE cg.intitule LIKE '%".$_GET["search_intitule"]."%'";
}
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste("Comptes généraux", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
print '<table class="liste">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountNumberShort"),"liste.php","cg.numero");
print_liste_field_titre($langs->trans("Label"),"liste.php","cg.intitule");
print_liste_field_titre($langs->trans("DateCreation"),"liste.php","cg.date_creation");
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="liste.php" method="GET">';
print '<td><input type="text" name="search_numero" value="'.$_GET["search_numero"].'"></td>';
print '<td><input type="text" name="search_intitule" value="'.$_GET["search_intitule"].'"></td>';
print '<td align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print '</form>';
print '</tr>';
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td>'.$obj->numero.'</td>'."\n";
print '<td>'.$obj->intitule.'</td>';
print '<td align="right" width="100">';
print dol_print_date($db->jdate($obj->dc));
print '</td>';
print "</tr>\n";
$i++;
}
print "</table>";
$db->free($resql);
}
else
{
dol_print_error($db);
}
$db->close();
llxFooter();
?>

View File

@ -1,75 +0,0 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/param/index.php
* \ingroup compta
* \brief Page acceuil zone parametrage comptabilite
*/
require("../../main.inc.php");
$langs->load("compta");
$langs->load("bills");
/*
* S<EFBFBD>curit<EFBFBD> acc<EFBFBD>s client
*/
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
llxHeader("",$langs->trans("AccountancySetup"));
/*
* Affichage page
*
*/
print_fiche_titre($langs->trans("AccountancySetup"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Zone recherche facture
*/
print '<form method="get" action="../facture.php">';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<td colspan="3">'.$langs->trans("SearchABill").'</td></tr>';
print "<tr $bc[0]><td>";
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="search_ref"></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print "</table></form><br>";
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</td></tr>';
print '</table>';
$db->close();
llxFooter();
?>

View File

@ -96,14 +96,15 @@ class BonPrelevement extends CommonObject
/** /**
* Add facture to withdrawal * Add facture to withdrawal
* @param facture_id id invoice to add *
* @param client_id id invoice customer * @param int $facture_id id invoice to add
* @param client_nom name of cliente * @param int $client_id id invoice customer
* @param amount amount of invoice * @param string $client_nom name of cliente
* @param code_banque code of bank withdrawal * @param int $amount amount of invoice
* @param code_guichet code of bank's office * @param string $code_banque code of bank withdrawal
* @param number bank account number * @param string $code_guichet code of bank's office
* @param number_key number key of account number * @param string $number bank account number
* @param string $number_key number key of account number
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
@ -153,14 +154,15 @@ class BonPrelevement extends CommonObject
/** /**
* Add line to withdrawal * Add line to withdrawal
* @param ligne_id id line to add *
* @param client_id id invoice customer * @param int &$line_id id line to add
* @param client_nom name of cliente * @param int $client_id id invoice customer
* @param amount amount of invoice * @param string $client_nom name of cliente
* @param code_banque code of bank withdrawal * @param int $amount amount of invoice
* @param code_guichet code of bank's office * @param string $code_banque code of bank withdrawal
* @param number bank account number * @param string $code_guichet code of bank's office
* @param number_key number key of account number * @param string $number bank account number
* @param string $number_key number key of account number
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
@ -234,8 +236,9 @@ class BonPrelevement extends CommonObject
/** /**
* Read errors * Read errors
* @param error id of error *
* @return array of errors * @param int $error id of error
* @return array Array of errors
*/ */
function ReadError($error) function ReadError($error)
{ {
@ -248,7 +251,8 @@ class BonPrelevement extends CommonObject
/** /**
* Get object and lines from database * Get object and lines from database
* @param rowid id of object to load *
* @param int $rowid id of object to load
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function fetch($rowid) function fetch($rowid)
@ -308,7 +312,10 @@ class BonPrelevement extends CommonObject
} }
/** /**
* Set credite
*
* @deprecated * @deprecated
* @return int <0 if KO, >0 if OK
*/ */
function set_credite() function set_credite()
{ {
@ -386,8 +393,9 @@ class BonPrelevement extends CommonObject
/** /**
* Set withdrawal to creditet status * Set withdrawal to creditet status
* @param user id of user *
* @param date date of action * @param User $user id of user
* @param timestamp $date date of action
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function set_infocredit($user, $date) function set_infocredit($user, $date)
@ -508,9 +516,10 @@ class BonPrelevement extends CommonObject
/** /**
* Set withdrawal to transmited status * Set withdrawal to transmited status
* @param user id of user *
* @param date date of action * @param User $user id of user
* @param method method of transmision to bank * @param timestamp $date date of action
* @param string $method method of transmision to bank
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function set_infotrans($user, $date, $method) function set_infotrans($user, $date, $method)
@ -575,6 +584,7 @@ class BonPrelevement extends CommonObject
/** /**
* Get invoice list * Get invoice list
*
* @return array id of invoices * @return array id of invoices
*/ */
function _get_list_factures() function _get_list_factures()
@ -623,7 +633,8 @@ class BonPrelevement extends CommonObject
/** /**
* Returns amount of withdrawal * Returns amount of withdrawal
* @return double total amount *
* @return double Total amount
*/ */
function SommeAPrelever() function SommeAPrelever()
{ {
@ -659,8 +670,9 @@ class BonPrelevement extends CommonObject
/** /**
* Get number of invoices to withdrawal * Get number of invoices to withdrawal
* @param banque bank *
* @param agence agence * @param int $banque bank
* @param int $agence agence
* @return int <O if KO, number of invoices if OK * @return int <O if KO, number of invoices if OK
*/ */
function NbFactureAPrelever($banque=0,$agence=0) function NbFactureAPrelever($banque=0,$agence=0)
@ -702,9 +714,10 @@ class BonPrelevement extends CommonObject
/** /**
* Create a withdraw * Create a withdraw
* @param banque code of bank *
* @param guichet code of banck office * @param int $banque code of bank
* @param mode real=do action, simu=test only * @param int $guichet code of banck office
* @param string $mode real=do action, simu=test only
* @return int <0 if KO, nbre of invoice withdrawed if OK * @return int <0 if KO, nbre of invoice withdrawed if OK
*/ */
function Create($banque=0, $guichet=0, $mode='real') function Create($banque=0, $guichet=0, $mode='real')
@ -855,7 +868,6 @@ class BonPrelevement extends CommonObject
/* /*
* Traitements * Traitements
*
*/ */
if (!$error) if (!$error)
{ {
@ -915,7 +927,6 @@ class BonPrelevement extends CommonObject
/* /*
* Creation process * Creation process
*
*/ */
if (!$error) if (!$error)
{ {
@ -938,8 +949,7 @@ class BonPrelevement extends CommonObject
* $fac[8] : client nom * $fac[8] : client nom
* $fac[2] : client id * $fac[2] : client id
*/ */
$ri = $bonprev->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $ri = $bonprev->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]);
$fac[3], $fac[4], $fac[5], $fac[6]);
if ($ri <> 0) if ($ri <> 0)
{ {
$error++; $error++;
@ -1005,7 +1015,6 @@ class BonPrelevement extends CommonObject
/* /*
* Update total * Update total
*
*/ */
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
@ -1023,7 +1032,6 @@ class BonPrelevement extends CommonObject
/* /*
* Rollback or Commit * Rollback or Commit
*
*/ */
if (!$error) if (!$error)
{ {
@ -1046,8 +1054,9 @@ class BonPrelevement extends CommonObject
/** /**
* Returns clickable name (with picto) * Returns clickable name (with picto)
* @param withpicto link with picto *
* @param option link target * @param int $withpicto link with picto
* @param string $option link target
* @return string URL of target * @return string URL of target
*/ */
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0,$option='')
@ -1073,7 +1082,8 @@ class BonPrelevement extends CommonObject
/** /**
* Delete a notification def by id * Delete a notification def by id
* @param rowid id of notification *
* @param int $rowid id of notification
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function DeleteNotificationById($rowid) function DeleteNotificationById($rowid)
@ -1095,8 +1105,9 @@ class BonPrelevement extends CommonObject
/** /**
* Delete a notification * Delete a notification
* @param user notification user *
* @param action notification action * @param User $user notification user
* @param string $action notification action
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function DeleteNotification($user, $action) function DeleteNotification($user, $action)
@ -1118,8 +1129,10 @@ class BonPrelevement extends CommonObject
/** /**
* Add a notification * Add a notification
* @param user notification user *
* @param action notification action * @param DoliDB $db database handler
* @param User $user notification user
* @param string $action notification action
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function AddNotification($db, $user, $action) function AddNotification($db, $user, $action)
@ -1148,12 +1161,12 @@ class BonPrelevement extends CommonObject
/** /**
* Generate a withdrawal file * Generate a withdrawal file. Generation Formats:
* Generation Formats:
* France: CFONB * France: CFONB
* Spain: AEB19 (if external module EsAEB is enabled) * Spain: AEB19 (if external module EsAEB is enabled)
* Others: Warning message * Others: Warning message
* File is generated with name this->filename * File is generated with name this->filename
*
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
//TODO: Optimize code to read lines in a single function //TODO: Optimize code to read lines in a single function
@ -1198,7 +1211,8 @@ class BonPrelevement extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$esaeb19->agregaRecibo($idOrdenante, $esaeb19->agregaRecibo(
$idOrdenante,
"idcliente".$i+1, "idcliente".$i+1,
$obj->client_nom, $obj->client_nom,
$obj->code_banque, $obj->code_banque,
@ -1206,7 +1220,8 @@ class BonPrelevement extends CommonObject
$obj->cle_rib, $obj->cle_rib,
$obj->number, $obj->number,
$obj->amount, $obj->amount,
"Fra.".$obj->facnumber." ".$obj->amount); "Fra.".$obj->facnumber." ".$obj->amount
);
$this->total = $this->total + $obj->amount; $this->total = $this->total + $obj->amount;
@ -1291,14 +1306,16 @@ class BonPrelevement extends CommonObject
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$this->EnregDestinataire($row[0], $this->EnregDestinataire(
$row[0],
$row[1], $row[1],
$row[2], $row[2],
$row[3], $row[3],
$row[4], $row[4],
$row[5], $row[5],
$row[6], $row[6],
$row[7]); $row[7]
);
$this->total = $this->total + $row[5]; $this->total = $this->total + $row[5];
@ -1362,14 +1379,16 @@ class BonPrelevement extends CommonObject
/** /**
* Write recipient of request (customer) * Write recipient of request (customer)
* @param rowid id of line *
* @param client_nom name of customer * @param int $rowid id of line
* @param rib_banque code of bank * @param string $client_nom name of customer
* @param rib_guichet code of bank office * @param string $rib_banque code of bank
* @param rib_number bank account * @param string $rib_guichet code of bank office
* @param amount amount * @param string $rib_number bank account
* @param facnumber ref of invoice * @param float $amount amount
* @param facid id of invoice * @param string $facnumber ref of invoice
* @param int $facid id of invoice
* @return void
*/ */
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid) function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid)
{ {
@ -1431,6 +1450,8 @@ class BonPrelevement extends CommonObject
/** /**
* Write sender of request (me) * Write sender of request (me)
*
* @return void
*/ */
function EnregEmetteur() function EnregEmetteur()
{ {
@ -1495,7 +1516,9 @@ class BonPrelevement extends CommonObject
/** /**
* Write end * Write end
* @param total total amount *
* @param int $total total amount
* @return void
*/ */
function EnregTotal($total) function EnregTotal($total)
{ {
@ -1554,7 +1577,8 @@ class BonPrelevement extends CommonObject
/** /**
* Return status label of object * Return status label of object
* @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto *
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
@ -1564,8 +1588,9 @@ class BonPrelevement extends CommonObject
/** /**
* Return status label for a status * Return status label for a status
* @param statut id statut *
* @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @param int $statut id statut
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut,$mode=0) function LibStatut($statut,$mode=0)

View File

@ -31,11 +31,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/ */
class ChargeSociales extends CommonObject class ChargeSociales extends CommonObject
{ {
var $db; public $element='rowid';
var $error; public $table='chargesociales';
var $element='rowid'; public $table_element='chargesociales';
var $table='chargesociales';
var $table_element='chargesociales';
var $id; var $id;
var $date_ech; var $date_ech;
@ -397,8 +395,11 @@ class ChargeSociales extends CommonObject
} }
/** /**
* Initialise an example of social contribution with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -30,11 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/ */
class PaymentSocialContribution extends CommonObject class PaymentSocialContribution extends CommonObject
{ {
var $db; //!< To store db handler public $element='paiementcharge'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) public $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
var $element='paiementcharge'; //!< Id that identify managed objects
var $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $ref; var $ref;
@ -428,8 +425,11 @@ class PaymentSocialContribution extends CommonObject
/** /**
* \brief Initialise object with example values * Initialise an instance with random values.
* \remarks id must be 0 if object instance is a specimen. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -33,11 +33,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Tva extends CommonObject class Tva extends CommonObject
{ {
var $db; //!< To store db handler //public $element='tva'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) //public $table_element='tva'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
//var $element='tva'; //!< Id that identify managed objects
//var $table_element='tva'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $ref; var $ref;
@ -302,8 +299,11 @@ class Tva extends CommonObject
/** /**
* \brief Initialise object with example values * Initialise an instance with random values.
* \remarks id must be 0 if object instance is a specimen. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
@ -318,8 +318,6 @@ class Tva extends CommonObject
$this->fk_bank=''; $this->fk_bank='';
$this->fk_user_creat=''; $this->fk_user_creat='';
$this->fk_user_modif=''; $this->fk_user_modif='';
} }

View File

@ -93,8 +93,32 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1); $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
} }
if ($action == 'list')
{
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
} }
} }
/**
* Fetch datas list
*
* @param int $limit Limit number of responses
* @param int $offset Offset for first response
* @param string $sortfield Sort field
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
global $conf, $langs;
//$this->getFieldList();
$this->list_datas = array();
}
}
?> ?>

View File

@ -27,11 +27,6 @@
*/ */
class DaoContactDefault extends Contact class DaoContactDefault extends Contact
{ {
var $db;
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
/** /**
* Constructor * Constructor
* *
@ -42,58 +37,6 @@ class DaoContactDefault extends Contact
$this->db = $DB; $this->db = $DB;
} }
/**
* Create third party in database
*
* @param User $user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO
*/
function create($user='')
{
$result = parent::create($user);
return $result;
}
/**
* Update parameters of third party
*
* @param int $id Id societe
* @param User $user Utilisateur qui demande la mise a jour
* @param int $call_trigger 0=non, 1=oui
* @param int $allowmodcodeclient Inclut modif code client et code compta
* @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 if KO, >=0 if OK
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{
$result = parent::update($id, $user, $call_trigger, $allowmodcodeclient, $allowmodcodefournisseur);
return $result;
}
/**
* Delete third party in database
*
* @return int <0 if KO, >=0 if OK
*/
function delete()
{
$result = parent::delete();
return $result;
}
/**
* Fetch datas list
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
global $conf, $langs;
$this->list_datas = array();
}
} }
?> ?>

View File

@ -34,10 +34,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Contact extends CommonObject class Contact extends CommonObject
{ {
var $db; public $element='contact';
var $error; public $table_element='socpeople';
var $element='contact';
var $table_element='socpeople';
var $id; var $id;
var $civilite_id; // In fact we stor civility_code var $civilite_id; // In fact we stor civility_code
@ -999,7 +997,9 @@ class Contact extends CommonObject
/** /**
* Initialise le contact avec valeurs fictives aleatoire * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */

View File

@ -37,12 +37,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/price.lib.php");
*/ */
class Contrat extends CommonObject class Contrat extends CommonObject
{ {
var $db; public $element='contrat';
var $error; public $table_element='contrat';
var $element='contrat'; public $table_element_line='contratdet';
var $table_element='contrat'; public $fk_element='fk_contrat';
var $table_element_line='contratdet';
var $fk_element='fk_contrat';
var $id; var $id;
var $ref; var $ref;
@ -1424,7 +1422,11 @@ class Contrat extends CommonObject
/** /**
* \brief Initialise le membre avec valeurs fictives aleatoire * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -462,8 +462,9 @@ class DiscountAbsolute
/** /**
* Initializes the intervention with random values * Initialise an instance with random values.
* Used to generate a intervention for the preview or demo models * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */

View File

@ -36,11 +36,8 @@
*/ */
class Events // extends CommonObject class Events // extends CommonObject
{ {
var $db; //!< To store db handler public $element='events'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) public $table_element='events'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
var $element='events'; //!< Id that identify managed objects
var $table_element='events'; //!< Name of table without prefix where object is stored
var $id; var $id;
@ -265,8 +262,11 @@ class Events // extends CommonObject
/** /**
* \brief Initialise object with example values * Initialise an instance with random values.
* \remarks id must be 0 if object instance is a specimen. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -59,8 +59,8 @@ class Menubase
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $DB Database handler
* @param string $menu_handler * @param string $menu_handler Menu handler
* @param string $type * @param string $type Type
*/ */
function Menubase($DB,$menu_handler='',$type='') function Menubase($DB,$menu_handler='',$type='')
{ {
@ -167,9 +167,10 @@ class Menubase
} }
/** /**
* Update menu entry into database * Update menu entry into database.
* @param user User that modify *
* @param notrigger 0=no, 1=yes (no update trigger) * @param User $user User that modify
* @param int $notrigger 0=no, 1=yes (no update trigger)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user=0, $notrigger=0) function update($user=0, $notrigger=0)
@ -302,10 +303,11 @@ class Menubase
} }
/* /**
* \brief Delete object in database * Delete object in database
* \param user User that delete *
* \return int <0 if KO, >0 if OK * @param User $user User that delete
* @return int <0 if KO, >0 if OK
*/ */
function delete($user) function delete($user)
{ {
@ -328,8 +330,11 @@ class Menubase
/** /**
* Initialise object with example values * Initialise an instance with random values.
* Id must be 0 if object instance is a specimen. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
@ -357,10 +362,11 @@ class Menubase
/** /**
* Complete this->newmenu with menu entry found in $tab * Complete this->newmenu with menu entry found in $tab
* *
* @param $tab * @param array $tab Tab array
* @param $pere * @param int $pere Id of parent
* @param $rang * @param int $rang Rang
* @param $myleftmenu Value for left that defined leftmenu * @param string $myleftmenu Value for left that defined leftmenu
* @return void
*/ */
function recur($tab, $pere, $rang, $myleftmenu) function recur($tab, $pere, $rang, $myleftmenu)
{ {
@ -398,10 +404,12 @@ class Menubase
/** /**
* Load tabMenu array * Load tabMenu array
* @param type_user 0=Internal,1=External,2=All *
* @param mainmenu Value for mainmenu that defined top menu * @param string $mainmenu Value for mainmenu that defined top menu
* @param menu_handler Name of menu_handler used (auguria, eldy...) * @param string $myleftmenu Left menu name
* @param tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param int $type_user 0=Internal,1=External,2=All
* @param string $menu_handler Name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Return array with menu entries for top menu * @return array Return array with menu entries for top menu
*/ */
function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null)
@ -446,13 +454,14 @@ class Menubase
} }
/** /**
* Load entries found in database in a menu array * Load entries found in database in a menu array.
* @param $newmenu Menu array to complete *
* @param $mainmenu Value for mainmenu that defined top menu of left menu * @param array $newmenu Menu array to complete
* @param $myleftmenu Value that defined leftmenu * @param string $mainmenu Value for mainmenu that defined top menu of left menu
* @param $type_user 0=Internal,1=External,2=All * @param string $myleftmenu Value that defined leftmenu
* @param $menu_handler Name of menu_handler used (auguria, eldy...) * @param int $type_user 0=Internal,1=External,2=All
* @param $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param string $menu_handler Name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @return array Menu array for particular mainmenu value or full tabArray * @return array Menu array for particular mainmenu value or full tabArray
*/ */
function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null)
@ -493,11 +502,12 @@ class Menubase
/** /**
* Load entries found in database in a menu array * Load entries found in database in a menu array.
* @param $myleftmenu Value for left that defined leftmenu *
* @param $type_user 0=Internal,1=External,2=All * @param string $myleftmenu Value for left that defined leftmenu
* @param $menu_handler Name of menu_handler used (auguria, eldy...) * @param int $type_user 0=Internal,1=External,2=All
* @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) * @param string $menu_handler Name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty)
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array()) function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array())

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2008-2011 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
@ -28,8 +28,15 @@
*/ */
abstract class Stats abstract class Stats
{ {
var $db ; protected $db;
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @return Stats
*/
function Stats($DB) function Stats($DB)
{ {
$this->db = $DB; $this->db = $DB;
@ -37,6 +44,7 @@ abstract class Stats
/** /**
* Return nb of entity by month for several years * Return nb of entity by month for several years
*
* @param endyear Start year * @param endyear Start year
* @param startyear End year * @param startyear End year
* @return array Array of values * @return array Array of values
@ -110,6 +118,7 @@ abstract class Stats
/** /**
* Return nb of elements by year * Return nb of elements by year
*
* @param sql SQL request * @param sql SQL request
* @return array * @return array
*/ */
@ -139,6 +148,7 @@ abstract class Stats
/** /**
* Return nb of elements, total amount and avg amount by year * Return nb of elements, total amount and avg amount by year
*
* @param sql SQL request * @param sql SQL request
* @return array * @return array
*/ */
@ -171,6 +181,7 @@ abstract class Stats
/** /**
* Renvoie le nombre de proposition par mois pour une annee donnee * Renvoie le nombre de proposition par mois pour une annee donnee
*
* @param year Year * @param year Year
* @param sql SQL * @param sql SQL
*/ */
@ -218,6 +229,7 @@ abstract class Stats
/** /**
* Renvoie le nombre d'element par mois pour une annee donnee * Renvoie le nombre d'element par mois pour une annee donnee
*
* @param year Year * @param year Year
* @param sql SQL * @param sql SQL
*/ */
@ -262,6 +274,7 @@ abstract class Stats
/** /**
* Renvoie le montant moyen par mois pour une annee donnee * Renvoie le montant moyen par mois pour une annee donnee
*
* @param year Year * @param year Year
* @param sql SQL * @param sql SQL
*/ */

View File

@ -30,11 +30,8 @@
*/ */
class EcmDirectory // extends CommonObject class EcmDirectory // extends CommonObject
{ {
var $db; //!< To store db handler //public $element='ecm_directories'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) //public $table_element='ecm_directories'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
//var $element='ecm_directories'; //!< Id that identify managed objects
//var $table_element='ecm_directories'; //!< Name of table without prefix where object is stored
var $id; var $id;
@ -377,8 +374,11 @@ class EcmDirectory // extends CommonObject
/** /**
* \brief Initialise object with example values * Initialise an instance with random values.
* \remarks id must be 0 if object instance is a specimen. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -36,11 +36,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/co
*/ */
class Expedition extends CommonObject class Expedition extends CommonObject
{ {
var $db; public $element="shipping";
var $error; public $fk_element="fk_expedition";
var $element="shipping"; public $table_element="expedition";
var $fk_element="fk_expedition";
var $table_element="expedition";
var $id; var $id;
var $socid; var $socid;
@ -973,8 +971,11 @@ class Expedition extends CommonObject
} }
/** /**
* \brief Initialise la facture avec valeurs fictives aleatoire * Initialise an instance with random values.
* Sert a generer une facture pour l'aperu des modeles ou dem * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -32,11 +32,10 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Fichinter extends CommonObject class Fichinter extends CommonObject
{ {
var $db; public $element='fichinter';
var $element='fichinter'; public $table_element='fichinter';
var $table_element='fichinter'; public $fk_element='fk_fichinter';
var $fk_element='fk_fichinter'; public $table_element_line='fichinterdet';
var $table_element_line='fichinterdet';
var $id; var $id;
@ -751,8 +750,11 @@ class Fichinter extends CommonObject
/** /**
* Initializes the intervention with random values * Initialise an instance with random values.
* Used to generate a intervention for the preview or demo models * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -36,15 +36,11 @@ require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
*/ */
class CommandeFournisseur extends Commande class CommandeFournisseur extends Commande
{ {
var $id ; public $element='order_supplier';
var $db ; public $table_element='commande_fournisseur';
var $error; public $table_element_line = 'commande_fournisseurdet';
public $fk_element = 'fk_commande';
var $element='order_supplier'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $table_element='commande_fournisseur';
var $table_element_line = 'commande_fournisseurdet';
var $fk_element = 'fk_commande';
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;
@ -1666,8 +1662,11 @@ class CommandeFournisseur extends Commande
/** /**
* Initialise an example of instance with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -35,15 +35,11 @@ include_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
*/ */
class FactureFournisseur extends Facture class FactureFournisseur extends Facture
{ {
var $id; public $element='invoice_supplier';
var $db; public $table_element='facture_fourn';
var $error; public $table_element_line='facture_fourn_det';
public $fk_element='fk_facture_fourn';
var $element='invoice_supplier'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $table_element='facture_fourn';
var $table_element_line='facture_fourn_det';
var $fk_element='fk_facture_fourn';
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;
@ -1201,8 +1197,11 @@ class FactureFournisseur extends Facture
/** /**
* Initialise an example of instance with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
*/ */
class PaiementFourn extends Paiement class PaiementFourn extends Paiement
{ {
var $db; public $element='payment_supplier';
var $error; public $table_element='paiementfourn';
var $element='payment_supplier';
var $table_element='paiementfourn';
var $id; var $id;
var $ref; var $ref;

View File

@ -62,7 +62,7 @@ class Import
{ {
global $langs,$conf; global $langs,$conf;
dol_syslog("Import::load_arrays user=".$user->id." filter=".$filter); dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
$var=true; $var=true;
$i=0; $i=0;
@ -73,14 +73,14 @@ class Import
$dir = $dirroot.'/includes/modules'; $dir = $dirroot.'/includes/modules';
// Search available exports // Search available exports
$handle=@opendir($dir); $handle=@opendir(dol_osencode($dir));
if (is_resource($handle)) if (! is_resource($handle)) continue;
{
// Search module files // Search module files
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) if (! preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) continue;
{
$modulename=$reg[1]; $modulename=$reg[1];
// Defined if module is enabled // Defined if module is enabled
@ -88,9 +88,9 @@ class Import
$part=strtolower(preg_replace('/^mod/i','',$modulename)); $part=strtolower(preg_replace('/^mod/i','',$modulename));
if (empty($conf->$part->enabled)) $enabled=false; if (empty($conf->$part->enabled)) $enabled=false;
if ($enabled) if (empty($enabled)) continue;
{
// Chargement de la classe // Init load class
$file = $dir."/".$modulename.".class.php"; $file = $dir."/".$modulename.".class.php";
$classname = $modulename; $classname = $modulename;
require_once($file); require_once($file);
@ -117,10 +117,7 @@ class Import
//print $bool." $perm[0]"."<br>"; //print $bool." $perm[0]"."<br>";
*/ */
// Permissions ok // Load lang file
// if ($bool)
// {
// Charge fichier lang en rapport
$langtoload=$module->getLangFilesArray(); $langtoload=$module->getLangFilesArray();
if (is_array($langtoload)) if (is_array($langtoload))
{ {
@ -157,15 +154,11 @@ class Import
dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r]));
$i++; $i++;
// }
}
}
}
}
} }
} }
} }
closedir($handle); closedir($handle);
}
return 1; return 1;
} }
@ -175,19 +168,18 @@ class Import
* Build an import example file. * Build an import example file.
* Arrays this->array_export_xxx are already loaded for required datatoexport * Arrays this->array_export_xxx are already loaded for required datatoexport
* *
* @param User $user User qui exporte * @param string $model Name of import engine ('csv', ...)
* @param string $model Modele d'export
* @param string $headerlinefields Array of values for first line of example file * @param string $headerlinefields Array of values for first line of example file
* @param string $contentlinevalues Array of values for content line of example file * @param string $contentlinevalues Array of values for content line of example file
* @return string <0 if KO, >0 if OK * @return string <0 if KO, >0 if OK
*/ */
function build_example_file($user, $model, $headerlinefields, $contentlinevalues) function build_example_file($model, $headerlinefields, $contentlinevalues)
{ {
global $conf,$langs; global $conf,$langs;
$indice=0; $indice=0;
dol_syslog("Import::build_example_file ".$model); dol_syslog(get_class($this)."::build_example_file ".$model);
// Creation de la classe d'import du model Import_XXX // Creation de la classe d'import du model Import_XXX
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/";
@ -238,7 +230,7 @@ class Import
$sql.= ')'; $sql.= ')';
$sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')";
dol_syslog("Import::create sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -249,7 +241,7 @@ class Import
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$this->errno=$this->db->lasterrno(); $this->errno=$this->db->lasterrno();
dol_syslog("Import::create error ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -267,7 +259,7 @@ class Import
$sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em';
$sql.= ' WHERE em.rowid = '.$id; $sql.= ' WHERE em.rowid = '.$id;
dol_syslog("Import::fetch sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {

View File

@ -86,6 +86,6 @@ foreach($fieldstarget as $code=>$label)
//var_dump($headerlinefields); //var_dump($headerlinefields);
//var_dump($contentlinevalues); //var_dump($contentlinevalues);
print $objimport->build_example_file($user,$format,$headerlinefields,$contentlinevalues); print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues);
?> ?>

View File

@ -173,9 +173,12 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
/** /**
* Generate Header * Generate Header
* @param pdf Pdf object *
* @param page Current page number * @param PDF &$pdf Pdf object
* @param pages Total number of pages * @param int $page Current page number
* @param int $pages Total number of pages
* @param Translate $outputlangs Object language for output
* @return void
*/ */
function Header(&$pdf, $page, $pages, $outputlangs) function Header(&$pdf, $page, $pages, $outputlangs)
{ {

View File

@ -37,11 +37,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/co
*/ */
class Livraison extends CommonObject class Livraison extends CommonObject
{ {
var $db; public $element="delivery";
var $error; public $fk_element="fk_livraison";
var $element="delivery"; public $table_element="livraison";
var $fk_element="fk_livraison";
var $table_element="livraison";
var $id; var $id;
var $brouillon; var $brouillon;
@ -713,7 +711,11 @@ class Livraison extends CommonObject
/** /**
* \brief Initialise object with default value to be used as example * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -67,7 +67,7 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6
* *
* @param string $val Value * @param string $val Value
* @param string $get 1=GET, 0=POST * @param string $get 1=GET, 0=POST
* @return boolean true if ther is an injection * @return boolean true if there is an injection
*/ */
function test_sql_and_script_inject($val, $get) function test_sql_and_script_inject($val, $get)
{ {
@ -90,7 +90,7 @@ function test_sql_and_script_inject($val, $get)
/** /**
* Security: Return true if OK, false otherwise * Security: Return true if OK, false otherwise
* *
* @param string $var Variable name * @param string &$var Variable name
* @param string $get 1=GET, 0=POST * @param string $get 1=GET, 0=POST
* @return boolean true if ther is an injection * @return boolean true if ther is an injection
*/ */

View File

@ -28,7 +28,6 @@ include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
*/ */
class ActionsCardProduct extends Product class ActionsCardProduct extends Product
{ {
var $db;
var $targetmodule; var $targetmodule;
var $canvas; var $canvas;
var $card; var $card;
@ -38,6 +37,7 @@ class ActionsCardProduct extends Product
// List of fiels for action=list // List of fiels for action=list
var $field_list =array(); var $field_list =array();
public $list_datas = array();
/** /**
@ -48,7 +48,7 @@ class ActionsCardProduct extends Product
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function ActionsCardIndividual($DB,$targetmodule,$canvas,$card) function ActionsCardProduct($DB,$targetmodule,$canvas,$card)
{ {
$this->db = $DB; $this->db = $DB;
$this->targetmodule = $targetmodule; $this->targetmodule = $targetmodule;
@ -64,6 +64,8 @@ class ActionsCardProduct extends Product
/** /**
* Return the title of card * Return the title of card
*
* @return string Label of card
*/ */
private function getTitle() private function getTitle()
{ {
@ -75,7 +77,8 @@ class ActionsCardProduct extends Product
/** /**
* Assign custom values for canvas (for example into this->tpl to be used by templates) * Assign custom values for canvas (for example into this->tpl to be used by templates)
* *
* @param action Type of action * @param string $action Type of action
* @return void
*/ */
function assign_values($action) function assign_values($action)
{ {
@ -249,6 +252,8 @@ class ActionsCardProduct extends Product
/** /**
* Fetch field list * Fetch field list
*
* @return void
*/ */
private function getFieldList() private function getFieldList()
{ {
@ -299,6 +304,12 @@ class ActionsCardProduct extends Product
/** /**
* Fetch datas list * Fetch datas list
*
* @param int $limit Limit number of responses
* @param int $offset Offset for first response
* @param string $sortfield Sort field
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void
*/ */
function LoadListDatas($limit, $offset, $sortfield, $sortorder) function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {

View File

@ -23,12 +23,11 @@
include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
/** /**
* \class ProductService * \class ActionsCardService
* \brief Class with controller methods for product canvas * \brief Class with controller methods for product canvas
*/ */
class ActionsCardService extends Product class ActionsCardService extends Product
{ {
var $db;
var $targetmodule; var $targetmodule;
var $canvas; var $canvas;
var $card; var $card;
@ -38,6 +37,7 @@ class ActionsCardService extends Product
// List of fiels for action=list // List of fiels for action=list
var $field_list =array(); var $field_list =array();
public $list_datas = array();
/** /**
@ -48,7 +48,7 @@ class ActionsCardService extends Product
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function ActionsCardIndividual($DB,$targetmodule,$canvas,$card) function ActionsCardService($DB,$targetmodule,$canvas,$card)
{ {
$this->db = $DB; $this->db = $DB;
$this->targetmodule = $targetmodule; $this->targetmodule = $targetmodule;
@ -64,6 +64,8 @@ class ActionsCardService extends Product
/** /**
* Return the title of card * Return the title of card
*
* @return string Label of card
*/ */
private function getTitle() private function getTitle()
{ {
@ -75,7 +77,8 @@ class ActionsCardService extends Product
/** /**
* Assign custom values for canvas (for example into this->tpl to be used by templates) * Assign custom values for canvas (for example into this->tpl to be used by templates)
* *
* @param action Type of action * @param string $action Type of action
* @return void
*/ */
function assign_values($action) function assign_values($action)
{ {
@ -229,6 +232,8 @@ class ActionsCardService extends Product
/** /**
* Fetch field list * Fetch field list
*
* @return void
*/ */
private function getFieldList() private function getFieldList()
{ {
@ -277,7 +282,13 @@ class ActionsCardService extends Product
} }
/** /**
* \brief Fetch datas list * Fetch datas list
*
* @param int $limit Limit number of responses
* @param int $offset Offset for first response
* @param string $sortfield Sort field
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void
*/ */
function LoadListDatas($limit, $offset, $sortfield, $sortorder) function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {

View File

@ -34,16 +34,12 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class Product extends CommonObject class Product extends CommonObject
{ {
var $db; public $element='product';
var $error; public $table_element='product';
var $errno = 0; public $fk_element='fk_product';
public $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur');
var $element='product'; protected $isnolinkedbythird = 1; // No field fk_soc
var $table_element='product'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $fk_element='fk_product';
var $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur');
var $isnolinkedbythird = 1; // No field fk_soc
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
//! Identifiant unique //! Identifiant unique
var $id ; var $id ;

View File

@ -33,10 +33,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
class Entrepot extends CommonObject class Entrepot extends CommonObject
{ {
var $db; public $element='label';
var $error; public $table_element='entrepot';
var $element='label';
var $table_element='entrepot';
var $id; var $id;
var $libelle; var $libelle;

View File

@ -30,11 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/ */
class Project extends CommonObject class Project extends CommonObject
{ {
var $db; //!< To store db handler public $element='project'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) public $table_element='projet'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
var $element='project'; //!< Id that identify managed objects
var $table_element='projet'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $ref; var $ref;
@ -666,7 +663,9 @@ class Project extends CommonObject
} }
/** /**
* Initialise object with default value to be used as example * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */

View File

@ -32,11 +32,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/ */
class Task extends CommonObject class Task extends CommonObject
{ {
var $db; //!< To store db handler public $element='project_task'; //!< Id that identify managed objects
var $error; //!< To return error code (or message) public $table_element='projet_task'; //!< Name of table without prefix where object is stored
var $errors=array(); //!< To return several error codes (or messages)
var $element='project_task'; //!< Id that identify managed objects
var $table_element='projet_task'; //!< Name of table without prefix where object is stored
var $id; var $id;
@ -437,7 +434,8 @@ class Task extends CommonObject
} }
/** /**
* Initialise object with example values * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen. * id must be 0 if object instance is a specimen.
* *
* @return void * @return void

View File

@ -33,8 +33,6 @@ abstract class ActionsCardCommon
var $canvas; var $canvas;
var $card; var $card;
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
//! Template container //! Template container
var $tpl = array(); var $tpl = array();
//! Object container //! Object container

View File

@ -17,9 +17,9 @@
*/ */
/** /**
* \file htdocs/societe/canvas/default/actions_card_company.class.php * \file htdocs/societe/canvas/company/actions_card_company.class.php
* \ingroup thirdparty * \ingroup thirdparty
* \brief Fichier de la classe Thirdparty card controller (default canvas) * \brief File of Thirdparty card controller (default canvas)
*/ */
include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php'); include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php');
@ -29,7 +29,6 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php');
*/ */
class ActionsCardCompany extends ActionsCardCommon class ActionsCardCompany extends ActionsCardCommon
{ {
var $db;
var $targetmodule; var $targetmodule;
var $canvas; var $canvas;
var $card; var $card;

View File

@ -27,10 +27,6 @@
*/ */
class DaoThirdPartyCompany extends Societe class DaoThirdPartyCompany extends Societe
{ {
var $db;
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
/** /**
* Constructor * Constructor
@ -42,66 +38,6 @@ class DaoThirdPartyCompany extends Societe
$this->db = $DB; $this->db = $DB;
} }
/**
* Lecture des donnees dans la base
* @param id Element id
*/
function fetch($id)
{
$result = parent::fetch($id);
return $result;
}
/**
* Create third party in database
* @param user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO
*/
function create($user='')
{
$result = parent::create($user);
return $result;
}
/**
* Update parameters of third party
* @param id id societe
* @param user Utilisateur qui demande la mise a jour
* @param call_trigger 0=non, 1=oui
* @param allowmodcodeclient Inclut modif code client et code compta
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 si ko, >=0 si ok
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{
$result = parent::update($id, $user, $call_trigger, $allowmodcodeclient, $allowmodcodefournisseur);
return $result;
}
/**
* Delete third party in database
* @param id id de la societe a supprimer
*/
function delete($id)
{
$result = parent::delete($id);
return $result;
}
/**
* Fetch datas list
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
global $conf, $langs;
$this->list_datas = array();
}
} }
?> ?>

View File

@ -28,7 +28,6 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php');
*/ */
class ActionsCardIndividual extends ActionsCardCommon class ActionsCardIndividual extends ActionsCardCommon
{ {
var $db;
var $targetmodule; var $targetmodule;
var $canvas; var $canvas;
var $card; var $card;

View File

@ -27,78 +27,18 @@
*/ */
class DaoThirdPartyIndividual extends Societe class DaoThirdPartyIndividual extends Societe
{ {
//! Numero d'erreur Plage 1280-1535 public $list_datas = array();
var $errno = 0;
/** /**
* Constructeur de la classe * Constructor
* @param DB Handler acces base de donnees *
* @param DoliDB $DB Databae handler
*/ */
function DaoThirdPartyIndividual($DB) function DaoThirdPartyIndividual($DB)
{ {
$this->db = $DB; $this->db = $DB;
} }
/**
* Lecture des donnees dans la base
* @param id Element id
*/
function fetch($id)
{
$result = parent::fetch($id);
return $result;
}
/**
* Create third party in database
* @param user Object of user that ask creation
* @return int >= 0 if OK, < 0 if KO
*/
function create($user='')
{
$result = parent::create($user);
return $result;
}
/**
* Update parameters of third party
* @param id id societe
* @param user Utilisateur qui demande la mise a jour
* @param call_trigger 0=non, 1=oui
* @param allowmodcodeclient Inclut modif code client et code compta
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 si ko, >=0 si ok
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
{
$result = parent::update($id, $user, $call_trigger, $allowmodcodeclient, $allowmodcodefournisseur);
return $result;
}
/**
* Delete third party in database
* @param id id de la societe a supprimer
*/
function delete($id)
{
$result = parent::delete($id);
return $result;
}
/**
* Fetch datas list
*/
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
global $conf, $langs;
$this->list_datas = array();
}
} }
?> ?>

View File

@ -30,55 +30,24 @@ include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
*/ */
class Client extends Societe class Client extends Societe
{ {
var $db; var $nb;
/** /**
* \brief Constructeur de la classe * Constructor
* \param DB handler acces base de donnees *
* \param id id societe (0 par defaut) * @param DoliDB $DB Database handler
*/ */
function Client($DB, $id=0) function Client($DB)
{ {
global $config; global $config;
$this->db = $DB; $this->db = $DB;
$this->id = $id;
$this->factures = array();
return 0;
} }
function read_factures()
{
$sql = "SELECT rowid, facnumber";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.fk_soc = ".$this->id;
$sql .= " ORDER BY datef DESC";
$i = 0;
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($i < $num )
{
$row = $this->db->fetch_row($resql);
$this->factures[$i][0] = $row[0];
$this->factures[$i][1] = $row[1];
$i++;
}
}
return $result;
}
/** /**
* \brief Charge indicateurs this->nb de tableaux de bord * Load indicators into this->nb for board
* \return int <0 si ko, >0 si ok *
* @return int <0 if KO, >0 if OK
*/ */
function load_state_board() function load_state_board()
{ {

View File

@ -65,10 +65,14 @@ class CompanyBankAccount extends Account
/** /**
* Create bank information record * Create bank information record
*
* @return int <0 if KO, >= 0 if OK
*/ */
function create() function create()
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; $now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -85,12 +89,13 @@ class CompanyBankAccount extends Account
} }
/** /**
* Update bank account
* *
* * @param User $user Object user
* @return int <=0 if KO, >0 if OK
*/ */
function update($user='') function update($user='')
{ {
$sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
$sql .= " WHERE fk_soc = ".$this->socid; $sql .= " WHERE fk_soc = ".$this->socid;
@ -135,8 +140,10 @@ class CompanyBankAccount extends Account
/** /**
* Load record from database * Load record from database
* @param id Id of record *
* @param socid Id of company * @param int $id Id of record
* @param int $socid Id of company
* @return int <0 if KO, >0 if OK
*/ */
function fetch($id,$socid=0) function fetch($id,$socid=0)
{ {

View File

@ -2481,8 +2481,11 @@ class Societe extends CommonObject
/** /**
* Initialise an example of company with random values * Initialise an instance with random values.
* Used to build previews or test instances * Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {

View File

@ -86,11 +86,7 @@ if ($action == 'add')
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)";
$sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")";
if ($db->query($sql)) if (! $db->query($sql))
{
}
else
{ {
$error++; $error++;
dol_print_error($db); dol_print_error($db);
@ -115,7 +111,7 @@ if ($action == 'add')
// Remove a notification // Remove a notification
if ($action == 'delete') if ($action == 'delete')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"];
$db->query($sql); $db->query($sql);
} }

View File

@ -106,12 +106,6 @@ if (empty($account->socid)) $account->socid=$soc->id;
if ($_GET["socid"] && $_GET["action"] != 'edit') if ($_GET["socid"] && $_GET["action"] != 'edit')
{ {
// Check BBAN
if (! checkBanForAccount($account))
{
print '<div class="warning">'.$langs->trans("RIBControlError").'</div><br>';
}
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>'; print '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>';
@ -165,22 +159,12 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
print '</table>'; print '</table>';
print '</div>'; // Check BBAN
if (! checkBanForAccount($account))
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{ {
print '<a class="butAction" href="rib.php?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
} }
print '</div>';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -194,7 +178,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
$form = new Form($db); $form = new Form($db);
if ($message) { print "$message<br><br>\n"; } dol_htmloutput_mesg($message);
print '<form action="rib.php?socid='.$soc->id.'" method="post">'; print '<form action="rib.php?socid='.$soc->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -268,6 +252,23 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
dol_fiche_end(); dol_fiche_end();
if ($_GET["socid"] && $_GET["action"] != 'edit')
{
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
}
print '</div>';
}
$db->close(); $db->close();

View File

@ -36,12 +36,9 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/ */
class User extends CommonObject class User extends CommonObject
{ {
var $db; public $element='user';
var $error; public $table_element='user';
var $errors=array(); protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $element='user';
var $table_element='user';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id=0; var $id=0;
var $ldap_sid; var $ldap_sid;
@ -119,10 +116,10 @@ class User extends CommonObject
/** /**
* Load a user from database with its id or ref (login) * Load a user from database with its id or ref (login)
* *
* @param id Si defini, id a utiliser pour recherche * @param int $id Si defini, id a utiliser pour recherche
* @param login Si defini, login a utiliser pour recherche * @param string $login Si defini, login a utiliser pour recherche
* @param sid Si defini, sid a utiliser pour recherche * @param strinf $sid Si defini, sid a utiliser pour recherche
* @param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
* @return int <0 if KO, 0 not found, >0 if OK * @return int <0 if KO, 0 not found, >0 if OK
*/ */
function fetch($id='', $login='',$sid='',$loadpersonalconf=1) function fetch($id='', $login='',$sid='',$loadpersonalconf=1)
@ -272,9 +269,9 @@ class User extends CommonObject
/** /**
* Ajoute un droit a l'utilisateur * Ajoute un droit a l'utilisateur
* *
* @param rid id du droit a ajouter * @param int $rid id du droit a ajouter
* @param allmodule Ajouter tous les droits du module allmodule * @param string $allmodule Ajouter tous les droits du module allmodule
* @param allperms Ajouter tous les droits du module allmodule, perms allperms * @param string $allperms Ajouter tous les droits du module allmodule, perms allperms
* @return int > 0 si ok, < 0 si erreur * @return int > 0 si ok, < 0 si erreur
*/ */
function addrights($rid,$allmodule='',$allperms='') function addrights($rid,$allmodule='',$allperms='')
@ -371,9 +368,9 @@ class User extends CommonObject
/** /**
* Retire un droit a l'utilisateur * Retire un droit a l'utilisateur
* *
* @param rid id du droit a retirer * @param int $rid Id du droit a retirer
* @param allmodule Retirer tous les droits du module allmodule * @param string $allmodule Retirer tous les droits du module allmodule
* @param allperms Retirer tous les droits du module allmodule, perms allperms * @param string $allperms Retirer tous les droits du module allmodule, perms allperms
* @return int > 0 si ok, < 0 si erreur * @return int > 0 si ok, < 0 si erreur
*/ */
function delrights($rid,$allmodule='',$allperms='') function delrights($rid,$allmodule='',$allperms='')
@ -466,6 +463,8 @@ class User extends CommonObject
/** /**
* Clear all permissions array of user * Clear all permissions array of user
*
* @return void
*/ */
function clearrights() function clearrights()
{ {
@ -479,7 +478,8 @@ class User extends CommonObject
/** /**
* Load permissions granted to user into object user * Load permissions granted to user into object user
* *
* @param moduletag Limit permission for a particular module ('' by default means load all permissions) * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
* @return void
*/ */
function getrights($moduletag='') function getrights($moduletag='')
{ {
@ -602,6 +602,7 @@ class User extends CommonObject
/** /**
* Change status of a user * Change status of a user
* *
* @param int $statut Status to set
* @return int <0 if KO, 0 if nothing is done, >0 if OK * @return int <0 if KO, 0 if nothing is done, >0 if OK
*/ */
function setstatus($statut) function setstatus($statut)
@ -709,8 +710,8 @@ class User extends CommonObject
/** /**
* Create a user into database * Create a user into database
* *
* @param user Objet user qui demande la creation * @param User $user Objet user qui demande la creation
* @param notrigger 1 ne declenche pas les triggers, 0 sinon * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @return int <0 si KO, id compte cree si OK * @return int <0 si KO, id compte cree si OK
*/ */
function create($user,$notrigger=0) function create($user,$notrigger=0)
@ -837,9 +838,9 @@ class User extends CommonObject
/** /**
* Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external
* *
* @param contact Object for source contact * @param Contact $contact Object for source contact
* @param login Login to force * @param string $login Login to force
* @param password Password to force * @param string $password Password to force
* @return int <0 if error, if OK returns id of created user * @return int <0 if error, if OK returns id of created user
*/ */
function create_from_contact($contact,$login='',$password='') function create_from_contact($contact,$login='',$password='')
@ -905,8 +906,8 @@ class User extends CommonObject
/** /**
* Create a user into database from a member object * Create a user into database from a member object
* *
* @param member Object member source * @param Adherent $member Object member source
* @param login Login to force * @param string $login Login to force
* @return int <0 if KO, if OK, return id of created account * @return int <0 if KO, if OK, return id of created account
*/ */
function create_from_member($member,$login='') function create_from_member($member,$login='')
@ -1008,10 +1009,10 @@ class User extends CommonObject
/** /**
* Update a user into databse (and also password if this->pass is defined) * Update a user into databse (and also password if this->pass is defined)
* *
* @param user User qui fait la mise a jour * @param User $user User qui fait la mise a jour
* @param notrigger 1 ne declenche pas les triggers, 0 sinon * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @param nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member * @param int $nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member
* @param nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member * @param int $nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member
* @return int <0 si KO, >=0 si OK * @return int <0 si KO, >=0 si OK
*/ */
function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0) function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0)
@ -1220,11 +1221,11 @@ class User extends CommonObject
/** /**
* Change password of a user * Change password of a user
* *
* @param user Object user of user making change * @param User $user Object user of user making change
* @param password New password in clear text (to generate if not provided) * @param string $password New password in clear text (to generate if not provided)
* @param changelater 1=Change password only after clicking on confirm email * @param int $changelater 1=Change password only after clicking on confirm email
* @param notrigger 1=Does not launch triggers * @param int $notrigger 1=Does not launch triggers
* @param nosyncmember Do not synchronize linked member * @param int $nosyncmember Do not synchronize linked member
* @return string If OK return clear password, 0 if no change, < 0 if error * @return string If OK return clear password, 0 if no change, < 0 if error
*/ */
function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0) function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0)
@ -1349,9 +1350,9 @@ class User extends CommonObject
/** /**
* Envoie mot de passe par mail * Envoie mot de passe par mail
* *
* @param user Object user de l'utilisateur qui fait l'envoi * @param User $user Object user de l'utilisateur qui fait l'envoi
* @param password Nouveau mot de passe * @param string $password Nouveau mot de passe
* @param changelater 1=Change password only after clicking on confirm email * @param int $changelater 1=Change password only after clicking on confirm email
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
function send_password($user, $password='', $changelater=0) function send_password($user, $password='', $changelater=0)
@ -1414,8 +1415,19 @@ class User extends CommonObject
$mesg.= "If you didn't ask anything, just forget this email\n\n"; $mesg.= "If you didn't ask anything, just forget this email\n\n";
dol_syslog("User::send_password url=".$url); dol_syslog("User::send_password url=".$url);
} }
$mailfile = new CMailFile($subject,$this->email,$conf->notification->email_from,$mesg, $mailfile = new CMailFile(
array(),array(),array(),'', '', 0, $msgishtml); $subject,
$this->email,
$conf->notification->email_from,
$mesg,
array(),
array(),
array(),
'',
'',
0,
$msgishtml
);
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
@ -1477,6 +1489,8 @@ class User extends CommonObject
/** /**
* Update clicktodial info * Update clicktodial info
*
* @return void
*/ */
function update_clicktodial() function update_clicktodial()
{ {
@ -1513,9 +1527,9 @@ class User extends CommonObject
/** /**
* Add user into a group * Add user into a group
* *
* @param group Id of group * @param Group $group Id of group
* @param entity Entity * @param int $entity Entity
* @param notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function SetInGroup($group, $entity, $notrigger=0) function SetInGroup($group, $entity, $notrigger=0)
@ -1574,9 +1588,9 @@ class User extends CommonObject
/** /**
* Remove a user from a group * Remove a user from a group
* *
* @param group Id of group * @param Group $group Id of group
* @param entity Entity * @param int $entity Entity
* @param notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function RemoveFromGroup($group, $entity, $notrigger=0) function RemoveFromGroup($group, $entity, $notrigger=0)
@ -1631,8 +1645,8 @@ class User extends CommonObject
* Return a link to the user card (with optionnaly the picto) * Return a link to the user card (with optionnaly the picto)
* Use this->id,this->nom, this->prenom * Use this->id,this->nom, this->prenom
* *
* @param withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) * @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul)
* @param option On what the link point to * @param string $option On what the link point to
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0,$option='')
@ -1659,8 +1673,8 @@ class User extends CommonObject
/** /**
* Renvoie login clicable (avec eventuellement le picto) * Renvoie login clicable (avec eventuellement le picto)
* *
* @param withpicto Inclut le picto dans le lien * @param int $withpicto Inclut le picto dans le lien
* @param option Sur quoi pointe le lien * @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getLoginUrl($withpicto=0,$option='') function getLoginUrl($withpicto=0,$option='')
@ -1686,9 +1700,9 @@ class User extends CommonObject
/** /**
* Return full name (civility+' '+name+' '+lastname) * Return full name (civility+' '+name+' '+lastname)
* *
* @param langs Language object for translation of civility * @param Translate $langs Language object for translation of civility
* @param option 0=No option, 1=Add civility * @param int $option 0=No option, 1=Add civility
* @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @return string String with full name * @return string String with full name
*/ */
function getFullName($langs,$option=0,$nameorder=-1) function getFullName($langs,$option=0,$nameorder=-1)
@ -1725,7 +1739,7 @@ class User extends CommonObject
/** /**
* Retourne le libelle du statut d'un user (actif, inactif) * Retourne le libelle du statut d'un user (actif, inactif)
* *
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label of status * @return string Label of status
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
@ -1736,8 +1750,8 @@ class User extends CommonObject
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
* @param statut Id statut * @param int $statut Id statut
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($statut,$mode=0) function LibStatut($statut,$mode=0)
@ -1782,8 +1796,8 @@ class User extends CommonObject
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
* @param info Info string loaded by _load_ldap_info * @param string $info Info string loaded by _load_ldap_info
* @param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1= * 1=
* 2=Return key only (uid=qqq) * 2=Return key only (uid=qqq)
* @return string DN * @return string DN
@ -1871,7 +1885,11 @@ class User extends CommonObject
/** /**
* Initialize user with default values * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/ */
function initAsSpecimen() function initAsSpecimen()
{ {
@ -1906,7 +1924,8 @@ class User extends CommonObject
/** /**
* Load info of user object * Load info of user object
* *
* @param id id of user to load * @param int $id Id of user to load
* @return void
*/ */
function info($id) function info($id)
{ {
@ -1970,7 +1989,7 @@ class User extends CommonObject
/** /**
* Return number of existing users * Return number of existing users
* *
* @param limitTo limit to 'active' or 'superadmin' users * @param string $limitTo Limit to 'active' or 'superadmin' users
* @return int Number of users * @return int Number of users
*/ */
function getNbOfUsers($limitTo='') function getNbOfUsers($limitTo='')

View File

@ -33,12 +33,9 @@ if ($conf->ldap->enabled) require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php")
*/ */
class UserGroup extends CommonObject class UserGroup extends CommonObject
{ {
var $db; // Database handler public $element='usergroup';
var $error; public $table_element='usergroup';
var $errors=array(); protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $element='usergroup';
var $table_element='usergroup';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; // Group id var $id; // Group id
var $entity; // Entity of group var $entity; // Entity of group
@ -679,7 +676,9 @@ class UserGroup extends CommonObject
/** /**
* Initialise le groupe avec valeurs fictives aleatoire * Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */