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 ***** ***** ChangeLog for 3.2 compared to 3.1 *****
For users: For users:
- New: task #11243: Show quantity into stocks for each sub-products into the sub-product tab - New: Can edit customer discounts from invoice create and edit card.
- New: task #10500: Option to choose if professional id are unique - New: task #11243: Show quantity into stocks for each sub-products into the sub-product tab.
- New: Add hidden option FOURN_PRODUCT_AVAILABILITY - New: task #10500: Option to choose if professional id are unique.
- New: task #11123: Add best supplier price - New: Add hidden option FOURN_PRODUCT_AVAILABILITY.
- New: task #11123: Add best supplier price.
- New: Enhancement in styles. - New: Enhancement in styles.
- New: task #11289 : Modify third party accountancy code generator aquarium - New: task #11289 : Modify third party accountancy code generator aquarium.
- New: task #10606 : more comprehensive message error - New: task #10606 : more comprehensive message error.
- New: task #11278 : Option into point of sale module to add services in list - 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: 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. - New: Can build PDF in USLetter format or canada format.
For developers: For developers:
- Qual: Removed no more used external libraries. - Qual: Removed no more used external libraries.
- Qual: Cleaned a lot of dead code. - Qual: Cleaned a lot of dead code.
- Qual: Parent templates classes were moved as abstract classes. - 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. - 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 ***** ***** ChangeLog for 3.1 compared to 3.0 *****

View File

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

View File

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

View File

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

View File

@ -68,12 +68,13 @@ switch ( $_GET['action'] )
{ {
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$productid = $ret['rowid']; $productid = $ret['rowid'];
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($thirdpartyid); $societe->fetch($thirdpartyid);
$product = new Product($db, $productid); $product = new Product($db);
$product->fetch($productid);
if(isset($product->multiprices[$societe->price_level])) if(isset($product->multiprices[$societe->price_level]))
{ {
$ret['price'] = $product->multiprices_ttc[$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]; // $product->multiprices_base_type[$societe->price_level];
$ret['tva_tx'] = $product->multiprices_tva_tx[$societe->price_level]; $ret['tva_tx'] = $product->multiprices_tva_tx[$societe->price_level];
} }
} }
/** end add Ditto */ /** end add Ditto */
$obj_facturation->id( $ret['rowid'] ); $obj_facturation->id( $ret['rowid'] );
$obj_facturation->ref( $ret['ref'] ); $obj_facturation->ref( $ret['ref'] );
$obj_facturation->stock( $ret['reel'] ); $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*/ /** add Ditto for MultiPrix*/
if($conf->global->PRODUIT_MULTIPRICES) 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])) if(isset($product->multiprices[$societe->price_level]))
{ {

View File

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

View File

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

View File

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

View File

@ -661,7 +661,7 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
// Ecrase $txtva par celui du produit // Ecrase $txtva par celui du produit
if ($_POST['idprod']) if ($_POST['idprod'])
{ {
$prod = new Product($db, $_POST['idprod']); $prod = new Product($db);
$prod->fetch($_POST['idprod']); $prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id); $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) if ($object->fetch($id,$ref) > 0)
{ {
$soc = new Societe($db, $object->socid); $soc = new Societe($db);
$soc->fetch($object->socid); $soc->fetch($object->socid);
$head = propal_prepare_head($object); $head = propal_prepare_head($object);

View File

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

View File

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

View File

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

View File

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

View File

@ -134,7 +134,7 @@ if ($id > 0 || ! empty($ref))
$commande = new Commande($db); $commande = new Commande($db);
if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0) if ( $commande->fetch($_GET['id'],$_GET['ref']) > 0)
{ {
$soc = new Societe($db, $commande->socid); $soc = new Societe($db);
$soc->fetch($commande->socid); $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 // Ecrase $base_price_type par celui du produit
if ($_POST['idprod']) if ($_POST['idprod'])
{ {
$prod = new Product($db, $_POST['idprod']); $prod = new Product($db);
$prod->fetch($_POST['idprod']); $prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id); $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 = new Commande($db);
$commande->fetch($_GET["id"]); $commande->fetch($_GET["id"]);
$commande->info($_GET["id"]); $commande->info($_GET["id"]);
$soc = new Societe($db, $commande->socid); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
$head = commande_prepare_head($commande); $head = commande_prepare_head($commande);

View File

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

View File

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

View File

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

View File

@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
$trip = new Deplacement($db); $trip = new Deplacement($db);
$trip->fetch($id,$ref); $trip->fetch($id,$ref);
$soc = new Societe($db, $trip->socid); $soc = new Societe($db);
$soc->fetch($trip->socid); $soc->fetch($trip->socid);
$h=0; $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 // Ecrase $base_price_type par celui du produit
if ($_POST['idprod']) if ($_POST['idprod'])
{ {
$prod = new Product($db, $_POST['idprod']); $prod = new Product($db);
$prod->fetch($_POST['idprod']); $prod->fetch($_POST['idprod']);
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id); $tva_tx = get_default_tva($mysoc,$object->client,$prod->id);
@ -1884,7 +1884,7 @@ else
$result=$object->fetch_thirdparty(); $result=$object->fetch_thirdparty();
$soc = new Societe($db, $object->socid); $soc = new Societe($db);
$soc->fetch($object->socid); $soc->fetch($object->socid);
$totalpaye = $object->getSommePaiement(); $totalpaye = $object->getSommePaiement();

View File

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

View File

@ -372,7 +372,7 @@ class Facture extends CommonObject
{ {
if ($_facrec->lines[$i]->fk_product) 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); $res=$prod->fetch($_facrec->lines[$i]->fk_product);
} }
$tva_tx = get_default_tva($mysoc,$soc,$prod->id); $tva_tx = get_default_tva($mysoc,$soc,$prod->id);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -92,9 +92,9 @@ $html = new Form($db);
if ($_GET["id"]) 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); $soc->fetch($contrat->societe->id);
$head = contract_prepare_head($contrat); $head = contract_prepare_head($contrat);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,10 +56,11 @@ class Menubase
/** /**
* Constructor * Constructor
* @param DB Database handler *
* @param menu_handler * @param DoliDB $DB Database handler
* @param type * @param string $menu_handler
* @param string $type
*/ */
function Menubase($DB,$menu_handler='',$type='') function Menubase($DB,$menu_handler='',$type='')
{ {
@ -72,8 +73,9 @@ class Menubase
/** /**
* Create menu entry into database * 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) function create($user=0)
{ {

View File

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

View File

@ -59,7 +59,9 @@ class RssParser
/** /**
* Constructor * Constructor
*
* @param DoliDB $DB Database handler
*/ */
public function RssParser($db) 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 * @param dir Force directory that contains /langs subdirectory (value is sometine '..' like into install/* pages or support/* pages).
* or support/* pages).
* @param conf Object with Dolibarr configuration * @param conf Object with Dolibarr configuration
*/ */
function Translate($dir = "",$conf) function Translate($dir = "",$conf)

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -84,12 +84,11 @@ class FactureFournisseur extends Facture
/** /**
* Constructor * Constructor
* @param DB Database access handler *
* @param socid Id societe ('' par defaut) * @param DoliDB $DB Database handler
* @param facid Id facture ('' par defaut)
*/ */
function FactureFournisseur($DB, $socid='', $facid='') function FactureFournisseur($DB)
{ {
$this->db = $DB ; $this->db = $DB ;
@ -112,8 +111,9 @@ class FactureFournisseur extends Facture
/** /**
* Create supplier invoice into database * 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) function create($user)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,8 +33,9 @@ class MenuTop {
/** /**
* Constructor * Constructor
* @param db Dabatase handler *
* @param DoliDB $DB Database handler
*/ */
function MenuTop($db) function MenuTop($db)
{ {
@ -122,6 +123,7 @@ class MenuLeft {
/** /**
* Constructor * Constructor
*
* @param db Database handler * @param db Database handler
* @param menu_array Table of menu entries to show before entries of menu 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 * @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() function showmenu()
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,8 +42,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
var $emetteur; // Objet societe qui emet var $emetteur; // Objet societe qui emet
/** /**
* \brief Constructor * Constructor
* \param db Database handler *
* @param DoliDB $DB Database handler
*/ */
function pdf_typhon($db) 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 // 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) function mailing_example($DB)
{ {
$this->db=$DB; $this->db=$DB;

View File

@ -37,7 +37,11 @@ class mailing_framboise extends MailingTargets
var $db; 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) function mailing_framboise($DB)
{ {
$this->db=$DB; $this->db=$DB;

View File

@ -34,10 +34,10 @@ class mailing_thirdparties_services_expired extends MailingTargets
/** /**
* Constructor * Constructor
* *
* @param $DB * @param DoliDB $DB Database handler
* @return mailing_thirdparties_services_expired * @return mailing_thirdparties_services_expired
*/ */
function mailing_thirdparties_services_expired($DB) 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) function pdf_standard($db)
{ {

View File

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

View File

@ -32,135 +32,136 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
class modPayBox extends DolibarrModules class modPayBox extends DolibarrModules
{ {
/** /**
* \brief Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler *
*/ * @param DoliDB $DB Database handler
function modPayBox($DB) */
{ function modPayBox($DB)
$this->db = $DB; {
$this->db = $DB;
// Id for module (must be unique). // Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50000; $this->numero = 50000;
// Key text used to identify module (for permissions, menus, etc...) // Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'paybox'; $this->rights_class = 'paybox';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "other"; $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) // 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)); $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) // 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"; $this->description = "Module to offer an online payment page by credit card with PayBox";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $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) // 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); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other) // Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1; $this->special = 1;
// Name of image file used for this module. // 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 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' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paybox@paybox'; $this->picto='paybox@paybox';
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
$this->dirs = array('/paybox/temp'); $this->dirs = array('/paybox/temp');
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'. // Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = ''; $this->style_sheet = '';
// Config pages. Put here list of php page names stored in admmin directory used to setup module. // 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"); $this->config_page_url = array("paybox.php@paybox");
// Dependencies // Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled $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->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->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->need_dolibarr_version = array(2,6); // Minimum version of Dolibarr required by module
$this->langfiles = array("paybox"); $this->langfiles = array("paybox");
// Constants // Constants
$this->const = array(); // List of particular constants to add when module is enabled $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), //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) ); // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// New pages on tabs // New pages on tabs
$this->tabs = array(); $this->tabs = array();
// Boxes // Boxes
$this->boxes = array(); // List of boxes $this->boxes = array(); // List of boxes
$r=0; $r=0;
// Add here list of php file(s) stored in includes/boxes that contains class to show a box. // Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example: // Example:
//$this->boxes[$r][1] = "myboxa.php"; //$this->boxes[$r][1] = "myboxa.php";
//$r++; //$r++;
//$this->boxes[$r][1] = "myboxb.php"; //$this->boxes[$r][1] = "myboxb.php";
//$r++; //$r++;
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;
// Add here list of permission defined by an id, a label, a boolean and two constant strings. // Add here list of permission defined by an id, a label, a boolean and two constant strings.
// Example: // Example:
// $this->rights[$r][0] = 2000; // Permission id (must not be already used) // $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1) // $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][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) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;
// Main menu entries // Main menu entries
$this->menus = array(); // List of menus to add $this->menus = array(); // List of menus to add
$r=0; $r=0;
// Add here entries to declare new menus // Add here entries to declare new menus
// Example to declare the Top Menu entry: // Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry // 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu', // 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule', // '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). // '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', // 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100, // 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'', // 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++; // $r++;
// //
// Example to declare a Left Menu entry: // 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) // $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 // 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 1', // 'titre'=>'MyModule left menu 1',
// 'mainmenu'=>'mymodule', // 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel1.php', // 'url'=>'/mymodule/pagelevel1.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100, // 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'', // 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++; // $r++;
// //
// Example to declare another Left Menu entry: // 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) // $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 // 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 2', // 'titre'=>'MyModule left menu 2',
// 'mainmenu'=>'mymodule', // 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel2.php', // 'url'=>'/mymodule/pagelevel2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100, // 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'', // 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++; // $r++;
// Exports // Exports
$r=1; $r=1;
// Example: // 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_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_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_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_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] =' 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] .=' 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] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++; // $r++;
} }
/** /**
* \brief Function called when module is enabled. * \brief Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories. * It also creates data directories.
* \return int 1 if OK, 0 if KO * \return int 1 if OK, 0 if KO
*/ */
function init() function init()
{ {
$sql = array(); $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. * \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database. * Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted. * Data directories are not deleted.
* \return int 1 if OK, 0 if KO * \return int 1 if OK, 0 if KO
*/ */
function remove() function remove()
{ {
$sql = array(); $sql = array();
return $this->_remove($sql); return $this->_remove($sql);
} }
/** /**
* \brief Create tables and keys required by module * \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys * Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/ * commands must be stored in directory /mymodule/sql/
* This function is called by this->init. * This function is called by this->init.
* \return int <=0 if KO, >0 if OK * \return int <=0 if KO, >0 if OK
*/ */
function load_tables() function load_tables()
{ {
return $this->_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 class modPaypal extends DolibarrModules
{ {
/** /**
* \brief Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler *
*/ * @param DoliDB $DB Database handler
function modPaypal($DB) */
{ function modPaypal($DB)
$this->db = $DB; {
$this->db = $DB;
// Id for module (must be unique). // Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 50200; $this->numero = 50200;
// Key text used to identify module (for permissions, menus, etc...) // Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'paypal'; $this->rights_class = 'paypal';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "other"; $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) // 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)); $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) // 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"; $this->description = "Module to offer an online payment page with PayPal";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $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) // 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); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other) // Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1; $this->special = 1;
// Name of image file used for this module. // 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 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' // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
$this->picto='paypal@paypal'; $this->picto='paypal@paypal';
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
$this->dirs = array('/paypal/temp'); $this->dirs = array('/paypal/temp');
// Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'. // Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'.
$this->style_sheet = ''; $this->style_sheet = '';
// Config pages. Put here list of php page names stored in admmin directory used to setup module. // 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"); $this->config_page_url = array("paypal.php@paypal");
// Dependencies // Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled $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->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->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->need_dolibarr_version = array(3,0,-2); // Minimum version of Dolibarr required by module
$this->langfiles = array("paypal"); $this->langfiles = array("paypal");
// Constants // Constants
$this->const = array(); // List of particular constants to add when module is enabled $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), //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) ); // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) );
// New pages on tabs // New pages on tabs
$this->tabs = array(); $this->tabs = array();
// Boxes // Boxes
$this->boxes = array(); // List of boxes $this->boxes = array(); // List of boxes
$r=0; $r=0;
// Add here list of php file(s) stored in includes/boxes that contains class to show a box. // Add here list of php file(s) stored in includes/boxes that contains class to show a box.
// Example: // Example:
//$this->boxes[$r][1] = "myboxa.php"; //$this->boxes[$r][1] = "myboxa.php";
//$r++; //$r++;
//$this->boxes[$r][1] = "myboxb.php"; //$this->boxes[$r][1] = "myboxb.php";
//$r++; //$r++;
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;
// Main menu entries // Main menu entries
$this->menus = array(); // List of menus to add $this->menus = array(); // List of menus to add
$r=0; $r=0;
// Add here entries to declare new menus // Add here entries to declare new menus
// Example to declare the Top Menu entry: // Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry // 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu', // 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule', // '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). // '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', // 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100, // 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'', // 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++; // $r++;
// //
// Example to declare a Left Menu entry: // 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) // $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 // 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 1', // 'titre'=>'MyModule left menu 1',
// 'mainmenu'=>'mymodule', // 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel1.php', // 'url'=>'/mymodule/pagelevel1.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100, // 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'', // 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++; // $r++;
// //
// Example to declare another Left Menu entry: // 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) // $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 // 'type'=>'left', // This is a Left menu entry
// 'titre'=>'MyModule left menu 2', // 'titre'=>'MyModule left menu 2',
// 'mainmenu'=>'mymodule', // 'mainmenu'=>'mymodule',
// 'url'=>'/mymodule/pagelevel2.php', // 'url'=>'/mymodule/pagelevel2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100, // 'position'=>100,
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'', // 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++; // $r++;
// Exports // Exports
$r=1; $r=1;
// Example: // 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_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_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_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_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] =' 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] .=' 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] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
// $r++; // $r++;
} }
/** /**
* \brief Function called when module is enabled. * \brief Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories. * It also creates data directories.
* \return int 1 if OK, 0 if KO * \return int 1 if OK, 0 if KO
*/ */
function init() function init()
{ {
$sql = array(); $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. * \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database. * Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted. * Data directories are not deleted.
* \return int 1 if OK, 0 if KO * \return int 1 if OK, 0 if KO
*/ */
function remove() function remove()
{ {
$sql = array(); $sql = array();
return $this->_remove($sql); return $this->_remove($sql);
} }
/** /**
* \brief Create tables and keys required by module * \brief Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys * Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/ * commands must be stored in directory /mymodule/sql/
* This function is called by this->init. * This function is called by this->init.
* \return int <=0 if KO, >0 if OK * \return int <=0 if KO, >0 if OK
*/ */
function load_tables() function load_tables()
{ {
return $this->_load_tables(''); return $this->_load_tables('');
} }
} }
?> ?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/** /**
* \brief Constructor * Constructor
* \param db Database handler *
* @param DoliDB $DB Database handler
*/ */
function doc_generic_odt($db) 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} var $prefixIsRequired; // Le champ prefix du tiers doit etre renseigne quand on utilise {pre}
/** Constructor /**
* Constructor
*/ */
function mod_codeclient_elephant() function mod_codeclient_elephant()
{ {

View File

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

View File

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

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