Skip to content
Snippets Groups Projects
Commit fb8cd2ad authored by Rodolphe Quiedeville's avatar Rodolphe Quiedeville
Browse files

Nouvelle structure des fonctions

parent 0b4fb8a1
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,8 @@ class modCommande extends modDolibarrModules
Function modCommande($DB)
{
$this->db = $DB ;
$this->const = array();
$this->boxes = array();
}
/*
*
......@@ -45,11 +47,10 @@ class modCommande extends modDolibarrModules
/*
* Activation du module
*/
$const = array();
$sql = array();
return $this->_init($const, $sql);
return $this->_init($this->const, $sql);
}
/*
......
......@@ -38,19 +38,43 @@ class modDolibarrModules
*
*/
Function _init($const, $array_sql)
Function _init($array_sql)
{
/*
* Activation du module
*/
$err = 0;
foreach ($this->boxes as $key => $value)
{
$titre = $this->boxes[$key][0];
$file = $this->boxes[$key][1];
$sql = "SELECT count(*) FROM llx_boxes_def WHERE name ='".$titre."'";
foreach ($const as $key => $value)
if ( $this->db->query($sql) )
{
$row = $this->db->fetch_row($sql);
if ($row[0] == 0)
{
$sql = "insert into llx_boxes_def (name, file) values ('".$titre."','".$file."')";
if (! $this->db->query($sql) )
{
$err++;
}
}
}
else
{
$err++;
}
}
foreach ($this->const as $key => $value)
{
$name = $const[$key][0];
$type = $const[$key][1];
$val = $const[$key][2];
$name = $this->const[$key][0];
$type = $this->const[$key][1];
$val = $this->const[$key][2];
$sql = "SELECT count(*) FROM llx_const WHERE name ='".$name."'";
......@@ -126,6 +150,23 @@ class modDolibarrModules
{
return 1;
}
/*
* Boites
*/
foreach ($this->boxes as $key => $value)
{
$titre = $this->boxes[$key][0];
$file = $this->boxes[$key][1];
$sql = "DELETE FROM llx_boxes_def WHERE file = '".$file."'";
if (! $this->db->query($sql) )
{
$err++;
}
}
}
}
?>
......@@ -36,6 +36,7 @@ class modFacture extends modDolibarrModules
$this->depends = array("MAIN_MODULE_SOCIETE","MAIN_MODULE_COMPTABILITE");
$this->const = array();
$this->boxes = array();
$this->const[0][0] = "FAC_PDF_INTITULE";
$this->const[0][1] = "chaine";
......@@ -72,6 +73,11 @@ class modFacture extends modDolibarrModules
$this->const[8][1] = "chaine";
$this->const[8][2] = "pluton";
$this->boxes[0][0] = "Factures";
$this->boxes[0][1] = "box_factures.php";
$this->boxes[1][0] = "Factures impayées";
$this->boxes[1][1] = "box_factures_imp.php";
}
/*
*
......@@ -92,10 +98,10 @@ class modFacture extends modDolibarrModules
"insert into llx_rights_def values (14,'Valider les factures','facture','d',0);",
"insert into llx_rights_def values (15,'Envoyer les factures aux clients','facture','d',0);",
"insert into llx_rights_def values (16,'Emettre des paiements sur les factures','facture','d',0);",
"insert into llx_rights_def values (19,'Supprimer les factures','facture','d',0);"
"insert into llx_rights_def values (19,'Supprimer les factures','facture','d',0);",
);
return $this->_init($this->const, $sql);
return $this->_init($sql);
}
/*
*
......@@ -103,7 +109,9 @@ class modFacture extends modDolibarrModules
*/
Function remove()
{
$sql = array("DELETE FROM llx_rights_def WHERE module = 'facture';");
$sql = array(
"DELETE FROM llx_rights_def WHERE module = 'facture';"
);
return $this->_remove($sql);
}
......
......@@ -36,6 +36,7 @@ class modPropale extends modDolibarrModules
$this->depends = array("MAIN_MODULE_SOCIETE","MAIN_MODULE_COMMERCIAL");
$this->const = array();
$this->boxes = array();
/*
* Constantes
*/
......@@ -46,6 +47,9 @@ class modPropale extends modDolibarrModules
$this->const[1][0] = "PROPALE_ADDON";
$this->const[1][1] = "chaine";
$this->const[1][2] = "mod_propale_ivoire";
$this->boxes[0][0] = "Proposition commerciales";
$this->boxes[0][1] = "box_propales.php";
}
/*
*
......@@ -66,12 +70,11 @@ class modPropale extends modDolibarrModules
"insert into llx_rights_def values (25,'Envoyer les propositions commerciales aux clients','propale','d',0);",
"insert into llx_rights_def values (26,'Clôturer les propositions commerciales','propale','d',0);",
"insert into llx_rights_def values (27,'Supprimer les propositions commerciales','propale','d',0);",
"INSERT INTO llx_boxes_def (name,file) VALUES('Proposition commerciales', 'box_propales.php');",
"REPLACE INTO llx_propal_model_pdf SET nom = '".$this->const[0][2]."'",
);
//"insert into llx_rights_def values (23,'Modifier les propositions commerciales d\'autrui','propale','m',0);",
return $this->_init($this->const, $sql);
return $this->_init($sql);
}
/*
......@@ -81,7 +84,6 @@ class modPropale extends modDolibarrModules
Function remove()
{
$sql = array(
"DELETE FROM llx_boxes_def WHERE file = 'box_propales.php';",
"DELETE FROM llx_rights_def WHERE module = 'propale';"
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment