Qual: Uniformize constructors

This commit is contained in:
Laurent Destailleur 2011-09-11 18:35:38 +00:00
parent 247c97581a
commit b75d19c264
114 changed files with 3478 additions and 3388 deletions

View File

@ -5,24 +5,26 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.2 compared to 3.1 *****
For users:
- New: task #11243: Show quantity into stocks for each sub-products into the sub-product tab
- New: task #10500: Option to choose if professional id are unique
- New: Add hidden option FOURN_PRODUCT_AVAILABILITY
- New: task #11123: Add best supplier price
- New: Can edit customer discounts from invoice create and edit card.
- New: task #11243: Show quantity into stocks for each sub-products into the sub-product tab.
- New: task #10500: Option to choose if professional id are unique.
- New: Add hidden option FOURN_PRODUCT_AVAILABILITY.
- New: task #11123: Add best supplier price.
- New: Enhancement in styles.
- New: task #11289 : Modify third party accountancy code generator aquarium
- New: task #10606 : more comprehensive message error
- New: task #11278 : Option into point of sale module to add services in list
- New: task #11289 : Modify third party accountancy code generator aquarium.
- New: task #10606 : more comprehensive message error.
- New: task #11278 : Option into point of sale module to add services in list.
- New: task #11261 : Add an entry into menu called "New shipment".
- New: Make option MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT available by default
- New: Make option MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT available by default.
- New: Can build PDF in USLetter format or canada format.
For developers:
- Qual: Removed no more used external libraries.
- Qual: Cleaned a lot of dead code.
- Qual: Parent templates classes were moved as abstract classes.
- Qual: Added more "hooks"
- Qual: Add more "hooks".
- Qual: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours.
- More OOP (usage of "abstract", "static", ...), unifformize constructors.
***** ChangeLog for 3.1 compared to 3.0 *****

View File

