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

@ -8,7 +8,7 @@
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowedWarning">
<severity>0</severity>
<severity>0</severity>
</rule>
<!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->

View File

@ -22,72 +22,73 @@
*/
/** \class AccountancyAccount
\brief Classe permettant la gestion des comptes
*/
/**
* \class AccountancyAccount
* \brief Classe permettant la gestion des comptes
*/
class AccountancyAccount
{
var $db;
var $error;
var $db;
var $error;
var $rowid;
var $fk_pcg_version;
var $pcg_type;
var $pcg_subtype;
var $label;
var $account_number;
var $account_parent;
var $rowid;
var $fk_pcg_version;
var $pcg_type;
var $pcg_subtype;
var $label;
var $account_number;
var $account_parent;
/**
* Constructor
*
* @param $DoliDB $DB Database handler
*/
function AccountancyAccount($DB)
{
$this->db = $DB;
}
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function AccountancyAccount($DB)
{
$this->db = $DB;
}
/**
* Insert account into database
*
* @param User $user User making add
* @return int <0 if KO, Id line added if OK
*/
function create($user)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount";
$sql.= " (date_creation, fk_user_author, numero,intitule)";
$sql.= " VALUES (".$this->db->idate(gmmktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')";
/**
* Insert account into database
*
* @param User $user User making add
* @return int <0 if KO, Id line added if OK
*/
function create($user)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount";
$sql.= " (date_creation, fk_user_author, numero,intitule)";
$sql.= " VALUES (".$this->db->idate(gmmktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')";
$resql = $this->db->query($sql);
if ($resql)
{
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."accountingaccount");
$resql = $this->db->query($sql);
if ($resql)
{
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."accountingaccount");
if ($id > 0)
{
$this->id = $id;
$result = $this->id;
}
else
{
$result = -2;
$this->error="AccountancyAccount::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
}
else
{
$result = -1;
$this->error="AccountancyAccount::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
if ($id > 0)
{
$this->id = $id;
$result = $this->id;
}
else
{
$result = -2;
$this->error="AccountancyAccount::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
}
else
{
$result = -1;
$this->error="AccountancyAccount::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
return $result;
}
}
?>

View File

@ -38,12 +38,9 @@ require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
*/
class Adherent extends CommonObject
{
var $db;
var $error;
var $errors=array();
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
public $element='member';
public $table_element='adherent';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
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()
{

View File

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

View File

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

View File

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

View File

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

View File

@ -32,102 +32,109 @@ include_once(DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.
*/
class BoutiqueCommande
{
var $db ;
var $db;
var $id ;
var $nom;
var $id;
var $nom;
function BoutiqueCommande($DB, $id=0)
{
$this->db = $DB;
$this->id = $id ;
$this->billing_adr = new Address();
$this->delivry_adr = new Address();
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function BoutiqueCommande($DB)
{
$this->db = $DB;
$this->id = $id;
$this->total_ot_subtotal = 0;
$this->total_ot_shipping = 0;
}
$this->billing_adr = new Address();
$this->delivry_adr = new Address();
/**
* \brief Get object and lines from database
* \param rowid id of object to load
* \param ref Ref of order
* \return int >0 si ok, <0 si ko
*/
function fetch ($id,$ref='')
{
global $conf;
$this->total_ot_subtotal = 0;
$this->total_ot_shipping = 0;
}
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value";
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
$sql.= " WHERE orders_id = ".$id;
/**
* Get object and lines from database
*
* @param int $id id of object to load
* @param string $ref Ref of order
* @return int >0 if OK, <0 if KO
*/
function fetch($id,$ref='')
{
global $conf;
$result = $this->db->query($sql);
if ( $result )
{
$array = $this->db->fetch_array($result);
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value";
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
$sql.= " WHERE orders_id = ".$id;
$this->id = $array["orders_id"];
$this->client_id = stripslashes($array["customers_id"]);
$this->client_name = stripslashes($array["customers_name"]);
$result = $this->db->query($sql);
if ( $result )
{
$array = $this->db->fetch_array($result);
$this->payment_method = stripslashes($array["payment_method"]);
$this->id = $array["orders_id"];
$this->client_id = stripslashes($array["customers_id"]);
$this->client_name = stripslashes($array["customers_name"]);
$this->date = $this->db->jdate($array["date_purchased"]);
$this->payment_method = stripslashes($array["payment_method"]);
$this->delivery_adr->name = stripslashes($array["delivery_name"]);
$this->delivery_adr->street = stripslashes($array["delivery_street_address"]);
$this->delivery_adr->cp = stripslashes($array["delivery_postcode"]);
$this->delivery_adr->city = stripslashes($array["delivery_city"]);
$this->delivery_adr->country = stripslashes($array["delivery_country"]);
$this->date = $this->db->jdate($array["date_purchased"]);
$this->billing_adr->name = stripslashes($array["billing_name"]);
$this->billing_adr->street = stripslashes($array["billing_street_address"]);
$this->billing_adr->cp = stripslashes($array["billing_postcode"]);
$this->billing_adr->city = stripslashes($array["billing_city"]);
$this->billing_adr->country = stripslashes($array["billing_country"]);
$this->delivery_adr->name = stripslashes($array["delivery_name"]);
$this->delivery_adr->street = stripslashes($array["delivery_street_address"]);
$this->delivery_adr->cp = stripslashes($array["delivery_postcode"]);
$this->delivery_adr->city = stripslashes($array["delivery_city"]);
$this->delivery_adr->country = stripslashes($array["delivery_country"]);
$this->db->free();
$this->billing_adr->name = stripslashes($array["billing_name"]);
$this->billing_adr->street = stripslashes($array["billing_street_address"]);
$this->billing_adr->cp = stripslashes($array["billing_postcode"]);
$this->billing_adr->city = stripslashes($array["billing_city"]);
$this->billing_adr->country = stripslashes($array["billing_country"]);
/*
* Totaux
*/
$sql = "SELECT value, class ";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
$this->db->free();
$result = $this->db->query($sql);
if ( $result )
{
$num = $this->db->num_rows($result);
/*
* Totaux
*/
$sql = "SELECT value, class ";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
while ($i < $num)
{
$array = $this->db->fetch_array($result);
if ($array["class"] == 'ot_total')
{
$this->total_ot_total = $array["value"];
}
if ($array["class"] == 'ot_shipping')
{
$this->total_ot_shipping = $array["value"];
}
$i++;
}
}
else
{
print $this->db->error();
}
$result = $this->db->query($sql);
if ( $result )
{
$num = $this->db->num_rows($result);
}
else
{
print $this->db->error();
}
while ($i < $num)
{
$array = $this->db->fetch_array($result);
if ($array["class"] == 'ot_total')
{
$this->total_ot_total = $array["value"];
}
if ($array["class"] == 'ot_shipping')
{
$this->total_ot_shipping = $array["value"];
}
$i++;
}
}
else
{
print $this->db->error();
}
return $result;
}
}
else
{
print $this->db->error();
}
return $result;
}
}
?>

View File

@ -16,28 +16,49 @@
*
*/
class Promotion {
var $db ;
/**
* \file htdocs/boutique/promotion/class/promotion.class.php
* \brief File of class to manage discounts on online shop
*/
var $id ;
var $parent_id ;
var $oscid ;
/**
* \class Promotion
* \brief Class to manage discounts on online shop
*/
class Promotion
{
var $db;
var $id;
var $parent_id;
var $oscid;
var $ref;
var $titre;
var $description;
var $price ;
var $status ;
var $price;
var $status;
function Promotion($DB, $id=0) {
$this->db = $DB;
$this->id = $id ;
}
/*
*
*
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function create($user, $pid, $percent) {
function Promotion($DB)
{
$this->db = $DB;
$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)
{
global $conf;
$sql = "SELECT products_price ";
@ -51,13 +72,13 @@ class Promotion {
$this->price_init = $result["products_price"];
}
$newprice = 0.95 * $this->price_init;
$newprice = $percent * $this->price_init;
$date_exp = "2003-05-01";
$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 .= " 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) )
{
@ -70,10 +91,13 @@ class Promotion {
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)
{
@ -89,10 +113,12 @@ class Promotion {
print $this->db->error() . ' in ' . $sql;
}
}
/*
*
*
/**
* Set active
*
* @param int $id id
* @return int <0 if KO, >0 if OK
*/
function set_active($id)
{
@ -109,8 +135,12 @@ class Promotion {
print $this->db->error() . ' in ' . $sql;
}
}
/*
/**
* Set inactive
*
* @param int $id id
* @return int <0 if KO, >0 if OK
*/
function set_inactive($id)
{
@ -127,12 +157,15 @@ class Promotion {
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;
$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;
$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
{
var $error;
var $db;
var $element='category';
var $table_element='category';
public $element='category';
public $table_element='category';
var $id;
var $id_mere;
@ -550,7 +547,7 @@ class Categorie
/**
* Retourne les filles de la categorie
*
*
* @return void
*/
function get_filles()
@ -936,7 +933,7 @@ class Categorie
/**
* Retourne les chemin de la categorie, avec les noms des categories
* separes par $sep (" >> " par defaut)
*
*
* @param string $sep Separator
* @param string $url Url
* @return void
@ -1053,7 +1050,7 @@ class Categorie
/**
* Retourne dans un tableau tous les chemins possibles pour arriver a la categorie
* en partant des categories principales, representes par des tableaux de categories
*
*
* @return void
*/
function get_all_ways ()
@ -1344,9 +1341,10 @@ class Categorie
/**
* Initialise an example of instance with random values
* Used to build previews or test instances
*
* 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()

View File

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

View File

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

View File

@ -42,13 +42,11 @@ require_once(DOL_DOCUMENT_ROOT ."/contact/class/contact.class.php");
*/
class Propal extends CommonObject
{
var $db;
var $error;
var $element='propal';
var $table_element='propal';
var $table_element_line='propaldet';
var $fk_element='fk_propal';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $element='propal';
public $table_element='propal';
public $table_element_line='propaldet';
public $fk_element='fk_propal';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
@ -2128,8 +2126,11 @@ class Propal extends CommonObject
/**
* Initialise an example of instance with random values
* Used to build previews or test instances
* 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()
{

View File

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

View File

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

View File

@ -35,16 +35,14 @@ require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
*/
class Commande extends CommonObject
{
var $db;
var $error;
var $element='commande';
var $table_element='commande';
var $table_element_line = 'commandedet';
var $class_element_line = 'OrderLine';
var $fk_element = 'fk_commande';
var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $element='commande';
public $table_element='commande';
public $table_element_line = 'commandedet';
public $class_element_line = 'OrderLine';
public $fk_element = 'fk_commande';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id ;
var $id;
var $socid; // Id client
var $client; // Objet societe client (a charger par fetch_client)
@ -2325,7 +2323,7 @@ class Commande extends CommonObject
dol_syslog("CustomerOrder::delete error", LOG_ERR);
$err++;
}
// On efface le repertoire de pdf provisoire
$comref = dol_sanitizeFileName($this->ref);
if ($conf->commande->dir_output)
@ -2598,8 +2596,11 @@ class Commande extends CommonObject
/**
* Initialise an example of instance with random values
* Used to build previews or test instances
* 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()
{

View File

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

View File

@ -34,10 +34,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/
class Account extends CommonObject
{
var $db;
var $error;
var $element='bank_account';
var $table_element='bank_account';
public $element='bank_account';
public $table_element='bank_account';
var $rowid;
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()
{

View File

@ -36,14 +36,10 @@
*/
class BankCateg // extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
//public $element='bank_categ'; //!< Id that identify managed objects
//public $table_element='bank_categ'; //!< Name of table without prefix where object is stored
var $id;
var $label;
@ -345,16 +341,17 @@ class BankCateg // extends CommonObject
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
* 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()
{
$this->id=0;
$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
{
var $db;
var $error;
var $element='deplacement';
var $table_element='deplacement';
var $table_element_line = '';
var $fk_element = '';
var $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $element='deplacement';
public $table_element='deplacement';
public $table_element_line = '';
public $fk_element = '';
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;

View File

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

View File

@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/
class Don extends CommonObject
{
var $db;
var $error;
var $element='don';
var $table_element='don';
public $element='don';
public $table_element='don';
var $id;
var $date;
@ -142,8 +140,11 @@ class Don extends CommonObject
/**
* \brief Initialise le don avec valeurs fictives alaatoire
* Sert a generer un recu de don pour l'aperu des modeles ou demo
* 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()
{

View File

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

View File

@ -40,14 +40,11 @@ require_once(DOL_DOCUMENT_ROOT ."/societe/class/client.class.php");
*/
class Facture extends CommonObject
{
var $db;
var $error;
var $errors=array();
var $element='facture';
var $table_element='facture';
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
public $element='facture';
public $table_element='facture';
public $table_element_line = 'facturedet';
public $fk_element = 'fk_facture';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id;
//! Id client
@ -3062,8 +3059,11 @@ class Facture extends CommonObject
/**
* Initialise an example of invoice with random values
* Used to build previews or test instances
* 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()
{

View File

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

View File

@ -33,8 +33,8 @@ class PaymentTerm // extends CommonObject
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
var $errors=array(); //!< To return several error codes (or messages)
//var $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 $element='c_payment_term'; //!< Id that identify managed objects
//public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored
var $id;
@ -455,10 +455,11 @@ class PaymentTerm // extends CommonObject
/**
* Initialise object with example values
* id must be 0 if object instance is a specimen
*
* @return void
* 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()
{

View File

@ -17,6 +17,11 @@
* 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_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
@ -54,8 +59,8 @@ $html=new Form($db);
$year_current = strftime("%Y",dol_now());
$pastmonth = strftime("%m",dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0)
$pastmonthyear = $year_current;
if ($pastmonth == 0)
{
$pastmonth = 12;
$pastmonthyear--;

View File

@ -17,6 +17,11 @@
* 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_once(DOL_DOCUMENT_ROOT."/lib/report.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
{
var $db;
var $error;
var $element='chequereceipt';
var $table_element='bordereau_cheque';
public $element='chequereceipt';
public $table_element='bordereau_cheque';
var $id;
var $num;

View File

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

View File

@ -30,11 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/
class PaymentSocialContribution extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
public $element='paiementcharge'; //!< Id that identify managed objects
public $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
@ -428,8 +425,11 @@ class PaymentSocialContribution extends CommonObject
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
* 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()
{

View File

@ -33,11 +33,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/
class Tva extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
//public $element='tva'; //!< Id that identify managed objects
//public $table_element='tva'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
@ -302,8 +299,11 @@ class Tva extends CommonObject
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
* 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()
{
@ -318,8 +318,6 @@ class Tva extends CommonObject
$this->fk_bank='';
$this->fk_user_creat='';
$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);
}
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
{
var $db;
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
/**
* Constructor
*
@ -42,58 +37,6 @@ class DaoContactDefault extends Contact
$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
{
var $db;
var $error;
var $element='contact';
var $table_element='socpeople';
public $element='contact';
public $table_element='socpeople';
var $id;
var $civilite_id; // In fact we stor civility_code
@ -999,9 +997,11 @@ class Contact extends CommonObject
/**
* Initialise le contact avec valeurs fictives aleatoire
*
* @return void
* 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()
{

View File

@ -37,12 +37,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/price.lib.php");
*/
class Contrat extends CommonObject
{
var $db;
var $error;
var $element='contrat';
var $table_element='contrat';
var $table_element_line='contratdet';
var $fk_element='fk_contrat';
public $element='contrat';
public $table_element='contrat';
public $table_element_line='contratdet';
public $fk_element='fk_contrat';
var $id;
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()
{

View File

@ -462,10 +462,11 @@ class DiscountAbsolute
/**
* Initializes the intervention with random values
* Used to generate a intervention for the preview or demo models
*
* @return void
* 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()
{

View File

@ -36,11 +36,8 @@
*/
class Events // extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
public $element='events'; //!< Id that identify managed objects
public $table_element='events'; //!< Name of table without prefix where object is stored
var $id;
@ -265,8 +262,11 @@ class Events // extends CommonObject
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
* 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()
{

View File

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

View File

@ -1,6 +1,6 @@
<?php
/* 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
* it under the terms of the GNU General Public License as published by
@ -28,8 +28,15 @@
*/
abstract class Stats
{
var $db ;
protected $db;
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @return Stats
*/
function Stats($DB)
{
$this->db = $DB;
@ -37,6 +44,7 @@ abstract class Stats
/**
* Return nb of entity by month for several years
*
* @param endyear Start year
* @param startyear End year
* @return array Array of values
@ -110,6 +118,7 @@ abstract class Stats
/**
* Return nb of elements by year
*
* @param sql SQL request
* @return array
*/
@ -139,6 +148,7 @@ abstract class Stats
/**
* Return nb of elements, total amount and avg amount by year
*
* @param sql SQL request
* @return array
*/
@ -171,6 +181,7 @@ abstract class Stats
/**
* Renvoie le nombre de proposition par mois pour une annee donnee
*
* @param year Year
* @param sql SQL
*/
@ -218,6 +229,7 @@ abstract class Stats
/**
* Renvoie le nombre d'element par mois pour une annee donnee
*
* @param year Year
* @param sql SQL
*/
@ -262,6 +274,7 @@ abstract class Stats
/**
* Renvoie le montant moyen par mois pour une annee donnee
*
* @param year Year
* @param sql SQL
*/

View File

@ -30,11 +30,8 @@
*/
class EcmDirectory // extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
//public $element='ecm_directories'; //!< Id that identify managed objects
//public $table_element='ecm_directories'; //!< Name of table without prefix where object is stored
var $id;
@ -377,8 +374,11 @@ class EcmDirectory // extends CommonObject
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
* 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()
{

View File

@ -36,11 +36,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/co
*/
class Expedition extends CommonObject
{
var $db;
var $error;
var $element="shipping";
var $fk_element="fk_expedition";
var $table_element="expedition";
public $element="shipping";
public $fk_element="fk_expedition";
public $table_element="expedition";
var $id;
var $socid;
@ -973,8 +971,11 @@ class Expedition extends CommonObject
}
/**
* \brief Initialise la facture avec valeurs fictives aleatoire
* Sert a generer une facture pour l'aperu des modeles ou dem
* 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()
{

View File

@ -32,11 +32,10 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/
class Fichinter extends CommonObject
{
var $db;
var $element='fichinter';
var $table_element='fichinter';
var $fk_element='fk_fichinter';
var $table_element_line='fichinterdet';
public $element='fichinter';
public $table_element='fichinter';
public $fk_element='fk_fichinter';
public $table_element_line='fichinterdet';
var $id;
@ -751,8 +750,11 @@ class Fichinter extends CommonObject
/**
* Initializes the intervention with random values
* Used to generate a intervention for the preview or demo models
* 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()
{

View File

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

View File

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

View File

@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
*/
class PaiementFourn extends Paiement
{
var $db;
var $error;
var $element='payment_supplier';
var $table_element='paiementfourn';
public $element='payment_supplier';
public $table_element='paiementfourn';
var $id;
var $ref;
@ -188,7 +186,7 @@ class PaiementFourn extends Paiement
dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid);
$error++;
}
}
else
{

View File

@ -62,7 +62,7 @@ class Import
{
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;
$i=0;
@ -73,99 +73,92 @@ class Import
$dir = $dirroot.'/includes/modules';
// Search available exports
$handle=@opendir($dir);
if (is_resource($handle))
$handle=@opendir(dol_osencode($dir));
if (! is_resource($handle)) continue;
// Search module files
while (($file = readdir($handle))!==false)
{
// Search module files
while (($file = readdir($handle))!==false)
if (! preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) continue;
$modulename=$reg[1];
// Defined if module is enabled
$enabled=true;
$part=strtolower(preg_replace('/^mod/i','',$modulename));
if (empty($conf->$part->enabled)) $enabled=false;
if (empty($enabled)) continue;
// Init load class
$file = $dir."/".$modulename.".class.php";
$classname = $modulename;
require_once($file);
$module = new $classname($this->db);
if (is_array($module->import_code))
{
if (preg_match("/^(mod.*)\.class\.php/i",$file,$reg))
foreach($module->import_code as $r => $value)
{
$modulename=$reg[1];
if ($filter && ($filter != $module->import_code[$r])) continue;
// Defined if module is enabled
$enabled=true;
$part=strtolower(preg_replace('/^mod/i','',$modulename));
if (empty($conf->$part->enabled)) $enabled=false;
if ($enabled)
// Test if permissions are ok
/*$perm=$module->import_permission[$r][0];
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if ($perm[2])
{
// Chargement de la classe
$file = $dir."/".$modulename.".class.php";
$classname = $modulename;
require_once($file);
$module = new $classname($this->db);
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
}
else
{
$bool=$user->rights->$perm[0]->$perm[1];
}
if ($perm[0]=='user' && $user->admin) $bool=true;
//print $bool." $perm[0]"."<br>";
*/
if (is_array($module->import_code))
// Load lang file
$langtoload=$module->getLangFilesArray();
if (is_array($langtoload))
{
foreach($langtoload as $key)
{
foreach($module->import_code as $r => $value)
{
if ($filter && ($filter != $module->import_code[$r])) continue;
// Test if permissions are ok
/*$perm=$module->import_permission[$r][0];
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if ($perm[2])
{
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
}
else
{
$bool=$user->rights->$perm[0]->$perm[1];
}
if ($perm[0]=='user' && $user->admin) $bool=true;
//print $bool." $perm[0]"."<br>";
*/
// Permissions ok
// if ($bool)
// {
// Charge fichier lang en rapport
$langtoload=$module->getLangFilesArray();
if (is_array($langtoload))
{
foreach($langtoload as $key)
{
$langs->load($key);
}
}
// Module
$this->array_import_module[$i]=$module;
// Permission
$this->array_import_perms[$i]=$user->rights->import->run;
// Icon
$this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto);
// Code du dataset export
$this->array_import_code[$i]=$module->import_code[$r];
// Libelle du dataset export
$this->array_import_label[$i]=$module->getImportDatasetLabel($r);
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i]=$module->import_tables_array[$r];
// Array of tables creator field to import (key=alias, value=creator field)
$this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r];
// Array of fiels to import (key=field, value=label)
$this->array_import_fields[$i]=$module->import_fields_array[$r];
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_import_entities[$i]=$module->import_entities_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=alias)
$this->array_import_regex[$i]=$module->import_regex_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=exemple)
$this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r];
// Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles)
$this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$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++;
// }
}
$langs->load($key);
}
}
// Module
$this->array_import_module[$i]=$module;
// Permission
$this->array_import_perms[$i]=$user->rights->import->run;
// Icon
$this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto);
// Code du dataset export
$this->array_import_code[$i]=$module->import_code[$r];
// Libelle du dataset export
$this->array_import_label[$i]=$module->getImportDatasetLabel($r);
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i]=$module->import_tables_array[$r];
// Array of tables creator field to import (key=alias, value=creator field)
$this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r];
// Array of fiels to import (key=field, value=label)
$this->array_import_fields[$i]=$module->import_fields_array[$r];
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_import_entities[$i]=$module->import_entities_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=alias)
$this->array_import_regex[$i]=$module->import_regex_array[$r];
// Tableau des alias a exporter (cle=champ, valeur=exemple)
$this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r];
// Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles)
$this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$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++;
}
}
}
closedir($handle);
}
closedir($handle);
return 1;
}
@ -175,19 +168,18 @@ class Import
* Build an import example file.
* Arrays this->array_export_xxx are already loaded for required datatoexport
*
* @param User $user User qui exporte
* @param string $model Modele d'export
* @param string $model Name of import engine ('csv', ...)
* @param string $headerlinefields Array of values for first line of example file
* @param string $contentlinevalues Array of values for content line of example file
* @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;
$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
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/";
@ -238,7 +230,7 @@ class Import
$sql.= ')';
$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);
if ($resql)
{
@ -249,7 +241,7 @@ class Import
{
$this->error=$this->db->lasterror();
$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();
return -1;
}
@ -267,7 +259,7 @@ class Import
$sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em';
$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);
if ($result)
{

View File

@ -86,6 +86,6 @@ foreach($fieldstarget as $code=>$label)
//var_dump($headerlinefields);
//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
* @param pdf Pdf object
* @param page Current page number
* @param pages Total number of pages
*
* @param PDF &$pdf Pdf object
* @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)
{

View File

@ -37,11 +37,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/co
*/
class Livraison extends CommonObject
{
var $db;
var $error;
var $element="delivery";
var $fk_element="fk_livraison";
var $table_element="livraison";
public $element="delivery";
public $fk_element="fk_livraison";
public $table_element="livraison";
var $id;
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()
{

View File

@ -67,7 +67,7 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6
*
* @param string $val Value
* @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)
{
@ -90,7 +90,7 @@ function test_sql_and_script_inject($val, $get)
/**
* Security: Return true if OK, false otherwise
*
* @param string $var Variable name
* @param string &$var Variable name
* @param string $get 1=GET, 0=POST
* @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
{
var $db;
var $targetmodule;
var $canvas;
var $card;
@ -38,6 +37,7 @@ class ActionsCardProduct extends Product
// List of fiels for action=list
var $field_list =array();
public $list_datas = array();
/**
@ -48,7 +48,7 @@ class ActionsCardProduct extends Product
* @param string $canvas Name of 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->targetmodule = $targetmodule;
@ -64,6 +64,8 @@ class ActionsCardProduct extends Product
/**
* Return the title of card
*
* @return string Label of card
*/
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)
*
* @param action Type of action
* @param string $action Type of action
* @return void
*/
function assign_values($action)
{
@ -141,7 +144,7 @@ class ActionsCardProduct extends Product
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
}
$this->tpl['finished'] = $this->object->finished;
$this->tpl['ref'] = $this->object->ref;
$this->tpl['label'] = $this->object->label;
@ -249,6 +252,8 @@ class ActionsCardProduct extends Product
/**
* Fetch field list
*
* @return void
*/
private function getFieldList()
{
@ -299,6 +304,12 @@ class ActionsCardProduct extends Product
/**
* 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)
{
@ -372,7 +383,7 @@ class ActionsCardProduct extends Product
$sql.= " AND p.canvas = '".$this->db->escape($_GET["canvas"])."'";
}
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit + 1 ,$offset);
$sql.= $this->db->plimit($limit+1, $offset);
//print $sql;
$resql = $this->db->query($sql);

View File

@ -23,12 +23,11 @@
include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
/**
* \class ProductService
* \class ActionsCardService
* \brief Class with controller methods for product canvas
*/
class ActionsCardService extends Product
{
var $db;
var $targetmodule;
var $canvas;
var $card;
@ -38,6 +37,7 @@ class ActionsCardService extends Product
// List of fiels for action=list
var $field_list =array();
public $list_datas = array();
/**
@ -48,7 +48,7 @@ class ActionsCardService extends Product
* @param string $canvas Name of 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->targetmodule = $targetmodule;
@ -64,6 +64,8 @@ class ActionsCardService extends Product
/**
* Return the title of card
*
* @return string Label of card
*/
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)
*
* @param action Type of action
* @param string $action Type of action
* @return void
*/
function assign_values($action)
{
@ -141,7 +144,7 @@ class ActionsCardService extends Product
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
}
$this->tpl['finished'] = $this->object->finished;
$this->tpl['ref'] = $this->object->ref;
$this->tpl['label'] = $this->object->label;
@ -229,6 +232,8 @@ class ActionsCardService extends Product
/**
* Fetch field list
*
* @return void
*/
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)
{
@ -327,7 +338,7 @@ class ActionsCardService extends Product
$sql .= " AND cp.fk_categorie = ".$this->db->escape($search_categ);
}
$sql.= $this->db->order($sortfield,$sortorder);
$sql.= $this->db->plimit($limit + 1 ,$offset);
$sql.= $this->db->plimit($limit+1, $offset);
$this->list_datas = array();

View File

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

View File

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

View File

@ -30,11 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/
class Project extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
public $element='project'; //!< Id that identify managed objects
public $table_element='projet'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
@ -666,9 +663,11 @@ class Project extends CommonObject
}
/**
* Initialise object with default value to be used as example
*
* @return void
* 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()
{

View File

@ -32,11 +32,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/
class Task extends CommonObject
{
var $db; //!< To store db handler
var $error; //!< To return error code (or message)
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
public $element='project_task'; //!< Id that identify managed objects
public $table_element='projet_task'; //!< Name of table without prefix where object is stored
var $id;
@ -437,10 +434,11 @@ 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.
*
* @return void
* @return void
*/
function initAsSpecimen()
{

View File

@ -33,8 +33,6 @@ abstract class ActionsCardCommon
var $canvas;
var $card;
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
//! Template container
var $tpl = array();
//! 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
* \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');
@ -29,7 +29,6 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php');
*/
class ActionsCardCompany extends ActionsCardCommon
{
var $db;
var $targetmodule;
var $canvas;
var $card;
@ -96,7 +95,7 @@ class ActionsCardCompany extends ActionsCardCommon
$this->tpl['profid3'] = $this->object->ape;
$this->tpl['profid4'] = $this->object->idprof4;
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK))
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK))
{
$js = "\n";
$js.= '<script language="JavaScript" type="text/javascript">';

View File

@ -27,14 +27,10 @@
*/
class DaoThirdPartyCompany extends Societe
{
var $db;
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
/**
* Constructor
*
*
* @param DoliDB $DB Databae handler
*/
function DaoThirdPartyCompany($DB)
@ -42,66 +38,6 @@ class DaoThirdPartyCompany extends Societe
$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
{
var $db;
var $targetmodule;
var $canvas;
var $card;

View File

@ -27,78 +27,18 @@
*/
class DaoThirdPartyIndividual extends Societe
{
//! Numero d'erreur Plage 1280-1535
var $errno = 0;
public $list_datas = array();
/**
* Constructeur de la classe
* @param DB Handler acces base de donnees
* Constructor
*
* @param DoliDB $DB Databae handler
*/
function DaoThirdPartyIndividual($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
{
var $db;
var $nb;
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
* \param id id societe (0 par defaut)
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Client($DB, $id=0)
function Client($DB)
{
global $config;
$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
* \return int <0 si ko, >0 si ok
* Load indicators into this->nb for board
*
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{

View File

@ -65,10 +65,14 @@ class CompanyBankAccount extends Account
/**
* Create bank information record
*
* @return int <0 if KO, >= 0 if OK
*/
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);
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='')
{
$sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
$sql .= " WHERE fk_soc = ".$this->socid;
@ -135,8 +140,10 @@ class CompanyBankAccount extends Account
/**
* 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)
{

View File

@ -1341,7 +1341,7 @@ class Societe extends CommonObject
if ($this->id)
{
$now=dol_now();
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
$sql .= " SET price_level = '".$price_level."'";
$sql .= " WHERE rowid = " . $this->id;
@ -2481,8 +2481,11 @@ class Societe extends CommonObject
/**
* Initialise an example of company with random values
* Used to build previews or test instances
* 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()
{

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 .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")";
if ($db->query($sql))
{
}
else
if (! $db->query($sql))
{
$error++;
dol_print_error($db);
@ -115,7 +111,7 @@ if ($action == 'add')
// Remove a notification
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);
}

View File

@ -106,12 +106,6 @@ if (empty($account->socid)) $account->socid=$soc->id;
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 '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>';
@ -165,22 +159,12 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
print '</table>';
print '</div>';
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
// Check BBAN
if (! checkBanForAccount($account))
{
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);
if ($message) { print "$message<br><br>\n"; }
dol_htmloutput_mesg($message);
print '<form action="rib.php?socid='.$soc->id.'" method="post">';
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();
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();

View File

@ -36,12 +36,9 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
*/
class User extends CommonObject
{
var $db;
var $error;
var $errors=array();
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
public $element='user';
public $table_element='user';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id=0;
var $ldap_sid;
@ -119,11 +116,11 @@ class User extends CommonObject
/**
* Load a user from database with its id or ref (login)
*
* @param id Si defini, id a utiliser pour recherche
* @param login Si defini, login a utiliser pour recherche
* @param sid Si defini, sid a utiliser pour recherche
* @param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
* @return int <0 if KO, 0 not found, >0 if OK
* @param int $id Si defini, id a utiliser pour recherche
* @param string $login Si defini, login a utiliser pour recherche
* @param strinf $sid Si defini, sid a utiliser pour recherche
* @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
* @return int <0 if KO, 0 not found, >0 if OK
*/
function fetch($id='', $login='',$sid='',$loadpersonalconf=1)
{
@ -270,12 +267,12 @@ class User extends CommonObject
}
/**
* Ajoute un droit a l'utilisateur
* Ajoute un droit a l'utilisateur
*
* @param rid id du droit a ajouter
* @param allmodule Ajouter tous les droits du module allmodule
* @param allperms Ajouter tous les droits du module allmodule, perms allperms
* @return int > 0 si ok, < 0 si erreur
* @param int $rid id du droit a ajouter
* @param string $allmodule Ajouter tous les droits du module allmodule
* @param string $allperms Ajouter tous les droits du module allmodule, perms allperms
* @return int > 0 si ok, < 0 si erreur
*/
function addrights($rid,$allmodule='',$allperms='')
{
@ -369,12 +366,12 @@ class User extends CommonObject
/**
* Retire un droit a l'utilisateur
* Retire un droit a l'utilisateur
*
* @param rid id du droit a retirer
* @param allmodule Retirer tous les droits du module allmodule
* @param allperms Retirer tous les droits du module allmodule, perms allperms
* @return int > 0 si ok, < 0 si erreur
* @param int $rid Id du droit a retirer
* @param string $allmodule Retirer tous les droits du module allmodule
* @param string $allperms Retirer tous les droits du module allmodule, perms allperms
* @return int > 0 si ok, < 0 si erreur
*/
function delrights($rid,$allmodule='',$allperms='')
{
@ -465,7 +462,9 @@ class User extends CommonObject
/**
* Clear all permissions array of user
* Clear all permissions array of user
*
* @return void
*/
function clearrights()
{
@ -479,7 +478,8 @@ class User extends CommonObject
/**
* 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='')
{
@ -600,9 +600,10 @@ class User extends CommonObject
}
/**
* Change status of a user
* Change status of a user
*
* @return int <0 if KO, 0 if nothing is done, >0 if OK
* @param int $statut Status to set
* @return int <0 if KO, 0 if nothing is done, >0 if OK
*/
function setstatus($statut)
{
@ -709,9 +710,9 @@ class User extends CommonObject
/**
* Create a user into database
*
* @param user Objet user qui demande la creation
* @param notrigger 1 ne declenche pas les triggers, 0 sinon
* @return int <0 si KO, id compte cree si OK
* @param User $user Objet user qui demande la creation
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @return int <0 si KO, id compte cree si OK
*/
function create($user,$notrigger=0)
{
@ -835,12 +836,12 @@ 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 login Login to force
* @param password Password to force
* @return int <0 if error, if OK returns id of created user
* @param Contact $contact Object for source contact
* @param string $login Login to force
* @param string $password Password to force
* @return int <0 if error, if OK returns id of created user
*/
function create_from_contact($contact,$login='',$password='')
{
@ -903,11 +904,11 @@ 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 login Login to force
* @return int <0 if KO, if OK, return id of created account
* @param Adherent $member Object member source
* @param string $login Login to force
* @return int <0 if KO, if OK, return id of created account
*/
function create_from_member($member,$login='')
{
@ -1008,11 +1009,11 @@ class User extends CommonObject
/**
* Update a user into databse (and also password if this->pass is defined)
*
* @param user User qui fait la mise a jour
* @param notrigger 1 ne declenche pas les triggers, 0 sinon
* @param 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
* @return int <0 si KO, >=0 si OK
* @param User $user User qui fait la mise a jour
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @param int $nosyncmember 0=Synchronize linked member (standard info), 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
*/
function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0)
{
@ -1201,7 +1202,7 @@ class User extends CommonObject
$sql.= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion
$sql.= " WHERE rowid = ".$this->id;
dol_syslog ("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG);
dol_syslog("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -1220,18 +1221,18 @@ class User extends CommonObject
/**
* Change password of a user
*
* @param user Object user of user making change
* @param password New password in clear text (to generate if not provided)
* @param changelater 1=Change password only after clicking on confirm email
* @param notrigger 1=Does not launch triggers
* @param nosyncmember Do not synchronize linked member
* @return string If OK return clear password, 0 if no change, < 0 if error
* @param User $user Object user of user making change
* @param string $password New password in clear text (to generate if not provided)
* @param int $changelater 1=Change password only after clicking on confirm email
* @param int $notrigger 1=Does not launch triggers
* @param int $nosyncmember Do not synchronize linked member
* @return string If OK return clear password, 0 if no change, < 0 if error
*/
function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0)
{
global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php");
$error=0;
dol_syslog("User::setPassword user=".$user->id." password=".preg_replace('/./i','*',$password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG);
@ -1347,12 +1348,12 @@ 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 password Nouveau mot de passe
* @param changelater 1=Change password only after clicking on confirm email
* @return int < 0 si erreur, > 0 si ok
* @param User $user Object user de l'utilisateur qui fait l'envoi
* @param string $password Nouveau mot de passe
* @param int $changelater 1=Change password only after clicking on confirm email
* @return int < 0 si erreur, > 0 si ok
*/
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";
dol_syslog("User::send_password url=".$url);
}
$mailfile = new CMailFile($subject,$this->email,$conf->notification->email_from,$mesg,
array(),array(),array(),'', '', 0, $msgishtml);
$mailfile = new CMailFile(
$subject,
$this->email,
$conf->notification->email_from,
$mesg,
array(),
array(),
array(),
'',
'',
0,
$msgishtml
);
if ($mailfile->sendfile())
{
@ -1476,7 +1488,9 @@ class User extends CommonObject
}
/**
* Update clicktodial info
* Update clicktodial info
*
* @return void
*/
function update_clicktodial()
{
@ -1511,12 +1525,12 @@ class User extends CommonObject
/**
* Add user into a group
* Add user into a group
*
* @param group Id of group
* @param entity Entity
* @param notrigger Disable triggers
* @return int <0 if KO, >0 if OK
* @param Group $group Id of group
* @param int $entity Entity
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function SetInGroup($group, $entity, $notrigger=0)
{
@ -1572,12 +1586,12 @@ class User extends CommonObject
}
/**
* Remove a user from a group
* Remove a user from a group
*
* @param group Id of group
* @param entity Entity
* @param notrigger Disable triggers
* @return int <0 if KO, >0 if OK
* @param Group $group Id of group
* @param int $entity Entity
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function RemoveFromGroup($group, $entity, $notrigger=0)
{
@ -1628,12 +1642,12 @@ class User extends CommonObject
}
/**
* Return a link to the user card (with optionnaly the picto)
* Use this->id,this->nom, this->prenom
* Return a link to the user card (with optionnaly the picto)
* 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 option On what the link point to
* @return string String with URL
* @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul)
* @param string $option On what the link point to
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='')
{
@ -1657,11 +1671,11 @@ 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 option Sur quoi pointe le lien
* @return string Chaine avec URL
* @param int $withpicto Inclut le picto dans le lien
* @param string $option Sur quoi pointe le lien
* @return string Chaine avec URL
*/
function getLoginUrl($withpicto=0,$option='')
{
@ -1684,12 +1698,12 @@ 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 option 0=No option, 1=Add civility
* @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @return string String with full name
* @param Translate $langs Language object for translation of civility
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @return string String with full name
*/
function getFullName($langs,$option=0,$nameorder=-1)
{
@ -1723,10 +1737,10 @@ 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
* @return string Label of status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label of status
*/
function getLibStatut($mode=0)
{
@ -1734,11 +1748,11 @@ class User extends CommonObject
}
/**
* Renvoi le libelle d'un statut donne
* Renvoi le libelle d'un statut donne
*
* @param 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
* @return string Label of status
* @param int $statut Id statut
* @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
*/
function LibStatut($statut,$mode=0)
{
@ -1782,11 +1796,11 @@ class User extends CommonObject
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
* @param info Info string loaded by _load_ldap_info
* @param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=
* 2=Return key only (uid=qqq)
* @return string DN
* @param string $info Info string loaded by _load_ldap_info
* @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
* 1=
* 2=Return key only (uid=qqq)
* @return string DN
*/
function _load_ldap_dn($info,$mode=0)
{
@ -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()
{
@ -1904,9 +1922,10 @@ 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)
{
@ -1968,10 +1987,10 @@ class User extends CommonObject
}
/**
* Return number of existing users
* Return number of existing users
*
* @param limitTo limit to 'active' or 'superadmin' users
* @return int Number of users
* @param string $limitTo Limit to 'active' or 'superadmin' users
* @return int Number of users
*/
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
{
var $db; // Database handler
var $error;
var $errors=array();
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
public $element='usergroup';
public $table_element='usergroup';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; // Group id
var $entity; // Entity of group
@ -679,9 +676,11 @@ class UserGroup extends CommonObject
/**
* Initialise le groupe avec valeurs fictives aleatoire
*
* @return void
* 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()
{