@ -40,21 +40,21 @@ class AccountancySystem
/**
* \brief Constructor of class
* \param DB Database handler
* \param id Id compte (0 by default)
* Constructor
*
* @param DoliDB $DB Database handler
*/
function AccountancySystem($DB, $id=0)
function AccountancySystem($DB)
{
$this->db = $DB;
$this->id = $id ;
}
/**
* \brief Insert accountancy system name into database
* \param user User making insert
* \return int <0 if KO, Id of line if OK
* Insert accountancy system name into database
*
* @param User $user User making insert
* @return int <0 if KO, Id of line if OK
*/
function create($user)
{

View File

@ -41,15 +41,13 @@ class Bookmark
/**
* Constructor
*
* @param DoliDB $db Handler for Database Access
* @param int $id Bookmark Id
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Bookmark($db, $id=-1)
function Bookmark($db)
{
$this->db = $db;
$this->id = $id;
}
/**

View File

@ -70,7 +70,7 @@ class Facturation {
/**
* Constructor
* Constructor
*/
public function Facturation()
{

View File

@ -68,12 +68,13 @@ switch ( $_GET['action'] )
{
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$productid = $ret['rowid'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$product = new Product($db, $productid);
$product = new Product($db);
$product->fetch($productid);
if(isset($product->multiprices[$societe->price_level]))
{
$ret['price'] = $product->multiprices_ttc[$societe->price_level];
@ -82,9 +83,9 @@ switch ( $_GET['action'] )
// $product->multiprices_base_type[$societe->price_level];
$ret['tva_tx'] = $product->multiprices_tva_tx[$societe->price_level];
}
}
}
/** end add Ditto */
$obj_facturation->id( $ret['rowid'] );
$obj_facturation->ref( $ret['ref'] );
$obj_facturation->stock( $ret['reel'] );

View File

@ -64,7 +64,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/** add Ditto for MultiPrix*/
if($conf->global->PRODUIT_MULTIPRICES)
{
$product = new Product($db, $ret[$i]['id']);
$product = new Product($db);
$product->fetch($ret[$i]['id']);
if(isset($product->multiprices[$societe->price_level]))
{

View File

@ -55,23 +55,23 @@ class Categorie
/**
* Constructor
* Constructor
*
* @param DB acces base de donnees
* @param id id de la categorie
* @param DoliDB $DB Database handler
* @param int $id Id of category to fetch during init
*/
function Categorie($DB, $id=-1)
{
$this->db = $DB;
$this->id = $id;
if ($id != -1) $this->fetch ($this->id);
if ($id != -1) $this->fetch($this->id);
}
/**
* Load category into memory from database
*
* @param id id of category
* @param int $id Id of category
*/
function fetch($id)
{
@ -216,7 +216,7 @@ class Categorie
$this->description=trim($this->description);
$this->parentId = ($this->id_mere) != "" ? intval($this->id_mere) : 0;
$this->visible = ($this->visible) != "" ? intval($this->visible) : 0;
if ($this->already_exists())
{
$this->error=$langs->trans("ImpossibleUpdateCat");

View File

@ -105,12 +105,8 @@ llxHeader("","",$langs->trans("Categories"));
print_fiche_titre($langs->trans("ModifCat"));
if ($mesg)
{
print '<div class="error">';
print $mesg;
print '</div>';
}
dol_htmloutput_errors($mesg);
$categorie = new Categorie($db, $id);
$html = new Form($db);

View File

@ -84,14 +84,16 @@ if ($_POST['action'] == 'setcustomeraccountancycode')
if ($_GET["action"] == 'attribute_prefix' && $user->rights->societe->creer)
{
$societe = new Societe($db, $_GET["socid"]);
$societe = new Societe($db);
$societe->fetch($_GET["socid"]);
$societe->attribute_prefix($db, $_GET["socid"]);
}
// conditions de reglement
if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer)
{
$societe = new Societe($db, $_GET["socid"]);
$societe = new Societe($db);
$societe->fetch($_GET["socid"]);
$societe->cond_reglement=$_POST['cond_reglement_id'];
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET cond_reglement='".$_POST['cond_reglement_id'];
$sql.= "' WHERE rowid='".$_GET["socid"]."'";
@ -101,7 +103,8 @@ if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer)
// mode de reglement
if ($_POST["action"] == 'setmode' && $user->rights->societe->creer)
{
$societe = new Societe($db, $_GET["socid"]);
$societe = new Societe($db);
$societe->fetch($_GET["socid"]);
$societe->mode_reglement=$_POST['mode_reglement_id'];
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET mode_reglement='".$_POST['mode_reglement_id'];
$sql.= "' WHERE rowid='".$_GET["socid"]."'";
@ -111,7 +114,8 @@ if ($_POST["action"] == 'setmode' && $user->rights->societe->creer)
// assujetissement a la TVA
if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer)
{
$societe = new Societe($db, $_GET["socid"]);
$societe = new Societe($db);
$societe->fetch($_GET["socid"]);
$societe->tva_assuj=$_POST['assujtva_value'];
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$socid."'";
$result = $db->query($sql);

View File

@ -661,7 +661,7 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
// Ecrase $txtva par celui du produit
if ($_POST['idprod'])
{
$prod = new Product($db, $_POST['idprod']);
$prod = new Product($db);
$prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id);

View File

@ -62,7 +62,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id,$ref) > 0)
{
$soc = new Societe($db, $object->socid);
$soc = new Societe($db);
$soc->fetch($object->socid);
$head = propal_prepare_head($object);

View File

@ -138,7 +138,7 @@ if ($id > 0 || ! empty($ref))
$propal = New Propal($db);
if ( $propal->fetch($id,$ref) > 0)
{
$soc = new Societe($db, $propal->socid);
$soc = new Societe($db);
$soc->fetch($propal->socid);

View File

@ -55,7 +55,8 @@ if ($_GET["action"] == 'cstc')
// set prospect level
if ($_POST["action"] == 'setprospectlevel' && $user->rights->societe->creer)
{
$societe = new Societe($db, $_GET["socid"]);
$societe = new Societe($db);
$societe->fetch($_GET["socid"]);
$societe->fk_prospectlevel=$_POST['prospect_level_id'];
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_prospectlevel='".$_POST['prospect_level_id'];
$sql.= "' WHERE rowid='".$_GET["socid"]."'";

View File

@ -65,7 +65,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id,$ref) > 0)
{
$soc = new Societe($db, $object->socid);
$soc = new Societe($db);
$soc->fetch($object->socid);

View File

@ -99,10 +99,11 @@ class Commande extends CommonObject
/**
* \brief Constructeur
* \param DB Handler d'acces base
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Commande($DB, $socid="", $commandeid=0)
function Commande($DB)
{
global $langs;
$langs->load('orders');
@ -1152,7 +1153,8 @@ class Commande extends CommonObject
/** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
{
$prod = new Product($this->db, $idproduct);
$prod = new Product($this->db);
$prod->fetch($idproduct);
$prod -> get_sousproduits_arbo ();
$prods_arbo = $prod->get_each_prod();
if(sizeof($prods_arbo) > 0)

View File

@ -134,7 +134,7 @@ if ($id > 0 || ! empty($ref))
$commande = new Commande($db);
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{
$soc = new Societe($db, $commande->socid);
$soc = new Societe($db);
$soc->fetch($commande->socid);

View File

@ -510,7 +510,7 @@ if ($action == 'addline' && $user->rights->commande->creer)
// Ecrase $base_price_type par celui du produit
if ($_POST['idprod'])
{
$prod = new Product($db, $_POST['idprod']);
$prod = new Product($db);
$prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id);

View File

@ -49,7 +49,7 @@ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES
$commande = new Commande($db);
$commande->fetch($_GET["id"]);
$commande->info($_GET["id"]);
$soc = new Societe($db, $commande->socid);
$soc = new Societe($db);
$soc->fetch($commande->socid);
$head = commande_prepare_head($commande);

View File

@ -85,7 +85,7 @@ $html = new Form($db);
if ($id > 0 || ! empty($ref))
{
$soc = new Societe($db, $commande->socid);
$soc = new Societe($db);
$soc->fetch($commande->socid);
$head = commande_prepare_head($commande);

View File

@ -36,94 +36,96 @@
*/
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
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
var $id;
var $id;
var $label;
var $label;
/**
* \brief Constructor
* \param DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function BankCateg($DB)
{
$this->db = $DB;
return 1;
$this->db = $DB;
return 1;
}
/**
* \brief Create in database
* \param user User that create
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, Id of created object if OK
* Create in database
*
* @param user User that create
* @param notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
// Check parameters
// Put here code to add control on parameters values
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ (";
$sql.= "label";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'")."";
$sql.= ", ".$conf->entity;
$sql.= ")";
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ (";
$sql.= "label";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'")."";
$sql.= ", ".$conf->entity;
$sql.= ")";
$this->db->begin();
$this->db->begin();
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_categ");
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_categ");
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
//// Call triggers
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return $this->id;
}
}
}
@ -134,36 +136,36 @@ class BankCateg // extends CommonObject
*/
function fetch($id)
{
global $langs,$conf;
global $langs,$conf;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ as t";
$sql.= " WHERE t.rowid = ".$id;
$sql.= " AND t.entity = ".$conf->entity;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ as t";
$sql.= " WHERE t.rowid = ".$id;
$sql.= " AND t.entity = ".$conf->entity;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->label = $obj->label;
$this->id = $obj->rowid;
$this->label = $obj->label;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
return -1;
}
}
@ -175,185 +177,185 @@ class BankCateg // extends CommonObject
*/
function update($user=0, $notrigger=0)
{
global $conf, $langs;
$error=0;
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
// Check parameters
// Put here code to add control on parameters values
// Check parameters
// Put here code to add control on parameters values
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null")."";
$sql.= " WHERE rowid=".$this->id;
$sql.= " AND entity = ".$conf->entity;
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null")."";
$sql.= " WHERE rowid=".$this->id;
$sql.= " AND entity = ".$conf->entity;
$this->db->begin();
$this->db->begin();
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
//// Call triggers
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* \brief Delete object in database
/**
* \brief Delete object in database
* \param user User that delete
* \param notrigger 0=launch triggers after, 1=disable triggers
* \return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
* \return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE rowid=".$this->id;
$sql.= " AND entity = ".$conf->entity;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE rowid=".$this->id;
$sql.= " AND entity = ".$conf->entity;
$this->db->begin();
$this->db->begin();
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
//// Call triggers
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* \brief Load an object from its id and create a new one in database
* \param fromid Id of object to clone
* \return int New id of clone
*/
function createFromClone($fromid)
{
global $user,$langs;
/**
* \brief Load an object from its id and create a new one in database
* \param fromid Id of object to clone
* \return int New id of clone
*/
function createFromClone($fromid)
{
global $user,$langs;
$error=0;
$error=0;
$object=new Bank_categ($this->db);
$object=new Bank_categ($this->db);
$this->db->begin();
$this->db->begin();
// Load source object
$object->fetch($fromid);
$object->id=0;
$object->statut=0;
// Load source object
$object->fetch($fromid);
$object->id=0;
$object->statut=0;
// Clear fields
// ...
// Clear fields
// ...
// Create clone
$result=$object->create($user);
// Create clone
$result=$object->create($user);
// Other options
if ($result < 0)
{
$this->error=$object->error;
$error++;
}
// Other options
if ($result < 0)
{
$this->error=$object->error;
$error++;
}
if (! $error)
{
if (! $error)
{
}
}
// End
if (! $error)
{
$this->db->commit();
return $object->id;
}
else
{
$this->db->rollback();
return -1;
}
}
// End
if (! $error)
{
$this->db->commit();
return $object->id;
}
else
{
$this->db->rollback();
return -1;
}
}
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
*/
function initAsSpecimen()
{
$this->id=0;
/**
* \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen.
*/
function initAsSpecimen()
{
$this->id=0;
$this->label='';
$this->label='';
}
}
}
?>

View File

@ -63,7 +63,8 @@ $thirdpartystatic=new Societe($db);
if ($action == 'attribute_prefix')
{
$societe = new Societe($db, $socid);
$societe = new Societe($db);
$societe->fetch($socid);
$societe->attribute_prefix($db, $socid);
}

View File

@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
$trip = new Deplacement($db);
$trip->fetch($id,$ref);
$soc = new Societe($db, $trip->socid);
$soc = new Societe($db);
$soc->fetch($trip->socid);
$h=0;

View File

@ -903,7 +903,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
// Ecrase $base_price_type par celui du produit
if ($_POST['idprod'])
{
$prod = new Product($db, $_POST['idprod']);
$prod = new Product($db);
$prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id);
@ -1884,7 +1884,7 @@ else
$result=$object->fetch_thirdparty();
$soc = new Societe($db, $object->socid);
$soc = new Societe($db);
$soc->fetch($object->socid);
$totalpaye = $object->getSommePaiement();

View File

@ -63,7 +63,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id,$ref) > 0)
{
$soc = new Societe($db, $object->socid);
$soc = new Societe($db);
$soc->fetch($object->socid);
$author = new User($db);

View File

@ -372,7 +372,7 @@ class Facture extends CommonObject
{
if ($_facrec->lines[$i]->fk_product)
{
$prod = new Product($this->db, $_facrec->lines[$i]->fk_product);
$prod = new Product($this->db);
$res=$prod->fetch($_facrec->lines[$i]->fk_product);
}
$tva_tx = get_default_tva($mysoc,$soc,$prod->id);

View File

@ -337,7 +337,7 @@ else
if ($fac->fetch($facid, $user->societe_id) > 0)
{
$soc = new Societe($db, $fac->socid);
$soc = new Societe($db);
$soc->fetch($fac->socid);
$author = new User($db);
$author->fetch($fac->user_author);

View File

@ -41,7 +41,7 @@ $fac = new Facture($db);
$fac->fetch($_GET["facid"]);
$fac->info($_GET["facid"]);
$soc = new Societe($db, $fac->socid);
$soc = new Societe($db);
$soc->fetch($fac->socid);
$head = facture_prepare_head($fac);

View File

@ -100,7 +100,7 @@ if ($id > 0 || ! empty($ref))
$fac = new Facture($db);
$fac->fetch($id,$ref);
$soc = new Societe($db, $fac->socid);
$soc = new Societe($db);
$soc->fetch($fac->socid);
$head = facture_prepare_head($fac);

View File

@ -105,7 +105,7 @@ if ($_REQUEST["facid"] > 0 || $_REQUEST["ref"])
{
if ($mesg) print $mesg.'<br>';
$soc = new Societe($db, $fac->socid);
$soc = new Societe($db);
$soc->fetch($fac->socid);
$totalpaye = $fac->getSommePaiement();

View File

@ -44,9 +44,9 @@ class RemiseCheque extends CommonObject
var $errno;
/**
* Constructor
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $DB Database handler
*/
function RemiseCheque($DB)
{

File diff suppressed because it is too large Load Diff

View File

@ -53,8 +53,9 @@ class PaymentSocialContribution extends CommonObject
var $fk_user_modif;
/**
* \brief Constructor
* \param DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function PaymentSocialContribution($DB)
{
@ -63,10 +64,11 @@ class PaymentSocialContribution extends CommonObject
}
/**
* Create payment of social contribution into database.
* Use this->amounts to have list of lines for the payment
* @param user User making payment
* @return int <0 if KO, id of payment if OK
* Create payment of social contribution into database.
* Use this->amounts to have list of lines for the payment
*
* @param User $user User making payment
* @return int <0 if KO, id of payment if OK
*/
function create($user)
{

View File

@ -56,8 +56,9 @@ class Tva extends CommonObject
/**
* \brief Constructor
* \param DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Tva($DB)
{
@ -67,9 +68,10 @@ class Tva extends CommonObject
/**
* \brief Create in database
* \param user User that create
* \return int <0 si ko, >0 si ok
* Create in database
*
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{

View File

@ -45,10 +45,11 @@ abstract class ActionsContactCardCommon
/**
* Constructor
* @param DB Handler acces base de donnees
* @param targmetmodule Name of directory of module where canvas is stored
* @param canvas Name of canvas
* @param card Name of tab (sub-canvas)
*
* @param DoliDB $DB Handler acces base de donnees
* @param string $targmetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of canvas
* @param streing $card Name of tab (sub-canvas)
*/
function ActionsContactCardCommon($DB,$targetmodule,$canvas,$card)
{

View File

@ -36,10 +36,11 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
/**
* Constructor
* @param DB Handler acces base de donnees
* @param targmetmodule Name of directory of module where canvas is stored
* @param canvas Name of canvas
* @param card Name of tab (sub-canvas)
*
* @param DoliDB $DB Handler acces base de donnees
* @param string $targmetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas)
*/
function ActionsContactCardDefault($DB,$targetmodule,$canvas,$card)
{

View File

@ -80,8 +80,9 @@ class Contact extends CommonObject
/**
* Constructor of class Contact
* @param DB Habler d'acces base
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Contact($DB)
{
@ -89,9 +90,10 @@ class Contact extends CommonObject
}
/**
* Add a contact into database
* @param user Object user that create
* @return int <0 if KO, >0 if OK
* Add a contact into database
*
* @param User $user Object user that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{

View File

@ -72,8 +72,9 @@ class Contrat extends CommonObject
/**
* Constructor of classe
* @param DB Databse handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Contrat($DB)
{

View File

@ -109,7 +109,7 @@ llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($contrat->id)
{
$soc = new Societe($db, $contrat->societe->id);
$soc = new Societe($db);
$soc->fetch($contrat->societe->id);
if ( $error_msg )

View File

@ -233,7 +233,7 @@ if ($action == 'addline' && $user->rights->contrat->creer)
// Ecrase $base_price_type par celui du produit
if ($_POST['idprod'])
{
$prod = new Product($db, $_POST['idprod']);
$prod = new Product($db);
$prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id);

View File

@ -92,9 +92,9 @@ $html = new Form($db);
if ($_GET["id"])
{
if ($mesg) print $mesg;
dol_htmloutput_mesg($mesg);
$soc = new Societe($db, $contrat->societe->id);
$soc = new Societe($db);
$soc->fetch($contrat->societe->id);
$head = contract_prepare_head($contrat);

View File

@ -48,8 +48,8 @@ class Canvas
/**
* Constructor
*
* @param DB Database handler
* @param action Action ('create', 'view', 'edit')
* @param DoliDB $DB Database handler
* @param string $action Action ('create', 'view', 'edit')
*/
function Canvas($DB, $action='view')
{

View File

@ -39,8 +39,9 @@ class DolCookie
var $cookie;
/**
* \brief Constructor
* \param key Personnal key
* Constructor
*
* @param string $key Personnal key
*/
function DolCookie($key = '')
{
@ -53,7 +54,7 @@ class DolCookie
/**
* \brief Encrypt en create the cookie
* Encrypt en create the cookie
*/
function cryptCookie()
{

View File

@ -89,8 +89,9 @@ class Events // extends CommonObject
/**
* \brief Constructor
* \param DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Events($DB)
{
@ -100,9 +101,9 @@ class Events // extends CommonObject
/**
* \brief Create in database
* \param user User that create
* \return int <0 si ko, >0 si ok
* Create in database
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{

View File

@ -44,8 +44,9 @@ class ExtraFields
/**
* Constructor
* @param DB base de donnees
* Constructor
*
* @param DoliDB $DB Database handler
*/
function ExtraFields($DB)
{
@ -405,7 +406,7 @@ class ExtraFields
function showInputField($key,$value,$moreparam='')
{
global $conf;
$label=$this->attribute_label[$key];
$type=$this->attribute_type[$key];
$size=$this->attribute_size[$key];
@ -427,7 +428,7 @@ class ExtraFields
$showsize=round($size);
if ($showsize > 48) $showsize=48;
}
if ($type == 'varchar')
{
$out='<input type="text" name="options_'.$key.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';

View File

@ -33,9 +33,9 @@ class GenericObject extends CommonObject
var $db;
/**
* Class constructor
* Constructor
*
* @param DoliDB $db Data base handler access
* @param DoliDB $DB Database handler
*/
function GenericObject($db)
{

View File

@ -55,8 +55,9 @@ class Form
/**
* Constructor
* @param $DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Form($DB)
{
@ -65,6 +66,7 @@ class Form
/**
* Output key field for an editable field
*
* @param text Text of label
* @param htmlname Name of select field
* @param preselected Preselected value for parameter

View File

@ -35,8 +35,9 @@ class FormActions
/**
* Constructor
* @param DB Database access handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function FormActions($DB)
{
@ -48,6 +49,7 @@ class FormActions
/**
* Show list of action status
*
* @param formname Name of form where select in included
* @param selected Preselected value
* @param canedit 1=can edit, 0=read only

View File

@ -35,8 +35,9 @@ class FormAdmin
/**
* \brief Constructor
* \param DB handler d'acces base de donnee
* Constructor
*
* @param DoliDB $DB Database handler
*/
function FormAdmin($DB)
{
@ -46,7 +47,8 @@ class FormAdmin
}
/**
* Output list with available languages.
* Output list with available languages
*
* @deprecated Use select_language instead
* @param selected Langue pre-selectionnee
* @param htmlname Nom de la zone select

View File

@ -37,8 +37,9 @@ class FormFile
/**
* Constructor
* @param DB handler d'acces base de donnee
* Constructor
*
* @param DoliDB $DB Database handler
*/
function FormFile($DB)
{

View File

@ -61,7 +61,8 @@ class FormSms
/**
* Constructor
* @param DB handler d'acces base de donnee
*
* @param DoliDB $DB Database handler
*/
function FormSms($DB)
{

View File

@ -31,264 +31,265 @@
class Interfaces
{
var $dir; // Directory with all core and external triggers files
var $errors = array(); // Array for errors
var $dir; // Directory with all core and external triggers files
var $errors = array(); // Array for errors
/**
* \brief Constructor.
* \param DB Database handler
*/
function Interfaces($DB)
{
$this->db = $DB ;
}
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function Interfaces($DB)
{
$this->db = $DB ;
}
/**
* \brief Fonction appelee lors du declenchement d'un evenement Dolibarr.
* Cette fonction declenche tous les triggers trouves actifs.
* \param action Trigger event code
* \param object Objet concern
* \param user Objet user
* \param lang Objet lang
* \param conf Objet conf
* \return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise.
*/
function run_triggers($action,$object,$user,$langs,$conf)
{
// Check parameters
if (! is_object($object) || ! is_object($conf)) // Error
{
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERROR);
return -1;
}
if (! is_object($user) || ! is_object($langs)) // Warning
{
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
}
/**
* \brief Fonction appelee lors du declenchement d'un evenement Dolibarr.
* Cette fonction declenche tous les triggers trouves actifs.
* \param action Trigger event code
* \param object Objet concern
* \param user Objet user
* \param lang Objet lang
* \param conf Objet conf
* \return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise.
*/
function run_triggers($action,$object,$user,$langs,$conf)
{
// Check parameters
if (! is_object($object) || ! is_object($conf)) // Error
{
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERROR);
return -1;
}
if (! is_object($user) || ! is_object($langs)) // Warning
{
dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
}
foreach($conf->triggers_modules as $reldir)
{
$dir=dol_buildpath($reldir,0);
//print "xx".$dir;exit;
foreach($conf->triggers_modules as $reldir)
{
$dir=dol_buildpath($reldir,0);
//print "xx".$dir;exit;
// Check if directory exists
if (!is_dir($dir)) continue;
// Check if directory exists
if (!is_dir($dir)) continue;
$handle=opendir($dir);
$modules = array();
$nbfile = $nbtotal = $nbok = $nbko = 0;
$handle=opendir($dir);
$modules = array();
$nbfile = $nbtotal = $nbok = $nbko = 0;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg))
{
$nbfile++;
while (($file = readdir($handle))!==false)
{
if (is_readable($dir."/".$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php$/i',$file,$reg))
{
$nbfile++;
$modName = "Interface".ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
dol_syslog("Interface::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR);
continue;
}
$modName = "Interface".ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
dol_syslog("Interface::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR);
continue;
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file))
{
continue;
}
// Check if trigger file is for a particular module
$qualified=true;
if (strtolower($reg[1]) != 'all')
{
$module=preg_replace('/^mod/i','',$reg[1]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (empty($conf->global->$constparam)) $qualified=false;
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file))
{
continue;
}
// Check if trigger file is for a particular module
$qualified=true;
if (strtolower($reg[1]) != 'all')
{
$module=preg_replace('/^mod/i','',$reg[1]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (empty($conf->global->$constparam)) $qualified=false;
}
if (! $qualified)
{
dol_syslog("Interfaces::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO);
continue;
}
if (! $qualified)
{
dol_syslog("Interfaces::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO);
continue;
}
include_once($dir."/".$file);
$objMod = new $modName($this->db);
$i=0;
if ($objMod)
{
// Bypass if workflow module is enabled and if the trigger asked to be disable in such case
if (! empty($conf->workflow->enabled) && ! empty($objMod->disabled_if_workflow))
{
dol_syslog("Interfaces::run_triggers action=".$action." Bypass triggers for file '".$file."'",LOG_INFO);
continue;
}
include_once($dir."/".$file);
$objMod = new $modName($this->db);
$i=0;
if ($objMod)
{
// Bypass if workflow module is enabled and if the trigger asked to be disable in such case
if (! empty($conf->workflow->enabled) && ! empty($objMod->disabled_if_workflow))
{
dol_syslog("Interfaces::run_triggers action=".$action." Bypass triggers for file '".$file."'",LOG_INFO);
continue;
}
dol_syslog("Interfaces::run_triggers action=".$action." Launch triggers for file '".$file."'",LOG_INFO);
dol_syslog("Interfaces::run_triggers action=".$action." Launch triggers for file '".$file."'",LOG_INFO);
$modules[$i] = $modName;
//dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
if ($result > 0)
{
// Action OK
$nbtotal++;
$nbok++;
}
if ($result == 0)
{
// Aucune action faite
$nbtotal++;
}
if ($result < 0)
{
// Action KO
$nbtotal++;
$nbko++;
$this->errors[]=$objMod->error;
}
$i++;
}
else
{
dol_syslog("Interfaces::run_triggers action=".$action." Failed to instantiate trigger for file '".$file."'",LOG_ERROR);
}
}
}
closedir($handle);
$modules[$i] = $modName;
//dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
if ($result > 0)
{
// Action OK
$nbtotal++;
$nbok++;
}
if ($result == 0)
{
// Aucune action faite
$nbtotal++;
}
if ($result < 0)
{
// Action KO
$nbtotal++;
$nbko++;
$this->errors[]=$objMod->error;
}
$i++;
}
else
{
dol_syslog("Interfaces::run_triggers action=".$action." Failed to instantiate trigger for file '".$file."'",LOG_ERROR);
}
}
}
closedir($handle);
}
}
}
if ($nbko)
{
dol_syslog("Interfaces::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR);
return -$nbko;
}
else
{
//dol_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG);
return $nbok;
}
}
if ($nbko)
{
dol_syslog("Interfaces::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR);
return -$nbko;
}
else
{
//dol_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG);
return $nbok;
}
}
/**
* Return list of triggers. Function used by admin page htdoc/admin/triggers
* @param workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated
* @return array Array list of triggers
*/
function getTriggersList($workflow=0)
{
global $conf, $langs;
/**
* Return list of triggers. Function used by admin page htdoc/admin/triggers
* @param workflow 0=Return all triggers, 1=Return only triggers not disabled if workflow module activated
* @return array Array list of triggers
*/
function getTriggersList($workflow=0)
{
global $conf, $langs;
$html = new Form($this->db);
$html = new Form($this->db);
$files = array();
$modules = array();
$orders = array();
$i = 0;
$files = array();
$modules = array();
$orders = array();
$i = 0;
foreach($conf->triggers_modules as $reldir)
{
$dir=dol_buildpath($reldir,0);
//print "xx".$dir;exit;
foreach($conf->triggers_modules as $reldir)
{
$dir=dol_buildpath($reldir,0);
//print "xx".$dir;exit;
// Check if directory exists
if (!is_dir($dir)) continue;
// Check if directory exists
if (!is_dir($dir)) continue;
$handle=opendir($dir);
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg))
{
$modName = 'Interface'.ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'</div>';
$objMod = new $modName($this->db);
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg))
{
$modName = 'Interface'.ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules))
{
$langs->load("errors");
print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'</div>';
$objMod = new $modName($this->db);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
else
{
include_once($dir.'/'.$file);
$objMod = new $modName($this->db);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
else
{
include_once($dir.'/'.$file);
$objMod = new $modName($this->db);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
}
}
closedir($handle);
$modules[$i] = $modName;
$files[$i] = $file;
$orders[$i] = $objMod->family; // Tri par famille
$i++;
}
}
}
closedir($handle);
}
}
}
asort($orders);
asort($orders);
$triggers = array();
$j = 0;
$triggers = array();
$j = 0;
// Loop on each trigger
foreach ($orders as $key => $value)
{
$modName = $modules[$key];
if ($modName)
{
$objMod = new $modName($this->db);
// Bypass if workflow module is enabled and if the trigger is compatible
if ($workflow && ! empty($objMod->disabled_if_workflow)) continue;
}
// Loop on each trigger
foreach ($orders as $key => $value)
{
$modName = $modules[$key];
if ($modName)
{
$objMod = new $modName($this->db);
// Bypass if workflow module is enabled and if the trigger is compatible
if ($workflow && ! empty($objMod->disabled_if_workflow)) continue;
}
// Define disabledbyname and disabledbymodule
$disabledbyname=0;
$disabledbymodule=1;
$module='';
if (preg_match('/NORUN$/i',$files[$key])) $disabledbyname=1;
if (preg_match('/^interface_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg))
{
// Check if trigger file is for a particular module
$module=preg_replace('/^mod/i','',$reg[1]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (strtolower($reg[1]) == 'all') $disabledbymodule=0;
else if (empty($conf->global->$constparam)) $disabledbymodule=2;
}
// Define disabledbyname and disabledbymodule
$disabledbyname=0;
$disabledbymodule=1;
$module='';
if (preg_match('/NORUN$/i',$files[$key])) $disabledbyname=1;
if (preg_match('/^interface_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg))
{
// Check if trigger file is for a particular module
$module=preg_replace('/^mod/i','',$reg[1]);
$constparam='MAIN_MODULE_'.strtoupper($module);
if (strtolower($reg[1]) == 'all') $disabledbymodule=0;
else if (empty($conf->global->$constparam)) $disabledbymodule=2;
}
$triggers[$j]['picto'] = $objMod->picto?img_object('',$objMod->picto):img_object('','generic');
$triggers[$j]['file'] = $files[$key];
$triggers[$j]['version'] = $objMod->getVersion();
$triggers[$j]['status'] = img_picto($langs->trans("Active"),'tick');
if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = "&nbsp;";
$triggers[$j]['picto'] = $objMod->picto?img_object('',$objMod->picto):img_object('','generic');
$triggers[$j]['file'] = $files[$key];
$triggers[$j]['version'] = $objMod->getVersion();
$triggers[$j]['status'] = img_picto($langs->trans("Active"),'tick');
if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = "&nbsp;";
$text ='<b>'.$langs->trans("Description").':</b><br>';
$text.=$objMod->getDesc().'<br>';
$text.='<br><b>'.$langs->trans("Status").':</b><br>';
if ($disabledbyname == 1)
{
$text.=$langs->trans("TriggerDisabledByName").'<br>';
if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'<br>';
}
else
{
if ($disabledbymodule == 0) $text.=$langs->trans("TriggerAlwaysActive").'<br>';
if ($disabledbymodule == 1) $text.=$langs->trans("TriggerActiveAsModuleActive",$module).'<br>';
if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'<br>';
}
$text ='<b>'.$langs->trans("Description").':</b><br>';
$text.=$objMod->getDesc().'<br>';
$text.='<br><b>'.$langs->trans("Status").':</b><br>';
if ($disabledbyname == 1)
{
$text.=$langs->trans("TriggerDisabledByName").'<br>';
if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'<br>';
}
else
{
if ($disabledbymodule == 0) $text.=$langs->trans("TriggerAlwaysActive").'<br>';
if ($disabledbymodule == 1) $text.=$langs->trans("TriggerActiveAsModuleActive",$module).'<br>';
if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'<br>';
}
$triggers[$j]['info'] = $html->textwithpicto('',$text);
$j++;
}
return $triggers;
}
$triggers[$j]['info'] = $html->textwithpicto('',$text);
$j++;
}
return $triggers;
}
}
?>

View File

@ -32,7 +32,7 @@ class Menu {
var $liste;
/**
* \brief Constructor for class menu
* Constructor
*/
function Menu()
{

View File

@ -56,10 +56,11 @@ class Menubase
/**
* Constructor
* @param DB Database handler
* @param menu_handler
* @param type
* Constructor
*
* @param DoliDB $DB Database handler
* @param string $menu_handler
* @param string $type
*/
function Menubase($DB,$menu_handler='',$type='')
{
@ -72,8 +73,9 @@ class Menubase
/**
* Create menu entry into database
* @param user User that create
* @return int <0 if KO, Id of record if OK
*
* @param User $user User that create
* @return int <0 if KO, Id of record if OK
*/
function create($user=0)
{

View File

@ -55,11 +55,12 @@ class Notify
/**
* \brief Renvoie le message signalant les notifications qui auront lieu sur
* un evenement pour affichage dans texte de confirmation evenement.
* \param action Id of action in llx_c_action_trigger
* \param socid Id of third party
* \return string Message
* Renvoie le message signalant les notifications qui auront lieu sur
* un evenement pour affichage dans texte de confirmation evenement
*
* @param action Id of action in llx_c_action_trigger
* @param socid Id of third party
* @return string Message
*/
function confirmMessage($action,$socid)
{

View File

@ -59,7 +59,9 @@ class RssParser
/**
* Constructor
* Constructor
*
* @param DoliDB $DB Database handler
*/
public function RssParser($db)
{

View File

@ -47,10 +47,9 @@ class Translate {
/**
* Constructor
* Constructor
*
* @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages
* or support/* pages).
* @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
* @param conf Object with Dolibarr configuration
*/
function Translate($dir = "",$conf)

View File

@ -52,8 +52,9 @@ class EcmDirectory // extends CommonObject
/**
* \brief Constructor
* \param DB Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function EcmDirectory($DB)
{
@ -63,9 +64,10 @@ class EcmDirectory // extends CommonObject
/**
* Create record into database
* @param user User that create
* @return int <0 if KO, >0 if OK
* Create record into database
*
* @param User $user User that create
* @return int <0 if KO, >0 if OK
*/
function create($user)
{

View File

@ -55,7 +55,7 @@ if ($id > 0 || ! empty($ref))
if ($object->fetch($id,$ref) > 0)
{
$soc = new Societe($db, $object->socid);
$soc = new Societe($db);
$soc->fetch($object->socid);
$head = fichinter_prepare_head($object);
@ -65,14 +65,14 @@ if ($id > 0 || ! empty($ref))
* Fiche intervention
*/
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
print '<td colspan="2">'.$object->ref.'</td>';
$nbrow=4;
print '<td rowspan="'.$nbrow.'" valign="top" width="50%">';
/*
* Documents
*/
@ -83,39 +83,39 @@ if ($id > 0 || ! empty($ref))
$filedetail = $filepath . $objectref . "-detail.pdf";
$relativepath = "${objectref}/${objectref}.pdf";
$relativepathdetail = "${objectref}/${objectref}-detail.pdf";
// Chemin vers png apercus
$fileimage = $file.".png"; // Si PDF d'1 page
$fileimagebis = $file."-0.png"; // Si PDF de plus d'1 page
$var=true;
// Si fichier PDF existe
if (file_exists($file))
{
$encfile = urlencode($file);
print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">';
print "<tr $bc[$var]><td>".$langs->trans("Intervention")." PDF</td>";
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
print '<td align="right">'.dol_print_size(dol_filesize($file)).'</td>';
print '<td align="right">'.dol_print_date(dol_filemtime($file),'dayhour').'</td>';
print '</tr>';
// Si fichier detail PDF existe
if (file_exists($filedetail))
{
print "<tr $bc[$var]><td>Fiche d'intervention detaillee</td>";
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=ficheinter&file='.urlencode($relativepathdetail).'">'.$object->ref.'-detail.pdf</a></td>';
print '<td align="right">'.dol_print_size(dol_filesize($filedetail)).'</td>';
print '<td align="right">'.dol_print_date(dol_filemtime($filedetail),'dayhour').'</td>';
print '</tr>';
}
print "</table>\n";
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
{
@ -131,26 +131,26 @@ if ($id > 0 || ! empty($ref))
}
}
}
print "</td></tr>";
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a>';
print '</td>';
print '</tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td>';
print "<td colspan=\"2\">".$object->getLibStatut(4)."</td>\n";
print '</tr>';
// Date
print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td colspan=\"2\">".dol_print_date($object->date,"daytext")."</td>\n";
print '</tr>';
print '</table>';
}
else

View File

@ -59,9 +59,9 @@ class Fichinter extends CommonObject
var $lines = array();
/**
* Class constructor
* Constructor
*
* @param DoliDB $DB Data base handler access
* @param DoliDB $DB Database handler
*/
function Fichinter($DB)
{

View File

@ -128,10 +128,10 @@ dol_htmloutput_mesg($mesg);
$id = $_GET["id"];
if ($id > 0)
{
$fichinter = New Fichinter($db);
$fichinter = new Fichinter($db);
if ($fichinter->fetch($_GET['id']) > 0)
{
$soc = new Societe($db, $fichinter->socid);
$soc = new Societe($db);
$soc->fetch($fichinter->socid);

View File

@ -111,7 +111,7 @@ if ($object->id)
{
$object->fetch_thirdparty();
$soc = new Societe($db, $object->societe->id);
$soc = new Societe($db);
$soc->fetch($object->societe->id);
if ( $error_msg )

File diff suppressed because it is too large Load Diff

View File

@ -84,12 +84,11 @@ class FactureFournisseur extends Facture
/**
* Constructor
* @param DB Database access handler
* @param socid Id societe ('' par defaut)
* @param facid Id facture ('' par defaut)
* Constructor
*
* @param DoliDB $DB Database handler
*/
function FactureFournisseur($DB, $socid='', $facid='')
function FactureFournisseur($DB)
{
$this->db = $DB ;
@ -112,8 +111,9 @@ class FactureFournisseur extends Facture
/**
* Create supplier invoice into database
* @param user object utilisateur qui cree
* @return int id facture si ok, < 0 si erreur
*
* @param User $user object utilisateur qui cree
* @return int id facture si ok, < 0 si erreur
*/
function create($user)
{

View File

@ -49,7 +49,9 @@ class ProductFournisseur extends Product
/**
* Constructor
* Constructor
*
* @param DoliDB $DB Database handler
*/
function ProductFournisseur($db)
{

View File

@ -135,7 +135,7 @@ if ($id > 0 || ! empty($ref))
$commande = new CommandeFournisseur($db);
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{
$soc = new Societe($db, $commande->socid);
$soc = new Societe($db);
$soc->fetch($commande->socid);

View File

@ -374,7 +374,8 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
if ($_GET['action'] == 'del_ligne')
{
$facfou = new FactureFournisseur($db,'',$_GET['facid']);
$facfou = new FactureFournisseur($db);
$facfou->fetch($_GET['facid']);
$facfou->deleteline($_GET['lineid']);
$_GET['action'] = 'edit';
}
@ -432,7 +433,7 @@ if ($_REQUEST['action'] == 'update_line')
if ($_GET['action'] == 'addline')
{
$facfou = new FactureFournisseur($db, '', $_GET['facid']);
$facfou = new FactureFournisseur($db);
$ret=$facfou->fetch($_GET['facid']);
if ($ret < 0)
{
@ -540,7 +541,7 @@ if ($_GET['action'] == 'addline')
if ($_POST['action'] == 'classin')
{
$facture = new FactureFournisseur($db,'',$_GET['facid']);
$facture = new FactureFournisseur($db);
$facture->fetch($_GET['facid']);
$result=$facture->setProject($_POST['projectid']);
}

View File

@ -48,7 +48,7 @@ llxHeader();
$fac = new FactureFournisseur($db);
$fac->fetch($_GET["facid"]);
$fac->info($_GET["facid"]);
$soc = new Societe($db, $fac->socid);
$soc = new Societe($db);
$soc->fetch($fac->socid);
$head = facturefourn_prepare_head($fac);

View File

@ -41,7 +41,7 @@ class box_actions extends ModeleBoxes {
/**
* Constructor
* Constructor
*/
function box_actions()
{

View File

@ -41,7 +41,7 @@ class box_comptes extends ModeleBoxes {
/**
* \brief Constructor for class
* Constructor
*/
function box_comptes()
{
@ -52,8 +52,9 @@ class box_comptes extends ModeleBoxes {
}
/**
* \brief Load data into info_box_contents array to show array later.
* \param $max Maximum number of records to load
* Load data into info_box_contents array to show array later.
*
* @param $max Maximum number of records to load
*/
function loadBox($max=5)
{

View File

@ -34,8 +34,9 @@ class MenuSmart {
/**
* Constructor
* @param db Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function MenuSmart($db)
{
@ -45,6 +46,7 @@ class MenuSmart {
/**
* Show menu
*
* @param limitmenuto To limit menu to a top or left menu value
*/
function showmenu($limitmenuto)

View File

@ -76,10 +76,11 @@ class MenuLeft {
/**
* Constructor
* @param db Database handler
* @param menu_array Table of menu entries to show before entries of menu handler
* @param menu_array_after Table of menu entries to show after entries of menu handler
* Constructor
*
* @param DoliDB $DB Database handler
* @param menu_array Table of menu entries to show before entries of menu handler
* @param menu_array_after Table of menu entries to show after entries of menu handler
*
*/
function MenuLeft($db,&$menu_array,&$menu_array_after)
@ -91,8 +92,9 @@ class MenuLeft {
/**
* \brief Show menu
* \return int Number of menu entries shown
* Show menu
*
* @return int Number of menu entries shown
*/
function showmenu()
{

View File

@ -78,6 +78,7 @@ class MenuLeft {
/**
* Constructor
*
* @param db Database handler
* @param menu_array Table of menu entries to show before entries of menu handler
* @param menu_array_after Table of menu entries to show after entries of menu handler
@ -91,8 +92,9 @@ class MenuLeft {
/**
* \brief Show menu
* \return int Number of menu entries shown
* Show menu
*
* @return int Number of menu entries shown
*/
function showmenu()
{

View File

@ -32,7 +32,7 @@
* \brief Class to manage top menu Eldy (for internal users)
*/
class MenuTop {
var $db;
var $require_left=array("eldy_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
var $hideifnotallowed=0; // Put 0 for back office menu, 1 for front office menu
@ -75,6 +75,7 @@ class MenuLeft {
/**
* Constructor
*
* @param db Database handler
* @param menu_array Table of menu entries to show before entries of menu handler
* @param menu_array_after Table of menu entries to show after entries of menu handler
@ -88,8 +89,9 @@ class MenuLeft {
/**
* \brief Show menu
* \return int Number of menu entries shown
* Show menu
*
* @return int Number of menu entries shown
*/
function showmenu()
{

View File

@ -75,6 +75,7 @@ class MenuLeft {
/**
* Constructor
*
* @param db Database handler
* @param menu_array Table of menu entries to show before entries of menu handler
* @param menu_array_after Table of menu entries to show after entries of menu handler
@ -88,8 +89,9 @@ class MenuLeft {
/**
* \brief Show menu
* \return int Number of menu entries shown
* Show menu
*
* @return int Number of menu entries shown
*/
function showmenu()
{

View File

@ -33,8 +33,9 @@ class MenuTop {
/**
* Constructor
* @param db Dabatase handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function MenuTop($db)
{
@ -122,6 +123,7 @@ class MenuLeft {
/**
* Constructor
*
* @param db Database handler
* @param menu_array Table of menu entries to show before entries of menu handler
* @param menu_array_after Table of menu entries to show after entries of menu handler
@ -135,7 +137,7 @@ class MenuLeft {
/**
* \brief Show menu
* Show menu
*/
function showmenu()
{

View File

@ -53,9 +53,9 @@ abstract class DolibarrModules
/**
* Constructor
*
* @param DB Database access handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function DolibarrModules($DB)
{

View File

@ -239,7 +239,7 @@ function commande_delete_preview($db, $commandeid, $commanderef='')
if (!$commanderef)
{
$com = new Commande($db,"",$commandeid);
$com = new Commande($db);
$com->fetch($commandeid);
$commanderef = $com->ref;
}

View File

@ -59,9 +59,9 @@ class pdf_einstein extends ModelePDFCommandes
/**
* Constructor
*
* @param DoliDb $db Database access handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_einstein($db)
{

View File

@ -40,8 +40,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
/**
* \brief Constructor
* \param db Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_expedition_merou($db=0)
{

View File

@ -43,8 +43,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
/**
* \brief Constructor
* \param db Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function doc_generic_invoice_odt($db)
{

View File

@ -60,8 +60,9 @@ class pdf_crabe extends ModelePDFFactures
/**
* Constructor
* @param db Database access handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_crabe($db)
{

View File

@ -50,7 +50,7 @@ class pdf_oursin extends ModelePDFFactures
/**
* Constructor
*
* @param DoliDB $db Handler access data base
* @param DoliDB $DB Database handler
*/
function pdf_oursin($db)
{

View File

@ -37,8 +37,10 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
class pdf_sirocco extends ModelePDFDeliveryOrder
{
/** \brief Constructor
* \param db Database handler
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_sirocco($db)
{

View File

@ -42,8 +42,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
var $emetteur; // Objet societe qui emet
/**
* \brief Constructor
* \param db Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_typhon($db)
{

View File

@ -39,6 +39,11 @@ class mailing_example extends MailingTargets
// CHANGE THIS: Constructor name must be called mailing_xxx with xxx=name of your selector
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function mailing_example($DB)
{
$this->db=$DB;

View File

@ -37,7 +37,11 @@ class mailing_framboise extends MailingTargets
var $db;
// CHANGE THIS: Constructor name must be called mailing_xxx with xxx=name of your selector
/**
* Constructor
*
* @param DoliDB $DB Database handler
*/
function mailing_framboise($DB)
{
$this->db=$DB;

View File

@ -34,10 +34,10 @@ class mailing_thirdparties_services_expired extends MailingTargets
/**
* Constructor
* Constructor
*
* @param $DB
* @return mailing_thirdparties_services_expired
* @param DoliDB $DB Database handler
* @return mailing_thirdparties_services_expired
*/
function mailing_thirdparties_services_expired($DB)
{

View File

@ -96,7 +96,9 @@ class pdf_standard {
/**
* Constructor
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_standard($db)
{

View File

@ -97,7 +97,9 @@ class pdf_standardlabel {
/**
* Constructor
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_standard($db)
{

View File

@ -32,135 +32,136 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
class modPayBox extends DolibarrModules
{
/**
* \brief Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler
*/
function modPayBox($DB)
{
$this->db = $DB;
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $DB Database handler
*/
function modPayBox($DB)
{
$this->db = $DB;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50000;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'paybox';
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50000;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'paybox';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "other";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Module to offer an online payment page by credit card with PayBox";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1;
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paybox@paybox';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "other";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Module to offer an online payment page by credit card with PayBox";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1;
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paybox@paybox';
// Data directories to create when module is enabled.
$this->dirs = array('/paybox/temp');
// Data directories to create when module is enabled.
$this->dirs = array('/paybox/temp');
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = '';
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = '';
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("paybox.php@paybox");
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("paybox.php@paybox");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2,6); // Minimum version of Dolibarr required by module
$this->langfiles = array("paybox");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2,6); // Minimum version of Dolibarr required by module
$this->langfiles = array("paybox");
// Constants
$this->const = array(); // List of particular constants to add when module is enabled
//Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// Constants
$this->const = array(); // List of particular constants to add when module is enabled
//Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// New pages on tabs
$this->tabs = array();
// New pages on tabs
$this->tabs = array();
// Boxes
$this->boxes = array(); // List of boxes
$r=0;
// Boxes
$this->boxes = array(); // List of boxes
$r=0;
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example:
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example:
//$this->boxes[$r][1] = "myboxa.php";
//$r++;
//$r++;
//$this->boxes[$r][1] = "myboxb.php";
//$r++;
//$r++;
// Permissions
$this->rights = array(); // Permission array used by this module
$r=0;
// Permissions
$this->rights = array(); // Permission array used by this module
$r=0;
// Add here list of permission defined by an id, a label, a boolean and two constant strings.
// Example:
// $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++;
// Add here list of permission defined by an id, a label, a boolean and two constant strings.
// Example:
// $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++;
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
// Add here entries to declare new menus
// Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule',
// 'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
// 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 1',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel1.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare another Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 2',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
// Add here entries to declare new menus
// Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule',
// 'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
// 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 1',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel1.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare another Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 2',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
// Exports
// Exports
$r=1;
// Example:
@ -168,54 +169,54 @@ class modPayBox extends DolibarrModules
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
// $this->export_permission[$r]=array(array("facture","facture","export"));
// $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef');
// $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
// $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
// $this->export_sql_start[$r]='SELECT DISTINCT ';
// $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)';
// $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
}
/**
/**
* \brief Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
* \return int 1 if OK, 0 if KO
* \return int 1 if OK, 0 if KO
*/
function init()
{
$sql = array();
function init()
{
$sql = array();
$result=$this->load_tables();
$result=$this->load_tables();
return $this->_init($sql);
}
return $this->_init($sql);
}
/**
* \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
* \return int 1 if OK, 0 if KO
*/
function remove()
{
$sql = array();
/**
* \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
* \return int 1 if OK, 0 if KO
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
return $this->_remove($sql);
}
/**
* \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/
* This function is called by this->init.
* \return int <=0 if KO, >0 if OK
*/
function load_tables()
{
return $this->_load_tables('');
}
/**
* \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/
* This function is called by this->init.
* \return int <=0 if KO, >0 if OK
*/
function load_tables()
{
return $this->_load_tables('');
}
}
?>

View File

@ -33,126 +33,127 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
class modPaypal extends DolibarrModules
{
/**
* \brief Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler
*/
function modPaypal($DB)
{
$this->db = $DB;
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $DB Database handler
*/
function modPaypal($DB)
{
$this->db = $DB;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50200;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'paypal';
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50200;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'paypal';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "other";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Module to offer an online payment page with PayPal";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1;
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paypal@paypal';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "other";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Module to offer an online payment page with PayPal";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1;
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paypal@paypal';
// Data directories to create when module is enabled.
$this->dirs = array('/paypal/temp');
// Data directories to create when module is enabled.
$this->dirs = array('/paypal/temp');
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = '';
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = '';
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("paypal.php@paypal");
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("paypal.php@paypal");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array('modPaypalPlus'); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0,-2); // Minimum version of Dolibarr required by module
$this->langfiles = array("paypal");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array('modPaypalPlus'); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0,-2); // Minimum version of Dolibarr required by module
$this->langfiles = array("paypal");
// Constants
$this->const = array(); // List of particular constants to add when module is enabled
//Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// Constants
$this->const = array(); // List of particular constants to add when module is enabled
//Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// New pages on tabs
$this->tabs = array();
// New pages on tabs
$this->tabs = array();
// Boxes
$this->boxes = array(); // List of boxes
$r=0;
// Boxes
$this->boxes = array(); // List of boxes
$r=0;
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example:
// Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example:
//$this->boxes[$r][1] = "myboxa.php";
//$r++;
//$r++;
//$this->boxes[$r][1] = "myboxb.php";
//$r++;
//$r++;
// Permissions
$this->rights = array(); // Permission array used by this module
$r=0;
// Permissions
$this->rights = array(); // Permission array used by this module
$r=0;
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
// Add here entries to declare new menus
// Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule',
// 'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
// 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 1',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel1.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare another Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 2',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
// Add here entries to declare new menus
// Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule',
// 'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
// 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 1',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel1.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
//
// Example to declare another Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 2',
// 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
// Exports
// Exports
$r=1;
// Example:
@ -160,54 +161,54 @@ class modPaypal extends DolibarrModules
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
// $this->export_permission[$r]=array(array("facture","facture","export"));
// $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef');
// $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
// $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
// $this->export_sql_start[$r]='SELECT DISTINCT ';
// $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)';
// $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
// $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++;
}
}
/**
/**
* \brief Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
* \return int 1 if OK, 0 if KO
* \return int 1 if OK, 0 if KO
*/
function init()
{
$sql = array();
function init()
{
$sql = array();
$result=$this->load_tables();
$result=$this->load_tables();
return $this->_init($sql);
}
return $this->_init($sql);
}
/**
* \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
* \return int 1 if OK, 0 if KO
*/
function remove()
{
$sql = array();
/**
* \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
* \return int 1 if OK, 0 if KO
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
return $this->_remove($sql);
}
/**
* \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/
* This function is called by this->init.
* \return int <=0 if KO, >0 if OK
*/
function load_tables()
{
return $this->_load_tables('');
}
/**
* \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/
* This function is called by this->init.
* \return int <=0 if KO, >0 if OK
*/
function load_tables()
{
return $this->_load_tables('');
}
}
?>

View File

@ -40,8 +40,9 @@ class pdf_baleine extends ModelePDFProjects
var $emetteur; // Objet societe qui emet
/**
* \brief Constructor
* \param db Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function pdf_baleine($db)
{

View File

@ -43,8 +43,8 @@ class pdf_propale_azur extends ModelePDFPropales
/**
* Constructor
*
* @param db Database access handler
*
* @param DoliDB $DB Database handler
*/
function pdf_propale_azur($db)
{

View File

@ -44,7 +44,7 @@ class pdf_propale_jaune extends ModelePDFPropales
/**
* Constructor
*
* @param DoliDB $db Handler access data base
* @param DoliDB $DB Database handler
*/
function pdf_propale_jaune($db)
{

View File

@ -41,11 +41,12 @@ class modGeneratePassNone extends ModeleGenPassword
/**
* \brief Constructor
* \param db Database handler
* \param conf Handler de conf
* \param lang Handler de langue
* \param user Handler du user connecte
* Constructor
*
* @param DoliDB $DB Database handler
* @param conf Handler de conf
* @param lang Handler de langue
* @param user Handler du user connecte
*/
function modGeneratePassNone($db, $conf, $langs, $user)
{

View File

@ -41,11 +41,12 @@ class modGeneratePassStandard extends ModeleGenPassword
/**
* \brief Constructor
* \param db Database handler
* \param conf Handler de conf
* \param lang Handler de langue
* \param user Handler du user connecte
* Constructor
*
* @param DoliDB $DB Database handler
* @param conf Handler de conf
* @param lang Handler de langue
* @param user Handler du user connecte
*/
function modGeneratePassStandard($db, $conf, $langs, $user)
{

View File

@ -41,8 +41,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/**
* \brief Constructor
* \param db Database handler
* Constructor
*
* @param DoliDB $DB Database handler
*/
function doc_generic_odt($db)
{

View File

@ -47,7 +47,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
var $prefixIsRequired; // Le champ prefix du tiers doit etre renseigne quand on utilise {pre}
/** Constructor
/**
* Constructor
*/
function mod_codeclient_elephant()
{

View File

@ -48,7 +48,8 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
var $code_auto; // Numerotation automatique
/** Constructor
/**
* Constructor
*/
function mod_codeclient_leopard()
{

View File

@ -44,7 +44,8 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
var $prefixsupplier='SU';
/** Constructor classe
/**
* Constructor
*/
function mod_codeclient_monkey()
{

Some files were not shown because too many files have changed in this diff Show More